From c5c0628ee86e12f8a7371c33720bf2c698c8c7a2 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 11 Oct 2022 10:05:56 +0200 Subject: [PATCH 01/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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/46] 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"); From 36a9ac414d1fe9c71b2f5f6abbdd946370aa6046 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 00:38:32 +0200 Subject: [PATCH 26/46] FIX The break of option in setup page was not working correctly --- htdocs/admin/workflow.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 10f32eed97d..d18cf067a23 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -79,7 +79,7 @@ $workflowcodes = array( 'picto'=>'ticket' ), - 'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''), + 'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>'', 'enabled'=>((isModEnabled("propal") && isModEnabled('commande')) || (isModEnabled('commande') && isModEnabled('facture')) || (isModEnabled('ticket') && isModEnabled('ficheinter')))), // Automatic classification of proposal 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array( @@ -118,8 +118,6 @@ $workflowcodes = array( 'warning'=>'' ), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card. - 'separator2'=>array('family'=>'separator', 'position'=>50), - // Automatic classification supplier proposal 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array( 'family'=>'classify_supplier_proposal', @@ -170,17 +168,19 @@ $workflowcodes = array( 'picto' => 'shipment' ), + 'separator2'=>array('family'=>'separator', 'position'=>400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))), + // Automatic link ticket -> contract 'WORKFLOW_TICKET_LINK_CONTRACT' => array( 'family' => 'link_ticket', - 'position' => 75, - 'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled), + 'position' => 500, + 'enabled' => (isModEnabled('ticket') && isModEnabled('contract')), 'picto' => 'ticket' ), 'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array( 'family' => 'link_ticket', - 'position' => 76, - 'enabled' => isModEnabled('ticket') && !empty($conf->contract->enabled), + 'position' => 501, + 'enabled' => (isModEnabled('ticket') && isModEnabled('contract')), 'picto' => 'ticket' ), ); From c7e4ca2437329fb226da9991b296e54c5216bb21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 00:40:41 +0200 Subject: [PATCH 27/46] Right alignement of button --- htdocs/admin/workflow.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index d18cf067a23..2e3473d4a99 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -235,6 +235,7 @@ foreach ($workflowcodes as $key => $params) { continue; } + $reg = array(); if ($oldfamily != $params['family']) { if ($params['family'] == 'create') { $header = $langs->trans("AutomaticCreation"); @@ -269,7 +270,7 @@ foreach ($workflowcodes as $key => $params) { print ''; print ''.$header.''; - print ''.$langs->trans("Status").''; + print ''.$langs->trans("Status").''; print ''; $oldfamily = $params['family']; @@ -286,7 +287,7 @@ foreach ($workflowcodes as $key => $params) { print ''; - print ''; + print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff($key); From fde8d2865fe96fe29374a8fba4bb74bb36736521 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 02:06:02 +0200 Subject: [PATCH 28/46] Add a line into log --- htdocs/public/payment/newpayment.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 0941446b4fc..1c74e3836be 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -342,9 +342,9 @@ $creditor = $mysoc->name; $paramcreditor = 'ONLINE_PAYMENT_CREDITOR'; $paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix; if (!empty($conf->global->$paramcreditorlong)) { - $creditor = $conf->global->$paramcreditorlong; + $creditor = $conf->global->$paramcreditorlong; // use label long of the seller to show } elseif (!empty($conf->global->$paramcreditor)) { - $creditor = $conf->global->$paramcreditor; + $creditor = $conf->global->$paramcreditor; // use label short of the seller to show } $mesg = ''; @@ -356,6 +356,8 @@ $mesg = ''; // Action dopayment is called after clicking/choosing the payment mode if ($action == 'dopayment') { + dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_stripe'); + if ($paymentmethod == 'paypal') { $PAYPAL_API_PRICE = price2num(GETPOST("newamount", 'alpha'), 'MT'); $PAYPAL_PAYMENT_TYPE = 'Sale'; From 4b7655b784c155ead43b0a754eb0175156ccd929 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 02:21:04 +0200 Subject: [PATCH 29/46] Fix log --- htdocs/public/payment/newpayment.php | 64 ++++++++++++++-------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 1c74e3836be..0a70c6c5204 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -356,7 +356,7 @@ $mesg = ''; // Action dopayment is called after clicking/choosing the payment mode if ($action == 'dopayment') { - dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_stripe'); + dol_syslog("--- newpayment.php Execute action = ".$action." paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment'); if ($paymentmethod == 'paypal') { $PAYPAL_API_PRICE = price2num(GETPOST("newamount", 'alpha'), 'MT'); @@ -493,9 +493,9 @@ if ($action == 'charge' && isModEnabled('stripe')) { $amountstripe = $amountstripe * 100; } - dol_syslog("--- newpayment.php Execute action = ".$action." STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION'), LOG_DEBUG, 0, '_stripe'); - dol_syslog("GET=".var_export($_GET, true), LOG_DEBUG, 0, '_stripe'); - dol_syslog("POST=".var_export($_POST, true), LOG_DEBUG, 0, '_stripe'); + dol_syslog("--- newpayment.php Execute action = ".$action." STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION'), LOG_DEBUG, 0, '_payment'); + dol_syslog("GET=".var_export($_GET, true), LOG_DEBUG, 0, '_payment'); + dol_syslog("POST=".var_export($_POST, true), LOG_DEBUG, 0, '_payment'); $stripeToken = GETPOST("stripeToken", 'alpha'); $email = GETPOST("email", 'alpha'); @@ -505,10 +505,10 @@ if ($action == 'charge' && isModEnabled('stripe')) { $vatnumber = GETPOST('vatnumber', 'alpha'); $savesource = GETPOSTISSET('savesource') ? GETPOST('savesource', 'int') : 1; - dol_syslog("POST stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); - dol_syslog("POST email = ".$email, LOG_DEBUG, 0, '_stripe'); - dol_syslog("POST thirdparty_id = ".$thirdparty_id, LOG_DEBUG, 0, '_stripe'); - dol_syslog("POST vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_stripe'); + dol_syslog("POST stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_payment'); + dol_syslog("POST email = ".$email, LOG_DEBUG, 0, '_payment'); + dol_syslog("POST thirdparty_id = ".$thirdparty_id, LOG_DEBUG, 0, '_payment'); + dol_syslog("POST vatnumber = ".$vatnumber, LOG_DEBUG, 0, '_payment'); $error = 0; $errormessage = ''; @@ -529,7 +529,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { } if ($thirdparty_id > 0) { - dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_stripe'); + dol_syslog("Search existing Stripe customer profile for thirdparty_id=".$thirdparty_id, LOG_DEBUG, 0, '_payment'); $service = 'StripeTest'; $servicestatus = 0; @@ -548,7 +548,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); if (empty($customer)) { $error++; - dol_syslog('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, LOG_ERR, 0, '_stripe'); + dol_syslog('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, LOG_ERR, 0, '_payment'); setEventMessages('Failed to get/create stripe customer for thirdparty id = '.$thirdparty_id.' and servicestatus = '.$servicestatus.': '.$stripe->error, null, 'errors'); $action = ''; } @@ -563,7 +563,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { if (empty($card)) { $error++; - dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe'); + dol_syslog('Failed to create card record', LOG_WARNING, 0, '_payment'); setEventMessages('Failed to create card record', null, 'errors'); $action = ''; } else { @@ -577,7 +577,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { $metadata["dol_type"] = $dol_type; } - dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe'); + dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_payment'); $charge = \Stripe\Charge::create(array( 'amount' => price2num($amountstripe, 'MU'), 'currency' => $currency, @@ -591,7 +591,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) { $error++; - dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); + dol_syslog('Failed to charge card', LOG_WARNING, 0, '_payment'); setEventMessages('Failed to charge card', null, 'errors'); $action = ''; } @@ -609,7 +609,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { if (empty($vatcleaned)) $taxinfo=null; */ - dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_stripe'); + dol_syslog("Create anonymous customer card profile", LOG_DEBUG, 0, '_payment'); $customer = \Stripe\Customer::create(array( 'email' => $email, @@ -646,7 +646,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { // The customer was just created with a source, so we can make a charge // with no card defined, the source just used for customer creation will be used. - dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe'); + dol_syslog("Create charge", LOG_DEBUG, 0, '_payment'); $charge = \Stripe\Charge::create(array( 'customer' => $customer->id, 'amount' => price2num($amountstripe, 'MU'), @@ -659,7 +659,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) if (empty($charge)) { $error++; - dol_syslog('Failed to charge card', LOG_WARNING, 0, '_stripe'); + dol_syslog('Failed to charge card', LOG_WARNING, 0, '_payment'); setEventMessages('Failed to charge card', null, 'errors'); $action = ''; } @@ -678,21 +678,21 @@ if ($action == 'charge' && isModEnabled('stripe')) { $error++; $errormessage = "ErrorCard ".$e->getMessage()." err=".var_export($err, true); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\RateLimit $e) { // Too many requests made to the API too quickly $error++; $errormessage = "ErrorRateLimit ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\InvalidRequest $e) { // Invalid parameters were supplied to Stripe's API $error++; $errormessage = "ErrorInvalidRequest ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\Authentication $e) { @@ -700,14 +700,14 @@ if ($action == 'charge' && isModEnabled('stripe')) { // (maybe you changed API keys recently) $error++; $errormessage = "ErrorAuthentication ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\ApiConnection $e) { // Network communication with Stripe failed $error++; $errormessage = "ErrorApiConnection ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (\Stripe\Error\Base $e) { @@ -715,14 +715,14 @@ if ($action == 'charge' && isModEnabled('stripe')) { // yourself an email $error++; $errormessage = "ErrorBase ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } catch (Exception $e) { // Something else happened, completely unrelated to Stripe $error++; $errormessage = "ErrorException ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } @@ -757,7 +757,7 @@ if ($action == 'charge' && isModEnabled('stripe')) { } catch (Exception $e) { $error++; $errormessage = "CantRetrievePaymentIntent ".$e->getMessage(); - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($e->getMessage(), null, 'errors'); $action = ''; } @@ -765,13 +765,13 @@ if ($action == 'charge' && isModEnabled('stripe')) { if ($paymentintent->status != 'succeeded') { $error++; $errormessage = "StatusOfRetrievedIntent is not succeeded: ".$paymentintent->status; - dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); + dol_syslog($errormessage, LOG_WARNING, 0, '_payment'); setEventMessages($paymentintent->status, null, 'errors'); $action = ''; } else { // TODO We can also record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method // Note that with other old Stripe architecture (using Charge API), the payment mode was not recorded, so it is not mandatory to do it here. - //dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_stripe'); + //dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_payment'); // Get here amount and currency used for payment and force value into $amount and $currency so the real amount is saved into session instead // of the amount and currency retreived from the POST. @@ -801,11 +801,11 @@ if ($action == 'charge' && isModEnabled('stripe')) { $_SESSION['TRANSACTIONID'] = (is_object($charge) ? $charge->id : (is_object($paymentintent) ? $paymentintent->id : '')); $_SESSION['errormessage'] = $errormessage; - dol_syslog("Action charge stripe STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')." ip=".$remoteip, LOG_DEBUG, 0, '_stripe'); - dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_stripe'); - dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_stripe'); - dol_syslog("error=".$error." errormessage=".$errormessage, LOG_DEBUG, 0, '_stripe'); - dol_syslog("Now call the redirect to paymentok or paymentko, URL = ".($error ? $urlko : $urlok), LOG_DEBUG, 0, '_stripe'); + dol_syslog("Action charge stripe STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')." ip=".$remoteip, LOG_DEBUG, 0, '_payment'); + dol_syslog("onlinetoken=".$_SESSION["onlinetoken"]." FinalPaymentAmt=".$_SESSION["FinalPaymentAmt"]." currencyCodeType=".$_SESSION["currencyCodeType"]." payerID=".$_SESSION['payerID']." TRANSACTIONID=".$_SESSION['TRANSACTIONID'], LOG_DEBUG, 0, '_payment'); + dol_syslog("FULLTAG=".$FULLTAG, LOG_DEBUG, 0, '_payment'); + dol_syslog("error=".$error." errormessage=".$errormessage, LOG_DEBUG, 0, '_payment'); + dol_syslog("Now call the redirect to paymentok or paymentko, URL = ".($error ? $urlko : $urlok), LOG_DEBUG, 0, '_payment'); if ($error) { header("Location: ".$urlko); @@ -834,6 +834,8 @@ $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); +dol_syslog("newpayment.php show page paymentmethod=".$paymentmethod.' amount='.$amount.' newamount='.GETPOST("newamount", 'alpha'), LOG_DEBUG, 0, '_payment'); + // Check link validity if ($source && in_array($ref, array('member_ref', 'contractline_ref', 'invoice_ref', 'order_ref', 'donation_ref', ''))) { $langs->load("errors"); From fb9ec11ffb3e1fbafd4364cdd2f17af42ea57382 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 02:37:08 +0200 Subject: [PATCH 30/46] Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead. --- ChangeLog | 1 + htdocs/admin/workflow.php | 16 ++++++++-------- htdocs/expedition/class/expedition.class.php | 15 --------------- htdocs/reception/class/reception.class.php | 15 --------------- 4 files changed, 9 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2376592a12f..9432bdea4d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,7 @@ Following changes may create regressions for some external modules, but were nec * Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead. * All functions fetch_all() are deprecated for naming consitency, use fetchAll() instead * Code standardization: $user->rights->propale is now $user->rights->propal everywhere. +* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead. ***** ChangeLog for 16.0.1 compared to 16.0.0 ***** diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 2e3473d4a99..675815f1dbb 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -152,14 +152,6 @@ $workflowcodes = array( 'warning'=>'' ), - // Automatic classification reception - 'WORKFLOW_BILL_ON_RECEPTION'=>array( - 'family'=>'classify_reception', - 'position'=>80, - 'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), - 'picto'=>'reception' - ), - // Automatic classification shipping 'WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE' => array( 'family' => 'classify_shipping', @@ -168,6 +160,14 @@ $workflowcodes = array( 'picto' => 'shipment' ), + // Automatic classification reception + 'WORKFLOW_BILL_ON_RECEPTION'=>array( + 'family'=>'classify_reception', + 'position'=>95, + 'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), + 'picto'=>'reception' + ), + 'separator2'=>array('family'=>'separator', 'position'=>400, 'enabled' => (isModEnabled('ticket') && isModEnabled('contract'))), // Automatic link ticket -> contract diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 82ba1d36040..d3981dcf264 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2243,21 +2243,6 @@ class Expedition extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on) - * - * @deprecated - * @see setBilled() - * @return int <0 if ko, >0 if ok - */ - public function set_billed() - { - // phpcs:enable - dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE); - return $this->setBilled(); - } - /** * Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on) * diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 47b4bcdeb0d..912f2cae93f 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1641,21 +1641,6 @@ class Reception extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on) - * - * @deprecated - * @see setBilled() - * @return int <0 if ko, >0 if ok - */ - public function set_billed() - { - // phpcs:enable - dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE); - return $this->setBilled(); - } - /** * Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on) * From 035c08536c9cdbca5af4055728081a2aadd6f317 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Oct 2022 03:32:03 +0200 Subject: [PATCH 31/46] Standardization of the name of some constant (customer match supplier) --- htdocs/admin/workflow.php | 2 +- htdocs/core/modules/modWorkflow.class.php | 1 - ...e_20_modWorkflow_WorkflowManager.class.php | 25 +++++++++++++------ htdocs/langs/en_US/workflow.lang | 4 +-- htdocs/reception/class/reception.class.php | 2 +- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 675815f1dbb..cf55c7b9127 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -161,7 +161,7 @@ $workflowcodes = array( ), // Automatic classification reception - 'WORKFLOW_BILL_ON_RECEPTION'=>array( + 'WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE'=>array( 'family'=>'classify_reception', 'position'=>95, 'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), diff --git a/htdocs/core/modules/modWorkflow.class.php b/htdocs/core/modules/modWorkflow.class.php index cc7e478e379..58da4876d32 100644 --- a/htdocs/core/modules/modWorkflow.class.php +++ b/htdocs/core/modules/modWorkflow.class.php @@ -93,7 +93,6 @@ class modWorkflow extends DolibarrModules 6=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0), 7=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0), 8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0), - 9=>array('WORKFLOW_BILL_ON_RECEPTION', 'chaine', '1', 'WORKFLOW_BILL_ON_RECEPTION', 0, 'current', 0), 10=>array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0), 11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0), 11=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '1', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 119a0122cb6..abaadfc85a8 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -181,14 +181,23 @@ class InterfaceWorkflowManager extends DolibarrTriggers } if (isModEnabled("expedition") && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE)) { - /** @var Facture $object */ $object->fetchObjectLinked('', 'shipping', $object->id, $object->element); - if (!empty($object->linkedObjects)) { - /** @var Expedition $shipment */ - $shipment = array_shift($object->linkedObjects['shipping']); - - $ret = $shipment->setClosed(); + $totalonlinkedelements = 0; + foreach ($object->linkedObjects['shipping'] as $element) { + if ($element->statut == Expedition::STATUS_VALIDATED) { + $totalonlinkedelements += $element->total_ht; + } + } + dol_syslog("Amount of linked shipment = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); + if ($totalonlinkedelements == $object->total_ht) { + foreach ($object->linkedObjects['shipping'] as $element) { + $ret = $element->setClosed(); + if ($ret < 0) { + return $ret; + } + } + } } } @@ -244,8 +253,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } - // Then set reception to "Billed" if WORKFLOW_BILL_ON_RECEPTION is set - if (isModEnabled("reception") && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) { + // Then set reception to "Billed" if WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE is set + if (isModEnabled("reception") && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE)) { $object->fetchObjectLinked('', 'reception', $object->id, $object->element); if (!empty($object->linkedObjects)) { $totalonlinkedelements = 0; diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index 803a31c9646..a2b6b4c1f95 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -22,7 +22,7 @@ descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=Classify linked sourc descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION=Classify linked source purchase order as received when a reception is validated (and if the quantity received by all receptions is the same as in the purchase order to update) descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED=Classify linked source purchase order as received when a reception is closed (and if the quantity received by all rceptions is the same as in the purchase order to update) # Autoclassify purchase invoice -descWORKFLOW_BILL_ON_RECEPTION=Classify receptions to "billed" when a linked supplier order is validated +descWORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE=Classify receptions to "billed" when a linked purchase invoice is validated (and if the amount of the invoice is the same as the total amount of the linked receptions) # Automatically link ticket to contract descWORKFLOW_TICKET_LINK_CONTRACT=When creating a ticket, link available contracts of matching thirdparty descWORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS=When linking contracts, search among those of parents companies @@ -31,6 +31,6 @@ descWORKFLOW_TICKET_CLOSE_INTERVENTION=Close all interventions linked to the tic AutomaticCreation=Automatic creation AutomaticClassification=Automatic classification # Autoclassify shipment -descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=Classify linked source shipment as closed when customer invoice is validated +descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=Classify linked source shipment as closed when customer invoice is validated (and if the amount of the invoice is the same as the total amount of the linked shipments) AutomaticClosing=Automatic closing AutomaticLinking=Automatic linking diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 912f2cae93f..1abfb49fb4c 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1642,7 +1642,7 @@ class Reception extends CommonObject } /** - * Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on) + * Classify the reception as invoiced (used when WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE is on) * * @return int <0 if ko, >0 if ok */ From 9792d4e0aa4a369a539794a589362929ecbb0fb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 01:40:32 +0200 Subject: [PATCH 32/46] Fix missing picto in combo list --- htdocs/expedition/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index e697c0be6c3..81e0adb15aa 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -526,7 +526,7 @@ $param .= $hookmanager->resPrint; $arrayofmassactions = array( 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - 'classifyclose'=>$langs->trans("Close"), + 'classifyclose' => img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("Close"), 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if (in_array($massaction, array('presend'))) { From a0203af926ec8dd6f5b83d39e096780ca819fecd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 02:49:57 +0200 Subject: [PATCH 33/46] Code comment --- htdocs/core/modules/syslog/mod_syslog_file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index e99e16ef649..04d1de3fbbd 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -116,7 +116,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) { // file depend on session key name (Note that session name is same for all users and is not a per user value) $suffixinfilename .= '_'.session_name(); } - if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on session value sor per user + if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on session name + ip so nearly per user $suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"]; } } From b268f630a12d64b9989a882d3034e739cebcc8d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 02:53:41 +0200 Subject: [PATCH 34/46] NEW conf->global->SYSLOG_FILE_ONEPERSESSION accept a string --- htdocs/core/modules/syslog/mod_syslog_file.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 04d1de3fbbd..265741f35c6 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -113,11 +113,15 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface } if (!empty($conf->global->SYSLOG_FILE_ONEPERSESSION)) { - if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) { // file depend on session key name (Note that session name is same for all users and is not a per user value) - $suffixinfilename .= '_'.session_name(); - } - if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on session name + ip so nearly per user - $suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"]; + if (is_numeric($conf->global->SYSLOG_FILE_ONEPERSESSION)) { + if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) { // file depend on instance session key name (Note that session name is same for the instance so for all users and is not a per user value) + $suffixinfilename .= '_'.session_name(); + } + if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) { // file depend on instance session key name + ip so nearly per user + $suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"]; + } + } else { + $suffixinfilename .= '_'.$conf->global->SYSLOG_FILE_ONEPERSESSION; } } From f682edb4f2e6225d9dc566e9761be08139d85c34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 03:37:01 +0200 Subject: [PATCH 35/46] Missing some info in log file --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index ed2bcef8034..8327addc260 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -212,7 +212,7 @@ class CMailFile // On defini alternative_boundary $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) - dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext upload_dir_tmp=$upload_dir_tmp", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); if (empty($subject)) { From d1cd43c9d8564e059d72b3f4483509cb0ddc2e4c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 04:02:42 +0200 Subject: [PATCH 36/46] Fix same file content = same hash --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 8327addc260..49269b47f2c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1783,7 +1783,7 @@ class CMailFile foreach ($matches[1] as $key => $ext) { // We save the image to send in disk $filecontent = $matches[2][$key]; - $cid = dol_hash(uniqid(time()), 3); + $cid = dol_hash($this->html, 'md5'); $destfiletmp = $images_dir.'/'.$cid.'.'.$ext; $fhandle = @fopen($destfiletmp, 'w'); From c9f43dc7a6232ab25327ac92c2f28dc366a4320b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 04:20:54 +0200 Subject: [PATCH 37/46] Fix error too large regex in memory --- htdocs/core/class/CMailFile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 49269b47f2c..e21a288e53e 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1761,7 +1761,7 @@ class CMailFile /* global $dolibarr_main_data_root; $outputfile = $dolibarr_main_data_root."/dolibarr_mail.log"; - $fp = fopen($outputfile, "w"); + $fp = fopen($outputfile, "w+"); fwrite($fp, $this->html); fclose($fp); */ @@ -1808,7 +1808,7 @@ class CMailFile // type $this->html_images[$i]["type"] = 'cidfromdata'; - $this->html = preg_replace('/src="data:image\/'.$ext.';base64,'.preg_quote($filecontent, '/').'"/', 'src="cid:'.$this->html_images[$i]["cid"].'"', $this->html); + $this->html = str_replace('src="data:image/'.$ext.';base64,'.$filecontent.'"', 'src="cid:'.$this->html_images[$i]["cid"].'"', $this->html); } $i++; } From 7c1a7a03af9c61faaace857be729813f7e9cc82d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 12:18:21 +0200 Subject: [PATCH 38/46] FIX Regression page nb was broken on bottom of PDF --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3899af425bc..f71a6ed6d3c 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1282,8 +1282,8 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // Show page nb only on iso languages (so default Helvetica font) if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { $pdf->SetXY($dims['wk'] - $dims['rm'] - 18, -$posy); - //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; - $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); + //$pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); + $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); } // Show Draft Watermark From 6645693b450b296e07a9499f28c96bc20c5549db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 12:34:49 +0200 Subject: [PATCH 39/46] Remove useless html colspan --- htdocs/admin/system/dolibarr.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 7fa1ef252cb..144580b83af 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -149,25 +149,26 @@ print '
'; // Session print '
'; print ''; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''; +print '\n"; -print ''."\n"; -print ''."\n"; +print ''."\n"; -print ''."\n"; -print ''."\n"; print ''."\n"; -print ''; + print '   '.$langs->trans("By").' '.$muser->getNomUrl(-1).''; print ''; diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 0e59adfc166..de9eb46631c 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -106,7 +106,7 @@ if ($id > 0 || $ref) { print ''; + print '   '.$langs->trans("By").' '.$muser->getNomUrl(-1).''; print ''; diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 8d88d761956..3b15676792e 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -100,7 +100,7 @@ if ($id > 0 || $ref) { print ''; + print '   '.$langs->trans("By").' '.$muser->getNomUrl(-1).''; print ''; @@ -135,7 +135,7 @@ if ($id > 0 || $ref) { print ''; print ''; - print ''; } - // End date + // Date validation if (!empty($arrayfields['cp.date_valid']['checked'])) { print ''; } + // Date appoval + if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook @@ -705,6 +713,9 @@ if ($resql) { if (!empty($arrayfields['cp.date_valid']['checked'])) { print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); } + if (!empty($arrayfields['cp.date_approval']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center '); + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -839,18 +850,20 @@ if ($resql) { $totalarray['nbfield']++; } } + // Date validation if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval - print ''; if (!$i) $totalarray['nbfield']++; } - /*if (!empty($arrayfields['cp.date_approve']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - }*/ + // Date approval + if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; From 40d18331542e8bfab73006cf5ae3ef6be49cc90e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Oct 2022 12:19:41 +0200 Subject: [PATCH 45/46] Prepare support of --force option on crons --- scripts/cron/cron_run_jobs.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index ee866203665..1d95a745e1c 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -164,6 +164,10 @@ $user->getrights(); if (isset($argv[3]) && $argv[3]) { $id = $argv[3]; } +$forcequalified = 0; +if (isset($argv[4]) && $argv[4] == '--force') { + $forcequalified = 1; +} // create a jobs object $object = new Cronjob($db); @@ -313,7 +317,7 @@ exit(0); */ function usage($path, $script_file) { - print "Usage: ".$script_file." securitykey userlogin|'firstadmin' [cronjobid]\n"; + print "Usage: ".$script_file." securitykey userlogin|'firstadmin' [cronjobid] [--force]\n"; print "The script return 0 when everything worked successfully.\n"; print "\n"; print "On Linux system, you can have cron jobs ran automatically by adding an entry into cron.\n"; From 41175b73ee05c9c49b27132b02dafa866d483382 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Oct 2022 12:57:14 +0200 Subject: [PATCH 46/46] NEW add option --force on CLI cron_run_jobs.php This allow to execute cron even if date is not yeat reached --- scripts/cron/cron_run_jobs.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 1d95a745e1c..630ae8c9948 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -92,7 +92,7 @@ $hookmanager->initHooks(array('cli')); $now = dol_now(); @set_time_limit(0); -print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=".$userlogin." ***** ".dol_print_date($now, 'dayhourrfc')." *****\n"; +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." - userlogin=".$userlogin." - ".dol_print_date($now, 'dayhourrfc')." *****\n"; // Check module cron is activated if (empty($conf->cron->enabled)) { @@ -250,7 +250,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) { } //If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database - if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) { + if ($forcequalified || (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now))) { echo " - qualified"; dol_syslog("cron_run_jobs.php line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc')); @@ -325,4 +325,6 @@ function usage($path, $script_file) print "30 3 * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n"; print "For example, to run pending tasks every 5mn, you can add this line:\n"; print "*/5 * * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n"; + print "\n"; + print "The option --force allow to bypass the check on date of execution so job will be executed even if date is not yet reached.\n"; }
'.$langs->trans("Session").''.$langs->trans("Value").'
'.$langs->trans("SessionSavePath").''.session_save_path().'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'.$langs->trans("CurrentSessionTimeOut").' (session.gc_maxlifetime)'.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds"); -print ''; +print '
'.$langs->trans("Session").''.$langs->trans("Value").'
'.$langs->trans("SessionSavePath").''.session_save_path().'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'.$langs->trans("CurrentSessionTimeOut").' (session.gc_maxlifetime)'; +print ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds"); print ''."\n"; print ''."\n"; print ''."\n"; print $form->textwithpicto('', $langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor"))); print "
'.$langs->trans("CurrentTheme").''.$conf->theme.'
'.$langs->trans("CurrentMenuHandler").''; +print '
'.$langs->trans("CurrentTheme").''.$conf->theme.'
'.$langs->trans("CurrentMenuHandler").''; print $conf->standard_menu; print '
'.$langs->trans("Screen").''; +print '
'.$langs->trans("Screen").''; print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; print '
'.$langs->trans("Session").''; +print '
'.$langs->trans("Session").''; $i = 0; foreach ($_SESSION as $key => $val) { if ($i > 0) { From d8c74eff5ff49cc6698e31c9e27c4aef8740903c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 12:39:37 +0200 Subject: [PATCH 40/46] css --- htdocs/admin/system/dolibarr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 144580b83af..4a55c1a1160 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -168,7 +168,7 @@ print '
'.$langs->trans("Screen").''; print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; print '
'.$langs->trans("Session").''; +print '
'.$langs->trans("Session").''; $i = 0; foreach ($_SESSION as $key => $val) { if ($i > 0) { From 18c9685051f637de78fe6576214ac76769bdbd41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 17:51:25 +0200 Subject: [PATCH 41/46] Rename table to prepare need of direct debit for non invoices --- htdocs/compta/facture/list.php | 2 +- htdocs/compta/facture/prelevement.php | 8 +++--- htdocs/compta/paiement.php | 2 +- htdocs/compta/paymentbybanktransfer/index.php | 2 +- .../class/bonprelevement.class.php | 26 +++++++++---------- .../class/rejetprelevement.class.php | 4 +-- htdocs/compta/prelevement/create.php | 2 +- htdocs/compta/prelevement/demandes.php | 2 +- htdocs/compta/prelevement/factures.php | 2 +- htdocs/compta/prelevement/index.php | 2 +- htdocs/compta/prelevement/line.php | 2 +- htdocs/compta/prelevement/list.php | 2 +- htdocs/core/class/commoninvoice.class.php | 10 +++---- htdocs/core/lib/fourn.lib.php | 2 +- htdocs/core/lib/invoice.lib.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/fourn/facture/paiement.php | 2 +- .../install/mysql/migration/16.0.0-17.0.0.sql | 5 ++++ ...acture.key.sql => llx_prelevement.key.sql} | 4 +-- ...vement_facture.sql => llx_prelevement.sql} | 2 +- ...ey.sql => llx_prelevement_demande.key.sql} | 4 +-- ...emande.sql => llx_prelevement_demande.sql} | 2 +- htdocs/stripe/class/stripe.class.php | 14 +++++----- 23 files changed, 55 insertions(+), 50 deletions(-) rename htdocs/install/mysql/tables/{llx_prelevement_facture.key.sql => llx_prelevement.key.sql} (76%) rename htdocs/install/mysql/tables/{llx_prelevement_facture.sql => llx_prelevement.sql} (96%) rename htdocs/install/mysql/tables/{llx_prelevement_facture_demande.key.sql => llx_prelevement_demande.key.sql} (78%) rename htdocs/install/mysql/tables/{llx_prelevement_facture_demande.sql => llx_prelevement_demande.sql} (97%) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index b5b9687686b..11fdb6ac982 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -493,7 +493,7 @@ if ($action == 'makepayment_confirm' && !empty($user->rights->facture->paiement) $rsql .= " , pfd.date_traite as date_traite"; $rsql .= " , pfd.amount"; $rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login"; - $rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $rsql .= " , ".MAIN_DB_PREFIX."user as u"; $rsql .= " WHERE fk_facture = ".((int) $objecttmp->id); $rsql .= " AND pfd.fk_user_demande = u.rowid"; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index d475e83c55b..9809554c37f 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -311,7 +311,7 @@ if ($object->id > 0) { $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande"; $sql .= " , pfd.date_traite as date_traite"; $sql .= " , pfd.amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; if ($type == 'bank-transfer') { $sql .= " WHERE fk_facture_fourn = ".((int) $object->id); } else { @@ -686,7 +686,7 @@ if ($object->id > 0) { // For which amount ? $sql = "SELECT SUM(pfd.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; if ($type == 'bank-transfer') { $sql .= " WHERE fk_facture_fourn = ".((int) $object->id); } else { @@ -812,7 +812,7 @@ if ($object->id > 0) { $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; $sql .= " pfd.date_traite as date_traite, pfd.amount,"; $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; if ($type == 'bank-transfer') { @@ -889,7 +889,7 @@ if ($object->id > 0) { $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,"; $sql .= " pb.ref,"; $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; if ($type == 'bank-transfer') { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index c51cb19ef1a..f2cd1fe18f9 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -750,7 +750,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $numdirectdebitopen = 0; $totaldirectdebit = 0; $sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE fk_facture = ".((int) $objp->facid); $sql .= " AND pfd.traite = 0"; $sql .= " AND pfd.ext_payment_id IS NULL"; diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 9e79cd98939..ba37fde1ba5 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -109,7 +109,7 @@ $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } -$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; +$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE s.rowid = f.fk_soc"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; $sql .= " AND f.total_ttc > 0"; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 8aaf8010dd2..344229dc0a8 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -151,7 +151,7 @@ class BonPrelevement extends CommonObject if ($result == 0) { if ($line_id > 0) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture ("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement ("; if ($type != 'bank-transfer') { $sql .= "fk_facture"; } else { @@ -577,7 +577,7 @@ class BonPrelevement extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; - $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; + $sql .= " , ".MAIN_DB_PREFIX."prelevement as pf"; $sql .= " WHERE pf.fk_prelevement_lignes = pl.rowid"; $sql .= " AND pl.fk_prelevement_bons = p.rowid"; $sql .= " AND p.rowid = ".((int) $this->id); @@ -635,7 +635,7 @@ class BonPrelevement extends CommonObject } else { $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; } - $sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; @@ -695,7 +695,7 @@ class BonPrelevement extends CommonObject } else { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; } - $sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; @@ -788,7 +788,7 @@ class BonPrelevement extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; } $sql .= ", ".MAIN_DB_PREFIX."societe as s"; - $sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE f.entity IN (".getEntity('invoice').')'; if ($type != 'bank-transfer') { $sql .= " AND f.rowid = pfd.fk_facture"; @@ -1014,7 +1014,7 @@ class BonPrelevement extends CommonObject } // Update invoice requests as done - $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande"; + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande"; $sql .= " SET traite = 1"; $sql .= ", date_traite = '".$this->db->idate($now)."'"; $sql .= ", fk_prelevement_bons = ".((int) $this->id); @@ -1147,7 +1147,7 @@ class BonPrelevement extends CommonObject } if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_facture WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")"; $resql1 = $this->db->query($sql); if (!$resql1) { dol_print_error($this->db); @@ -1171,7 +1171,7 @@ class BonPrelevement extends CommonObject } if (!$error) { - $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id); + $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id); $resql4 = $this->db->query($sql); if (!$resql4) { dol_print_error($this->db); @@ -1425,7 +1425,7 @@ class BonPrelevement extends CommonObject $sql .= " FROM"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."facture as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as pf,"; $sql .= " ".MAIN_DB_PREFIX."societe as soc,"; $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; @@ -1541,7 +1541,7 @@ class BonPrelevement extends CommonObject $sql .= " FROM"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as pf,"; $sql .= " ".MAIN_DB_PREFIX."societe as soc,"; $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; @@ -1634,7 +1634,7 @@ class BonPrelevement extends CommonObject $sql .= " FROM"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."facture as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as pf"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; $sql .= " AND pf.fk_facture = f.rowid"; @@ -1660,7 +1660,7 @@ class BonPrelevement extends CommonObject $sql .= " FROM"; $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; + $sql .= " ".MAIN_DB_PREFIX."prelevement as pf"; $sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id); $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; $sql .= " AND pf.fk_facture_fourn = f.rowid"; @@ -1691,7 +1691,7 @@ class BonPrelevement extends CommonObject fclose($this->file); if (!empty($conf->global->MAIN_UMASK)) { - @chmod($this->file, octdec($conf->global->MAIN_UMASK)); + @chmod($this->filename, octdec($conf->global->MAIN_UMASK)); } return $result; diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index f88ff5201f3..27e27fe60bd 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -221,7 +221,7 @@ class RejetPrelevement $userid = 0; $sql = "SELECT fk_user_demande"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE pfd.fk_prelevement_bons = ".((int) $this->bon_id); $sql .= " AND pfd.fk_facture".($this->type == 'bank-transfer' ? '_fourn' : '').' = '.((int) $fac->id); @@ -289,7 +289,7 @@ class RejetPrelevement //Returns all invoices of a withdrawal $sql = "SELECT f.rowid as facid, pl.amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement as pf"; if ($this->type == 'bank-transfer') { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON (pf.fk_facture_fourn = f.rowid)"; } else { diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 5d6a58b9215..c5b0dda6cf2 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -348,7 +348,7 @@ if ($type == 'bank-transfer') { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; } $sql .= " ".MAIN_DB_PREFIX."societe as s,"; -$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; +$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE s.rowid = f.fk_soc"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 585c601da56..905c8f36415 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -137,7 +137,7 @@ if ($type != 'bank-transfer') { $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; } $sql .= " ".MAIN_DB_PREFIX."societe as s,"; -$sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; +$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd"; if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index d6009631ac2..dcb91710bd6 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -177,7 +177,7 @@ $sql .= " f.rowid as facid, f.ref as ref, f.total_ttc,"; $sql .= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl"; -$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture as pf"; +$sql .= ", ".MAIN_DB_PREFIX."prelevement as pf"; if ($object->type != 'bank-transfer') { $sql .= ", ".MAIN_DB_PREFIX."facture as f"; } else { diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 830bd101d0a..d71314a08e2 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -109,7 +109,7 @@ $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } -$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; +$sql .= " , ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE s.rowid = f.fk_soc"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; $sql .= " AND f.total_ttc > 0"; diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 1fccef050d1..186546b74a9 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -262,7 +262,7 @@ if ($id) { $sql .= " , s.rowid as socid, s.nom as name"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; - $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; + $sql .= " , ".MAIN_DB_PREFIX."prelevement as pf"; if ($type == 'bank-transfer') { $sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f"; } else { diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index b84bc7f3d2d..571c78358e0 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -114,7 +114,7 @@ $sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, $sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; -$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture as pf"; +$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf"; if ($type == 'bank-transfer') { $sql .= " , ".MAIN_DB_PREFIX."facture_fourn as f"; } else { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 2d63347c029..2a185b362be 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -756,7 +756,7 @@ abstract class CommonInvoice extends CommonObject $bac->fetch(0, $this->socid); $sql = "SELECT count(*)"; - $sql .= " FROM ".$this->db->prefix()."prelevement_facture_demande"; + $sql .= " FROM ".$this->db->prefix()."prelevement_demande"; if ($type == 'bank-transfer') { $sql .= " WHERE fk_facture_fourn = ".((int) $this->id); } else { @@ -786,7 +786,7 @@ abstract class CommonInvoice extends CommonObject } if (is_numeric($amount) && $amount != 0) { - $sql = 'INSERT INTO '.$this->db->prefix().'prelevement_facture_demande('; + $sql = 'INSERT INTO '.$this->db->prefix().'prelevement_demande('; if ($type == 'bank-transfer') { $sql .= 'fk_facture_fourn, '; } else { @@ -883,7 +883,7 @@ abstract class CommonInvoice extends CommonObject } $sql = "SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn"; - $sql .= " FROM ".$this->db->prefix()."prelevement_facture_demande"; + $sql .= " FROM ".$this->db->prefix()."prelevement_demande"; $sql .= " WHERE rowid = ".((int) $did); dol_syslog(get_class($this)."::makeStripeSepaRequest 1", LOG_DEBUG); @@ -1572,7 +1572,7 @@ abstract class CommonInvoice extends CommonObject $this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?"; } - $sql = "INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande("; + $sql = "INSERT INTO '.MAIN_DB_PREFIX.'prelevement_demande("; $sql .= "fk_facture, "; $sql .= " amount, date_demande, fk_user_demande, ext_payment_id, ext_payment_site, sourcetype, entity)"; $sql .= " VALUES (".$this->id; @@ -1633,7 +1633,7 @@ abstract class CommonInvoice extends CommonObject public function demande_prelevement_delete($fuser, $did) { // phpcs:enable - $sql = 'DELETE FROM '.$this->db->prefix().'prelevement_facture_demande'; + $sql = 'DELETE FROM '.$this->db->prefix().'prelevement_demande'; $sql .= ' WHERE rowid = '.((int) $did); $sql .= ' AND traite = 0'; if ($this->db->query($sql)) { diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index c65013722d4..8ba05557220 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -58,7 +58,7 @@ function facturefourn_prepare_head($object) if (!empty($conf->paymentbybanktransfer->enabled)) { $nbStandingOrders = 0; $sql = "SELECT COUNT(pfd.rowid) as nb"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE pfd.fk_facture_fourn = ".((int) $object->id); $sql .= " AND pfd.ext_payment_id IS NULL"; $resql = $db->query($sql); diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index bd02d7cca53..0d14b322953 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -59,7 +59,7 @@ function facture_prepare_head($object) if (!empty($conf->prelevement->enabled)) { $nbStandingOrders = 0; $sql = "SELECT COUNT(pfd.rowid) as nb"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE pfd.fk_facture = ".((int) $object->id); $sql .= " AND pfd.ext_payment_id IS NULL"; $resql = $db->query($sql); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 1d7149cdb10..ddc4036e91b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -345,7 +345,7 @@ if (empty($reshook)) { $rsql .= " , pfd.date_traite as date_traite"; $rsql .= " , pfd.amount"; $rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login"; - $rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $rsql .= " , ".MAIN_DB_PREFIX."user as u"; $rsql .= " WHERE fk_facture_fourn = ".((int) $objecttmp->id); $rsql .= " AND pfd.fk_user_demande = u.rowid"; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index b421496153d..bad8d19bd28 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -718,7 +718,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $numdirectdebitopen = 0; $totaldirectdebit = 0; $sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; $sql .= " WHERE fk_facture_fourn = ".((int) $objp->facid); $sql .= " AND pfd.traite = 0"; $sql .= " AND pfd.ext_payment_id IS NULL"; diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 24ac0e37ff5..ce81740b50d 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -361,3 +361,8 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_MODIFY','Template invoices update','Executed when a Template invoices is updated','facturerec',901); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_DELETE','Template invoices deleted','Executed when a Template invoices is deleted','facturerec',902); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BILLREC_AUTOCREATEBILL','Template invoices use to create invoices with auto batch','Executed when a Template invoices is use to create invoice with auto batch','facturerec',903); + + +ALTER TABLE llx_prelevement_facture RENAME TO llx_prelevement; +ALTER TABLE llx_prelevement_facture_demande RENAME TO llx_prelevement_demande; + diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture.key.sql b/htdocs/install/mysql/tables/llx_prelevement.key.sql similarity index 76% rename from htdocs/install/mysql/tables/llx_prelevement_facture.key.sql rename to htdocs/install/mysql/tables/llx_prelevement.key.sql index bc8b1bd8386..c3234b7756a 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_facture.key.sql +++ b/htdocs/install/mysql/tables/llx_prelevement.key.sql @@ -18,8 +18,8 @@ -- ============================================================================ -ALTER TABLE llx_prelevement_facture ADD INDEX idx_prelevement_facture_fk_prelevement_lignes (fk_prelevement_lignes); +ALTER TABLE llx_prelevement ADD INDEX idx_prelevement_fk_prelevement_lignes (fk_prelevement_lignes); -ALTER TABLE llx_prelevement_facture ADD CONSTRAINT fk_prelevement_facture_fk_prelevement_lignes FOREIGN KEY (fk_prelevement_lignes) REFERENCES llx_prelevement_lignes (rowid); +ALTER TABLE llx_prelevement ADD CONSTRAINT fk_prelevement_facture_fk_prelevement_lignes FOREIGN KEY (fk_prelevement_lignes) REFERENCES llx_prelevement_lignes (rowid); diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture.sql b/htdocs/install/mysql/tables/llx_prelevement.sql similarity index 96% rename from htdocs/install/mysql/tables/llx_prelevement_facture.sql rename to htdocs/install/mysql/tables/llx_prelevement.sql index 53a329f4376..b1fd80ef78b 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_facture.sql +++ b/htdocs/install/mysql/tables/llx_prelevement.sql @@ -16,7 +16,7 @@ -- -- =================================================================== -create table llx_prelevement_facture +create table llx_prelevement ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_facture integer NULL, diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture_demande.key.sql b/htdocs/install/mysql/tables/llx_prelevement_demande.key.sql similarity index 78% rename from htdocs/install/mysql/tables/llx_prelevement_facture_demande.key.sql rename to htdocs/install/mysql/tables/llx_prelevement_demande.key.sql index 4f9aedb9cdf..cd4ed476635 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_facture_demande.key.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_demande.key.sql @@ -17,6 +17,6 @@ -- =================================================================== -ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); -ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); +ALTER TABLE llx_prelevement_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); +ALTER TABLE llx_prelevement_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql b/htdocs/install/mysql/tables/llx_prelevement_demande.sql similarity index 97% rename from htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql rename to htdocs/install/mysql/tables/llx_prelevement_demande.sql index 9837f709777..bfad4d7fa6a 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_demande.sql @@ -17,7 +17,7 @@ -- =================================================================== -create table llx_prelevement_facture_demande +create table llx_prelevement_demande ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 25a4edb6123..43f940acdee 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -386,7 +386,7 @@ class Stripe extends CommonObject // That's why we can comment the part of code to retrieve a payment intent with object id (never mind if we cumulate payment intent with old ones that will not be used) $sql = "SELECT pi.ext_payment_id, pi.entity, pi.fk_facture, pi.sourcetype, pi.ext_payment_site"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pi"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pi"; $sql .= " WHERE pi.fk_facture = ".((int) $object->id); $sql .= " AND pi.sourcetype = '".$this->db->escape($object->element)."'"; $sql .= " AND pi.entity IN (".getEntity('societe').")"; @@ -530,12 +530,12 @@ class Stripe extends CommonObject $paymentintentalreadyexists = 0; // Check that payment intent $paymentintent->id is not already recorded. $sql = "SELECT pi.rowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pi"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pi"; $sql .= " WHERE pi.entity IN (".getEntity('societe').")"; $sql .= " AND pi.ext_payment_site = '".$this->db->escape($service)."'"; $sql .= " AND pi.ext_payment_id = '".$this->db->escape($paymentintent->id)."'"; - dol_syslog(get_class($this)."::getPaymentIntent search if payment intent already in prelevement_facture_demande", LOG_DEBUG); + dol_syslog(get_class($this)."::getPaymentIntent search if payment intent already in prelevement_demande", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -552,7 +552,7 @@ class Stripe extends CommonObject // If not, we create it. if (!$paymentintentalreadyexists) { $now = dol_now(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site, amount)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site, amount)"; $sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $user->id).", '".$this->db->escape($paymentintent->id)."', ".((int) $object->id).", '".$this->db->escape($object->element)."', ".((int) $conf->entity).", '".$this->db->escape($service)."', ".((float) $amount).")"; $resql = $this->db->query($sql); if (!$resql) { @@ -696,12 +696,12 @@ class Stripe extends CommonObject $setupintentalreadyexists = 0; // Check that payment intent $setupintent->id is not already recorded. $sql = "SELECT pi.rowid"; - $sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi"; + $sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_demande as pi"; $sql.= " WHERE pi.entity IN (".getEntity('societe').")"; $sql.= " AND pi.ext_payment_site = '" . $this->db->escape($service) . "'"; $sql.= " AND pi.ext_payment_id = '".$this->db->escape($setupintent->id)."'"; - dol_syslog(get_class($this) . "::getPaymentIntent search if payment intent already in prelevement_facture_demande", LOG_DEBUG); + dol_syslog(get_class($this) . "::getPaymentIntent search if payment intent already in prelevement_demande", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -717,7 +717,7 @@ class Stripe extends CommonObject if (! $setupintentalreadyexists) { $now=dol_now(); - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_facture_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site)"; + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_demande (date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site)"; $sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $user->id).", '".$this->db->escape($setupintent->id)."', ".((int) $object->id).", '".$this->db->escape($object->element)."', " . ((int) $conf->entity) . ", '" . $this->db->escape($service) . "', ".((float) $amount).")"; $resql = $this->db->query($sql); if (! $resql) From 4596a16cdb3c4fc4b02e52d8da59f1cb3d06350b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 18:02:40 +0200 Subject: [PATCH 42/46] css --- htdocs/compta/prelevement/factures.php | 2 +- htdocs/compta/prelevement/fiche-rejet.php | 2 +- htdocs/compta/prelevement/fiche-stat.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index dcb91710bd6..0ed75b5c3b8 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -111,7 +111,7 @@ if ($id > 0 || $ref) { print '
'.$langs->trans("TransData").''; print dol_print_date($object->date_trans, 'day'); - print ' '.$langs->trans("By").' '.$muser->getNomUrl(-1).'
'.$langs->trans("TransMetod").''; print $object->methodes_trans[$object->method_trans]; print '
'.$langs->trans("TransData").''; print dol_print_date($object->date_trans, 'day'); - print ' '.$langs->trans("By").' '.$muser->getNomUrl(-1).'
'.$langs->trans("TransMetod").''; print $object->methodes_trans[$object->method_trans]; print '
'.$langs->trans("TransData").''; print dol_print_date($object->date_trans, 'day'); - print ' '.$langs->trans("By").' '.$muser->getNomUrl(-1).'
'.$langs->trans("TransMetod").''; print $object->methodes_trans[$object->method_trans]; print '
'; + print '
'; $labelfororderfield = 'WithdrawalFile'; if ($object->type == 'bank-transfer') { $labelfororderfield = 'CreditTransferFile'; From 29d819be5eeb281f9358f1eedbb53d4517d5b076 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 Oct 2022 18:11:54 +0200 Subject: [PATCH 43/46] Rename cid so we can retreive it easily on file --- htdocs/core/class/CMailFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index e21a288e53e..2651df8b2e5 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1783,7 +1783,7 @@ class CMailFile foreach ($matches[1] as $key => $ext) { // We save the image to send in disk $filecontent = $matches[2][$key]; - $cid = dol_hash($this->html, 'md5'); + $cid = 'cid000'.dol_hash($this->html, 'md5'); $destfiletmp = $images_dir.'/'.$cid.'.'.$ext; $fhandle = @fopen($destfiletmp, 'w'); From 3a78777c9fb529181c6877dd9f7e902e34ab65de Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Oct 2022 12:07:26 +0200 Subject: [PATCH 44/46] Fix separation of date validation and approval as 2 different dates --- htdocs/holiday/list.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 8f16676f9ce..ddbafbcbd3c 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -126,7 +126,7 @@ $arrayfields = array( 'cp.date_debut'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>40), 'cp.date_fin'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>42), 'cp.date_valid'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'position'=>60), - 'cp.date_approve'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1, 'position'=>70), + 'cp.date_approval'=>array('label'=>$langs->trans("DateApprove"), 'checked'=>1, 'position'=>70), 'cp.date_create'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'cp.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>501), 'cp.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), @@ -271,6 +271,8 @@ $sql .= " cp.statut as status,"; $sql .= " cp.fk_validator,"; $sql .= " cp.date_valid,"; $sql .= " cp.fk_user_valid,"; +$sql .= " cp.date_approval,"; +$sql .= " cp.fk_user_approve,"; $sql .= " cp.date_refuse,"; $sql .= " cp.fk_user_refuse,"; $sql .= " cp.date_cancel,"; @@ -636,12 +638,18 @@ if ($resql) { print ''; print ''; + print ''; + print ''; print dol_print_date($db->jdate($obj->date_valid), 'day'); print ''; - print dol_print_date($db->jdate($obj->date_approve), 'day'); - print ''; + print dol_print_date($db->jdate($obj->date_approval), 'day'); + print '