From f2adc3de4f2a1397f88a5a7c64f77b60796250c0 Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Tue, 7 Jul 2020 18:03:11 +1100 Subject: [PATCH 01/24] Fix Dolibarr/dolibarr#14181. Limits and accuracy form not saving modified values --- htdocs/admin/limits.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 0646c7f6d46..9d0a7d57a85 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -34,6 +34,10 @@ if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); $currencycode = GETPOST('currencycode', 'alpha'); +if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { + $currencycode = (!empty($currencycode) ? $currencycode : $conf->currency); +} + $mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : ''); $mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(!empty($currencycode) ? '_'.$currencycode : ''); $mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(!empty($currencycode) ? '_'.$currencycode : ''); @@ -94,7 +98,6 @@ llxHeader(); print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup'); -$currencycode = (!empty($currencycode) ? $currencycode : $conf->currency); $aCurrencies = array($conf->currency); // Default currency always first position if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) @@ -162,9 +165,7 @@ if ($action == 'edit') print ''; print '
'; -} -else -{ +} else { print ''; print ''; @@ -203,9 +204,7 @@ if (empty($mysoc->country_code)) $langs->load("errors"); $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); print '
'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").''; -} -else -{ +} else { // Show examples print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', ''); @@ -252,8 +251,7 @@ else $vat_rates[$i] = $obj->vat_rate; } } - } - else dol_print_error($db); + } else dol_print_error($db); if (count($vat_rates)) { @@ -269,9 +267,7 @@ else print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; } } - } - else - { + } else { // More examples if not specific vat rate found // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10) // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule. From 6ed2ae188ef64f9094dabe10332ee9c825d084d9 Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Fri, 10 Jul 2020 00:51:41 +1100 Subject: [PATCH 02/24] Fix extrafields ordering on PDFs --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 72d45f2467c..be23895fe7f 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1296,7 +1296,7 @@ abstract class CommonDocGenerator { // Sort extrafields by rank uasort($fields, function ($a, $b) { - return ($a->rank > $b->rank) ? -1 : 1; + return ($a->rank > $b->rank) ? 1 : -1; }); // define some HTML content with style From eede2f9944d561f3e7a8696a944f67868b59865d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Jul 2020 10:39:12 +0200 Subject: [PATCH 03/24] Add telangana province for india --- htdocs/install/mysql/data/llx_20_c_departements.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 46d9b4d712e..9a941258b25 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -1102,6 +1102,7 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PY', 11701, NULL, 0, 'PY', 'Puducherry', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('RJ', 11701, NULL, 0, 'RJ', 'Rajasthan', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('SK', 11701, NULL, 0, 'SK', 'Sikkim', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('TE', 11701, NULL, 0, 'TE', 'Telangana', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('TN', 11701, NULL, 0, 'TN', 'Tamil Nadu', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('TR', 11701, NULL, 0, 'TR', 'Tripura', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('UL', 11701, NULL, 0, 'UL', 'Uttarakhand', 1); From 6aae68bb07233028b7f741c5c17349a69deee6eb Mon Sep 17 00:00:00 2001 From: Alfredo Altamirano Date: Sat, 11 Jul 2020 10:28:03 -0500 Subject: [PATCH 04/24] Change Mexico City name Mexico City official name and code changed since 2016 --- htdocs/install/mysql/data/llx_20_c_departements.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 9a941258b25..54ab237c9b8 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -1146,7 +1146,7 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('SU', 11801, NULL, 0, 'SU', 'Sumatera Utara ', 1); -- Provinces Mexique (id country=154) -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('DIF', 15401, '', 0, 'DIF', 'Distrito Federal', 1); +INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('CMX', 15401, '', 0, 'CMX', 'Ciudad de México', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AGS', 15401, '', 0, 'AGS', 'Aguascalientes', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('BCN', 15401, '', 0, 'BCN', 'Baja California Norte', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('BCS', 15401, '', 0, 'BCS', 'Baja California Sur', 1); From 045fbad616b40110f174c64999005f427d875898 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 13 Jul 2020 17:48:21 +0200 Subject: [PATCH 05/24] fix extrafields linnktoObject Thirdpary option showAdress --- htdocs/core/class/html.form.class.php | 6 +++--- htdocs/societe/class/societe.class.php | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9c4e2526249..cebe79da30a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6122,7 +6122,7 @@ class Form $prefixforautocompletemode = $objecttmp->element; if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode = 'company'; $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT - + $options=array(); if (!empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields (like societe, contact, ...) { $tmpfieldstoshow = ''; @@ -6222,8 +6222,8 @@ class Form $obj = $this->db->fetch_object($resql); $label = ''; $tmparray = explode(',', $fieldstoshow); - foreach ($tmparray as $key => $val) - { + + foreach ($tmparray as $key => $val) { $val = preg_replace('/t\./', '', $val); $label .= (($label && $obj->$val) ? ' - ' : '').$obj->$val; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 730e66eaab8..e3d6409ddd6 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -725,6 +725,8 @@ class Societe extends CommonObject */ public function __construct($db) { + global $conf; + $this->db = $db; $this->client = 0; @@ -735,6 +737,13 @@ class Societe extends CommonObject $this->forme_juridique_code = 0; $this->tva_assuj = 1; $this->status = 1; + + if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) { + $this->fields['address']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST; + $this->fields['zip']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST; + $this->fields['town']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST; + //$this->fields['fk_pays']['showoncombobox'] = $conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST; + } } From 96d26be1d4ce49db45c6e21316d01b6a53561504 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 13 Jul 2020 17:51:58 +0200 Subject: [PATCH 06/24] fix extrafields linnktoObject Thirdpary option showAdress --- 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 cebe79da30a..59296826a08 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6122,7 +6122,7 @@ class Form $prefixforautocompletemode = $objecttmp->element; if ($prefixforautocompletemode == 'societe') $prefixforautocompletemode = 'company'; $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT - $options=array(); + if (!empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields (like societe, contact, ...) { $tmpfieldstoshow = ''; From 1173059e7b74b60eca0e66cdcecd383a65377b2d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 13 Jul 2020 17:52:41 +0200 Subject: [PATCH 07/24] fix extrafields linnktoObject Thirdpary option showAdress --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 59296826a08..e5f5aaf7d0a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6223,7 +6223,8 @@ class Form $label = ''; $tmparray = explode(',', $fieldstoshow); - foreach ($tmparray as $key => $val) { + foreach ($tmparray as $key => $val) + { $val = preg_replace('/t\./', '', $val); $label .= (($label && $obj->$val) ? ' - ' : '').$obj->$val; } From 72e0250117ffae0f758c7220d15ac16302130276 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 13 Jul 2020 17:53:00 +0200 Subject: [PATCH 08/24] fix extrafields linnktoObject Thirdpary option showAdress --- htdocs/core/class/html.form.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e5f5aaf7d0a..9c4e2526249 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6222,7 +6222,6 @@ class Form $obj = $this->db->fetch_object($resql); $label = ''; $tmparray = explode(',', $fieldstoshow); - foreach ($tmparray as $key => $val) { $val = preg_replace('/t\./', '', $val); From 6ad8145645c0dc20896c51770c51ef910ab44777 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Jul 2020 18:52:33 +0200 Subject: [PATCH 09/24] FIX for #14253 --- htdocs/accountancy/journal/expensereportsjournal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 4be0b133143..200b7cdb98e 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -265,7 +265,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->debit = ($mt > 0) ? $mt : 0; - $bookkeeping->credit = ($mt <= 0) ? $mt : 0; + $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; $bookkeeping->journal_label = $journal_label; $bookkeeping->fk_user_author = $user->id; @@ -325,7 +325,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->debit = ($mt > 0) ? $mt : 0; - $bookkeeping->credit = ($mt <= 0) ? $mt : 0; + $bookkeeping->credit = ($mt <= 0) ? -$mt : 0; $bookkeeping->code_journal = $journal; $bookkeeping->journal_label = $journal_label; $bookkeeping->fk_user_author = $user->id; From f07a1a6d1e5813419626f98c8976ddfef6a8063d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Jul 2020 18:54:55 +0200 Subject: [PATCH 10/24] FIX for #14253 --- htdocs/accountancy/journal/expensereportsjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 200b7cdb98e..9d8d13b2aec 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -625,7 +625,7 @@ if (empty($action) || $action == 'view') { else print $accountoshow; print ''; print ""; - print '"; + print '"; print '"; print ""; } From bb4543167fa2cdfd162b55429f28d1e511b58fe0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Jul 2020 19:19:12 +0200 Subject: [PATCH 11/24] FIX #14222 --- htdocs/projet/activity/perday.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 1e0c147c82a..c5fb194a1f0 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -291,9 +291,11 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac if (count($timespent_duration) > 0) { + foreach ($timespent_duration as $key => $val) { $object->fetch($key); + $taskid = $object->id; if (GETPOSTISSET($taskid.'progress')) $object->progress = GETPOST($taskid.'progress', 'int'); else unset($object->progress); From eef66ae6ed23c4225c2578214d919b344957dc60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Jul 2020 19:22:03 +0200 Subject: [PATCH 12/24] Fix var not defined --- htdocs/projet/activity/perday.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index c5fb194a1f0..9c80cbd602e 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -272,6 +272,7 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac { if (intval($time) > 0) { + $matches = array(); // Hours or minutes of duration if (preg_match("/([0-9]+)duration(hour|min)/", $key, $matches)) { From a252c87c82dcdb50925d3fbfd7a1bd405dd8cea7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Jul 2020 19:41:11 +0200 Subject: [PATCH 13/24] Fix comment --- htdocs/core/lib/admin.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index f849be78865..c8e957a7345 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -273,9 +273,9 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle if ($offsetforchartofaccount > 0) { // Replace lines - // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', '0', '...', 1);' + // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE','CAPIT', '1', '0', '...', 1);' // with - // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', '0', '...', 1);' + // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', '1', '0', '...', 1);' $newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql); $newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql); //var_dump($newsql); From ac92a9fa4040c744346c573c34b4ffea44385407 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Jul 2020 22:59:47 +0200 Subject: [PATCH 14/24] Doc more complete --- htdocs/core/lib/admin.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index c8e957a7345..12fb15d3b2a 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -273,9 +273,10 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle if ($offsetforchartofaccount > 0) { // Replace lines - // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE','CAPIT', '1', '0', '...', 1);' + // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE', 'CAPIT', '1234', 1400, '...', 1);' // with - // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', '1', '0', '...', 1);' + // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', '1234', 1400 + 200100000, '...', 1);' + // Note: string with 1234 instead of '1234' is also supported $newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql); $newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql); //var_dump($newsql); From f3e3c47af3860c2df5ba18c49533c0d0d0d8c47a Mon Sep 17 00:00:00 2001 From: Oarces DEV Date: Sat, 18 Jul 2020 11:55:42 +0200 Subject: [PATCH 15/24] Add the possibility for the prospect to order A prospect can do make order everywhere in Dolibarr, except in order tab... https://www.dolibarr.fr/forum/t/nouvelle-commande-ou-sont-les-prospects/33275/7 --- htdocs/commande/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 795602cd95d..ed1f27e3c82 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1637,7 +1637,7 @@ if ($action == 'create' && $usercancreate) print ''; } else { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("SubledgerAccount")."'.($mt < 0 ? -price(-$mt) : '')."'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."
'; - print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { @@ -2067,7 +2067,7 @@ if ($action == 'create' && $usercancreate) if ($action == 'clone') { // Create an array for form $formquestion = array( - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=3)')) + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)')) ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } From 1e6273b92dd85f36bb9319a0404f54d648f81975 Mon Sep 17 00:00:00 2001 From: "Abdessalam@MEGALOGI" Date: Wed, 15 Jul 2020 20:21:27 +0100 Subject: [PATCH 16/24] Update card.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La description d'un produit/service libre (HTML) d'un devis est formatée en texte simple. --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 8f743015f06..e07f69ea5dc 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -822,7 +822,7 @@ if (empty($reshook)) elseif ($action == 'addline' && $usercancreate) { // Set if we used free entry or predefined product $predef = ''; - $product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : ''); + $product_desc = (GETPOST('dp_desc', 'none') ?GETPOST('dp_desc', 'none') : ''); $price_ht = GETPOST('price_ht'); $price_ht_devise = GETPOST('multicurrency_price_ht'); $prod_entry_mode = GETPOST('prod_entry_mode'); From c30491284fb63f38325bae5e2d9ce3a009471a7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 18 Jul 2020 23:16:05 +0200 Subject: [PATCH 17/24] Fix phpcs --- htdocs/projet/activity/perday.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 9c80cbd602e..2c9de0fa62c 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -292,7 +292,6 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac if (count($timespent_duration) > 0) { - foreach ($timespent_duration as $key => $val) { $object->fetch($key); @@ -304,9 +303,9 @@ if ($action == 'addtime' && $user->rights->projet->lire && GETPOST('formfilterac $object->timespent_duration = $val; $object->timespent_fk_user = $usertoprocess->id; $object->timespent_note = GETPOST($key.'note'); - if (GETPOST($key."hour") != '' && GETPOST($key."hour") >= 0) // If hour was entered + if (GETPOST($key."hour", 'int') != '' && GETPOST($key."hour", 'int') >= 0) // If hour was entered { - $object->timespent_datehour = dol_mktime(GETPOST($key."hour"), GETPOST($key."min"), 0, $monthofday, $dayofday, $yearofday); + $object->timespent_datehour = dol_mktime(GETPOST($key."hour", 'int'), GETPOST($key."min", 'int'), 0, $monthofday, $dayofday, $yearofday); $object->timespent_withhour = 1; } else From 32410b59c452c3d15f978d2b4c8a89e542c98ce7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jul 2020 00:02:02 +0200 Subject: [PATCH 18/24] Code comment --- htdocs/admin/limits.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 9d0a7d57a85..21b0fc1167f 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2020 Laurent Destailleur * Copyright (C) 2009-2018 Regis Houssin * Copyright (C) 2010 Juanjo Menent * @@ -35,7 +35,8 @@ $action = GETPOST('action', 'alpha'); $currencycode = GETPOST('currencycode', 'alpha'); if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) { - $currencycode = (!empty($currencycode) ? $currencycode : $conf->currency); + // When MULTICURRENCY_USE_LIMIT_BY_CURRENCY is on, we use always a defined currency code instead of '' even for default. + $currencycode = (!empty($currencycode) ? $currencycode : $conf->currency); } $mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(!empty($currencycode) ? '_'.$currencycode : ''); From 16d486e2114ce38d34b5b8b0da9bd88a05568d7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jul 2020 01:03:37 +0200 Subject: [PATCH 19/24] FIX Setup of currency limit and accuracy --- htdocs/admin/limits.php | 43 +++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 21b0fc1167f..4da340e588c 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -44,6 +44,11 @@ $mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(!empty($currencycode) ? '_'.$curr $mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(!empty($currencycode) ? '_'.$currencycode : ''); $mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(!empty($currencycode) ? '_'.$currencycode : ''); +$valmainmaxdecimalsunit = GETPOST($mainmaxdecimalsunit, 'int'); +$valmainmaxdecimalstot = GETPOST($mainmaxdecimalstot, 'int'); +$valmainmaxdecimalsshown = GETPOST($mainmaxdecimalsshown, 'int'); +$valmainroundingruletot = price2num(GETPOST($mainroundingruletot, 'alpha')); + if ($action == 'update') { $error = 0; @@ -65,9 +70,9 @@ if ($action == 'update') setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors'); } - if ($_POST[$mainroundingruletot]) + if ($valmainroundingruletot) { - if ($_POST[$mainroundingruletot] * pow(10, $_POST[$mainmaxdecimalstot]) < 1) + if ($valmainroundingruletot * pow(10, $valmainmaxdecimalstot) < 1) { $langs->load("errors"); $error++; @@ -77,11 +82,11 @@ if ($action == 'update') if (!$error) { - dolibarr_set_const($db, $mainmaxdecimalsunit, $_POST[$mainmaxdecimalsunit], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, $mainmaxdecimalstot, $_POST[$mainmaxdecimalstot], 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, $mainmaxdecimalsshown, $_POST[$mainmaxdecimalsshown], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $mainmaxdecimalsunit, $valmainmaxdecimalsunit, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $mainmaxdecimalstot, $valmainmaxdecimalstot, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $mainmaxdecimalsshown, $valmainmaxdecimalsshown, 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, $mainroundingruletot, $_POST[$mainroundingruletot], 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, $mainroundingruletot, $valmainroundingruletot, 'chaine', 0, '', $conf->entity); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(!empty($currencycode) ? '¤cycode='.$currencycode : '')); exit; @@ -236,9 +241,9 @@ if (empty($mysoc->country_code)) // Add vat rates examples specific to country $vat_rates = array(); - $sql = "SELECT taux as vat_rate"; + $sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; - $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$mysoc->country_code."' AND t.taux <> 0"; + $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$mysoc->country_code."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)"; $sql .= " ORDER BY t.taux ASC"; $resql = $db->query($sql); if ($resql) @@ -249,23 +254,31 @@ if (empty($mysoc->country_code)) for ($i = 0; $i < $num; $i++) { $obj = $db->fetch_object($resql); - $vat_rates[$i] = $obj->vat_rate; + $vat_rates[] = array('vat_rate'=>$obj->vat_rate, 'code'=>$obj->vat_code, 'localtax_rate1'=>$obj->localtax_rate1, 'locltax_rate2'=>$obj->localtax_rate2); } } } else dol_print_error($db); if (count($vat_rates)) { - foreach ($vat_rates as $vat) + foreach ($vat_rates as $vatarray) { + $vat = $vatarray['vat_rate']; for ($qty = 1; $qty <= 2; $qty++) { + $vattxt = $vat.($vatarray['code'] ? ' ('.$vatarray['code'].')' : ''); + + $localtax_array = getLocalTaxesFromRate($vattxt, 0, $mysoc, $mysoc); + $s = 10 / 3; - $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); + $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; - print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + print ($vatarray['code'] ? ' ('.$vatarray['code'].')' : ''); + print '   ->   '.$langs->trans("TotalPriceAfterRounding").": "; + print $tmparray[0].' / '.$tmparray[1].($tmparray[9] ? '+'.$tmparray[9] : '').($tmparray[10] ? '+'.$tmparray[10] : '').' / '.$tmparray[2]; + print "
\n"; } } } else { @@ -273,15 +286,17 @@ if (empty($mysoc->country_code)) // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10) // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule. + $localtax_array = array(); + $s = 10 / 3; $qty = 1; $vat = 10; - $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); + $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; $s = 10 / 3; $qty = 2; $vat = 10; - $tmparray = calcul_price_total(1, $qty * price2num($s, 'MU'), 0, $vat, 0, 0, 0, 'HT', 0, 0, $mysoc); + $tmparray = calcul_price_total($qty, price2num($s, 'MU'), 0, $vat, -1, -1, 0, 'HT', 0, 0, $mysoc, $localtax_array); print ''.$langs->trans("UnitPriceOfProduct").": ".price2num($s, 'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; From ee74740384cdb0b63aaa31bdeea61a16c8908529 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jul 2020 01:29:42 +0200 Subject: [PATCH 20/24] FIX #14259 --- htdocs/product/class/api_products.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index b04560dab32..eb5d083b14b 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -808,7 +808,8 @@ class Products extends DolibarrApi foreach($product_fourn_list as $tmpobj) { $this->_cleanObjectDatas($tmpobj); } - //var_dump($product_fourn_list->db);exit; + + //var_dump($product_fourn_list->db);exit; $obj_ret[$obj->rowid] = $product_fourn_list; $i++; @@ -833,7 +834,7 @@ class Products extends DolibarrApi * @param string $ref Ref of element * @param string $ref_ext Ref ext of element * @param string $barcode Barcode of element - * @return array|mixed Data without useless information + * @return array|mixed Data without useless information * * @url GET {id}/purchase_prices * @@ -863,11 +864,17 @@ class Products extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } + $product_fourn_list = array(); + if ($result) { $product_fourn = new ProductFournisseur($this->db); $product_fourn_list = $product_fourn->list_product_fournisseur_price($this->product->id, '', '', 0, 0); } + foreach($product_fourn_list as $tmpobj) { + $this->_cleanObjectDatas($tmpobj); + } + return $this->_cleanObjectDatas($product_fourn_list); } @@ -1585,6 +1592,8 @@ class Products extends DolibarrApi // phpcs:enable $object = parent::_cleanObjectDatas($object); + unset($object->db); + unset($object->regeximgext); unset($object->price_by_qty); unset($object->prices_by_qty_id); From 6fdd5ea73a66e66de4c911d660c82eb2e69adc74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jul 2020 01:31:51 +0200 Subject: [PATCH 21/24] Not required --- htdocs/product/class/api_products.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index eb5d083b14b..7fea66e325e 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1592,8 +1592,6 @@ class Products extends DolibarrApi // phpcs:enable $object = parent::_cleanObjectDatas($object); - unset($object->db); - unset($object->regeximgext); unset($object->price_by_qty); unset($object->prices_by_qty_id); From 48adeb9dd751e5818e7af3f540f04af617e95fc0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jul 2020 01:38:38 +0200 Subject: [PATCH 22/24] FIX #14256 --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index e1a69a1facc..82a0f11e893 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -250,7 +250,10 @@ INSERT INTO llx_c_ticket_resolution (code, pos, label, active, use_default, desc DELETE FROM llx_const WHERE name = __ENCRYPT('DONATION_ART885')__; -ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0; +-- VMYSQL4.1 ALTER TABLE llx_extrafields MODIFY COLUMN printable integer DEFAULT 0; +-- VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN printable DROP DEFAULT; +-- VPGSQL8.2 ALTER TABLE llx_extrafields MODIFY COLUMN printable integer USING printable::integer; +-- VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN printable SET DEFAULT 0; ALTER TABLE llx_extrafields ADD COLUMN printable integer DEFAULT 0; UPDATE llx_const SET name = 'INVOICE_USE_RETAINED_WARRANTY' WHERE name = 'INVOICE_USE_SITUATION_RETAINED_WARRANTY'; From f26a64fb88ef6326abfac0d2148f653fe3e9f3bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jul 2020 01:47:17 +0200 Subject: [PATCH 23/24] FIX If using a rounding step, localtax1+2 not included in total --- htdocs/admin/limits.php | 49 ----------------------------------- htdocs/core/lib/price.lib.php | 4 +-- 2 files changed, 2 insertions(+), 51 deletions(-) diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 4da340e588c..caf2192a9a3 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -302,55 +302,6 @@ if (empty($mysoc->country_code)) print " - ".$langs->trans("VAT").": ".$vat.'%'; print '   ->   '.$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; } - - // Important: can debug rounding, to simulate the rounded total - /* - print '
'.$langs->trans("VATRoundedByLine").' ('.$langs->trans("DolibarrDefault").')
'; - - foreach($vat_rates as $vat) - { - for ($qty=1; $qty<=2; $qty++) - { - $s1=10/3; - $s2=2/7; - - // Round by line - $tmparray1=calcul_price_total(1,$qty*price2num($s1,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc); - $tmparray2=calcul_price_total(1,$qty*price2num($s2,'MU'),0,$vat,0,0,0,'HT',0, 0,$mysoc); - $total_ht = $tmparray1[0] + $tmparray2[0]; - $total_tva = $tmparray1[1] + $tmparray2[1]; - $total_ttc = $tmparray1[2] + $tmparray2[2]; - - print $langs->trans("UnitPriceOfProduct").": ".(price2num($s1,'MU') + price2num($s2,'MU')); - print " x ".$langs->trans("Quantity").": ".$qty; - print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."
\n"; - } - } - - print '
'.$langs->trans("VATRoundedOnTotal").'
'; - - foreach($vat_rates as $vat) - { - for ($qty=1; $qty<=2; $qty++) - { - $s1=10/3; - $s2=2/7; - - // Global round - $subtotal_ht = (($qty*price2num($s1,'MU')) + ($qty*price2num($s2,'MU'))); - $tmparray3=calcul_price_total(1,$subtotal_ht,0,$vat,0,0,0,'HT',0, 0,$mysoc); - $total_ht = $tmparray3[0]; - $total_tva = $tmparray3[1]; - $total_ttc = $tmparray3[2]; - - print $langs->trans("UnitPriceOfProduct").": ".price2num($s1+$s2,'MU'); - print " x ".$langs->trans("Quantity").": ".$qty; - print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."
\n"; - } - } - */ } // End of page diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index c06c4431562..81c62958418 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -351,17 +351,17 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt { $result[0] = round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[2] = price2num($result[0] + $result[1], 'MT'); $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; + $result[2] = price2num($result[0] + $result[1] + $result[9] + $result[10], 'MT'); } else { $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; $result[2] = round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; - $result[0] = price2num($result[2] - $result[1], 'MT'); $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; + $result[0] = price2num($result[2] - $result[1] - $result[9] - $result[10], 'MT'); } } From 521c4679d991d2c8802bac02a8b097a7988f59ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Jul 2020 01:52:30 +0200 Subject: [PATCH 24/24] FIX #14241 Mysql 8 compatibility --- htdocs/core/db/mysqli.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 9c023a05478..719e34c5df9 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -448,8 +448,9 @@ class DoliDBMysqli extends DoliDB 1215 => 'DB_ERROR_CANNOT_ADD_FOREIGN_KEY_CONSTRAINT', 1216 => 'DB_ERROR_NO_PARENT', 1217 => 'DB_ERROR_CHILD_EXISTS', - 1396 => 'DB_ERROR_USER_ALREADY_EXISTS', // When creating user already existing - 1451 => 'DB_ERROR_CHILD_EXISTS' + 1396 => 'DB_ERROR_USER_ALREADY_EXISTS', // When creating a user that already existing + 1451 => 'DB_ERROR_CHILD_EXISTS', + 1826 => 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' ); if (isset($errorcode_map[$this->db->errno])) {