diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php
index 9ba965e6bfc..fe6ad2cf8d3 100644
--- a/htdocs/admin/oauthlogintokens.php
+++ b/htdocs/admin/oauthlogintokens.php
@@ -160,253 +160,255 @@ if ($mode == 'setup' && $user->admin) {
$oauthstateanticsrf = bin2hex(random_bytes(128 / 8));
// $list is defined into oauth.lib.php to the list of supporter OAuth providers.
- foreach ($listinsetup as $key) {
- $supported = 0;
- $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
- $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
- $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
- if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
- $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
- $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
- } else {
- $keybeforeprovider = $keyforsupportedoauth2array;
- $keyforprovider = '';
- }
- $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
- $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
+ if (!empty($listinsetup)) {
+ foreach ($listinsetup as $key) {
+ $supported = 0;
+ $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
+ $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
+ $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
+ if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
+ $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
+ $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
+ } else {
+ $keybeforeprovider = $keyforsupportedoauth2array;
+ $keyforprovider = '';
+ }
+ $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
+ $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
- $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : ''));
+ $OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : ''));
- $shortscope = '';
- if (getDolGlobalString($key[4])) {
- $shortscope = getDolGlobalString($key[4]);
- }
- $state = $shortscope; // TODO USe a better state
+ $shortscope = '';
+ if (getDolGlobalString($key[4])) {
+ $shortscope = getDolGlobalString($key[4]);
+ }
+ $state = $shortscope; // TODO USe a better state
- // Define $urltorenew, $urltodelete, $urltocheckperms
- if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') {
- // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
- // We pass this param list in to 'state' because we need it before and after the redirect.
+ // Define $urltorenew, $urltodelete, $urltocheckperms
+ if ($keyforsupportedoauth2array == 'OAUTH_GITHUB_NAME') {
+ // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
+ // We pass this param list in to 'state' because we need it before and after the redirect.
- // Note: github does not accept csrf key inside the state parameter (only known values)
- $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($shortscope).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
- $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
- $urltocheckperms = 'https://github.com/settings/applications/';
- } elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') {
- // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
- // List of scopes for Google are here: https://developers.google.com/identity/protocols/oauth2/scopes
- // We pass this key list into the param 'state' because we need it before and after the redirect.
- $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
- $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
- $urltocheckperms = 'https://security.google.com/settings/security/permissions';
- } elseif (!empty($supportedoauth2array[$keyforsupportedoauth2array]['returnurl'])) {
- $urltorenew = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
- $urltodelete = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
- $urltocheckperms = '';
- } else {
- $urltorenew = '';
- $urltodelete = '';
- $urltocheckperms = '';
- }
+ // Note: github does not accept csrf key inside the state parameter (only known values)
+ $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($shortscope).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
+ $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
+ $urltocheckperms = 'https://github.com/settings/applications/';
+ } elseif ($keyforsupportedoauth2array == 'OAUTH_GOOGLE_NAME') {
+ // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
+ // List of scopes for Google are here: https://developers.google.com/identity/protocols/oauth2/scopes
+ // We pass this key list into the param 'state' because we need it before and after the redirect.
+ $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'-'.$oauthstateanticsrf.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
+ $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
+ $urltocheckperms = 'https://security.google.com/settings/security/permissions';
+ } elseif (!empty($supportedoauth2array[$keyforsupportedoauth2array]['returnurl'])) {
+ $urltorenew = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?shortscope='.urlencode($shortscope).'&state='.urlencode($state).'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
+ $urltodelete = $urlwithroot.$supportedoauth2array[$keyforsupportedoauth2array]['returnurl'].'?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
+ $urltocheckperms = '';
+ } else {
+ $urltorenew = '';
+ $urltodelete = '';
+ $urltocheckperms = '';
+ }
- if ($urltorenew) {
- $urltorenew .= '&keyforprovider='.urlencode($keyforprovider);
- }
- if ($urltodelete) {
- $urltodelete .= '&keyforprovider='.urlencode($keyforprovider);
- }
+ if ($urltorenew) {
+ $urltorenew .= '&keyforprovider='.urlencode($keyforprovider);
+ }
+ if ($urltodelete) {
+ $urltodelete .= '&keyforprovider='.urlencode($keyforprovider);
+ }
- // Show value of token
- $tokenobj = null;
- // Token
- require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
- // Dolibarr storage
- $storage = new DoliStorage($db, $conf, $keyforprovider);
- try {
- // $OAUTH_SERVICENAME is for example 'Google-keyforprovider'
- print ''."\n";
- $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
- //print $storage->token.'
';
- //print $tokenobj->getExtraParams()['id_token'].'
';
- //print $tokenobj->getAccessToken().'
';
- } catch (Exception $e) {
- // Return an error if token not found
- //print $e->getMessage();
- }
+ // Show value of token
+ $tokenobj = null;
+ // Token
+ require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
+ // Dolibarr storage
+ $storage = new DoliStorage($db, $conf, $keyforprovider);
+ try {
+ // $OAUTH_SERVICENAME is for example 'Google-keyforprovider'
+ print ''."\n";
+ $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
+ //print $storage->token.'
';
+ //print $tokenobj->getExtraParams()['id_token'].'
';
+ //print $tokenobj->getAccessToken().'
';
+ } catch (Exception $e) {
+ // Return an error if token not found
+ //print $e->getMessage();
+ }
- // Set other properties
- $refreshtoken = false;
- $expiredat = '';
+ // Set other properties
+ $refreshtoken = false;
+ $expiredat = '';
- $expire = false;
- // Is token expired or will token expire in the next 30 seconds
- if (is_object($tokenobj)) {
- $expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
- }
- if ($key[1] != '' && $key[2] != '') {
+ $expire = false;
+ // Is token expired or will token expire in the next 30 seconds
if (is_object($tokenobj)) {
- $refreshtoken = $tokenobj->getRefreshToken();
+ $expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
+ }
+ if ($key[1] != '' && $key[2] != '') {
+ if (is_object($tokenobj)) {
+ $refreshtoken = $tokenobj->getRefreshToken();
- $endoflife = $tokenobj->getEndOfLife();
- if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES) {
- $expiredat = $langs->trans("Never");
- } elseif ($endoflife == $tokenobj::EOL_UNKNOWN) {
- $expiredat = $langs->trans("Unknown");
- } else {
- $expiredat = dol_print_date($endoflife, "dayhour", 'tzuserrel');
+ $endoflife = $tokenobj->getEndOfLife();
+ if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES) {
+ $expiredat = $langs->trans("Never");
+ } elseif ($endoflife == $tokenobj::EOL_UNKNOWN) {
+ $expiredat = $langs->trans("Unknown");
+ } else {
+ $expiredat = dol_print_date($endoflife, "dayhour", 'tzuserrel');
+ }
}
}
- }
- $submit_enabled = 0;
+ $submit_enabled = 0;
- print '
'.$langs->trans('Message').' :
'.$message.'
'.$langs->trans($see_ticket).' : '.$url_public_ticket.'
'; $message_customer .= ''.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'
'; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index b1250d4e334..7d9fed91fe0 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1290,6 +1290,8 @@ class EmailCollector extends CommonObject if (strpos($rule['rulevalue'], '!') === 0) { // The value start with !, so we exclude the criteria $not = 'NOT '; + // Then remove the ! from the string for next filters + $rule['rulevalue'] = substr($rule['rulevalue'], 1); } if ($rule['type'] == 'from') { @@ -1428,6 +1430,8 @@ class EmailCollector extends CommonObject if (strpos($rule['rulevalue'], '!') === 0) { // The value start with !, so we exclude the criteria $not = 'NOT '; + // Then remove the ! from the string for next filters + $rule['rulevalue'] = substr($rule['rulevalue'], 1); } if ($rule['type'] == 'from') { @@ -2410,10 +2414,25 @@ class EmailCollector extends CommonObject if ($operation['type'] == 'loadthirdparty') { dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." name_alias=".$namealiastouseforthirdparty." was not found"); - $errorforactions++; - $langs->load("errors"); - $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty, $namealiastouseforthirdparty); - $this->errors[] = $this->error; + //search into contacts of thirdparty + $resultContact = $contactstatic->fetch('', '', '', $emailtouseforthirdparty); + if ($resultContact > 0) { + $idtouseforthirdparty = $contactstatic->socid; + $result = $thirdpartystatic->fetch($idtouseforthirdparty); + if ($result > 0) { + dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." name_alias=".$namealiastouseforthirdparty." was found thanks to linked contact search"); + } else { + $errorforactions++; + $langs->load("errors"); + $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty, $namealiastouseforthirdparty); + $this->errors[] = $this->error; + } + } else { + $errorforactions++; + $langs->load("errors"); + $this->error = $langs->trans('ErrorFailedToLoadThirdParty', $idtouseforthirdparty, $emailtouseforthirdparty, $nametouseforthirdparty, $namealiastouseforthirdparty); + $this->errors[] = $this->error; + } } elseif ($operation['type'] == 'loadandcreatethirdparty') { dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." name_alias=".$namealiastouseforthirdparty." was not found. We try to create it."); diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 718041fdd7b..786453d972d 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -246,3 +246,4 @@ XSubsriptionCreated=%s subscription(s) created XSubsriptionErrors=%s subscription(s) where in error CreateSubscription=Create subscription WarningNoComplementaryActionDone=No Complementary action on recording will be executed with this massaction +NewMembership=New membership \ No newline at end of file diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 53c7957cf78..eb3c4d656a0 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -326,7 +326,8 @@ class modMyModule extends DolibarrModules /* END MODULEBUILDER TOPMENU MYOBJECT */ /* BEGIN MODULEBUILDER LEFTMENU MYOBJECT */ - /*$this->menu[$r++]=array( + /* + $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry 'titre'=>'MyObject', @@ -341,6 +342,20 @@ class modMyModule extends DolibarrModules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode + 'type'=>'left', // This is a Left menu entry + 'titre'=>'New_MyObject', + 'mainmenu'=>'mymodule', + 'leftmenu'=>'mymodule_myobject_new', + 'url'=>'/mymodule/myobject_card.php?action=create', + 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. + 'position'=>1000+$r, + 'enabled'=>'isModEnabled("mymodule")', // Define condition to show or hide menu entry. Use 'isModEnabled("mymodule")' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'perms'=>'$user->hasRight("mymodule", "myobject", "write")' + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); $this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry @@ -355,20 +370,7 @@ class modMyModule extends DolibarrModules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); - $this->menu[$r++]=array( - 'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - 'type'=>'left', // This is a Left menu entry - 'titre'=>'New_MyObject', - 'mainmenu'=>'mymodule', - 'leftmenu'=>'mymodule_myobject_new', - 'url'=>'/mymodule/myobject_card.php?action=create', - 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>1000+$r, - 'enabled'=>'isModEnabled("mymodule")', // Define condition to show or hide menu entry. Use 'isModEnabled("mymodule")' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - 'perms'=>'$user->hasRight("mymodule", "myobject", "write")' - 'target'=>'', - 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both - );*/ + */ /* END MODULEBUILDER LEFTMENU MYOBJECT */ diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 6e13ce4117b..1a482944772 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -111,7 +111,7 @@ if ($reshook < 0) { // Add file in email form if (empty($reshook)) { if ($cancel) { - $backtopage = DOL_URL_ROOT.'/public/ticket/index.php'; + $backtopage = getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE', DOL_URL_ROOT.'/public/ticket/'); header("Location: ".$backtopage); exit; @@ -395,7 +395,7 @@ if (empty($reshook)) { $message = (getDolGlobalString('TICKET_MESSAGE_MAIL_NEW') !== '' ? getDolGlobalString('TICKET_MESSAGE_MAIL_NEW') : $langs->transnoentities('TicketNewEmailBody')).''.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", ''.$langs->trans("TicketPublicDesc")).'
').''; print '