From c5c0628ee86e12f8a7371c33720bf2c698c8c7a2 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 11 Oct 2022 10:05:56 +0200 Subject: [PATCH 01/25] add short cicility --- htdocs/langs/en_US/dict.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index 0524cf1ca18..9eaeb52f8f2 100644 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -250,7 +250,9 @@ CountryMF=Saint Martin ##### Civilities ##### CivilityMME=Mrs. +CivilityMMEShort=CivilityMMEShort CivilityMR=Mr. +CivilityMRShort=CivilityMRShort CivilityMLE=Ms. CivilityMTRE=Master CivilityDR=Doctor From 82ca472245b551df5d05f35813cf8d78b7d9a494 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 18 Oct 2022 10:50:21 +0200 Subject: [PATCH 02/25] FIX: only modify hidden checkbox/multislected extrafields on update if they are provided in request --- htdocs/core/class/extrafields.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 384d4f1fba4..1fbadc2ee81 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2084,13 +2084,21 @@ class ExtraFields $enabled = 1; if (isset($this->attributes[$object->table_element]['list'][$key])) { - $enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1); + $enabled = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1)); } $perms = 1; if (isset($this->attributes[$object->table_element]['perms'][$key])) { $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1); } - if (empty($enabled)) { + if ( + empty($enabled) + || ( + $onlykey === '@GETPOSTISSET' + && in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst')) + && in_array(abs($enabled), array(2, 5)) + && ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided + ) + ) { continue; } if (empty($perms)) { From 6050f607043d9b83462e4a5eea0f620c393879b7 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 18 Oct 2022 11:36:17 +0200 Subject: [PATCH 03/25] add loadRoleMode on getlinearray --- htdocs/projet/class/project.class.php | 11 ++++++----- htdocs/projet/class/task.class.php | 23 ++++++++++++----------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index b127d3aa686..63b8d0077ee 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -838,7 +838,7 @@ class Project extends CommonObject } // Fetch tasks - $this->getLinesArray($user); + $this->getLinesArray($user, 0); // Delete tasks $ret = $this->deleteTasks($user); @@ -2204,14 +2204,15 @@ class Project extends CommonObject /** * Create an array of tasks of current project * - * @param User $user Object user we want project allowed to - * @return int >0 if OK, <0 if KO + * @param User $user Object user we want project allowed to + * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action + * @return int >0 if OK, <0 if KO */ - public function getLinesArray($user) + public function getLinesArray($user, $loadRoleMode = 1) { require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $taskstatic = new Task($this->db); - $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0); + $this->lines = $taskstatic->getTasksArray(0, $user, $this->id, 0, 0, '', '-1', '', 0, 0, array(), 0, array(), 0, $loadRoleMode); } } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index cda8494682b..2663053b549 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -772,9 +772,10 @@ class Task extends CommonObject * @param array $extrafields Show additional column from project or task * @param int $includebilltime Calculate also the time to bill and billed * @param array $search_array_options Array of search + * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action * @return array Array of tasks */ - public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array()) + public function getTasksArray($usert = null, $userp = null, $projectid = 0, $socid = 0, $mode = 0, $filteronproj = '', $filteronprojstatus = '-1', $morewherefilter = '', $filteronprojuser = 0, $filterontaskuser = 0, $extrafields = array(), $includebilltime = 0, $search_array_options = array(), $loadRoleMode = 1) { global $conf, $hookmanager; @@ -925,18 +926,18 @@ class Task extends CommonObject $error = 0; $obj = $this->db->fetch_object($resql); - - if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user - if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) { - $error++; + if ($loadRoleMode) { + if ((!$obj->public) && (is_object($userp))) { // If not public project and we ask a filter on project owned by a user + if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) { + $error++; + } + } + if (is_object($usert)) { // If we ask a filter on a user affected to a task + if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) { + $error++; + } } } - if (is_object($usert)) { // If we ask a filter on a user affected to a task - if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) { - $error++; - } - } - if (!$error) { $tasks[$i] = new Task($this->db); $tasks[$i]->id = $obj->taskid; From 71bae4f94b42d6099d50ceafd4e837e7c583d7f9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 18 Oct 2022 09:43:55 +0000 Subject: [PATCH 04/25] Fixing style errors. --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 63b8d0077ee..2e6bdd8cec0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2208,7 +2208,7 @@ class Project extends CommonObject * @param int $loadRoleMode 1= will test Roles on task; 0 used in delete project action * @return int >0 if OK, <0 if KO */ - public function getLinesArray($user, $loadRoleMode = 1) + public function getLinesArray($user, $loadRoleMode = 1) { require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $taskstatic = new Task($this->db); From 87339de68da4232024d8cc090b75cf6597be8468 Mon Sep 17 00:00:00 2001 From: jpb Date: Wed, 19 Oct 2022 09:29:11 +0200 Subject: [PATCH 05/25] add human readeable trad --- htdocs/langs/en_US/dict.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/dict.lang b/htdocs/langs/en_US/dict.lang index 9eaeb52f8f2..00ab5a05f24 100644 --- a/htdocs/langs/en_US/dict.lang +++ b/htdocs/langs/en_US/dict.lang @@ -250,9 +250,9 @@ CountryMF=Saint Martin ##### Civilities ##### CivilityMME=Mrs. -CivilityMMEShort=CivilityMMEShort +CivilityMMEShort=Mrs. CivilityMR=Mr. -CivilityMRShort=CivilityMRShort +CivilityMRShort=Mr. CivilityMLE=Ms. CivilityMTRE=Master CivilityDR=Doctor From 765e619cee2fa6d246aab8eec825879d93c83fc9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 20 Oct 2022 14:47:55 +0200 Subject: [PATCH 06/25] FIX avoid unnecessary multiple calculation (#22637) --- htdocs/core/lib/project.lib.php | 10 ++++++---- htdocs/projet/activity/perday.php | 9 ++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 776d0f0776f..e32eb092a46 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1226,13 +1226,14 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); - $modeinput = 'hours'; + // Comment for avoid unnecessary multiple calculation + /*$modeinput = 'hours'; print ''; + print '';*/ print ''; @@ -1613,13 +1614,14 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr //$tableCell.=' '; print $tableCell; - $modeinput = 'hours'; + // Comment for avoid unnecessary multiple calculation + /*$modeinput = 'hours'; print ''; + print '';*/ print ''; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index c191b3baeaa..86df142d40c 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -795,12 +795,12 @@ print ''; print ''; -$modeinput = 'hours'; - -if ($conf->use_javascript_ajax) { +if (!empty($conf->use_javascript_ajax)) { + $modeinput = 'hours'; print "\n\n"; print ''; } From c3fb0fde85e8f787da18f6b0f56aeb45973ee4fe Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 20 Oct 2022 15:53:03 +0200 Subject: [PATCH 07/25] FIX : we must be able to select only bom of a specific product + several fixes on select_bom() function --- htdocs/core/class/html.form.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5869a85f3cf..7388da7596e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2428,7 +2428,7 @@ class Form * @param int $forcecombo Force to use combo box * @return void|string */ - public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 1, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0) + public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 0, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0, $TProducts = []) { // phpcs:enable global $conf, $user, $langs, $db; @@ -2450,8 +2450,9 @@ class Form $sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; $sql.= ' WHERE b.entity IN ('.getEntity('bom').')'; if (!empty($status)) $sql.= ' AND status = '. (int) $status; - if (!empty($type)) $sql.= ' AND status = '. (int) $type; - if (!empty($limit)) $sql.= 'LIMIT '. (int) $limit; + if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type; + if(! empty($TProducts)) $sql .= ' AND fk_product IN ('.implode(',', $TProducts).')'; + if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit; $resql = $db->query($sql); if ($resql) { if ($showempty) { From 06646d45409002f31e8bfda104693d3ebf71812e Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 20 Oct 2022 15:56:32 +0200 Subject: [PATCH 08/25] FIX : php doc --- htdocs/core/class/html.form.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7388da7596e..5dd4db65bab 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2426,6 +2426,7 @@ class Form * @param string $morecss Add more css on select * @param string $nooutput No print, return the output into a string * @param int $forcecombo Force to use combo box + * @param array $TProducts Add filter on a defined product * @return void|string */ public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 0, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0, $TProducts = []) From 02d9c9897a19573cc5043ca16090e9baac3a1509 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 20 Oct 2022 16:27:20 +0200 Subject: [PATCH 09/25] FIX : bug on selected value for select_bom() function --- htdocs/core/class/html.form.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5dd4db65bab..564c917ef1a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2464,8 +2464,9 @@ class Form while ($obj = $db->fetch_object($resql)) { $product = new Product($db); $res = $product->fetch($obj->fk_product); - if ($obj->rowid == $selected) $out .= ''; - $out .= ''; + $out .= ''; } } else { $error++; From 2bf2faef723198b26bf492e2bc3e45048d8824d1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 22 Oct 2022 09:22:12 +0200 Subject: [PATCH 10/25] FIX avoid access forbidden with numeric ref --- htdocs/core/lib/security.lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 1d3f013e9f3..798ba265643 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -289,6 +289,11 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f return 1; } + // To avoid access forbidden with numeric ref + if ($dbt_select != 'rowid' && $dbt_select != 'id') { + $objectid = "'".$objectid."'"; + } + // Features/modules to check $featuresarray = array($features); if (preg_match('/&/', $features)) { From 2fa0e34b097492e2abc3d854f4dc75f95774035b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 22 Oct 2022 15:32:54 +0200 Subject: [PATCH 11/25] Fix api product : rang is now position --- htdocs/product/class/api_products.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 2566ca24919..484a09947a5 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1014,7 +1014,7 @@ class Products extends DolibarrApi throw new RestException(401); } - $sql = "SELECT t.rowid, t.ref, t.ref_ext, t.label, t.rang, t.entity"; + $sql = "SELECT t.rowid, t.ref, t.ref_ext, t.label, t.position, t.entity"; $sql .= " FROM ".$this->db->prefix()."product_attribute as t"; $sql .= ' WHERE t.entity IN ('.getEntity('product').')'; @@ -1051,7 +1051,7 @@ class Products extends DolibarrApi $tmp->ref = $result->ref; $tmp->ref_ext = $result->ref_ext; $tmp->label = $result->label; - $tmp->rang = $result->rang; + $tmp->position = $result->position; $tmp->entity = $result->entity; $return[] = $this->_cleanObjectDatas($tmp); @@ -1088,7 +1088,7 @@ class Products extends DolibarrApi throw new RestException(404, "Product attribute not found"); } - $fields = ["id", "ref", "ref_ext", "label", "rang", "entity"]; + $fields = ["id", "ref", "ref_ext", "label", "position", "entity"]; foreach ($prodattr as $field => $value) { if (!in_array($field, $fields)) { From 6c87982838d8010af3b7368dca24b67d1fe55246 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 22 Oct 2022 19:42:44 +0200 Subject: [PATCH 12/25] Fix newpayment.php with stripeconnect --- htdocs/public/payment/newpayment.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 14d455b5496..c0cfc869e9b 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2390,7 +2390,17 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme // Code for payment with option STRIPE_USE_NEW_CHECKOUT set // Create a Stripe client. + var stripe = Stripe(''); + + var stripe = Stripe('', { stripeAccount: '' }); + // Create an instance of Elements var elements = stripe.elements(); @@ -2433,9 +2443,19 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme } elseif (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { ?> // Code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION set to 1 or 2 - + // Create a Stripe client. + var stripe = Stripe(''); + + var stripe = Stripe('', { stripeAccount: '' }); + Date: Sat, 22 Oct 2022 17:43:17 +0000 Subject: [PATCH 13/25] Fixing style errors. --- htdocs/public/payment/newpayment.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c0cfc869e9b..e9b402b08dd 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2392,13 +2392,13 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme // Create a Stripe client. + ?> var stripe = Stripe(''); - + ?> var stripe = Stripe('', { stripeAccount: '' }); - @@ -2447,13 +2447,13 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme // Create a Stripe client. + ?> var stripe = Stripe(''); - + ?> var stripe = Stripe('', { stripeAccount: '' }); - From 57927cac06cafb27996bd16d481fd752059643d2 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Sun, 23 Oct 2022 03:00:09 +0200 Subject: [PATCH 14/25] Send expensereports-related e-mails from MAIN_MAIL_EMAIL_FROM address --- htdocs/expensereport/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 1da36a72e32..beb9c501b3e 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -414,7 +414,7 @@ if (empty($reshook)) { // FROM $expediteur = new User($db); $expediteur->fetch($object->fk_user_author); - $emailFrom = $expediteur->email; + $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM; if ($emailTo && $emailFrom) { $filename = array(); $filedir = array(); $mimetype = array(); @@ -521,7 +521,7 @@ if (empty($reshook)) { // FROM $expediteur = new User($db); $expediteur->fetch($object->fk_user_author); - $emailFrom = $expediteur->email; + $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM; if ($emailFrom && $emailTo) { $filename = array(); $filedir = array(); $mimetype = array(); @@ -637,7 +637,7 @@ if (empty($reshook)) { // FROM $expediteur = new User($db); $expediteur->fetch($object->fk_user_approve > 0 ? $object->fk_user_approve : $object->fk_user_validator); - $emailFrom = $expediteur->email; + $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM; if ($emailFrom && $emailTo) { $filename = array(); $filedir = array(); $mimetype = array(); @@ -745,7 +745,7 @@ if (empty($reshook)) { // FROM $expediteur = new User($db); $expediteur->fetch($object->fk_user_refuse); - $emailFrom = $expediteur->email; + $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM; if ($emailFrom && $emailTo) { $filename = array(); $filedir = array(); $mimetype = array(); @@ -859,7 +859,7 @@ if (empty($reshook)) { // FROM $expediteur = new User($db); $expediteur->fetch($object->fk_user_cancel); - $emailFrom = $expediteur->email; + $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM; if ($emailFrom && $emailTo) { $filename = array(); $filedir = array(); $mimetype = array(); @@ -1039,7 +1039,7 @@ if (empty($reshook)) { // FROM $expediteur = new User($db); $expediteur->fetch($user->id); - $emailFrom = $expediteur->email; + $emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM; if ($emailFrom && $emailTo) { $filename = array(); $filedir = array(); $mimetype = array(); From 7ff84f4e42bc4bcb86d3ad424a081c6fcd87ed98 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Sun, 23 Oct 2022 03:25:55 +0200 Subject: [PATCH 15/25] Add help picto to remind users to respect SPF/DKIM in FROM e-mails --- htdocs/admin/mailing.php | 3 ++- htdocs/admin/mails.php | 6 ++++-- htdocs/core/lib/admin.lib.php | 7 +++++-- htdocs/langs/en_US/admin.lang | 1 + 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 37735a43ed3..4d12a87f7bd 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -136,7 +136,8 @@ print ''.$langs->trans("Example").''; print "\n"; print ''; -print $langs->trans("MailingEMailFrom").''; +$help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM")); +print $langs->trans("MailingEMailFrom").' '.$help.''; print ''; if (!empty($conf->global->MAILING_EMAIL_FROM) && !isValidEmail($conf->global->MAILING_EMAIL_FROM)) { print ' '.img_warning($langs->trans("BadEMail")); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 67bf775bdd9..5b470eafdc0 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -505,7 +505,8 @@ if ($action == 'edit') { print ''.$langs->trans("OtherOptions").''; // From - print ''.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).''; + $help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM")); + print ''.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.''; print ''; @@ -702,7 +703,8 @@ if ($action == 'edit') { print ''.$langs->trans("OtherOptions").''; // From - print ''.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).''; + $help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM")); + print ''.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.''; print ''.$conf->global->MAIN_MAIL_EMAIL_FROM; if (empty($conf->global->MAIN_MAIL_EMAIL_FROM)) { print img_warning($langs->trans("Mandatory")); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index fdecb7a73fb..a07f16c06cb 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1709,14 +1709,14 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&adminpw=%MAILMAN_ADMINPW%&subscribe_or_invite=0&send_welcome_msg_to_this_batch=0&notification_to_list_owner=0'; print ''; } - if ($const == 'ADHERENT_MAILMAN_UNSUB_URL') { + elseif ($const == 'ADHERENT_MAILMAN_UNSUB_URL') { print '. '.$langs->trans("Example").': '.img_down().'
'; print ''; //print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%'; } - if ($const == 'ADHERENT_MAILMAN_LISTS') { + elseif ($const == 'ADHERENT_MAILMAN_LISTS') { print '. '.$langs->trans("Example").': '.img_down().'
'; print ''; //print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%'; } + elseif ($const == 'ADHERENT_MAIL_FROM') { + print ' '.img_help(1, $langs->trans("EMailHelpMsgSPFDKIM")); + } print "\n"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d0c73a562f5..7dd27ff29ab 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -294,6 +294,7 @@ MAIN_MAIL_SMTP_SERVER=SMTP/SMTPS Host (default value in php.ini: %s) MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=SMTP/SMTPS Port (Not defined into PHP on Unix-like systems) MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=SMTP/SMTPS Host (Not defined into PHP on Unix-like systems) MAIN_MAIL_EMAIL_FROM=Sender email for automatic emails (default value in php.ini: %s) +EMailHelpMsgSPFDKIM=To prevent Dolibarr emails to be classified as spam, make sure that the server is authorized to send e-mails from this address by SPF and DKIM configuration MAIN_MAIL_ERRORS_TO=Email used for error returns emails (fields 'Errors-To' in emails sent) MAIN_MAIL_AUTOCOPY_TO= Copy (Bcc) all sent emails to MAIN_DISABLE_ALL_MAILS=Disable all email sending (for test purposes or demos) From 39934a9a81607dd8d0760cdf40f544167fc41537 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 23 Oct 2022 11:19:23 +0200 Subject: [PATCH 16/25] Fix scrutinizer api_thirdparties.class.php 5 issues --- htdocs/societe/class/api_thirdparties.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 962bbf021b8..b5d9f7bfc48 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1082,7 +1082,7 @@ class Thirdparties extends DolibarrApi $invoice = new Facture($this->db); $result = $invoice->list_replacable_invoices($id); if ($result < 0) { - throw new RestException(405, $this->thirdparty->error); + throw new RestException(405, $invoice->error); } return $result; @@ -1125,7 +1125,7 @@ class Thirdparties extends DolibarrApi $invoice = new Facture($this->db); $result = $invoice->list_qualified_avoir_invoices($id); if ($result < 0) { - throw new RestException(405, $this->thirdparty->error); + throw new RestException(405, $invoice->error); } return $result; @@ -1164,10 +1164,9 @@ class Thirdparties extends DolibarrApi $sql .= " WHERE fk_soc = ".((int) $id); } - $result = $this->db->query($sql); - if ($result->num_rows == 0) { + if ($this->db->num_rows($result) == 0) { throw new RestException(404, 'Account not found'); } @@ -1409,7 +1408,7 @@ class Thirdparties extends DolibarrApi if ($result > 0) { return array("success" => $result); } else { - throw new RestException(500, 'Error generating the document '.$this->error); + throw new RestException(500, 'Error generating the document '.$this->company->error); } } From 7e1a37c1387107ef2958d24e57bf78cb4bef37ea Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 23 Oct 2022 11:35:58 +0200 Subject: [PATCH 17/25] Fix : remove duplicate code and fix #22176 --- htdocs/core/modules/modProduct.class.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index b18d10a29b1..dc0cff86353 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -650,16 +650,7 @@ class modProduct extends DolibarrModules } // End add extra fields $this->import_fieldshidden_array[$r] = array('extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'product'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) - $this->import_regex_array[$r] = array( - 'p.ref'=>'[^ ]', - 'p.price_base_type' => 'HT|TTC', - 'p.tosell'=>'^[0|1]$', - 'p.tobuy'=>'^[0|1]$', - 'p.fk_product_type'=>'^[0|1]$', - 'p.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', - 'p.recuperableonly' => '^[0|1]$', - 'p.finished' => '^[0|1]$' - ); + // field order as per structure of table llx_product $import_sample = array( 'p.ref' => "ref:PREF123456", From 7bf0287c65862c7ed8ee29de67d1374ccfc4abf1 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 23 Oct 2022 11:46:15 +0200 Subject: [PATCH 18/25] Fix : remove nonsense code --- htdocs/compta/tva/card.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 3a34d71c11d..3d6f4f4d329 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -74,17 +74,6 @@ $hookmanager->initHooks(array('taxvatcard', 'globalcard')); // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); - -// Initialize array of search criterias -$search_all = GETPOST("search_all", 'alpha'); -$search = array(); -foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) { - $search[$key] = GETPOST('search_'.$key, 'alpha'); - } -} - if (empty($action) && empty($id) && empty($ref)) { $action = 'view'; } From 92ad656bf02faa5b9ffb9c5d89598f7f36397998 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 23 Oct 2022 12:06:13 +0200 Subject: [PATCH 19/25] Fix : dict data too long error --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index ab7eaf73653..85455dd4be9 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -842,7 +842,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); } else { - dol_print_error($db); + setEventMessages($db->error(), null, 'errors'); } } } From 83afee60470382c3b82597bb76ed7362f09253b5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 24 Oct 2022 07:47:43 +0200 Subject: [PATCH 20/25] FIX can not set prospect status "Do not contact" --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 624dcda170a..8961d70a4cc 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1479,7 +1479,7 @@ class Societe extends CommonObject $sql .= ",fk_effectif = ".($this->effectif_id > 0 ? ((int) $this->effectif_id) : "null"); if (isset($this->stcomm_id)) { - $sql .= ",fk_stcomm=".($this->stcomm_id > 0 ? ((int) $this->stcomm_id) : "0"); + $sql .= ",fk_stcomm=".($this->stcomm_id >= -1 ? ((int) $this->stcomm_id) : "0"); } if (isset($this->typent_id)) { $sql .= ",fk_typent = ".($this->typent_id > 0 ? ((int) $this->typent_id) : "0"); From d9f067eabb17ba32f54c2293a65adb59404672da Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 24 Oct 2022 09:46:41 +0200 Subject: [PATCH 21/25] FIX : travis & stickler feedbacks --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 564c917ef1a..5efbdeae8e1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2452,7 +2452,7 @@ class Form $sql.= ' WHERE b.entity IN ('.getEntity('bom').')'; if (!empty($status)) $sql.= ' AND status = '. (int) $status; if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type; - if(! empty($TProducts)) $sql .= ' AND fk_product IN ('.implode(',', $TProducts).')'; + if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit; $resql = $db->query($sql); if ($resql) { From baccf336f20bea38699db1a803d1a7116e823c55 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 24 Oct 2022 16:41:31 +0200 Subject: [PATCH 22/25] FIX remove > 0 and -1 --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8961d70a4cc..83de127f254 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1479,7 +1479,7 @@ class Societe extends CommonObject $sql .= ",fk_effectif = ".($this->effectif_id > 0 ? ((int) $this->effectif_id) : "null"); if (isset($this->stcomm_id)) { - $sql .= ",fk_stcomm=".($this->stcomm_id >= -1 ? ((int) $this->stcomm_id) : "0"); + $sql .= ",fk_stcomm=".(($this->stcomm_id > 0 || $this->stcomm_id = -1) ? ((int) $this->stcomm_id) : "0"); } if (isset($this->typent_id)) { $sql .= ",fk_typent = ".($this->typent_id > 0 ? ((int) $this->typent_id) : "0"); From e9b80fa65605931717219824f977873b992b4ea8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Oct 2022 19:40:51 +0200 Subject: [PATCH 23/25] Fix phpcs --- htdocs/core/lib/admin.lib.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index a07f16c06cb..03bb5d6ba69 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1708,15 +1708,13 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Valu print ''; - } - elseif ($const == 'ADHERENT_MAILMAN_UNSUB_URL') { + } elseif ($const == 'ADHERENT_MAILMAN_UNSUB_URL') { print '. '.$langs->trans("Example").': '.img_down().'
'; print ''; //print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%'; - } - elseif ($const == 'ADHERENT_MAILMAN_LISTS') { + } elseif ($const == 'ADHERENT_MAILMAN_LISTS') { print '. '.$langs->trans("Example").': '.img_down().'
'; print ''; //print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%'; - } - elseif ($const == 'ADHERENT_MAIL_FROM') { + } elseif ($const == 'ADHERENT_MAIL_FROM') { print ' '.img_help(1, $langs->trans("EMailHelpMsgSPFDKIM")); } From 791927723aaa2aaccb4d49f6dae5b606092ca9b6 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 26 Oct 2022 11:38:07 +0200 Subject: [PATCH 24/25] Fix #22671 : fix permissions notes.tpl.php --- htdocs/core/tpl/notes.tpl.php | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index e0f0c5d9142..0430ec16e0e 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -29,6 +29,9 @@ $module = $object->element; $note_public = 'note_public'; $note_private = 'note_private'; +if ($module == "product") { + $module = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); +} $colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : '')); // Set $permission from the $permissionnote var defined on calling page $permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : (isset($user->rights->$module->create) ? $user->rights->$module->create : (isset($user->rights->$module->creer) ? $user->rights->$module->creer : 0)))); @@ -60,37 +63,39 @@ if (!empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES)) { // Special cases if ($module == 'propal') { - $permission = $user->rights->propale->creer; + $permission = $user->hasRight("propale", "creer"); } elseif ($module == 'supplier_proposal') { - $permission = $user->rights->supplier_proposal->creer; + $permission = $user->hasRight("supplier_proposal", "creer"); } elseif ($module == 'fichinter') { - $permission = $user->rights->ficheinter->creer; + $permission = $user->hasRight("ficheinter", "creer"); } elseif ($module == 'project') { - $permission = $user->rights->projet->creer; + $permission = $user->hasRight("projet", "creer"); } elseif ($module == 'project_task') { - $permission = $user->rights->projet->creer; + $permission = $user->hasRight("projet", "creer"); } elseif ($module == 'invoice_supplier') { if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) { - $permission = $user->rights->fournisseur->facture->creer; + $permission = $user->hasRight("fournisseur", "facture", "creer"); } else { - $permission = $user->rights->supplier_invoice->creer; + $permission = $user->hasRight("supplier_invoice", "creer"); } } elseif ($module == 'order_supplier') { if (empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) { - $permission = $user->rights->fournisseur->commande->creer; + $permission = $user->hasRight("fournisseur", "commande", "creer"); } else { - $permission = $user->rights->supplier_order->creer; + $permission = $user->hasRight("supplier_order", "creer"); } } elseif ($module == 'societe') { - $permission = $user->rights->societe->creer; + $permission = $user->hasRight("societe", "creer"); } elseif ($module == 'contact') { - $permission = $user->rights->societe->creer; + $permission = $user->hasRight("societe", "creer"); } elseif ($module == 'shipping') { - $permission = $user->rights->expedition->creer; + $permission = $user->hasRight("expedition", "creer"); } elseif ($module == 'product') { - $permission = $user->rights->produit->creer; + $permission = $user->hasRight("produit", "creer"); +} elseif ($module == 'service') { + $permission = $user->hasRight("service", "creer"); } elseif ($module == 'ecmfiles') { - $permission = $user->rights->ecm->setup; + $permission = $user->hasRight("ecm", "setup"); } //else dol_print_error('','Bad value '.$module.' for param module'); From 2281b187b7a1ed714aa62f2c078457cefda2f739 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 26 Oct 2022 12:15:30 +0200 Subject: [PATCH 25/25] FIX just add integer --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 83de127f254..7a8e1004468 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1479,7 +1479,7 @@ class Societe extends CommonObject $sql .= ",fk_effectif = ".($this->effectif_id > 0 ? ((int) $this->effectif_id) : "null"); if (isset($this->stcomm_id)) { - $sql .= ",fk_stcomm=".(($this->stcomm_id > 0 || $this->stcomm_id = -1) ? ((int) $this->stcomm_id) : "0"); + $sql .= ",fk_stcomm=".(int) $this->stcomm_id; } if (isset($this->typent_id)) { $sql .= ",fk_typent = ".($this->typent_id > 0 ? ((int) $this->typent_id) : "0");