From 96d60b92f471e8bcc810bd4f4fc491fe5a00413e Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 27 Nov 2024 22:39:52 +0100 Subject: [PATCH 01/38] fix: when create separate extarfields, if already exists always return false error (#32103) --- htdocs/core/class/extrafields.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 91ac9fe0b9550..05916ddfe80b5 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -177,7 +177,9 @@ public function addExtraField($attrname, $label, $type, $pos, $size, $elementtyp // Add declaration of field into table $result2 = $this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams); $err2 = $this->errno; - if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) { + if ($result2 > 0 + || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS') + || ($type == 'separate' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) { $this->error = ''; $this->errno = '0'; return 1; From 8f7810a06b88d68679c60b66775c33bb3f80e72f Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 13:40:38 +0100 Subject: [PATCH 02/38] Debug v21 --- htdocs/admin/tools/dolibarr_import.php | 33 +++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index adc8de229008e..5fc190a7d55a0 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -46,7 +46,7 @@ } $radio_dump = GETPOST('radio_dump'); -$showpass = GETPOST('showpass'); +$action = GETPOST('action', 'aZ09'); /* @@ -148,11 +148,12 @@
'; - print ''.$langs->trans('RestoreMySQL').''; - print '
'; - // Parameters execution - $command = $db->getPathOfRestore(); + print '
'; + print ''.$langs->trans('RestoreMySQL').''; + print '
'; + + // Parameters execution + $command = $db->getPathOfRestore(); if (preg_match("/\s/", $command)) { $command = $command = escapeshellarg($command); // Use quotes on command } @@ -170,17 +171,17 @@ $paramclear .= " -p".$dolibarr_main_db_pass; } - echo $langs->trans("ImportMySqlDesc"); - print '
'; - print '
'; - print ajax_autoselect('restorecommand'); + print $langs->trans("ImportMySqlDesc"); + print '
'; + print '
'; + print ajax_autoselect('restorecommand'); - if (!GETPOST("showpass") && $dolibarr_main_db_pass) { - print '
'.$langs->trans("UnHidePassword").''; + if (GETPOST("action") != 'showpass' && $dolibarr_main_db_pass) { + print '
'.$langs->trans("UnHidePassword").''; } - //else print '
'.$langs->trans("HidePassword").''; - print '
'; - print '
'; + //else print '
'.$langs->trans("HidePassword").''; + print '
'; + print ''; } elseif (in_array($type, array('pgsql'))) { print '
'; print 'Restore PostgreSQL'; @@ -212,7 +213,7 @@ echo $langs->trans("ImportPostgreSqlDesc"); print '
'; - print '
'; + print '
'; print ajax_autoselect('restorecommand'); print '
'; From ff18a34c7179c01a50e827917540c841ee087b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 28 Nov 2024 15:43:47 +0100 Subject: [PATCH 03/38] FIX: Ensure extraparams cannot be selected by the user (#32132) * FIX: Ensure extraparams cannot be selected by the user * Update newpayment.php --- htdocs/public/payment/newpayment.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 21e67dde87e50..2a07fa72ebc77 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1675,7 +1675,7 @@ } // - If a new amount was posted from the form if ($caneditamount && GETPOSTISSET('newamount') && GETPOSTFLOAT('newamount', 'MT') > 0) { - $amount = GETPOSTFLOAT('newamount', 'MT'); + $amount = GETPOSTFLOAT('newamount', 'MT'); } // - If a min is set or an amount from the posted form, we take them into account $amount = max(0, (float) $amount, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT")); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 24629554b3227..4791136e400a6 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -328,7 +328,7 @@ class Ticket extends CommonObject 'progress' => array('type' => 'integer', 'label' => 'Progression', 'visible' => -1, 'enabled' => 1, 'position' => 540, 'notnull' => -1, 'css' => 'right', 'help' => "", 'isameasure' => 2, 'csslist' => 'width50'), 'resolution' => array('type' => 'integer', 'label' => 'Resolution', 'visible' => -1, 'enabled' => 'getDolGlobalString("TICKET_ENABLE_RESOLUTION")', 'position' => 550, 'notnull' => 1), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'PDFTemplate', 'enabled' => 1, 'visible' => 0, 'position' => 560), - 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 570), + 'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => 0, 'position' => 570), 'fk_statut' => array('type' => 'integer', 'label' => 'Status', 'visible' => 1, 'enabled' => 1, 'position' => 600, 'notnull' => 1, 'index' => 1, 'arrayofkeyval' => array(0 => 'Unread', 1 => 'Read', 2 => 'Assigned', 3 => 'InProgress', 5 => 'NeedMoreInformation', 7 => 'OnHold', 8 => 'SolvedClosed', 9 => 'Deleted')), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 900), ); From 3fc50f21a4b862800d4d792b88266789d6830793 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 28 Nov 2024 15:45:37 +0100 Subject: [PATCH 04/38] FIX set birthday alert (#32133) * FIX set birthday alert on contact personal data card * also on create card * fix travis --- htdocs/contact/card.php | 2 +- htdocs/contact/perso.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f7a52afa4895d..59b5863a9ffe0 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -241,7 +241,7 @@ // Note: Correct date should be completed with location to have exact GM time of birth. $object->birthday = dol_mktime(0, 0, 0, GETPOSTINT("birthdaymonth"), GETPOSTINT("birthdayday"), GETPOSTINT("birthdayyear")); - $object->birthday_alert = GETPOSTINT("birthday_alert"); + $object->birthday_alert = (GETPOST('birthday_alert', 'alpha') == "on" ? 1 : 0); //Default language $object->default_lang = GETPOST('default_lang'); diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 0661a80b685a9..209e04d199de4 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -56,7 +56,7 @@ // Note: Correct date should be completed with location to have exact GM time of birth. $object->birthday = dol_mktime(0, 0, 0, GETPOST("birthdaymonth"), GETPOST("birthdayday"), GETPOST("birthdayyear")); - $object->birthday_alert = GETPOSTINT("birthday_alert"); + $object->birthday_alert = (GETPOST('birthday_alert', 'alpha') == "on" ? 1 : 0); if (GETPOST('deletephoto')) { $object->photo = ''; From cd946f9829561391e6b2f47925e4e5bb395c400c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 16:44:19 +0100 Subject: [PATCH 05/38] Doc --- htdocs/core/modules/modAgenda.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 47c766d525b1b..bc0d440bad833 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -211,6 +211,8 @@ public function __construct($db) // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both // $r++; + + // TODO Move the top menu entry into the code part (eldy_menu.php and auguria.sql) so we can have a top menu shown for resource module only. $this->menu[$r] = array( 'fk_menu' => 0, 'type' => 'top', From 11b4492c0e0f6dc16346e976f92fcb9040714819 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 19:56:10 +0100 Subject: [PATCH 06/38] Fix warning. --- htdocs/admin/mails.php | 34 +++++++++---------- htdocs/admin/mails_emailing.php | 50 ++++++++++++++-------------- htdocs/admin/mails_ingoing.php | 2 +- htdocs/admin/mails_passwordreset.php | 46 ++++++++++++------------- htdocs/admin/mails_ticket.php | 48 +++++++++++++------------- htdocs/core/lib/admin.lib.php | 2 +- 6 files changed, 91 insertions(+), 91 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index c54ca5dc0f4a8..b4e9267eec030 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -412,7 +412,7 @@ function change_smtp_auth_method() { print ''; } else { print ''; - $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER') ? $conf->global->MAIN_MAIL_SMTP_SERVER : ''); + $mainserver = getDolGlobalString('MAIN_MAIL_SMTP_SERVER'); $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -443,7 +443,7 @@ function change_smtp_auth_method() { print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { - $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT') ? $conf->global->MAIN_MAIL_SMTP_PORT : ''); + $mainport = getDolGlobalString('MAIN_MAIL_SMTP_PORT'); $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -495,14 +495,14 @@ function change_smtp_auth_method() { // ID if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { - $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID') ? $conf->global->MAIN_MAIL_SMTPS_ID : ''); + $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID'); print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); - print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID, $htmltext, 1, 'superadmin'); + print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_ID'), $htmltext, 1, 'superadmin'); print ''; } print ''; @@ -549,7 +549,7 @@ function change_smtp_auth_method() { print ''.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS') ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS') ? getDolGlobalString('MAIN_MAIL_EMAIL_TLS') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -562,7 +562,7 @@ function change_smtp_auth_method() { print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS') ? getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -575,7 +575,7 @@ function change_smtp_auth_method() { print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED') ? getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -588,7 +588,7 @@ function change_smtp_auth_method() { print ''.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('swiftmailer')))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_ENABLED') ? $conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_ENABLED') ? getDolGlobalString('MAIN_MAIL_EMAIL_DKIM_ENABLED') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -599,17 +599,17 @@ function change_smtp_auth_method() { // DKIM Domain print ''.$langs->trans("MAIN_MAIL_EMAIL_DKIM_DOMAIN").''; - print ''; // DKIM Selector print ''.$langs->trans("MAIN_MAIL_EMAIL_DKIM_SELECTOR").''; - print ''; // DKIM PRIVATE KEY print ''.$langs->trans("MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY").''; - print ''; + print ''; print ''; print ''; @@ -632,13 +632,13 @@ function change_smtp_auth_method() { print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); print ' '.$help; print ''; - print ''; // Default from type $liste = array(); $liste['user'] = $langs->trans('UserEmail'); - $liste['company'] = $langs->trans('CompanyEmail').' ('.(!getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')'; + $liste['company'] = $langs->trans('CompanyEmail').' ('.(!getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $langs->trans("NotDefined") : getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')).')'; print ''.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; print $form->selectarray('MAIN_MAIL_DEFAULT_FROMTYPE', $liste, getDolGlobalString('MAIN_MAIL_DEFAULT_FROMTYPE'), 0); @@ -716,7 +716,7 @@ function change_smtp_auth_method() { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER') ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').''; + print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').''; } @@ -724,7 +724,7 @@ function change_smtp_auth_method() { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT') ? $conf->global->MAIN_MAIL_SMTP_PORT : '').''; + print ''.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_PORT').''; } // AUTH method @@ -909,7 +909,7 @@ function change_smtp_auth_method() { print '' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) { print img_warning($langs->trans("Mandatory")); - } elseif (!isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) { + } elseif (!isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))) { print img_warning($langs->trans("ErrorBadEMail")); } print ''; @@ -957,7 +957,7 @@ function change_smtp_auth_method() { // Errors To print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; print ''.(getDolGlobalString('MAIN_MAIL_ERRORS_TO')); - if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) { + if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail(getDolGlobalString('MAIN_MAIL_ERRORS_TO'))) { print img_warning($langs->trans("ErrorBadEMail")); } print ''; diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 78d1e381804f4..e91f1058b3da9 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -363,7 +363,7 @@ function change_smtp_auth_method() { // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_EMAILING); + print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')); } else { $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')]; if (empty($text)) { @@ -386,7 +386,7 @@ function change_smtp_auth_method() { print ''; } else { print ''; - $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : ''); + $mainserver = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING'); $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -418,7 +418,7 @@ function change_smtp_auth_method() { print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { - $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : ''); + $mainport = getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING'); $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -441,7 +441,7 @@ function change_smtp_auth_method() { print ''; // AUTH method - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { print ''.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; $vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING'; if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { @@ -469,22 +469,22 @@ function change_smtp_auth_method() { } // ID - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { - $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING') ? $conf->global->MAIN_MAIL_SMTPS_ID_EMAILING : ''); + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { + $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING'); print '' . $langs->trans("MAIN_MAIL_SMTPS_ID") . ''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); - print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING, $htmltext, 1, 'superadmin'); + print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING'), $htmltext, 1, 'superadmin'); print ''; } print ''; } // PW - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { $mainsmtppw = getDolGlobalString('MAIN_MAIL_SMTPS_PW_EMAILING'); print '' . $langs->trans("MAIN_MAIL_SMTPS_PW") . ''; // SuperAdministrator access only @@ -499,13 +499,13 @@ function change_smtp_auth_method() { } // OAUTH service provider - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { print ''.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder - print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING); + print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING')); } else { $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING')]; if (empty($text)) { @@ -521,9 +521,9 @@ function change_smtp_auth_method() { // TLS print ''.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING') ? $conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING') ? getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -534,9 +534,9 @@ function change_smtp_auth_method() { // STARTTLS print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING') ? getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -547,9 +547,9 @@ function change_smtp_auth_method() { // SMTP_ALLOW_SELF_SIGNED_EMAILING print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING') ? getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -593,14 +593,14 @@ function change_smtp_auth_method() { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '').''; + print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING').''; } // Port if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '').''; + print ''.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING').''; } // AUTH method @@ -618,12 +618,12 @@ function change_smtp_auth_method() { } // SMTPS ID - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").''.getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING').''; } // SMTPS PW - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') != "XOAUTH2") { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') != "XOAUTH2") { print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_EMAILING')).''; } @@ -641,7 +641,7 @@ function change_smtp_auth_method() { // Nothing } else { print ''.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING')); } else { @@ -658,7 +658,7 @@ function change_smtp_auth_method() { // Nothing } else { print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING')); } else { @@ -675,7 +675,7 @@ function change_smtp_auth_method() { // Nothing } else { print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING')); } else { @@ -773,8 +773,8 @@ function change_smtp_auth_method() { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test"); - $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); - $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); + $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM')); + $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM')); $formmail->fromid = $user->id; $formmail->fromalsorobot = 1; $formmail->withfromreadonly = 0; diff --git a/htdocs/admin/mails_ingoing.php b/htdocs/admin/mails_ingoing.php index 12bd4d93ce8d5..734d83f619c7b 100644 --- a/htdocs/admin/mails_ingoing.php +++ b/htdocs/admin/mails_ingoing.php @@ -127,7 +127,7 @@ // SMTPS oauth service if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') === "XOAUTH2") { - $text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE]; + $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE')]; if (empty($text)) { $text = $langs->trans("Undefined").img_warning(); } diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index 29c8d20334207..5f3b07ce7ee2d 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -358,7 +358,7 @@ function change_smtp_auth_method() { // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SENDMODE_PASSWORDRESET', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET); + print $form->selectarray('MAIN_MAIL_SENDMODE_PASSWORDRESET', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET')); } else { $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET')]; if (empty($text)) { @@ -381,7 +381,7 @@ function change_smtp_auth_method() { print ''; } else { print ''; - $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_PASSWORDRESET : ''); + $mainserver = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_PASSWORDRESET'); $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -413,7 +413,7 @@ function change_smtp_auth_method() { print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { - $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTP_PORT_PASSWORDRESET : ''); + $mainport = getDolGlobalString('MAIN_MAIL_SMTP_PORT_PASSWORDRESET'); $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -436,7 +436,7 @@ function change_smtp_auth_method() { print ''; // AUTH method - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { print ''.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; $vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_PASSWORDRESET'; if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { @@ -464,22 +464,22 @@ function change_smtp_auth_method() { } // ID - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { - $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTPS_ID_PASSWORDRESET : ''); + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { + $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID_PASSWORDRESET'); print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); - print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_PASSWORDRESET, $htmltext, 1, 'superadmin'); + print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_ID_PASSWORDRESET'), $htmltext, 1, 'superadmin'); print ''; } print ''; } // PW - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { $mainsmtppw = getDolGlobalString('MAIN_MAIL_SMTPS_PW_PASSWORDRESET'); print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''; // SuperAdministrator access only @@ -494,11 +494,11 @@ function change_smtp_auth_method() { } // OAUTH service provider - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { print ''.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET); + print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET')); } else { $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_PASSWORDRESET')]; if (empty($text)) { @@ -514,9 +514,9 @@ function change_smtp_auth_method() { // TLS print ''.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET') ? $conf->global->MAIN_MAIL_EMAIL_TLS_PASSWORDRESET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET') ? getDolGlobalString('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -528,9 +528,9 @@ function change_smtp_auth_method() { // STARTTLS print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET') ? getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -541,9 +541,9 @@ function change_smtp_auth_method() { // SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET') ? getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -587,14 +587,14 @@ function change_smtp_auth_method() { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_PASSWORDRESET : '').''; + print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_PASSWORDRESET').''; } // Port if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_PASSWORDRESET') ? $conf->global->MAIN_MAIL_SMTP_PORT_PASSWORDRESET : '').''; + print ''.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_PORT_PASSWORDRESET').''; } // AUTH method @@ -612,12 +612,12 @@ function change_smtp_auth_method() { } // SMTPS ID - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").'' . getDolGlobalString('MAIN_MAIL_SMTPS_ID_PASSWORDRESET').''; } // SMTPS PW - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_PASSWORDRESET') != "XOAUTH2") { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_PASSWORDRESET') != "XOAUTH2") { print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_PASSWORDRESET')).''; } @@ -635,7 +635,7 @@ function change_smtp_auth_method() { // Nothing } else { print ''.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_TLS_PASSWORDRESET')); } else { @@ -652,7 +652,7 @@ function change_smtp_auth_method() { // Nothing } else { print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET')); } else { @@ -669,7 +669,7 @@ function change_smtp_auth_method() { // Nothing } else { print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET) && in_array($conf->global->MAIN_MAIL_SENDMODE_PASSWORDRESET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_PASSWORDRESET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET')); } else { diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 4ffa822f96661..6666861cf89e7 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -358,7 +358,7 @@ function change_smtp_auth_method() { // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SENDMODE_TICKET', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_TICKET); + print $form->selectarray('MAIN_MAIL_SENDMODE_TICKET', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')); } else { $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')]; if (empty($text)) { @@ -381,7 +381,7 @@ function change_smtp_auth_method() { print ''; } else { print ''; - $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : ''); + $mainserver = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET'); $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -413,7 +413,7 @@ function change_smtp_auth_method() { print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } else { - $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : ''); + $mainport = getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET'); $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -436,7 +436,7 @@ function change_smtp_auth_method() { print ''; // AUTH method - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { print ''.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; $vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET'; if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { @@ -464,22 +464,22 @@ function change_smtp_auth_method() { } // ID - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { - $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET') ? $conf->global->MAIN_MAIL_SMTPS_ID_TICKET : ''); + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { + $mainstmpid = getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET'); print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { print ''; } else { $htmltext = $langs->trans("ContactSuperAdminForChange"); - print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_TICKET, $htmltext, 1, 'superadmin'); + print $form->textwithpicto(getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET'), $htmltext, 1, 'superadmin'); print ''; } print ''; } // PW - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { $mainsmtppw = getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET'); print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''; // SuperAdministrator access only @@ -494,11 +494,11 @@ function change_smtp_auth_method() { } // OAUTH service provider - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { print ''.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").''; // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET); + print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')); } else { $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')]; if (empty($text)) { @@ -513,9 +513,9 @@ function change_smtp_auth_method() { // TLS print ''.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_TLS_TICKET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') ? getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -526,9 +526,9 @@ function change_smtp_auth_method() { // STARTTLS print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_TICKET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') ? getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -539,9 +539,9 @@ function change_smtp_auth_method() { // SMTP_ALLOW_SELF_SIGNED_TICKET print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { + if (!empty($conf->use_javascript_ajax) || in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { - print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET : 0), 1); + print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') ? getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') : 0), 1); } else { print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } @@ -585,14 +585,14 @@ function change_smtp_auth_method() { if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : '').''; + print ''.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET').''; } // Port if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) { //print ''.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").''; } else { - print ''.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : '').''; + print ''.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET').''; } // AUTH method @@ -610,12 +610,12 @@ function change_smtp_auth_method() { } // SMTPS ID - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { - print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").'' . getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET').''; + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { + print ''.$langs->trans("MAIN_MAIL_SMTPS_ID").''.getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET').''; } // SMTPS PW - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") { print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET')).''; } @@ -633,7 +633,7 @@ function change_smtp_auth_method() { // Nothing } else { print ''.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET')); } else { @@ -650,7 +650,7 @@ function change_smtp_auth_method() { // Nothing } else { print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET')); } else { @@ -667,7 +667,7 @@ function change_smtp_auth_method() { // Nothing } else { print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) { print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET')); } else { diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index fadbbcad13a27..b7eb906685033 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -2144,7 +2144,7 @@ function email_admin_prepare_head() $h++; } - if (getDolGlobalString('MAIN_MAIL_ALLOW_CUSTOM_SENDING_METHOD_FOR_PASSWORD_RESET')) { + if (!getDolGlobalString('MAIN_MAIL_HIDE_CUSTOM_SENDING_METHOD_FOR_PASSWORD_RESET')) { $head[$h][0] = DOL_URL_ROOT."/admin/mails_passwordreset.php"; $head[$h][1] = $langs->trans("OutGoingEmailSetupForEmailing", $langs->transnoentitiesnoconv("PasswordReset")); $head[$h][2] = 'common_passwordreset'; From 55e387bbbfa88cc5adf5b77ff042bc4b5a96fb90 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 21:48:55 +0100 Subject: [PATCH 07/38] Example --- htdocs/install/upgrade2.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index c612d5367f8c4..396a0b0061f9f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -113,6 +113,9 @@ $path = __DIR__.'/'; if (substr($sapi_type, 0, 3) == 'cli') { print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n"; + print 'Example: '.$script_file." 19.0.0 20.0.0\n"; + print 'Example: '.$script_file." 0.0.0 0.0.0 Adherents\n"; + print "\n"; } exit; } From 99a2787efc888b06533fab8ae2666b818ca7bb04 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 21:51:30 +0100 Subject: [PATCH 08/38] Debug v21 --- htdocs/install/upgrade2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 396a0b0061f9f..47995518803f6 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -114,7 +114,7 @@ if (substr($sapi_type, 0, 3) == 'cli') { print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n"; print 'Example: '.$script_file." 19.0.0 20.0.0\n"; - print 'Example: '.$script_file." 0.0.0 0.0.0 Adherents\n"; + print 'Example: '.$script_file." 0.0.0 0.0.0 MAIN_MODULE_Adherent\n"; print "\n"; } exit; From 87af64245444b5413d2d94e94d3d1f4abb229de3 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 21:54:09 +0100 Subject: [PATCH 09/38] Fix help --- htdocs/install/upgrade2.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 47995518803f6..31340596a946c 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -113,8 +113,8 @@ $path = __DIR__.'/'; if (substr($sapi_type, 0, 3) == 'cli') { print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n"; - print 'Example: '.$script_file." 19.0.0 20.0.0\n"; - print 'Example: '.$script_file." 0.0.0 0.0.0 MAIN_MODULE_Adherent\n"; + print 'Example, upgrade from 19 to 20: '.$script_file." 19.0.0 20.0.0\n"; + print 'Example, enable a module only: '.$script_file." 0.0.0 0.0.0 MAIN_MODULE_Adherent\n"; print "\n"; } exit; From 670e6464e8d08ea4fd26517ebb080bc2d3e4e73c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 22:25:53 +0100 Subject: [PATCH 10/38] Fix selection of state from country in member creation --- htdocs/adherents/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b02702218c804..b5a71fc5484a1 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1079,9 +1079,9 @@ function initfieldrequired() { // State if (!getDolGlobalString('MEMBER_DISABLE_STATE')) { print ''.$langs->trans('State').''; - if ($soc->country_id) { + if ($soc->country_id || GETPOSTISSET('country_id')) { print img_picto('', 'state', 'class="pictofixedwidth"'); - print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOSTINT('state_id') : $soc->state_id, $soc->country_code); + print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOSTINT('state_id') : $soc->state_id, GETPOSTISSET('country_id') ? GETPOSTINT('country_id') : $soc->country_code); } else { print $countrynotdefined; } From 787efd34975caa6e6a0e27424ba38928fa591855 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 22:41:20 +0100 Subject: [PATCH 11/38] Debug v21 --- htdocs/adherents/admin/member.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 472a376635ae7..b8d13a3737797 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -127,7 +127,9 @@ $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity); $res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); - $res7 = dolibarr_set_const($db, 'MEMBER_PUBLIC_ENABLED', GETPOST('MEMBER_PUBLIC_ENABLED', 'alpha'), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MEMBER_PUBLIC_ENABLED')) { + $res7 = dolibarr_set_const($db, 'MEMBER_PUBLIC_ENABLED', GETPOST('MEMBER_PUBLIC_ENABLED', 'alpha'), 'chaine', 0, '', $conf->entity); + } $res8 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', GETPOST('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF', 'alpha'), 'chaine', 0, '', $conf->entity); $res9 = dolibarr_set_const($db, 'MEMBER_SUBSCRIPTION_START_AFTER', GETPOST('MEMBER_SUBSCRIPTION_START_AFTER', 'alpha'), 'chaine', 0, '', $conf->entity); // Use vat for invoice creation @@ -138,7 +140,7 @@ $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity); } } - if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0) { + if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0 || $res8 < 0 || $res9 < 0) { setEventMessages('ErrorFailedToSaveData', null, 'errors'); $db->rollback(); } else { @@ -549,10 +551,12 @@ print "\n"; // Publish member information on public annuary -$linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : ''); -print ''.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).''; -print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED'), 1, false, 0, 1); -print "\n"; +/* Feature disabled by default for security purpose. + $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.((int) $conf->entity) : ''); + print ''.$langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist).''; + print $form->selectyesno('MEMBER_PUBLIC_ENABLED', getDolGlobalInt('MEMBER_PUBLIC_ENABLED'), 1, false, 0, 1); + print "\n"; +*/ // Allow members to change type on renewal forms /* To test during next beta From c73cff07816b82b4e902fd59a25c78e51f17a616 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 28 Nov 2024 22:51:11 +0100 Subject: [PATCH 12/38] Debug v21 --- htdocs/core/class/conf.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 02e4d63e5f047..3848b19cc289e 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -1082,6 +1082,11 @@ public function setValues($db) $this->global->USE_STRICT_CSV_RULES = 2; } + // By default, accept to create members with no login + if (!isset($this->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + $this->global->ADHERENT_LOGIN_NOT_REQUIRED = 1; + } + // Use a SCA ready workflow with Stripe module (STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION by default if nothing defined) if (!isset($this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION) && empty($this->global->STRIPE_USE_NEW_CHECKOUT)) { $this->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 1; From 3b93f7ffcc4a248cf0b4635e86cb7c95fac04fec Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 14:17:53 +0100 Subject: [PATCH 13/38] Debug v21 --- htdocs/admin/agenda_extsites.php | 4 ++-- htdocs/admin/agenda_other.php | 4 ++-- htdocs/admin/agenda_reminder.php | 2 +- htdocs/admin/agenda_xcal.php | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index c4490d27cb843..e0cff71b11ed1 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -223,11 +223,11 @@ $selectedvalue = 1; } -print ""; +print "
"; print ""; print '"; -print '"; +print ''; print ""; // Show external agenda diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index fcf6023b8348b..972ede049d2d4 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -221,7 +221,7 @@ $sql = "SELECT nom"; $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; $sql .= " WHERE type = 'action'"; -$sql .= " AND entity = ".$conf->entity; +$sql .= " AND entity = ".((int) $conf->entity); $resql = $db->query($sql); if ($resql) { @@ -346,7 +346,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; // AGENDA_DEFAULT_VIEW diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index d27d081d66e40..68e63d3eb32ab 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -182,7 +182,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; // AGENDA REMINDER BROWSER diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 6c065ba69e3c0..3d380e1134486 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -121,7 +121,7 @@ print ''; print ""; -print ""; +print ""; //print ""; print ""; print ""; @@ -180,8 +180,8 @@ clearstatcache(); -//if ($mesg) print "
$mesg
"; -print "
"; + +print "

"; // Define $urlwithroot From 1a60e40b9f970711a861c80f476310dbdb364a25 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 14:44:11 +0100 Subject: [PATCH 14/38] Debug v21 --- htdocs/theme/md/dropdown.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index c5c521a3ac5b4..1b14f471c654f 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -41,7 +41,7 @@ div#topmenu-login-dropdown { position: fixed; - : 20px; + : 10px; top: 0px; } From 82f54e707e3587debe874138091c0b7f8ef57bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:45:26 +0100 Subject: [PATCH 15/38] Update extrafields.class.php (#32135) --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6aca908bffda1..4009a3f749e2c 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1499,7 +1499,7 @@ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $ $sql .= $sqlwhere; //print $sql; - $sql .= ' ORDER BY '.implode(', ', $fields_label); + $sql .= $this->db->order(implode(',', $fields_label)); dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); $resql = $this->db->query($sql); From 1e213f041495ef06425ece773f14a81f375c1125 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 29 Nov 2024 14:46:21 +0100 Subject: [PATCH 16/38] FIX result is always in error (#32141) * FIX result is always in error * FIX Blank line found at end of control structure --- htdocs/admin/modules.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 6b6faa7d4818e..f9cde4b5363c2 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -290,9 +290,8 @@ if (!is_numeric($checkRes) && $checkRes != '') { $langs->load("errors"); setEventMessages($modulename.' : '.$langs->trans($checkRes), null, 'errors'); + $error++; } - - $error++; } catch (Exception $e) { // Nothing done } From 34b2f2587500f670f86b8b9191f1a35282ef799f Mon Sep 17 00:00:00 2001 From: atm-GregM <85485123+atm-GregM@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:47:15 +0100 Subject: [PATCH 17/38] FIX data too long for column signature (#32144) * Fix data too long for column signature * Fix data too long for column signature --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 1 + htdocs/install/mysql/tables/llx_user.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 71037e6248e1c..5299e01857677 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -384,3 +384,4 @@ INSERT INTO llx_c_type_contact (element, source, code, libelle, active ) values ALTER TABLE llx_facture_rec ADD COLUMN fk_societe_rib integer DEFAULT NULL; ALTER TABLE llx_facture ADD COLUMN is_also_delivery_note tinyint DEFAULT 0 NOT NULL; +ALTER TABLE llx_user MODIFY COLUMN signature LONGTEXT; diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 065c6bd4f0d85..66d3acc0db3b8 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -60,7 +60,7 @@ create table llx_user email varchar(255), personal_email varchar(255), email_oauth2 varchar(255), -- an email to validate OAuth2 authentication when email differs from the OAuth2 email - signature text DEFAULT NULL, + signature longtext DEFAULT NULL, socialnetworks text DEFAULT NULL, -- json with socialnetworks From 4d885d1e344e81aff0e705ab142802372ec78090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:47:33 +0100 Subject: [PATCH 18/38] add phpdoc (#32136) --- htdocs/core/tpl/onlinepaymentlinks.tpl.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/onlinepaymentlinks.tpl.php b/htdocs/core/tpl/onlinepaymentlinks.tpl.php index 59ef1023b2b0a..3964d67232d3b 100644 --- a/htdocs/core/tpl/onlinepaymentlinks.tpl.php +++ b/htdocs/core/tpl/onlinepaymentlinks.tpl.php @@ -14,7 +14,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - +/** + * @var Conf $conf + * @var Translate $langs + * @var string $servicename + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; From c0b42287c1180d81bfa8319478d21e147b9cb98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:47:53 +0100 Subject: [PATCH 19/38] add phpdoc (#32137) --- build/phpstan/phpstan-baseline.neon | 78 --------------------------- htdocs/core/tpl/passwordreset.tpl.php | 32 +++++++---- 2 files changed, 23 insertions(+), 87 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 192a9985d69a0..ba84964cca24e 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17598,84 +17598,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$disabled might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$dol_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$focus_element might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 18 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$mode might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$newpass1 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$newpass2 might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$passworduidhash might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$setnewpassword might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$urllogo might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - - - message: '#^Variable \$username might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordreset.tpl.php - - message: '#^Variable \$db might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/tpl/passwordreset.tpl.php b/htdocs/core/tpl/passwordreset.tpl.php index 61a27c6853a86..4754c76c4fb62 100644 --- a/htdocs/core/tpl/passwordreset.tpl.php +++ b/htdocs/core/tpl/passwordreset.tpl.php @@ -22,7 +22,29 @@ if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', 1); } - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * + * @var string $action + * @var string $captcha + * @var string $disabled + * @var string $dol_url_root + * @var string $focus_element + * @var string $mode + * @var string $message + * @var string $newpass1 + * @var string $newpass2 + * @var string $passworduidhash + * @var string $title + * @var string $urllogo + * @var string $user + * @var string $username + * + * @var int $setnewpassword + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; @@ -38,14 +60,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -/** - * @var HookManager $hookmanager - * @var string $action - * @var string $captcha - * @var string $message - * @var string $title - */ - /* * View From 9874e67acb125c737dffa03718c7a3554eeacac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 29 Nov 2024 14:48:33 +0100 Subject: [PATCH 20/38] add phpdoc (#32138) * add phpdoc * add phpdoc --- build/phpstan/phpstan-baseline.neon | 54 ----------------------- htdocs/core/tpl/passwordforgotten.tpl.php | 27 ++++++++---- 2 files changed, 18 insertions(+), 63 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index ba84964cca24e..b4842b6c19ef3 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17544,60 +17544,6 @@ parameters: count: 1 path: ../../htdocs/core/tpl/originproductline.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$disabled might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$dol_url_root might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$focus_element might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 10 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$mode might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$urllogo might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - - - message: '#^Variable \$username might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/passwordforgotten.tpl.php - - message: '#^Variable \$db might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 272c21ded9d8e..d01fb3a5f99bf 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -23,7 +23,24 @@ if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', 1); } - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * + * @var string $action + * @var string $captcha + * @var string $disabled + * @var string $dol_url_root + * @var string $focus_element + * @var string $mode + * @var string $message + * @var string $title + * @var string $urllogo + * @var string $user + * @var string $username + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; @@ -39,14 +56,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -/** - * @var HookManager $hookmanager - * @var string $action - * @var string $captcha - * @var string $message - * @var string $title - */ - /* * View From c983cfff50c962acc110b9f092157a91188d21b5 Mon Sep 17 00:00:00 2001 From: nateogroup-antoine Date: Fri, 29 Nov 2024 14:50:25 +0100 Subject: [PATCH 21/38] Typo in log : SERVICES_ARE_ECOMMERCE_200238EC => SERVICE_ARE_ECOMMERCE_200238EC and set shipment origin for shipment created by api on an order (#32143) * Update functions.lib.php * set shipment origin for shipment created by api on an order --- htdocs/commande/class/api_orders.class.php | 1 + htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 701d923862757..bd39f0fae3fd2 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -1090,6 +1090,7 @@ public function createOrderShipment($id, $warehouse_id) $shipment = new Expedition($this->db); $shipment->socid = $this->commande->socid; $shipment->origin_id = $this->commande->id; + $shipment->origin = $this->commande->element; $result = $shipment->create(DolibarrApiAccess::$user); if ($result <= 0) { throw new RestException(500, 'Error on creating expedition :'.$this->db->lasterror()); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 06ce0567f5300..9c411ea7caf54 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7577,7 +7577,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $buyer_country_code = $thirdparty_buyer->country_code; $buyer_in_cee = isInEEC($thirdparty_buyer); - dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".((string) (int) $seller_in_cee).", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".((string) (int) $buyer_in_cee).", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(getDolGlobalString('SERVICES_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); + dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".((string) (int) $seller_in_cee).", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".((string) (int) $buyer_in_cee).", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICE_ARE_ECOMMERCE_200238EC : '')); // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm) // we use the buyer VAT. From 546a68eafb05f14b639b8af2ab5f38f82029b020 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 15:11:36 +0100 Subject: [PATCH 22/38] Fix the amount in linke is not correctly formatted. --- htdocs/core/lib/payments.lib.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index c299a33ed35c8..357730cdac7a5 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -270,12 +270,12 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y } if ($type == 'free') { - $out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '' : '').price2num($amount, 'MT').($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) { if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { $out .= '&securekey='.urlencode(getDolGlobalString('PAYMENT_SECURITY_TOKEN')); } else { - $out .= '&securekey='.urlencode(dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2)); + $out .= '&securekey='.urlencode(dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 'sha1md5')); } } //if ($mode) $out.='&noidempotency=1'; @@ -297,7 +297,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + order_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -320,7 +320,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -343,7 +343,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + contractline_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -351,7 +351,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y } elseif ($type == 'member' || $type == 'membersubscription') { $newtype = 'member'; $out = $urltouse.'/public/payment/newpayment.php?source=member'; - $out .= '&amount='.$amount; + $out .= '&amount='.price2num($amount, 'MT'); $out .= '&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'member_ref'; @@ -365,11 +365,11 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= '&securekey='.urlencode(getDolGlobalString('PAYMENT_SECURITY_TOKEN')); } else { $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) { + if ($mode == 1) { // mode tuto $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$newtype."' + member_ref)"; } - if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $newtype.$ref, 2); + if ($mode == 0) { // mode real + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$newtype.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -392,7 +392,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + donation_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } @@ -415,7 +415,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = 0, $freetag = 'y $out .= "hash('" . getDolGlobalString('PAYMENT_SECURITY_TOKEN')."' + '".$type."' + invoice_ref)"; } if ($mode == 0) { - $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $type.$ref, 2); + $out .= dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN').$type.$ref, 'sha1md5'); } $out .= ($mode ? '' : ''); } From 7b0e34ffdd5377cc5926bd5dc71ee6004ff4a9a0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 15:19:51 +0100 Subject: [PATCH 23/38] Fix css of public payment page --- htdocs/public/payment/newpayment.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 2a07fa72ebc77..59f4039c6c810 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2108,19 +2108,19 @@ } if ($source == 'order' && $object->billed) { - print '

'.$langs->trans("OrderBilled").''; + print '

'.$langs->trans("OrderBilled").'
'; } elseif ($source == 'invoice' && $object->paye) { - print '

'.$langs->trans("InvoicePaid").''; + print '

'.$langs->trans("InvoicePaid").'
'; } elseif ($source == 'donation' && $object->paid) { - print '

'.$langs->trans("DonationPaid").''; + print '

'.$langs->trans("DonationPaid").'
'; } else { // Membership can be paid and we still allow to make renewal if (($source == 'member' || $source == 'membersubscription') && $object->datefin > dol_now()) { $langs->load("members"); - print '
'; + print '
'; $s = $langs->trans("MembershipPaid", '{s1}'); print str_replace('{s1}', ''.dol_print_date($object->datefin, 'day').'', $s); - print '
'; + print '
'; print '
'.$langs->trans("PaymentWillBeRecordedForNextPeriod").'
'; print '
'; } From b9e81ef46c442fbdf8fbc946ee05eea59996f73a Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:36:58 +0100 Subject: [PATCH 24/38] Fix search in member list (lastname and company) --- htdocs/adherents/list.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index cf444f1b06a38..571445c922dea 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -267,7 +267,6 @@ $search_filter = ""; $search_status = ""; $search_import_key = ''; - $catid = ""; $search_all = ""; $toselect = array(); $search_datec_start = ''; @@ -521,7 +520,7 @@ $sql .= natural_search("d.firstname", $search_firstname); } if ($search_lastname) { - $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname); + $sql .= natural_search("d.lastname", $search_lastname); } if ($search_gender != '' && $search_gender != '-1') { $sql .= natural_search("d.gender", $search_gender); @@ -530,7 +529,7 @@ $sql .= natural_search("d.login", $search_login); } if ($search_company) { - $sql .= natural_search("s.nom", $search_company); + $sql .= natural_search(array("s.nom", "d.societe"), $search_company); } if ($search_email) { $sql .= natural_search("d.email", $search_email); From eab6a9f97baff3c8ab1f9472c8774b563668c69b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:49:04 +0100 Subject: [PATCH 25/38] Fix name of index --- .../mysql/tables/llx_bookcal_availabilities-bookcal.key.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql b/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql index 79a7fe8347205..53f3e91082db0 100644 --- a/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql +++ b/htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal.key.sql @@ -16,10 +16,10 @@ -- BEGIN MODULEBUILDER INDEXES ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_rowid (rowid); -ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); +ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT fk_bookcal_availabilities_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid); ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_status (status); -ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_type (type); -ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_bookcal_calendar FOREIGN KEY (fk_bookcal_calendar) REFERENCES llx_bookcal_calendar(rowid); +ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_fk_bookcal_calendar (fk_bookcal_calendar); +ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT fk_bookcal_availabilities_fk_bookcal_calendar FOREIGN KEY (fk_bookcal_calendar) REFERENCES llx_bookcal_calendar(rowid); -- END MODULEBUILDER INDEXES From 459f631eccf5c4d48032ee94a9f52e7cb3b29305 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:52:53 +0100 Subject: [PATCH 26/38] Reduce length --- htdocs/install/mysql/data/llx_c_holiday_types.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_holiday_types.sql b/htdocs/install/mysql/data/llx_c_holiday_types.sql index 92bc8739968d2..ef17d8f202cfd 100644 --- a/htdocs/install/mysql/data/llx_c_holiday_types.sql +++ b/htdocs/install/mysql/data/llx_c_holiday_types.sql @@ -57,7 +57,7 @@ insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '9M-M', 'Ειδική άδεια προστασίας μητρότητας 9 μηνών(χωρίς αποδοχές)', 0, 0, 0, 102, 24, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '4M-M', 'Τετράμηνη γονική Άδεια Ανατροφής Τέκνων(χωρίς αποδοχές)', 0, 0, 0, 102, 25, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '6-8D-SP', 'Εξαήμερη ή Οκταήμερη Άδεια για μονογονεϊκές οικογένειες(με αποδοχές)', 0, 0, 0, 102, 26, 0); -insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '6-8-14D-FC', 'Άδεια για ασθένεια μελών οικογένειας(χωρίς αποδοχές, 6 ημέρες/έτος ένα παιδί - 8 ημέρες/έτος δύο παιδιά και σε 14 ημέρες/έτος τρία (3) παιδιά και πάνω', 0, 0, 0, 102, 27, 0); +insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '6-8-14D-FC', 'Αναρρωτική άδεια (άνευ αποδοχών, 6 ημέρες/έτος για ένα παιδί - 8 ημέρες/έτος για δύο και 14 ημέρες/έτος για τρία ή περισσότερα)', 0, 0, 0, 102, 27, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '10D-CD', 'Δεκαήμερη Γονική Άδεια για παιδί με σοβαρά νοσήματα και λόγω νοσηλείας παιδιών(με αποδοχές)', 0, 0, 0, 102, 28, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '30D-CD', 'Άδεια λόγω νοσηλείας των παιδιών(έως 30 ημέρες/έτος χωρίς αποδοχές)', 0, 0, 0, 102, 29, 0); insert into llx_c_holiday_types(entity, code, label, affect, delay, newbymonth, fk_country, sortorder, active) values (__ENTITY__, '5D-CG', 'Άδεια φροντιστή(έως 5 ημέρες/έτος χωρίς αποδοχές)', 0, 0, 0, 102, 30, 0); From 82ae009e8be7a20082fee514216bd68f67d39327 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:53:45 +0100 Subject: [PATCH 27/38] Fix size too low --- htdocs/install/mysql/tables/llx_c_invoice_subtype.sql | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql b/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql index 201df19923cda..c204df3b93324 100644 --- a/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql +++ b/htdocs/install/mysql/tables/llx_c_invoice_subtype.sql @@ -16,14 +16,13 @@ -- -- ======================================================================== -CREATE TABLE llx_c_invoice_subtype +CREATE TABLE llx_c_invoice_subtype ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_country integer NOT NULL, code varchar(5) NOT NULL, - label varchar(100), + label varchar(200), active tinyint DEFAULT 1 NOT NULL ) ENGINE=innodb; - From dd67fe7b6d57a0b77e997472961e04734dd5bc48 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 16:58:39 +0100 Subject: [PATCH 28/38] Fix duplicate record --- htdocs/install/mysql/data/llx_c_type_contact.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_type_contact.sql b/htdocs/install/mysql/data/llx_c_type_contact.sql index b7e649559e949..50a952bbea129 100644 --- a/htdocs/install/mysql/data/llx_c_type_contact.sql +++ b/htdocs/install/mysql/data/llx_c_type_contact.sql @@ -74,9 +74,9 @@ insert into llx_c_type_contact (element, source, code, libelle, active ) values insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'external', 'SHIPPING', 'Contact client livraison commande', 1); -- Shipment / Expedition +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'CUSTOMER', 'Customer shipping contact', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Loading facility', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Delivery facility', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Customer shipping contact', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'DELIVERY', 'Delivery facility', 1); -- Intervention / Fichinter insert into llx_c_type_contact (element, source, code, libelle, active ) values ('fichinter', 'internal', 'INTERREPFOLL', 'Responsable suivi de l''intervention', 1); From ca5335a71964c79b5a63da6aafcf8dc1a4180212 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 18:13:06 +0100 Subject: [PATCH 29/38] Fix migration --- htdocs/install/mysql/migration/20.0.0-21.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql index 5299e01857677..47cc3f8d6c028 100644 --- a/htdocs/install/mysql/migration/20.0.0-21.0.0.sql +++ b/htdocs/install/mysql/migration/20.0.0-21.0.0.sql @@ -45,7 +45,7 @@ ALTER TABLE llx_c_holiday_types DROP INDEX uk_c_holiday_types; ALTER TABLE llx_c_holiday_types ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; ALTER TABLE llx_c_holiday_types ADD UNIQUE INDEX uk_c_holiday_types (entity, code); -ALTER TABLE llx_hrm_evaluation MODIFY COLUMN modelpdf varchar(255) DEFAULT NULL; +ALTER TABLE llx_hrm_evaluation ADD COLUMN model_pdf varchar(255) DEFAULT NULL; -- Add ref_ext to asset_model to use various CommonOjbect methods ALTER TABLE llx_asset_model ADD COLUMN ref_ext varchar(255) AFTER ref; From 5e6ab79990942c7d2ae875aa45ea995bf1158475 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Fri, 29 Nov 2024 18:41:56 +0100 Subject: [PATCH 30/38] Fix remove hard constraint that must be soft constraints. --- .../llx_accounting_category_account-accounting.key.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql b/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql index 7c4a543ebc00e..a45941697f234 100644 --- a/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql +++ b/htdocs/install/mysql/tables/llx_accounting_category_account-accounting.key.sql @@ -14,13 +14,13 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- Table for connect accounting category with accounting account +-- Table for a relation n-n between c_accounting_category and accounting_account -- =================================================================== ALTER TABLE llx_accounting_category_account ADD INDEX idx_accounting_category_account_fk_accounting_category (fk_accounting_category); -ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_category FOREIGN KEY (fk_accounting_category) REFERENCES llx_c_accounting_category (rowid); +--ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_category FOREIGN KEY (fk_accounting_category) REFERENCES llx_c_accounting_category (rowid); ALTER TABLE llx_accounting_category_account ADD INDEX idx_accounting_category_account_fk_accounting_account (fk_accounting_account); -ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_account FOREIGN KEY (fk_accounting_account) REFERENCES llx_accounting_account (rowid); +--ALTER TABLE llx_accounting_category_account ADD CONSTRAINT fk_accounting_category_account_fk_accounting_account FOREIGN KEY (fk_accounting_account) REFERENCES llx_accounting_account (rowid); ALTER TABLE llx_accounting_category_account ADD UNIQUE INDEX uk_accounting_category_account (fk_accounting_category, fk_accounting_account); From f2c2b634e31c64eb40930d0bcc6eaa8739080461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 30 Nov 2024 12:51:38 +0100 Subject: [PATCH 31/38] fix CI (#32153) --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index b5a71fc5484a1..a794273525048 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1079,7 +1079,7 @@ function initfieldrequired() { // State if (!getDolGlobalString('MEMBER_DISABLE_STATE')) { print '
'; print ''; @@ -709,7 +715,7 @@ function on_change() { $pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ? GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : '')); print ''; // Price qty min @@ -718,7 +724,7 @@ function on_change() { print ''; print ''; print ' '; - print $form->selectPriceBaseType('', "disabled_price_base_type"); + print $form->selectPriceBaseType('', "disabled_price_base_type", 1); print ''; $currencies = array(); @@ -780,7 +786,7 @@ function edit_price_from_multicurrency() { print ''; print ''; } From 63e5e0ab77685234ff32f61f2b9bdda7b2c0f020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 30 Nov 2024 12:55:27 +0100 Subject: [PATCH 33/38] add phpdoc (#32139) * add phpdoc * clean baseline --- build/phpstan/phpstan-baseline.neon | 84 --------------------------- htdocs/core/tpl/resource_add.tpl.php | 24 ++++++++ htdocs/core/tpl/resource_view.tpl.php | 28 ++++++++- 3 files changed, 51 insertions(+), 85 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index b4842b6c19ef3..b969325e0aabc 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -17526,96 +17526,12 @@ parameters: count: 3 path: ../../htdocs/core/tpl/objectlinked_lineimport.tpl.php - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 29 - path: ../../htdocs/core/tpl/onlinepaymentlinks.tpl.php - - - - message: '#^Variable \$servicename might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../htdocs/core/tpl/onlinepaymentlinks.tpl.php - - message: '#^Variable \$langs might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../htdocs/core/tpl/originproductline.tpl.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$element might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$element_id might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$element_ref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/core/tpl/resource_add.tpl.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$element might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$element_id might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 7 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$linked_resources might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$mode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - - - message: '#^Variable \$resource_type might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/core/tpl/resource_view.tpl.php - - message: '#^Variable \$shippingline might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/core/tpl/resource_add.tpl.php b/htdocs/core/tpl/resource_add.tpl.php index 6b67021096bef..3cc89537d5b2e 100644 --- a/htdocs/core/tpl/resource_add.tpl.php +++ b/htdocs/core/tpl/resource_add.tpl.php @@ -1,6 +1,30 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +/** + * @var Conf $conf + * @var DoliDB $db + * @var Translate $langs + * + * @var string $element + * @var int $element_id + * @var string $element_ref + */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 42ed0f8139de4..454cc61ded6e2 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -1,6 +1,32 @@ +/* Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * @var Conf $conf + * @var DoliDB $db + * @var Translate $langs + * + * @var string $element + * @var int $element_id + * @var string $mode + * @var string $resource_type + * @var array,mandatory:int<0,1>}> $linked_resources */ // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { From be9d72e3b6934dce46e1981b8dc62d31e7b91123 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sat, 30 Nov 2024 13:44:24 +0100 Subject: [PATCH 34/38] The $empty param must follow same rules than other select component. --- htdocs/core/class/html.formticket.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 482e6af0088aa..9573e8c5cb696 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -968,7 +968,7 @@ public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $fi * @param string $htmlname Name of select component * @param string $filtertype To filter on some properties in llx_c_ticket_category ('public = 1'). This parameter must not come from input of users. * @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code - * @param int $empty 1 = can be empty, 0 = or can't be empty + * @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only * @param int $noadmininfo 0 = ddd admin info, 1 = disable admin info * @param int $maxlength Max length of label * @param string $morecss More CSS @@ -995,7 +995,7 @@ public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', if ($use_multilevel <= 0) { print ''; // Group => Category @@ -469,12 +469,12 @@ function(response) { if ($public) { $filter = '(public:=:1)'; } - $this->selectGroupTickets($category_code, 'category_code', $filter, 2, 1, 0, 0, 'minwidth200 maxwidth500'); + $this->selectGroupTickets($category_code, 'category_code', $filter, 2, 'ifone', 0, 0, 'minwidth200 maxwidth500'); print ''; // Severity => Priority print ''; if (isModEnabled('knowledgemanagement')) { @@ -869,8 +869,8 @@ function(response) { * @param string|int[] $selected Id of preselected field or array of Ids * @param string $htmlname Nom de la zone select * @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz)) - * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code - * @param int $empty 1=peut etre vide, 0 sinon + * @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code + * @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only * @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $maxlength Max length of label * @param string $morecss More CSS @@ -896,7 +896,7 @@ public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $fi print ''; if ($empty) { - print ''; + print ''; } if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) { @@ -1075,7 +1077,7 @@ public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', } print ajax_combobox('select'.$htmlname); - } elseif ($htmlname != '') { + } elseif ($htmlname != '') { // complexe mode using selection of group using a combo for each level (when using a hierarchy of groups). $selectedgroups = array(); $groupvalue = ""; $groupticket = GETPOST($htmlname, 'aZ09'); @@ -1320,14 +1322,14 @@ public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', /** * Return html list of ticket severitys (priorities) * - * @param string $selected Id severity pre-selected - * @param string $htmlname Name of the select area - * @param string $filtertype To filter on field type in llx_c_ticket_severity (array('code'=>xx,'label'=>zz)) - * @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code - * @param int $empty 1 = can be empty, 0 = or not - * @param int $noadmininfo 0 = add admin info, 1 = disable admin info - * @param int $maxlength Max length of label - * @param string $morecss More CSS + * @param string $selected Id severity pre-selected + * @param string $htmlname Name of the select area + * @param string $filtertype To filter on field type in llx_c_ticket_severity (array('code'=>xx,'label'=>zz)) + * @param int $format 0 = id+label, 1 = code+code, 2 = code+label, 3 = id+code + * @param int|string $empty 1 = can be empty or 'string' to show the string as the empty value, 0 = can't be empty, 'ifone' = can be empty but autoselected if there is one only + * @param int $noadmininfo 0 = add admin info, 1 = disable admin info + * @param int $maxlength Max length of label + * @param string $morecss More CSS * @return void */ public function selectSeveritiesTickets($selected = '', $htmlname = 'ticketseverity', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') @@ -1348,7 +1350,7 @@ public function selectSeveritiesTickets($selected = '', $htmlname = 'ticketsever print '
'.$langs->trans("Parameter")."'.$langs->trans("Value")."
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
".$langs->trans("Parameter")."".$langs->trans("Value")."".$langs->trans("Examples")." 
'.$langs->trans('State').''; - if ($soc->country_id || GETPOSTISSET('country_id')) { + if ($soc->country_id || GETPOSTISSET('country_id')) { print img_picto('', 'state', 'class="pictofixedwidth"'); print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOSTINT('state_id') : $soc->state_id, GETPOSTISSET('country_id') ? GETPOSTINT('country_id') : $soc->country_code); } else { From 51611489be02a7381b65aa5ec24ae3c9f344e348 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Sat, 30 Nov 2024 12:52:57 +0100 Subject: [PATCH 32/38] Debug v21 --- htdocs/product/price_suppliers.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/product/price_suppliers.php b/htdocs/product/price_suppliers.php index 82c500e09c14e..220f9f667dc97 100644 --- a/htdocs/product/price_suppliers.php +++ b/htdocs/product/price_suppliers.php @@ -700,7 +700,13 @@ function on_change() { } print $form->selectMultiCurrency($currencycodetouse, "multicurrency_code", 1); print '     '.$langs->trans("CurrencyRate").' '; - print ''; + print ''; print '
'; print ' '; - print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ? GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices + print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ? GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type", 1); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices print '
'.$langs->trans("PriceQtyMin").''; print ' '; - print $form->selectPriceBaseType((GETPOSTISSET('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type"); // We keep 'HT' here, price_base_type is not yet supported for supplier prices + print $form->selectPriceBaseType((GETPOSTISSET('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type", 1); // We keep 'HT' here, price_base_type is not yet supported for supplier prices print '
'; - $this->selectTypesTickets($type_code, 'type_code', '', 2, 1, 0, 0, 'minwidth200 maxwidth500'); + $this->selectTypesTickets($type_code, 'type_code', '', 2, 'ifone', 0, 0, 'minwidth200 maxwidth500'); print '
'; - $this->selectSeveritiesTickets($severity_code, 'severity_code', '', 2, 1, 0, 0, 'minwidth200 maxwidth500'); + $this->selectSeveritiesTickets($severity_code, 'severity_code', '', 2, 'ifone', 0, 0, 'minwidth200 maxwidth500'); print '
'; + $out .= '
'; $out .= ''; $out .= ''; $out .= ''; @@ -1146,9 +1146,12 @@ public function display_price_product_fournisseur($showunitprice = 1, $showsupti } $out .= '
'.($showunitprice ? $langs->trans("Price").' '.$langs->trans("HT") : '').''.($showunitprice ? $langs->trans("QtyMin") : '').''.$langs->trans("Supplier").'
'; } else { - $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT").'   (' : ''); - $out .= ($showsuptitle ? ''.$langs->trans("Supplier").': ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->ref_supplier; - $out .= ($showunitprice ? ')' : ''); + $out = ($showunitprice ? price($this->fourn_unitprice * (1 - $this->fourn_remise_percent / 100) + $this->fourn_remise, 0, $langs, 1, -1, -1, $conf->currency).' '.$langs->trans("HT") : ''); + if ($user->hasRight("fournisseur", "read")) { // Without permission, never show the best supplier seller + $out .= ($showunitprice ? '   (' : ''); + $out .= ($showsuptitle ? ''.$langs->trans("Supplier").': ' : '').$this->getSocNomUrl(1, 'supplier', $maxlen, $notooltip).' / '.$langs->trans("SupplierRef").': '.$this->ref_supplier; + $out .= ($showunitprice ? ')' : ''); + } } return $out; }