From 94a8b85d8d18b814fef23edc3c28fd11e9b29c44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Jun 2024 17:49:44 +0200 Subject: [PATCH 01/46] Comment --- htdocs/cron/class/cronjob.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 83c4511c9bc..34623fedd33 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -520,7 +520,7 @@ class Cronjob extends CommonObject * @param int $offset Offset ppage * @param int $status Display active or not * @param string|array $filter Filter USF. - * @param int $processing Processing or not + * @param int $processing Processing or not (-1=all, 0=not in progress, 1=in progress) * @return int if KO: <0 || if OK: >0 */ public function fetchAll(string $sortorder = 'DESC', string $sortfield = 't.rowid', int $limit = 0, int $offset = 0, int $status = 1, $filter = '', int $processing = -1) From 335c5761f94225e506696331a4772088e29821bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Jun 2024 18:01:42 +0200 Subject: [PATCH 02/46] Fix add a protection to be able to process jobs not closed correctly. --- scripts/cron/cron_run_jobs.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index cc5a12e7ad6..84fc4e1d0fe 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -167,7 +167,7 @@ if (isset($argv[4]) && $argv[4] == '--force') { $forcequalified = 1; } -// create a jobs object +// Create a jobs object $object = new Cronjob($db); $filter = array(); @@ -180,6 +180,15 @@ if (!empty($id)) { $filter['t.rowid'] = $id; } + +// Update old jobs that were not closed correctly so processing is moved from 1 to 0 (otherwise task stopped with fatal error are always in status "in progress") +$sql = "UPDATE ".MAIN_DB_PREFIX."cronjob set processing = 0"; +$sql .= " WHERE processing = 1"; +$sql .= " AND datelastrun <= '".$db->idate(dol_now() - 24*3600, 'gmt')."'"; +$sql .= " AND datelastresult IS NULL"; +$db->query($sql); + + $result = $object->fetchAll('ASC,ASC,ASC', 't.priority,t.entity,t.rowid', 0, 0, 1, $filter, 0); if ($result < 0) { echo "Error: ".$object->error; From 25e9d9b2ba6d713483b0b76f24577bfa52a3c917 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jun 2024 13:57:56 +0200 Subject: [PATCH 03/46] Trans --- htdocs/install/inc.php | 1 + htdocs/langs/en_US/install.lang | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 54ee7c77842..8a5e4ad6a14 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -256,6 +256,7 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > $includeconferror = 'ErrorBadFormatForConfFile'; } } + $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; // Define prefix diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 9f37526ef52..23b4363afc3 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -211,7 +211,7 @@ YouTryInstallDisabledByFileLock=The application tried to self-upgrade, but the i YouTryUpgradeDisabledByMissingFileUnLock=The application tried to self-upgrade, but the upgrade process is currently not allowed.
ClickHereToGoToApp=Click here to go to your application ClickOnLinkOrRemoveManualy=If an upgrade is in progress, please wait. If not, click on the following link. If you always see this same page, you must remove/rename the file install.lock in the documents directory. -ClickOnLinkOrCreateUnlockFileManualy=If an upgrade is in progress, please wait... If not, you must remove the file install.lock or create a file upgrade.unlock into the Dolibarr documents directory. +ClickOnLinkOrCreateUnlockFileManualy=If an upgrade is in progress, please wait... If not, you must remove the file install.lock (or create a file upgrade.unlock for upgrade) into the Dolibarr documents directory. Loaded=Loaded FunctionTest=Function test NodoUpgradeAfterDB=No action requested by external modules after upgrade of database From 524f300034276cada0b072922e547d885a56e55a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jun 2024 14:33:36 +0200 Subject: [PATCH 04/46] Clean repair page --- htdocs/install/repair.php | 66 +++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 219852a33d0..fd7864db2cd 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -80,31 +80,47 @@ $actiondone = 1; print '

'.$langs->trans("Repair").'

'; -print 'Option standard (\'test\' or \'confirmed\') is '.(GETPOST('standard', 'alpha') ? GETPOST('standard', 'alpha') : 'undefined').'
'."\n"; -// Disable modules -print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha') ? GETPOST('force_disable_of_modules_not_found', 'alpha') : 'undefined').'
'."\n"; -// Files -print 'Option restore_thirdparties_logos (\'test\' or \'confirmed\') is '.(GETPOST('restore_thirdparties_logos', 'alpha') ? GETPOST('restore_thirdparties_logos', 'alpha') : 'undefined').'
'."\n"; -print 'Option restore_user_pictures (\'test\' or \'confirmed\') is '.(GETPOST('restore_user_pictures', 'alpha') ? GETPOST('restore_user_pictures', 'alpha') : 'undefined').'
'."\n"; -print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_product_thumbs', 'alpha') ? GETPOST('rebuild_product_thumbs', 'alpha') : 'undefined').'
'."\n"; -// Clean tables and data -print 'Option clean_linked_elements (\'test\' or \'confirmed\') is '.(GETPOST('clean_linked_elements', 'alpha') ? GETPOST('clean_linked_elements', 'alpha') : 'undefined').'
'."\n"; -print 'Option clean_menus (\'test\' or \'confirmed\') is '.(GETPOST('clean_menus', 'alpha') ? GETPOST('clean_menus', 'alpha') : 'undefined').'
'."\n"; -print 'Option clean_orphelin_dir (\'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir', 'alpha') ? GETPOST('clean_orphelin_dir', 'alpha') : 'undefined').'
'."\n"; -print 'Option clean_product_stock_batch (\'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch', 'alpha') ? GETPOST('clean_product_stock_batch', 'alpha') : 'undefined').'
'."\n"; -print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha') ? GETPOST('clean_perm_table', 'alpha') : 'undefined').'
'."\n"; -print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'confirmed\') is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha') ? GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha') : 'undefined').'
'."\n"; -// Init data -print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST('set_empty_time_spent_amount', 'alpha') ? GETPOST('set_empty_time_spent_amount', 'alpha') : 'undefined').'
'."\n"; -// Structure -print 'Option force_utf8_on_tables (force utf8 + row=dynamic), for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha') ? GETPOST('force_utf8_on_tables', 'alpha') : 'undefined').'
'."\n"; -print "Option force_utf8mb4_on_tables (force utf8mb4 + row=dynamic, EXPERIMENTAL!), for mysql/mariadb only ('test' or 'confirmed') is ".(GETPOST('force_utf8mb4_on_tables', 'alpha') ? GETPOST('force_utf8mb4_on_tables', 'alpha') : 'undefined')."
\n"; -print "Option force_collation_from_conf_on_tables (force ".$conf->db->character_set."/".$conf->db->dolibarr_main_db_collation." + row=dynamic), for mysql/mariadb only ('test' or 'confirmed') is ".(GETPOST('force_collation_from_conf_on_tables', 'alpha') ? GETPOST('force_collation_from_conf_on_tables', 'alpha') : 'undefined')."
\n"; -// Rebuild sequence -print 'Option rebuild_sequences, for postgresql only (\'test\' or \'confirmed\') is '.(GETPOST('rebuild_sequences', 'alpha') ? GETPOST('rebuild_sequences', 'alpha') : 'undefined').'
'."\n"; +print '
'; +print $langs->trans("SetAtLeastOneOptionAsUrlParameter"); +print '
'; + +//print 'You must set one of the following option with a parameter value that is "test" or "confirmed" on the URL
'; +//print $langs->trans("Example").': '.DOL_MAIN_URL_ROOT.'/install/repair.php?standard=confirmed
'."\n"; print '
'; -print ''; +print 'Option standard is '.(GETPOST('standard', 'alpha') ? GETPOST('standard', 'alpha') : 'undefined').'
'."\n"; +// Disable modules +print 'Option force_disable_of_modules_not_found is '.(GETPOST('force_disable_of_modules_not_found', 'alpha') ? GETPOST('force_disable_of_modules_not_found', 'alpha') : 'undefined').'
'."\n"; +// Files +print 'Option restore_thirdparties_logos is '.(GETPOST('restore_thirdparties_logos', 'alpha') ? GETPOST('restore_thirdparties_logos', 'alpha') : 'undefined').'
'."\n"; +print 'Option restore_user_pictures is '.(GETPOST('restore_user_pictures', 'alpha') ? GETPOST('restore_user_pictures', 'alpha') : 'undefined').'
'."\n"; +print 'Option rebuild_product_thumbs is '.(GETPOST('rebuild_product_thumbs', 'alpha') ? GETPOST('rebuild_product_thumbs', 'alpha') : 'undefined').'
'."\n"; +// Clean tables and data +print 'Option clean_linked_elements is '.(GETPOST('clean_linked_elements', 'alpha') ? GETPOST('clean_linked_elements', 'alpha') : 'undefined').'
'."\n"; +print 'Option clean_menus is '.(GETPOST('clean_menus', 'alpha') ? GETPOST('clean_menus', 'alpha') : 'undefined').'
'."\n"; +print 'Option clean_orphelin_dir is '.(GETPOST('clean_orphelin_dir', 'alpha') ? GETPOST('clean_orphelin_dir', 'alpha') : 'undefined').'
'."\n"; +print 'Option clean_product_stock_batch is '.(GETPOST('clean_product_stock_batch', 'alpha') ? GETPOST('clean_product_stock_batch', 'alpha') : 'undefined').'
'."\n"; +print 'Option clean_perm_table is '.(GETPOST('clean_perm_table', 'alpha') ? GETPOST('clean_perm_table', 'alpha') : 'undefined').'
'."\n"; +print 'Option repair_link_dispatch_lines_supplier_order_lines, is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha') ? GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha') : 'undefined').'
'."\n"; +// Init data +print 'Option set_empty_time_spent_amount is '.(GETPOST('set_empty_time_spent_amount', 'alpha') ? GETPOST('set_empty_time_spent_amount', 'alpha') : 'undefined').'
'."\n"; +// Structure +print 'Option force_utf8_on_tables (force utf8 + row=dynamic), for mysql/mariadb only is '.(GETPOST('force_utf8_on_tables', 'alpha') ? GETPOST('force_utf8_on_tables', 'alpha') : 'undefined').'
'."\n"; +print ''."Option force_utf8mb4_on_tables (force utf8mb4 + row=dynamic, EXPERIMENTAL!), for mysql/mariadb only ('test' or 'confirmed') is ".(GETPOST('force_utf8mb4_on_tables', 'alpha') ? GETPOST('force_utf8mb4_on_tables', 'alpha') : 'undefined'); +print ''; +if ($dolibarr_main_db_character_set == 'utf8mb4') { + print ''; +} +print "
\n"; +print "Option force_collation_from_conf_on_tables (force ".$conf->db->character_set."/".$conf->db->dolibarr_main_db_collation." + row=dynamic), for mysql/mariadb only ('test' or 'confirmed') is ".(GETPOST('force_collation_from_conf_on_tables', 'alpha') ? GETPOST('force_collation_from_conf_on_tables', 'alpha') : 'undefined')."
\n"; + +// Rebuild sequence +print 'Option rebuild_sequences, for postgresql only, is '.(GETPOST('rebuild_sequences', 'alpha') ? GETPOST('rebuild_sequences', 'alpha') : 'undefined').'
'."\n"; +print '
'; + +print '
'; + +print '
'; $error = 0; // If password is encoded, we decode it @@ -1724,10 +1740,6 @@ if ($oneoptionset) { print ''; -} else { - print '
'; - print $langs->trans("SetAtLeastOneOptionAsUrlParameter"); - print '
'; } dolibarr_install_syslog("--- repair: end"); From 14ca7e80a69f119c8f5e02f40ab76163922751d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jun 2024 14:34:24 +0200 Subject: [PATCH 05/46] Fix test --- htdocs/install/repair.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index fd7864db2cd..712dd7ec84f 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -108,7 +108,7 @@ print 'Option set_empty_time_spent_amount is '.(GETPOST('set_empty_time_spent_am print 'Option force_utf8_on_tables (force utf8 + row=dynamic), for mysql/mariadb only is '.(GETPOST('force_utf8_on_tables', 'alpha') ? GETPOST('force_utf8_on_tables', 'alpha') : 'undefined').'
'."\n"; print ''."Option force_utf8mb4_on_tables (force utf8mb4 + row=dynamic, EXPERIMENTAL!), for mysql/mariadb only ('test' or 'confirmed') is ".(GETPOST('force_utf8mb4_on_tables', 'alpha') ? GETPOST('force_utf8mb4_on_tables', 'alpha') : 'undefined'); print ''; -if ($dolibarr_main_db_character_set == 'utf8mb4') { +if ($dolibarr_main_db_character_set != 'utf8mb4') { print ''; } print "
\n"; From 8e12d3fd17d61675b51c49b05c6a910a6ea1f3ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jun 2024 14:42:02 +0200 Subject: [PATCH 06/46] Trans --- htdocs/install/repair.php | 6 +++--- htdocs/langs/en_US/install.lang | 2 +- htdocs/langs/en_US/other.lang | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 712dd7ec84f..845127210ca 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -105,14 +105,14 @@ print 'Option repair_link_dispatch_lines_supplier_order_lines, is '.(GETPOST('re // Init data print 'Option set_empty_time_spent_amount is '.(GETPOST('set_empty_time_spent_amount', 'alpha') ? GETPOST('set_empty_time_spent_amount', 'alpha') : 'undefined').'
'."\n"; // Structure -print 'Option force_utf8_on_tables (force utf8 + row=dynamic), for mysql/mariadb only is '.(GETPOST('force_utf8_on_tables', 'alpha') ? GETPOST('force_utf8_on_tables', 'alpha') : 'undefined').'
'."\n"; -print ''."Option force_utf8mb4_on_tables (force utf8mb4 + row=dynamic, EXPERIMENTAL!), for mysql/mariadb only ('test' or 'confirmed') is ".(GETPOST('force_utf8mb4_on_tables', 'alpha') ? GETPOST('force_utf8mb4_on_tables', 'alpha') : 'undefined'); +print 'Option force_utf8_on_tables (force utf8 + row=dynamic), for mysql/mariadb only, is '.(GETPOST('force_utf8_on_tables', 'alpha') ? GETPOST('force_utf8_on_tables', 'alpha') : 'undefined').'
'."\n"; +print ''."Option force_utf8mb4_on_tables (force utf8mb4 + row=dynamic, EXPERIMENTAL!), for mysql/mariadb only, is ".(GETPOST('force_utf8mb4_on_tables', 'alpha') ? GETPOST('force_utf8mb4_on_tables', 'alpha') : 'undefined'); print ''; if ($dolibarr_main_db_character_set != 'utf8mb4') { print ''; } print "
\n"; -print "Option force_collation_from_conf_on_tables (force ".$conf->db->character_set."/".$conf->db->dolibarr_main_db_collation." + row=dynamic), for mysql/mariadb only ('test' or 'confirmed') is ".(GETPOST('force_collation_from_conf_on_tables', 'alpha') ? GETPOST('force_collation_from_conf_on_tables', 'alpha') : 'undefined')."
\n"; +print "Option force_collation_from_conf_on_tables (force ".$conf->db->character_set."/".$conf->db->dolibarr_main_db_collation." + row=dynamic), for mysql/mariadb only is ".(GETPOST('force_collation_from_conf_on_tables', 'alpha') ? GETPOST('force_collation_from_conf_on_tables', 'alpha') : 'undefined')."
\n"; // Rebuild sequence print 'Option rebuild_sequences, for postgresql only, is '.(GETPOST('rebuild_sequences', 'alpha') ? GETPOST('rebuild_sequences', 'alpha') : 'undefined').'
'."\n"; diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 23b4363afc3..21b58f4c4d9 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -139,7 +139,7 @@ KeepDefaultValuesDeb=You used the Dolibarr setup wizard from a Linux package (Ub KeepDefaultValuesMamp=You used the Dolibarr setup wizard from DoliMamp, so the values proposed here are already optimized. Change them only if you know what you are doing. KeepDefaultValuesProxmox=You used the Dolibarr setup wizard from a Proxmox virtual appliance, so the values proposed here are already optimized. Change them only if you know what you are doing. UpgradeExternalModule=Run dedicated upgrade process of external module -SetAtLeastOneOptionAsUrlParameter=Set at least one option as a parameter in URL. For example: '...repair.php?standard=confirmed' +SetAtLeastOneOptionAsUrlParameter=Set at least one option as a parameter in URL with value 'test' or 'confirmed'. For example: '...repair.php?standard=confirmed' NothingToDelete=Nothing to clean/delete NothingToDo=Nothing to do ######### diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 2bd0f18cf38..c4fb5652cb9 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -16,6 +16,9 @@ TextPreviousMonthOfInvoice=Previous month (text) of invoice date NextMonthOfInvoice=Following month (number 1-12) of invoice date TextNextMonthOfInvoice=Following month (text) of invoice date PreviousMonth=Previous month +PreviousYear=Previous year +NextMonth=Next month +NextYear=Next year CurrentMonth=Current month ZipFileGeneratedInto=Zip file generated into %s. DocFileGeneratedInto=Doc file generated into %s. From c26cd298c38b46b932bcb3ce006d6a7ac0b5b3b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jun 2024 14:56:45 +0200 Subject: [PATCH 07/46] Debug v20 --- htdocs/comm/mailing/card.php | 26 +++++++----- htdocs/comm/mailing/cibles.php | 75 +++++++++++++++++++++++++--------- 2 files changed, 71 insertions(+), 30 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 4b16e949849..9a89e57b8b7 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1034,14 +1034,20 @@ if ($action == 'create') { print $form->editfieldkey("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); print '
'; @@ -1081,9 +1087,9 @@ if ($action == 'create') { $nbemail = ($object->nbemail ? $object->nbemail : 0); if (is_numeric($nbemail)) { $text = ''; - if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) { + if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < $nbemail) && ($object->status == 1 || ($object->status == 2 && $nbtry < $nbemail))) { if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) { - $text .= $langs->trans('LimitSendingEmailing', getDolGlobalInt('MAILING_LIMIT_SENDBYWEB')); + $text .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB')); } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index bae497fad30..16e86bf95b7 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -90,14 +90,21 @@ if (version_compare(phpversion(), '7.0', '>=')) { if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) { accessforbidden(); } -//$result = restrictedArea($user, 'mailing'); +if (empty($action) && empty($object->id)) { + accessforbidden('Object not found'); +} + +$permissiontoread = $user->hasRight('maling', 'lire'); +$permissiontocreate = $user->hasRight('mailing', 'creer'); +$permissiontovalidatesend = $user->hasRight('mailing', 'valider'); +$permissiontodelete = $user->hasRight('mailing', 'supprimer'); /* * Actions */ -if ($action == 'add' && $user->hasRight('mailing', 'creer')) { // Add recipients +if ($action == 'add' && $permissiontocreate) { // Add recipients $module = GETPOST("module", 'alpha'); $result = -1; @@ -146,7 +153,7 @@ if ($action == 'add' && $user->hasRight('mailing', 'creer')) { // Add recipient } } -if (GETPOSTINT('clearlist') && $user->hasRight('mailing', 'creer')) { +if (GETPOSTINT('clearlist') && $permissiontocreate) { // Loading Class $obj = new MailingTargets($db); $obj->clear_target($id); @@ -156,7 +163,7 @@ if (GETPOSTINT('clearlist') && $user->hasRight('mailing', 'creer')) { */ } -if (GETPOSTINT('exportcsv') && $user->hasRight('mailing', 'lire')) { +if (GETPOSTINT('exportcsv') && $permissiontoread) { $completefilename = 'targets_emailing'.$object->id.'_'.dol_print_date(dol_now(), 'dayhourlog').'.csv'; header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename='.$completefilename); @@ -195,7 +202,7 @@ if (GETPOSTINT('exportcsv') && $user->hasRight('mailing', 'lire')) { exit; } -if ($action == 'delete' && $user->hasRight('mailing', 'creer')) { +if ($action == 'delete' && $permissiontocreate) { // Ici, rowid indique le destinataire et id le mailing $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid = ".((int) $rowid); $resql = $db->query($sql); @@ -252,7 +259,7 @@ if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyt $mesg = $object->error; } - setEventMessages($mesg, null, 'errors'); + setEventMessages($mesg, $mesgs, 'errors'); $action = ""; } @@ -301,6 +308,7 @@ if ($object->fetch($id) >= 0) { print '
'; print $form->editfieldval("MailErrorsTo", 'email_errorsto', $object->email_errorsto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); - $email = CMailFile::getValidAddress($object->email_errorsto, 2); - if ($action != 'editemail_errorsto') { - if ($email && !isValidEmail($email)) { - $langs->load("errors"); - print img_warning($langs->trans("ErrorBadEMail", $email)); - } elseif ($email && !isValidMailDomain($email)) { - $langs->load("errors"); - print img_warning($langs->trans("ErrorBadMXDomain", $email)); + $emailarray = CMailFile::getArrayAddress($object->email_errorsto); + foreach ($emailarray as $email => $name) { + if ($name != $email) { + print dol_escape_htmltag($name).' <'.$email; + print '>'; + if ($email && !isValidEmail($email)) { + $langs->load("errors"); + print img_warning($langs->trans("ErrorBadEMail", $email)); + } elseif ($email && !isValidMailDomain($email)) { + $langs->load("errors"); + print img_warning($langs->trans("ErrorBadMXDomain", $email)); + } + } else { + print dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1); } } print '
'; + // From print ''; } + // Reply to + if ($object->messtype != 'sms') { + print ''; + } + print '
'.$langs->trans("MailFrom").''; $emailarray = CMailFile::getArrayAddress($object->email_from); foreach ($emailarray as $email => $name) { @@ -327,9 +335,12 @@ if ($object->fetch($id) >= 0) { if ($name != $email) { print dol_escape_htmltag($name).' <'.$email; print '>'; - if (!isValidEmail($email)) { + if ($email && !isValidEmail($email)) { $langs->load("errors"); print img_warning($langs->trans("ErrorBadEMail", $email)); + } elseif ($email && !isValidMailDomain($email)) { + $langs->load("errors"); + print img_warning($langs->trans("ErrorBadMXDomain", $email)); } } else { print dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1); @@ -338,6 +349,25 @@ if ($object->fetch($id) >= 0) { print '
'; + print $form->editfieldkey("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); + print ''; + print $form->editfieldval("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string'); + $email = CMailFile::getValidAddress($object->email_replyto, 2); + if ($action != 'editemail_replyto') { + if ($email && !isValidEmail($email)) { + $langs->load("errors"); + print img_warning($langs->trans("ErrorBadEMail", $email)); + } elseif ($email && !isValidMailDomain($email)) { + $langs->load("errors"); + print img_warning($langs->trans("ErrorBadMXDomain", $email)); + } + } + print '
'; print ''; @@ -354,7 +384,7 @@ if ($object->fetch($id) >= 0) { $nbemail = ($object->nbemail ? $object->nbemail : 0); if (is_numeric($nbemail)) { $text = ''; - if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->status == 1 || ($object->status == 2 && $nbtry < $nbemail))) { + if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < $nbemail) && ($object->status == 1 || ($object->status == 2 && $nbtry < $nbemail))) { if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) { $text .= $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB')); } else { @@ -376,19 +406,24 @@ if ($object->fetch($id) >= 0) { print ''; print $langs->trans("MAIN_MAIL_SENDMODE"); print ''; - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { - $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')]; - } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE')) { - $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE')]; - } else { - $text = $listofmethods['mail']; - } - print $text; - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { - if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') { - print ' ('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING').')'; + if ($object->messtype != 'sms') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { + $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')]; + } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE')) { + $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE')]; + } else { + $text = $listofmethods['mail']; } - } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) { + print $text; + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') { + if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') { + print ' ('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING', getDolGlobalString('MAIN_MAIL_SMTP_SERVER')).')'; + } + } elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) { + print ' ('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')'; + } + } else { + print 'SMS '; print ' ('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')'; } print ''; From 6717ce209d8ddd99ccf661463bdd389da59fb7f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jun 2024 15:44:54 +0200 Subject: [PATCH 08/46] Fix menu link --- htdocs/core/modules/modOpenSurvey.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index 82f0ae853a8..578b60045be 100644 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -127,11 +127,11 @@ class modOpenSurvey extends DolibarrModules 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), 'mainmenu' => 'tools', 'leftmenu' => 'opensurvey', - 'url' => '/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey', + 'url' => '/opensurvey/list.php?mainmenu=tools&leftmenu=opensurvey', 'langs' => 'opensurvey', 'position' => 200, - 'enabled' => '$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. - 'perms' => '$user->rights->opensurvey->read', + 'enabled' => 'isModEnabled("opensurvey")', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. + 'perms' => '$user->hasRight("opensurvey", "read")', 'target' => '', 'user' => 0, ); @@ -146,8 +146,8 @@ class modOpenSurvey extends DolibarrModules 'url' => '/opensurvey/wizard/index.php', 'langs' => 'opensurvey', 'position' => 210, - 'enabled' => '$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. - 'perms' => '$user->rights->opensurvey->write', + 'enabled' => 'isModEnabled("opensurvey")', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. + 'perms' => '$user->hasRight("opensurvey", "write")', 'target' => '', 'user' => 0, ); @@ -162,8 +162,8 @@ class modOpenSurvey extends DolibarrModules 'url' => '/opensurvey/list.php', 'langs' => 'opensurvey', 'position' => 220, - 'enabled' => '$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. - 'perms' => '$user->rights->opensurvey->read', + 'enabled' => 'isModEnabled("opensurvey")', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled. + 'perms' => '$user->hasRight("opensurvey", "read")', 'target' => '', 'user' => 0, ); From 830c7b9885a7dd720d979e1c4407375245a75b14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Jun 2024 16:17:52 +0200 Subject: [PATCH 09/46] Fix type --- htdocs/opensurvey/wizard/choix_date.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index fb62df59443..f74ee97fe83 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -41,6 +41,7 @@ $erreur = false; $erreurNb = 0; $choixdate = ''; + /* * Actions */ @@ -337,7 +338,7 @@ if (issetAndNoEmpty('anneeapres_x') || issetAndNoEmpty('anneeapres')) { // valeurs du nombre de jour dans le mois et du premier jour du mois $nbrejourmois = idate("t", dol_get_first_day((int) $_SESSION["annee"], (int) $_SESSION["mois"])); -$premierjourmois = dol_print_date(dol_get_first_day((int) $_SESSION["annee"], (int) $_SESSION["mois"]), "%w") - 1; +$premierjourmois = (int) dol_print_date(dol_get_first_day((int) $_SESSION["annee"], (int) $_SESSION["mois"]), "%w") - 1; //var_dump(dol_get_first_day((int) $_SESSION["annee"], (int) $_SESSION["mois"])); //var_dump($premierjourmois); From 1d7946e0bd2d61dbaa843739e6e014171159508d Mon Sep 17 00:00:00 2001 From: Anthony Damhet <73399671+EchoLoGeek@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:42:05 +0200 Subject: [PATCH 10/46] Add llxHeader class to Accountancy customers and suppliers (#29994) --- htdocs/accountancy/customer/card.php | 2 +- htdocs/accountancy/customer/index.php | 2 +- htdocs/accountancy/customer/lines.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/index.php | 2 +- htdocs/accountancy/supplier/card.php | 2 +- htdocs/accountancy/supplier/index.php | 2 +- htdocs/accountancy/supplier/lines.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 627693bfc3a..f606cc48868 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -86,7 +86,7 @@ if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) { */ $help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; -llxHeader("", $langs->trans('FicheVentilation'), $help_url); +llxHeader("", $langs->trans('FicheVentilation'), $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-customer page-card'); if ($cancel == $langs->trans("Cancel")) { $action = ''; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 6b26b6ae43f..59e31753f39 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -301,7 +301,7 @@ if ($action == 'validatehistory') { */ $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; -llxHeader('', $langs->trans("CustomersVentilation"), $help_url); +llxHeader('', $langs->trans("CustomersVentilation"), $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-customer page-index'); $textprevyear = ''.img_previous().''; $textnextyear = ' '.img_next().''; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 618e6392a90..6d8dd13951f 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -177,7 +177,7 @@ $formother = new FormOther($db); $help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double#Liaisons_comptables'; -llxHeader('', $langs->trans("CustomersVentilation").' - '.$langs->trans("Dispatched"), $help_url); +llxHeader('', $langs->trans("CustomersVentilation").' - '.$langs->trans("Dispatched"), $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-customer page-lines'); print '