From ee34b6d8f563ea0a3eac3be86d68bcd481f0a055 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 27 Sep 2022 09:39:37 +0200 Subject: [PATCH 01/26] FIXME sql error --- .../accountancy/class/accountingjournal.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 9720399fb5e..444198a86a3 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -441,24 +441,29 @@ class AccountingJournal extends CommonObject $langs->loadLangs(array("assets")); // Clean parameters - if (empty($type)) $type = 'view'; - if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; + if (empty($type)) { + $type = 'view'; + } + if (empty($in_bookkeeping)) { + $in_bookkeeping = 'notyet'; + } $sql = ""; - if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { + // FIXME sql error + /*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { $sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= " SELECT DISTINCT fk_docdet"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; $sql .= " WHERE doc_type = 'asset'"; $sql .= ")"; - } + }*/ $sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht"; $sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat"; $sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset"; if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { - $sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid"; } $sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing $sql .= " AND ad.ref != ''"; // not reversal lines From 36c54a140ff9a5f24a67ff13bc64a12233d69929 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 28 Sep 2022 22:32:55 +0200 Subject: [PATCH 02/26] FIX compatibility with Mysql <= 5.7 --- .../class/accountingjournal.class.php | 22 +++++++++++---- htdocs/accountancy/journal/variousjournal.php | 28 ++++++++++--------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 444198a86a3..20e09a8f6bc 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -449,7 +449,8 @@ class AccountingJournal extends CommonObject } $sql = ""; - // FIXME sql error + + // FIXME sql error with Mysql 5.7 /*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { $sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS ("; $sql .= " SELECT DISTINCT fk_docdet"; @@ -457,15 +458,23 @@ class AccountingJournal extends CommonObject $sql .= " WHERE doc_type = 'asset'"; $sql .= ")"; }*/ + $sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht"; $sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat"; $sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit"; $sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset"; - if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid"; - } + // FIXME sql error with Mysql 5.7 + /*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { + $sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid"; + }*/ $sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing + // Compatibility with Mysql 5.7 + if ($in_bookkeeping == 'already') { + $sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; + } else if ($in_bookkeeping == 'notyet') { + $sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; + } $sql .= " AND ad.ref != ''"; // not reversal lines if ($date_start && $date_end) { $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($date_start) . "' AND ad.depreciation_date <= '" . $this->db->idate($date_end) . "'"; @@ -475,9 +484,10 @@ class AccountingJournal extends CommonObject $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'"; } // Already in bookkeeping or not - if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { + // FIXME sql error with Mysql 5.7 + /*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') { $sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL"; - } + }*/ $sql .= " ORDER BY ad.depreciation_date"; dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index d737925f2c3..32a4adb3569 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -289,19 +289,21 @@ print '' . $langs->trans("Debit") . ''; print '' . $langs->trans("Credit") . ''; print "\n"; -foreach ($journal_data as $element_id => $element) { - foreach ($element['blocks'] as $lines) { - foreach ($lines as $line) { - print ''; - print '' . $line['date'] . ''; - print '' . $line['piece'] . ''; - print '' . $line['account_accounting'] . ''; - print '' . $line['subledger_account'] . ''; - print '' . $line['label_operation'] . ''; - if ($object->nature == 4) print '' . $line['payment_mode'] . ''; - print '' . $line['debit'] . ''; - print '' . $line['credit'] . ''; - print ''; +if (is_array($journal_data) && !empty($journal_data)) { + foreach ($journal_data as $element_id => $element) { + foreach ($element['blocks'] as $lines) { + foreach ($lines as $line) { + print ''; + print '' . $line['date'] . ''; + print '' . $line['piece'] . ''; + print '' . $line['account_accounting'] . ''; + print '' . $line['subledger_account'] . ''; + print '' . $line['label_operation'] . ''; + if ($object->nature == 4) print '' . $line['payment_mode'] . ''; + print '' . $line['debit'] . ''; + print '' . $line['credit'] . ''; + print ''; + } } } } From 6b4cf5c8d9e40a450561ddb5bbab444ba6545564 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 28 Sep 2022 20:39:47 +0000 Subject: [PATCH 03/26] Fixing style errors. --- htdocs/accountancy/class/accountingjournal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 20e09a8f6bc..3134dfa95ba 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -472,7 +472,7 @@ class AccountingJournal extends CommonObject // Compatibility with Mysql 5.7 if ($in_bookkeeping == 'already') { $sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; - } else if ($in_bookkeeping == 'notyet') { + } elseif ($in_bookkeeping == 'notyet') { $sql .= " AND NOT EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')"; } $sql .= " AND ad.ref != ''"; // not reversal lines From 9a96aad737bd7b447e8438ec8d53ce3e073e8157 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 28 Sep 2022 23:39:23 +0200 Subject: [PATCH 04/26] FIX #22440 --- htdocs/langs/en_US/accountancy.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index fd5ff8461fe..d890377866a 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -58,6 +58,7 @@ MainAccountForSuppliersNotDefined=Main accounting account for vendors not define MainAccountForUsersNotDefined=Main accounting account for users not defined in setup MainAccountForVatPaymentNotDefined=Main accounting account for VAT payment not defined in setup MainAccountForSubscriptionPaymentNotDefined=Main accounting account for subscription payment not defined in setup +UserAccountNotDefined=Accounting account for user not defined in setup AccountancyArea=Accounting area AccountancyAreaDescIntro=Usage of the accountancy module is done in several step: From 3fad00600ccd3b7042efea1b82dfd93c67b94109 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Sep 2022 15:02:34 +0200 Subject: [PATCH 05/26] FIX default value for partnership status --- htdocs/install/mysql/tables/llx_partnership-partnership.sql | 2 +- htdocs/partnership/class/partnership.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_partnership-partnership.sql b/htdocs/install/mysql/tables/llx_partnership-partnership.sql index 8f83e2e82e5..0be59af5ebf 100644 --- a/htdocs/install/mysql/tables/llx_partnership-partnership.sql +++ b/htdocs/install/mysql/tables/llx_partnership-partnership.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_partnership( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, ref varchar(128) DEFAULT '(PROV)' NOT NULL, - status smallint NOT NULL DEFAULT '0', + status smallint DEFAULT 0 NOT NULL, fk_type integer DEFAULT 0 NOT NULL, fk_soc integer, fk_member integer, diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 85787075f28..7eca7fa4869 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -118,7 +118,7 @@ class Partnership extends CommonObject 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Terminated'),), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Terminated'),), 'url_to_check' => array('type'=>'varchar(255)', 'label'=>'UrlToCheck', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>-1), 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',), 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>-2,), From 150f4c45d8d7a6a57d802506473e34b3d9921b6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Sep 2022 15:02:34 +0200 Subject: [PATCH 06/26] FIX default value for partnership status --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/install/mysql/tables/llx_partnership-partnership.sql | 2 +- htdocs/partnership/class/partnership.class.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 04f1c6239be..a1906123f62 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9007,7 +9007,7 @@ abstract class CommonObject // Clean and check mandatory foreach ($keys as $key) { - // If field is an implicit foreign key field + // If field is an implicit foreign key field (so type = 'integer:...') if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') { $values[$key] = ''; } @@ -9027,7 +9027,7 @@ abstract class CommonObject $values[$key] = $this->quote($this->fields[$key]['default'], $this->fields[$key]); } - // If field is an implicit foreign key field + // If field is an implicit foreign key field (so type = 'integer:...') if (preg_match('/^integer:/i', $this->fields[$key]['type']) && empty($values[$key])) { if (isset($this->fields[$key]['default'])) { $values[$key] = ((int) $this->fields[$key]['default']); diff --git a/htdocs/install/mysql/tables/llx_partnership-partnership.sql b/htdocs/install/mysql/tables/llx_partnership-partnership.sql index 8f83e2e82e5..0be59af5ebf 100644 --- a/htdocs/install/mysql/tables/llx_partnership-partnership.sql +++ b/htdocs/install/mysql/tables/llx_partnership-partnership.sql @@ -19,7 +19,7 @@ CREATE TABLE llx_partnership( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, ref varchar(128) DEFAULT '(PROV)' NOT NULL, - status smallint NOT NULL DEFAULT '0', + status smallint DEFAULT 0 NOT NULL, fk_type integer DEFAULT 0 NOT NULL, fk_soc integer, fk_member integer, diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 85787075f28..e1f23ba7014 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -118,7 +118,7 @@ class Partnership extends CommonObject 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), 'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>0, 'visible'=>2, 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Terminated'),), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>2, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('-1'=>'','0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '9'=>'Terminated'),), 'url_to_check' => array('type'=>'varchar(255)', 'label'=>'UrlToCheck', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>-1), 'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',), 'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>-2,), From fe59054522c1fe7878d149faa4ae271e107e75cc Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Thu, 29 Sep 2022 22:56:06 +0200 Subject: [PATCH 07/26] Supplier Reference is lost when page breaks https://www.dolibarr.org/forum/t/pdf-aurore-modules-php-seems-to-loose-track-of-supplier-references/22856 --- .../core/modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 14af31976d8..b3c73c57e16 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -483,7 +483,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pageposafter = $pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc); + pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); From 65b5f002ea4ac2fdd7682a01c95d1f5c5fb654d6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 3 Oct 2022 08:22:27 +0200 Subject: [PATCH 08/26] FIX missing class "societe" when create another object with workflow --- htdocs/core/ajax/onlineSign.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 3ec4cfa0f20..7de590eb98e 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -28,9 +28,10 @@ if (!defined('NOREQUIREHTML')) { if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } -if (!defined('NOREQUIRESOC')) { +// Needed for create other object with workflow +/*if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); -} +}*/ if (!defined('NOCSRFCHECK')) { define('NOCSRFCHECK', '1'); } From 3777b7dffe80ca80ca9f1a3ea28c8f95aab8f111 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 3 Oct 2022 13:38:15 +0200 Subject: [PATCH 09/26] fix: [AdvTargetEmailling] bad table from select and use of dict for prospect status --- .../mailing/class/advtargetemailing.class.php | 18 +++++++++++------- .../class/html.formadvtargetemailing.class.php | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index ea6ec241b16..72c9a0e4eb7 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -111,6 +111,8 @@ class AdvanceTargetingMailing extends CommonObject global $langs; $langs->load('customers'); + + $this->db = $db; $this->select_target_type = array( @@ -119,13 +121,15 @@ class AdvanceTargetingMailing extends CommonObject '3' => $langs->trans('ThirdParty'), '4' => $langs->trans('ContactsWithThirdpartyFilter') ); - $this->type_statuscommprospect = array( - -1 => $langs->trans("StatusProspect-1"), - 0 => $langs->trans("StatusProspect0"), - 1 => $langs->trans("StatusProspect1"), - 2 => $langs->trans("StatusProspect2"), - 3 => $langs->trans("StatusProspect3") - ); + + require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; + $customerStatic = new Client($this->db); + $customerStatic->loadCacheOfProspStatus(); + if (!empty($customerStatic->cacheprospectstatus)) { + foreach ($customerStatic->cacheprospectstatus as $dataProspectSt) { + $this->type_statuscommprospect[$dataProspectSt['id']]=$dataProspectSt['label']; + } + } } /** diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 9e10d51031e..50169438baa 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -355,7 +355,7 @@ class FormAdvTargetEmailing extends Form $out = ''; $sql = "SELECT c.rowid, c.name, c.fk_element"; - $sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as c"; + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_advtarget as c"; $sql .= " WHERE type_element = '".$this->db->escape($type_element)."'"; $sql .= " ORDER BY c.name"; From 7ac0168397e1a8e911b4f6b10ae4985956cff2ea Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 3 Oct 2022 13:40:33 +0200 Subject: [PATCH 10/26] travais --- htdocs/comm/mailing/class/advtargetemailing.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 72c9a0e4eb7..35412193c50 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -111,8 +111,6 @@ class AdvanceTargetingMailing extends CommonObject global $langs; $langs->load('customers'); - - $this->db = $db; $this->select_target_type = array( @@ -129,6 +127,8 @@ class AdvanceTargetingMailing extends CommonObject foreach ($customerStatic->cacheprospectstatus as $dataProspectSt) { $this->type_statuscommprospect[$dataProspectSt['id']]=$dataProspectSt['label']; } + } else { + $this->type_statuscommprospect = array(); } } From 83fa90eef794a34252897f70893b9c990282136e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 3 Oct 2022 13:41:07 +0200 Subject: [PATCH 11/26] travais --- htdocs/comm/mailing/class/advtargetemailing.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 35412193c50..7b4e06c897f 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -128,7 +128,13 @@ class AdvanceTargetingMailing extends CommonObject $this->type_statuscommprospect[$dataProspectSt['id']]=$dataProspectSt['label']; } } else { - $this->type_statuscommprospect = array(); + $this->type_statuscommprospect = array( + -1 => $langs->trans("StatusProspect-1"), + 0 => $langs->trans("StatusProspect0"), + 1 => $langs->trans("StatusProspect1"), + 2 => $langs->trans("StatusProspect2"), + 3 => $langs->trans("StatusProspect3") + ); } } From 787de2fd8a83b1f261ef3b7002bf998edea2a5f5 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Mon, 3 Oct 2022 15:16:41 +0200 Subject: [PATCH 12/26] FIX: contact deletion: execute trigger before really deleting --- htdocs/contact/class/contact.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index db99a8203bc..89d84df9426 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1208,6 +1208,15 @@ class Contact extends CommonObject $this->db->begin(); + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('CONTACT_DELETE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + if (!$error) { // Get all rowid of element_contact linked to a type that is link to llx_socpeople $sql = "SELECT ec.rowid"; @@ -1298,15 +1307,6 @@ class Contact extends CommonObject } } - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('CONTACT_DELETE', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - if (!$error) { $this->db->commit(); return 1; From 5ccc5c9e1a59939478e53ecb33664f2dc201e6d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Oct 2022 17:30:47 +0200 Subject: [PATCH 13/26] Fix error message --- htdocs/api/index.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index afb0289aa32..a87edf8166c 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -120,7 +120,7 @@ if (empty($conf->global->MAIN_MODULE_API)) { // Test if explorer is not disabled if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API_EXPLORER_DISABLED)) { $langs->load("admin"); - dol_syslog("Call Dolibarr API interfaces with module REST disabled"); + dol_syslog("Call Dolibarr API interfaces with module API REST disabled"); print $langs->trans("WarningAPIExplorerDisabled").'.

'; //session_destroy(); exit(0); @@ -153,6 +153,10 @@ preg_match('/index\.php\/([^\/]+)(.*)$/', $url, $reg); $refreshcache = (empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false); if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) { $refreshcache = true; + if (!is_writable($conf->api->dir_temp)) { + print 'Erreur temp dir api/temp not writable'; + exit(0); + } } $api = new DolibarrApi($db, '', $refreshcache); From 49163de473acc73b5c9d6c3ac4b974edae779b48 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 3 Oct 2022 22:01:04 +0200 Subject: [PATCH 14/26] Fix better fix for php 8 --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5fb9ba38588..2f3eb754b48 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4812,7 +4812,7 @@ class Product extends CommonObject $sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens $sql.= " ORDER BY pa.rang"; - dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.implode(',', $parents), LOG_DEBUG); + dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG); if ($level == 1) { $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly From 013d136bf7debe3611f6fe4699190dcec2c6969e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Oct 2022 13:57:42 +0200 Subject: [PATCH 15/26] FIX @ must be allowed into dol_eval --- htdocs/core/lib/functions.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f5206c700d0..3ea1a741ed2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8232,7 +8232,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' // Test dangerous char (used for RCE), we allow only PHP variable testing. if ($onlysimplestring == '1') { //print preg_quote('$_->&|', '/'); - if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/', '/').']/i', $s)) { + if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/@', '/').']/i', $s)) { if ($returnvalue) { return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s; } else { @@ -8242,11 +8242,11 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' } } elseif ($onlysimplestring == '2') { //print preg_quote('$_->&|', '/'); - if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/;[]', '/').']/i', $s)) { + if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/@;[]', '/').']/i', $s)) { if ($returnvalue) { - return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s; + return 'Bad string syntax to evaluate (found chars that are not chars for simplestring 2): '.$s; } else { - dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s); + dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring 2): '.$s); return ''; } } From 68c018896995b578383873ace77a265e3e14962f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Oct 2022 14:17:57 +0200 Subject: [PATCH 16/26] Revert "FIX: Preview button position on documents list (case when the file is too long)" This reverts commit 88b5594af31f54bed54d0c89e61930f78c48404e. --- htdocs/core/class/html.formfile.class.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 78e54731f05..4bcf742d461 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -884,7 +884,6 @@ class FormFile // Show file name with link to download $out .= ''; - $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param, 'paddingright')."\n"; $out .= 'trans("File").': '.$file["name"]); $out .= dol_trunc($file["name"], 150); - $out .= ''; + $out .= ''."\n"; + $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param); $out .= ''; // Show file size @@ -1341,11 +1341,6 @@ class FormFile // File name print ''; - // Preview link - if (!$editline) { - print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity), 'paddingright') . "\n"; - } - // Show file name with link to download //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; @@ -2145,10 +2144,9 @@ class FormFile * @param string $relativepath Relative path of docs * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) * @param string $param More param on http links - * @param string $moreclass Add more class to class style * @return string $out Output string with HTML */ - public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '', $moreclass = '') + public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '') { global $langs, $conf; @@ -2156,7 +2154,7 @@ class FormFile if ($conf->browser->layout != 'phone' && !empty($conf->use_javascript_ajax)) { $urladvancedpreview = getAdvancedPreviewUrl($modulepart, $relativepath, 1, $param); // Return if a file is qualified for preview. if (count($urladvancedpreview)) { - $out .= ''; + $out .= ''; //$out.= ''; if (empty($ruleforpicto)) { //$out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); From b5c745a573b9b3e99bb9d65f3971e2d8ee858725 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Oct 2022 19:41:04 +0200 Subject: [PATCH 17/26] Fix warnings --- htdocs/cron/class/cronjob.class.php | 11 +++++++++-- htdocs/partnership/class/partnershiputils.class.php | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index a84fa3109df..b18c7146795 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -163,10 +163,16 @@ class Cronjob extends CommonObject public $libname; /** - * @var string A test condition to know if job is visible/qualified + * @var string A test condition to know if job is visible/qualified */ public $test; + /** + * @var string Autodelete + */ + public $autodelete; + + const STATUS_DISABLED = 0; const STATUS_ENABLED = 1; const STATUS_ARCHIVED = 2; @@ -1191,7 +1197,8 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::run_jobs START ".$this->objectname."->".$this->methodename."(".$this->params.");", LOG_DEBUG); // Create Object for the called module - $object = new $this->objectname($this->db); + $nameofclass = $this->objectname; + $object = new $nameofclass($this->db); if ($this->entity > 0) { $object->entity = $this->entity; // We work on a dedicated entity } diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 9ad2e5b7ca2..c73068e17a4 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -41,6 +41,8 @@ class PartnershipUtils public $error; //!< To return error code (or message) public $errors = array(); //!< To return several error codes (or messages) + public $output; // To store output of some cron methods + /** * Constructor From 85a764afc608163499ffead9efdb5789384abcce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Oct 2022 13:50:02 +0200 Subject: [PATCH 18/26] FIX bad closing select --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 1222e9f7ffc..413137ec0b0 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1207,7 +1207,7 @@ if (!empty($arrayfields['customerorsupplier']['checked'])) { print ''; } print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list'); - print ''; + print ''; } // Prospect level if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { From a73aa6c0dfc548cdbce43c07c872e7fc7aa38ba8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Oct 2022 09:55:51 +0200 Subject: [PATCH 19/26] Fix bad muticurrency rate --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b9d6e199015..c8ada26a316 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1215,7 +1215,7 @@ if (empty($reshook)) { $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); - $object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int'); + $object->multicurrency_tx = price2num(GETPOST('originmulticurrency_tx', 'alpha')); $object->fk_project = GETPOST('projectid', 'int'); // Fill array 'array_options' with data from add form From 872d0ddff4f8b8782b834a7925ad703e33a1ef20 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 5 Oct 2022 10:07:01 +0200 Subject: [PATCH 20/26] TODO wrong invoice status if "alreadypaid" is missing --- htdocs/core/lib/invoice.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 52daea0f150..34bf65de8ba 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -751,6 +751,7 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0) $result .= ''.$companystatic->getNomUrl(1, 'customer').''; $result .= ''.dol_print_date($db->jdate($obj->datec), 'day').''; $result .= ''.price($obj->total_ttc).''; + // TODO with "alreadypaid" parameter with value -1 the status of invoice validated with no paiement sort with "status3" (BillStatusStarted) $result .= ''.$objectstatic->getLibStatut(5).''; $result .= ''; From af34a968fc2a0d4284cf68b7515d05f2f6f9ec5c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 5 Oct 2022 10:31:32 +0200 Subject: [PATCH 21/26] FIX missing check if incoice as a payment (wrong status) --- htdocs/core/lib/invoice.lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 34bf65de8ba..2184520c11e 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -751,8 +751,10 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0) $result .= ''.$companystatic->getNomUrl(1, 'customer').''; $result .= ''.dol_print_date($db->jdate($obj->datec), 'day').''; $result .= ''.price($obj->total_ttc).''; - // TODO with "alreadypaid" parameter with value -1 the status of invoice validated with no paiement sort with "status3" (BillStatusStarted) - $result .= ''.$objectstatic->getLibStatut(5).''; + + // Check if invoice as a payment + $payment = $objectstatic->getSommePaiement(); + $result .= ''.$objectstatic->getLibStatut(5, $payment).''; $result .= ''; From 509c85672e4f6510ff6dc6cc69146292280dcc2c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 5 Oct 2022 10:45:29 +0200 Subject: [PATCH 22/26] FIX Protection against bad value into accurancy setup --- htdocs/admin/limits.php | 65 +++++++++++++++++++++++----------- htdocs/langs/en_US/errors.lang | 4 ++- 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 1209f41c48e..db963562deb 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2022 Laurent Destailleur * Copyright (C) 2009-2018 Regis Houssin * Copyright (C) 2010 Juanjo Menent * @@ -29,11 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'products', 'admin')); -if (!$user->admin) { - accessforbidden(); -} - $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); $currencycode = GETPOST('currencycode', 'alpha'); if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { @@ -48,25 +45,36 @@ $mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$cu $valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int'); $valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int'); -$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'int'); +$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'alpha'); // Can be 'x.y' but also 'x...' $valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alphanohtml'), '', 2); -if ($action == 'update') { +if (!$user->admin) { + accessforbidden(); +} + + +/* + * Actions + */ + +if ($action == 'update' && !$cancel) { $error = 0; $MAXDEC = 8; - if ($_POST[$mainmaxdecimalsunit] > $MAXDEC - || $_POST[$mainmaxdecimalstot] > $MAXDEC - || $_POST[$mainmaxdecimalsshown] > $MAXDEC) { + if ($valmainmaxdecimalsunit > $MAXDEC + || $valmainmaxdecimalstot > $MAXDEC + || $valmainmaxdecimalsshown > $MAXDEC) { $error++; setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors'); + $action = 'edit'; } - if ($_POST[$mainmaxdecimalsunit].(!empty($currencycode) ? '_'.$currencycode : '') < 0 - || $_POST[$mainmaxdecimalstot] < 0 - || $_POST[$mainmaxdecimalsshown] < 0) { + if ($valmainmaxdecimalsunit < 0 + || $valmainmaxdecimalstot < 0 + || $valmainmaxdecimalsshown < 0) { $langs->load("errors"); $error++; setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors'); + $action = 'edit'; } if ($valmainroundingruletot) { @@ -74,9 +82,23 @@ if ($action == 'update') { $langs->load("errors"); $error++; setEventMessages($langs->trans("ErrorMAIN_ROUNDING_RULE_TOTCanMAIN_MAX_DECIMALS_TOT"), null, 'errors'); + $action = 'edit'; } } + if ((float) $valmainmaxdecimalsshown == 0) { + $langs->load("errors"); + $error++; + setEventMessages($langs->trans("ErrorValueCantBeNull", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors'); + $action = 'edit'; + } + if (! $error && ((float) $valmainmaxdecimalsshown < $valmainmaxdecimalsunit || (float) $valmainmaxdecimalsshown < $valmainmaxdecimalstot)) { + $langs->load("errors"); + $error++; + setEventMessages($langs->trans("ErrorValueForTooLow", dol_trunc(dol_string_nohtmltag($langs->transnoentitiesnoconv("MAIN_MAX_DECIMALS_SHOWN")), 40)), null, 'errors'); + $action = 'edit'; + } + if (!$error) { dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity); @@ -143,24 +165,25 @@ if ($action == 'edit') { print ''; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); - print ''; + print ''; print ''; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); - print ''; + print ''; print ''.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").''; - print ''; + print ''; print ''; print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly")); - print ''; + print ''; print ''; - print '
'; print '
'; - print ''; + print ''; + print '   '; + print ''; print '
'; print '
'; @@ -169,7 +192,7 @@ if ($action == 'edit') { } else { print '
'; print ''; - print ''; + print ''; print ''; $result .= ''; - // Check if invoice as a payment + // Load amount of existing payment of invoice (needed for complete status) $payment = $objectstatic->getSommePaiement(); $result .= '';
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly")); @@ -190,7 +213,7 @@ if ($action == 'edit') { print ''; print ''; } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 7cf67f10af8..8c5e7562b8b 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -291,6 +291,8 @@ ErrorAjaxRequestFailed=Request failed ErrorThirpdartyOrMemberidIsMandatory=Third party or Member of partnership is mandatory ErrorFailedToWriteInTempDirectory=Failed to write in temp directory ErrorQuantityIsLimitedTo=Quantity is limited to %s +ErrorValueForTooLow=Value for %s is too low +ErrorValueCantBeNull=Value for %s can't be null # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. @@ -327,7 +329,7 @@ WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So y WarningPaypalPaymentNotCompatibleWithStrict=The value 'Strict' makes the online payment features not working correctly. Use 'Lax' instead. WarningThemeForcedTo=Warning, theme has been forced to %s by hidden constant MAIN_FORCETHEME WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal=Automatic validation is disabled when option to decrease stock is set on "Invoice validation". - + # Validate RequireValidValue = Value not valid RequireAtLeastXString = Requires at least %s character(s) From b2cd5fc3ca4f69c0b27d4c9144194f9a98676ec2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 5 Oct 2022 16:14:59 +0200 Subject: [PATCH 23/26] fix: remove php warning non_numeric_value --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 1bbbb2c9f3f..b1830e367e6 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1428,7 +1428,7 @@ class pdf_sponge extends ModelePDFFactures // Total remise $total_line_remise = 0; foreach ($object->lines as $i => $line) { - $total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib + $total_line_remise += (float)pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib // Gestion remise sous forme de ligne négative if ($line->total_ht < 0) { $total_line_remise += -$line->total_ht; From a72fff4a5d07e48bec38ab805db84d35ef2e3633 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 5 Oct 2022 16:39:26 +0200 Subject: [PATCH 24/26] FIX #22241 --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 82e7f8e3a90..dec6565be80 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5974,7 +5974,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, // Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle. if (($seller_country_code == $buyer_country_code) - || (in_array($seller_country_code, array('FR,MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined + || (in_array($seller_country_code, array('FR', 'MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined //print 'VATRULE 2'; return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); } From 82cb267fb884635a3ec4624b214d11e81b0e240c Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 5 Oct 2022 14:57:47 +0000 Subject: [PATCH 25/26] Fixing style errors. --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index b1830e367e6..4489f26268c 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1428,7 +1428,7 @@ class pdf_sponge extends ModelePDFFactures // Total remise $total_line_remise = 0; foreach ($object->lines as $i => $line) { - $total_line_remise += (float)pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib + $total_line_remise += (float) pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib // Gestion remise sous forme de ligne négative if ($line->total_ht < 0) { $total_line_remise += -$line->total_ht; From 81e5c428a1a04447a17bdae94adbda79dc88d298 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Oct 2022 11:52:40 +0200 Subject: [PATCH 26/26] Update invoice.lib.php --- htdocs/core/lib/invoice.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 2184520c11e..b6ab19e2495 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -752,7 +752,7 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0) $result .= ''.dol_print_date($db->jdate($obj->datec), 'day').''.price($obj->total_ttc).''.$objectstatic->getLibStatut(5, $payment).'