From 6c8293612d807d6eae8b9fd8daa45f7d962d96c1 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 26 Mar 2021 16:41:48 +0100 Subject: [PATCH 001/135] 13.0 --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 371c8be2f5e..18ae79180a0 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,10 @@ htdocs/includes/squizlabs/ htdocs/includes/webmozart/ htdocs/.well-known/apple-developer-merchantid-domain-association + +cyberoffice/ +mycyberoffice/ + # Node Modules build/yarn-error.log build/node_modules/ From 63d7698b43b7ffd2be954bfbd0930428b6030481 Mon Sep 17 00:00:00 2001 From: Robin Date: Fri, 16 Apr 2021 15:26:29 +0200 Subject: [PATCH 002/135] ADD company option for disable Workforce --- htdocs/societe/card.php | 43 ++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 66b5f68564e..512c66f9ddd 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1459,15 +1459,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } // Type - Workforce/Staff - print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"' : '').'>'."\n"; + print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'."\n"; $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam, '', 1); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print ''; - if ($conf->browser->layout == 'phone') print ''; - print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"' : '').'>'; - print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); - if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) + { + print ''; + if ($conf->browser->layout == 'phone') print ''; + print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"' : '').'>'; + print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); + if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + else + { + print ''; + } print ''; // Legal Form @@ -2081,14 +2088,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; // Type - Workforce/Staff - print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''; + print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'; print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - print ''; - if ($conf->browser->layout == 'phone') print ''; - print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).''; - print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) + { + print ''; + if ($conf->browser->layout == 'phone') print ''; + print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).''; + print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + else + { + print ''; + } print ''; // Juridical type @@ -2494,7 +2508,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; // Workforce/Staff - print ''.$langs->trans("Workforce").''.$object->effectif.''; + if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) + { + print ''.$langs->trans("Workforce").''.$object->effectif.''; + } print ''; print ''; From f8fcf7c16b68fa4fe4bc80820be42808b5826df3 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 16 Apr 2021 16:55:19 +0200 Subject: [PATCH 003/135] FIX : type link extrafield case for advanced target emailing --- htdocs/comm/mailing/class/advtargetemailing.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 6987a27dacd..ff2e056344c 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -640,6 +640,10 @@ class AdvanceTargetingMailing extends CommonObject if ($arrayquery['options_'.$key]!=''){ $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")"; } + } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') { + if ($arrayquery['options_'.$key] > 0){ + $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")"; + } } else { if (is_array($arrayquery['options_'.$key])) { $sqlwhere[]= " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))"; @@ -666,7 +670,6 @@ class AdvanceTargetingMailing extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $this->thirdparty_lines[$i] = $obj->rowid; $i++; From 37f44f4a07d05bd25de1e7d4aa6a776ec52c9d9f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 16 Apr 2021 14:58:57 +0000 Subject: [PATCH 004/135] Fixing style errors. --- htdocs/comm/mailing/class/advtargetemailing.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index ff2e056344c..3a8a9396d29 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -643,7 +643,7 @@ class AdvanceTargetingMailing extends CommonObject } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') { if ($arrayquery['options_'.$key] > 0){ $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")"; - } + } } else { if (is_array($arrayquery['options_'.$key])) { $sqlwhere[]= " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))"; From 5b6439ca5eb742a41d13a40fbe1f33b00a5817f2 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 19 Apr 2021 09:15:47 +0200 Subject: [PATCH 005/135] FIX : cast int --- htdocs/comm/mailing/class/advtargetemailing.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index ff2e056344c..730ca263f1d 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -638,7 +638,7 @@ class AdvanceTargetingMailing extends CommonObject } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') { if ($arrayquery['options_'.$key]!=''){ - $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")"; + $sqlwhere[]= " (te.".$key." = ".((int)$arrayquery['options_'.$key]).")"; } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') { if ($arrayquery['options_'.$key] > 0){ From 8c428081ab94113a19ae70e0b1d8b8be4eeab84c Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 19 Apr 2021 09:17:33 +0200 Subject: [PATCH 006/135] FIX : test on link type --- 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 4356039d080..bb472753204 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -638,11 +638,11 @@ class AdvanceTargetingMailing extends CommonObject } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') { if ($arrayquery['options_'.$key]!=''){ - $sqlwhere[]= " (te.".$key." = ".((int)$arrayquery['options_'.$key]).")"; + $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")"; } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') { if ($arrayquery['options_'.$key] > 0){ - $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")"; + $sqlwhere[]= " (te.".$key." = ".((int)$arrayquery['options_'.$key]).")"; } } else { if (is_array($arrayquery['options_'.$key])) { From 318a783237afa2c4c06226d282f28bcaf1cb7e31 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 19 Apr 2021 07:19:45 +0000 Subject: [PATCH 007/135] Fixing style errors. --- htdocs/comm/mailing/class/advtargetemailing.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index bb472753204..cb539768cf9 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -642,7 +642,7 @@ class AdvanceTargetingMailing extends CommonObject } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') { if ($arrayquery['options_'.$key] > 0){ - $sqlwhere[]= " (te.".$key." = ".((int)$arrayquery['options_'.$key]).")"; + $sqlwhere[]= " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")"; } } else { if (is_array($arrayquery['options_'.$key])) { From a6c6f9eb08443c2dd4e0c4e7568573ed08002521 Mon Sep 17 00:00:00 2001 From: Pierre Payet Date: Mon, 19 Apr 2021 10:20:51 +0200 Subject: [PATCH 008/135] add missing printFieldListFrom hook --- htdocs/fichinter/list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index d054f5e5bcc..d690feb7407 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -223,6 +223,10 @@ if (!empty($conf->contrat->enabled)) { } if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; if (!$user->rights->societe->client->voir && empty($socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE f.entity IN (".getEntity('intervention').")"; From 81907191ca3e75f57d029966b46136b4c477b16c Mon Sep 17 00:00:00 2001 From: altairis-noe Date: Tue, 20 Apr 2021 10:17:08 +0200 Subject: [PATCH 009/135] product card typo --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 094ce8670a9..66f4b66aa75 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -894,7 +894,7 @@ if (empty($reshook)) { $result = $facture->addline( $desc, $pu_ht, - price2nm(GETPOST('qty'), 'MS'), + price2num(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, $localtax2_tx, From 53a89180d910e9fdfedb95eda2653c75b183558c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 20 Apr 2021 11:22:12 +0200 Subject: [PATCH 010/135] Update element.php merging by - if (!empty($conf->facture->enabled)) - if (!empty($conf->loan->enabled)) --- htdocs/projet/element.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 95c348a7e09..a6e3af11979 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -41,8 +41,6 @@ if (!empty($conf->propal->enabled)) { } if (!empty($conf->facture->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -} -if (!empty($conf->facture->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; } if (!empty($conf->commande->enabled)) { @@ -80,8 +78,6 @@ if (!empty($conf->don->enabled)) { } if (!empty($conf->loan->enabled)) { require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; -} -if (!empty($conf->loan->enabled)) { require_once DOL_DOCUMENT_ROOT.'/loan/class/loanschedule.class.php'; } if (!empty($conf->stock->enabled)) { From 3a1f70fe348082167469209bc8b8d2cad2fb3fb7 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 20 Apr 2021 11:31:45 +0200 Subject: [PATCH 011/135] Update bom_agenda.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; --- htdocs/bom/bom_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index dc3421dea0c..0f18c39d2af 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -126,7 +126,7 @@ $form = new Form($db); if ($object->id > 0) { $title = $langs->trans("Agenda"); //if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; - $help_url = ''; + $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; llxHeader('', $title, $help_url); if (!empty($conf->notification->enabled)) { From cce6224c910740941f2e5ee74820100d33675c74 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 20 Apr 2021 11:33:47 +0200 Subject: [PATCH 012/135] Update bom_card.php $help_url ='EN:Module_BOM'; llxHeader('', $title, $help_url); --- htdocs/bom/bom_card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 37ec67e1ba3..ae35eae14f4 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -241,8 +241,8 @@ $formfile = new FormFile($db); $title = $langs->trans('BOM'); - -llxHeader('', $title, ''); +$help_url ='EN:Module_BOM'; +llxHeader('', $title, $help_url); // Example : Adding jquery code print '"; // Start "Add new file" area $nameforformuserfile = 'formuserfileecm'; @@ -139,22 +154,26 @@ if ($action == 'delete_section') { // End confirm if ($action == 'confirmconvertimgwebp') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$website->ref, $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); + if ($module == 'medias') { + print $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$website->ref.'&dir='.$_GET['dir'], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); + } else { + print $form->formconfirm($_SERVER["PHP_SELF"].'?dir='.$_GET['dir'], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); + } $action = 'file_manager'; } if ($action == 'convertimgwebp' && $permtoadd) { if ($module == 'medias') { - $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/image/'.$websitekey.'/'; + $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.$_GET['dir']; } else { - $imagefolder = $conf->ecm->dir_output; + $imagefolder = $conf->ecm->dir_output.'/'.$_GET['dir']; } include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; $regeximgext = getListOfPossibleImageExt(); - $filelist = dol_dir_list($imagefolder, "all", 1, $regeximgext); + $filelist = dol_dir_list($imagefolder, "all", 0, $regeximgext); foreach ($filelist as $filename) { $filepath = $filename['fullname']; From 09d68dd7a649a4d8e84461ac24c852393d0feb15 Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 26 Apr 2021 17:00:53 +0200 Subject: [PATCH 058/135] fix the productCombination class on updatePrice --- htdocs/variants/class/ProductCombination.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 9152336bbe4..d01fd5c37c7 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -534,7 +534,7 @@ class ProductCombination $new_price += $variation_price; } - $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq); + $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq,0, array(),$parent->default_vat_code); } } } else { From 8d07b43ccd9f19b3ea47d0fe7212e0b8049e274f Mon Sep 17 00:00:00 2001 From: jpb Date: Mon, 26 Apr 2021 17:05:21 +0200 Subject: [PATCH 059/135] space stickler --- htdocs/variants/class/ProductCombination.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index d01fd5c37c7..51499ead88d 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -534,7 +534,7 @@ class ProductCombination $new_price += $variation_price; } - $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq,0, array(),$parent->default_vat_code); + $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq,0, array(), $parent->default_vat_code); } } } else { From a8136a00b1933b8891e3e28b416767aedabccde3 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 26 Apr 2021 15:07:41 +0000 Subject: [PATCH 060/135] Fixing style errors. --- htdocs/variants/class/ProductCombination.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index 51499ead88d..bc479b68653 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -534,7 +534,7 @@ class ProductCombination $new_price += $variation_price; } - $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq,0, array(), $parent->default_vat_code); + $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code); } } } else { From 9c46b234cf20fde86279708db5002a9a62040065 Mon Sep 17 00:00:00 2001 From: kamel Date: Mon, 26 Apr 2021 17:43:27 +0200 Subject: [PATCH 061/135] FIX Supplier invoices (deposit, multicurency in lines) --- htdocs/core/class/discount.class.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 105 +++++++++++++++--- htdocs/fourn/class/paiementfourn.class.php | 61 +++++++++- htdocs/fourn/facture/card.php | 6 +- .../install/mysql/migration/13.0.0-14.0.0.sql | 2 + .../tables/llx_facture_fourn_det.key.sql | 1 + .../mysql/tables/llx_facture_fourn_det.sql | 1 + 7 files changed, 160 insertions(+), 18 deletions(-) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 63ef3dc1153..32d7faa1557 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -141,7 +141,7 @@ class DiscountAbsolute $sql .= " fsup.ref as ref_invoice_supplier_source, fsup.type as type_invoice_supplier_source"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as fsup ON sr.fk_invoice_supplier_source = fsup.rowid"; $sql .= " WHERE sr.entity IN (".getEntity('invoice').")"; if ($rowid) { $sql .= " AND sr.rowid=".((int) $rowid); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 8245e8ec1cc..b8d46d9bf9d 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -36,7 +36,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php'; require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -501,8 +500,8 @@ class FactureFournisseur extends CommonInvoice if (count($this->lines) && is_object($this->lines[0])) { // If this->lines is array of InvoiceLines (preferred mode) dol_syslog("There is ".count($this->lines)." lines that are invoice lines objects"); foreach ($this->lines as $i => $val) { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code)'; - $sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).')'; + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code, fk_remise_except)'; + $sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).','.($this->lines[$i]->fk_remise_except > 0 ? $this->lines[$i]->fk_remise_except : 'NULL').')'; $resql_insert = $this->db->query($sql); if ($resql_insert) { @@ -546,8 +545,8 @@ class FactureFournisseur extends CommonInvoice $line = (object) $line; } - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code)'; - $sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).')'; + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn, special_code, fk_remise_except)'; + $sql .= ' VALUES ('.$this->id.','.intval($this->lines[$i]->special_code).','.($this->lines[$i]->fk_remise_except > 0 ? $this->lines[$i]->fk_remise_except : 'NULL').')'; $resql_insert = $this->db->query($sql); if ($resql_insert) { @@ -797,7 +796,7 @@ class FactureFournisseur extends CommonInvoice $this->lines = array(); $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; - $sql .= ', f.localtax1_tx, f.localtax2_tx, f.localtax1_type, f.localtax2_type, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn '; + $sql .= ', f.localtax1_tx, f.localtax2_tx, f.localtax1_type, f.localtax2_type, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn, f.fk_remise_except'; $sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; $sql .= ', f.fk_code_ventilation, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc'; @@ -841,6 +840,7 @@ class FactureFournisseur extends CommonInvoice $line->localtax2_type = $obj->localtax2_type; $line->qty = $obj->qty; $line->remise_percent = $obj->remise_percent; + $line->fk_remise_except = $obj->fk_remise_except; $line->tva = $obj->total_tva; // deprecated $line->total_ht = $obj->total_ht; $line->total_ttc = $obj->total_ttc; @@ -1772,13 +1772,14 @@ class FactureFournisseur extends CommonInvoice * @param string $ref_supplier Supplier ref * @param string $special_code Special code * @param int $fk_parent_line Parent line id + * @param int $fk_remise_except Id discount used * @return int >0 if OK, <0 if KO */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0) + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0, $fk_remise_except = 0) { global $langs, $mysoc, $conf; - dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG); + dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit,fk_remise_except=$fk_remise_except", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; if ($this->statut == self::STATUS_DRAFT) { @@ -1957,6 +1958,7 @@ class FactureFournisseur extends CommonInvoice $this->line->ventil = $ventil; $this->line->rang = $rang; $this->line->info_bits = $info_bits; + $this->line->fk_remise_except = $fk_remise_except; $this->line->special_code = ((string) $special_code != '' ? $special_code : $this->special_code); $this->line->fk_parent_line = $fk_parent_line; @@ -2677,10 +2679,10 @@ class FactureFournisseur extends CommonInvoice $this->multicurrency_tx = 1; $this->multicurrency_code = $conf->currency; + $xnbp = 0; if (empty($option) || $option != 'nolines') { // Lines $nbp = 5; - $xnbp = 0; while ($xnbp < $nbp) { $line = new SupplierInvoiceLine($this->db); $line->desc = $langs->trans("Description")." ".$xnbp; @@ -2774,7 +2776,7 @@ class FactureFournisseur extends CommonInvoice */ public function createFromClone(User $user, $fromid, $invertdetail = 0) { - global $langs; + global $conf, $langs; $error = 0; @@ -3133,6 +3135,12 @@ class SupplierInvoiceLine extends CommonObjectLine */ public $info_bits; + /** + * Link to line into llx_remise_except + * @var int + */ + public $fk_remise_except; + /** * @var int ID */ @@ -3189,7 +3197,7 @@ class SupplierInvoiceLine extends CommonObjectLine public function fetch($rowid) { $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx'; - $sql .= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; + $sql .= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2, f.fk_remise_except'; $sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc'; $sql .= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc'; @@ -3232,6 +3240,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->qty = $obj->qty; $this->remise_percent = $obj->remise_percent; + $this->fk_remise_except = $obj->fk_remise_except; $this->tva = $obj->total_tva; // deprecated $this->total_ht = $obj->total_ht; $this->total_tva = $obj->total_tva; @@ -3348,6 +3357,22 @@ class SupplierInvoiceLine extends CommonObjectLine $this->localtax2_tx = 0; } + if (empty($this->pa_ht)) { + $this->pa_ht = 0; + } + if (empty($this->multicurrency_subprice)) { + $this->multicurrency_subprice = 0; + } + if (empty($this->multicurrency_total_ht)) { + $this->multicurrency_total_ht = 0; + } + if (empty($this->multicurrency_total_tva)) { + $this->multicurrency_total_tva = 0; + } + if (empty($this->multicurrency_total_ttc)) { + $this->multicurrency_total_ttc = 0; + } + $this->db->begin(); if (empty($this->fk_product)) { @@ -3371,6 +3396,8 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", pu_ttc = ".price2num($this->pu_ttc); $sql .= ", qty = ".price2num($this->qty); $sql .= ", remise_percent = ".price2num($this->remise_percent); + if ($this->fk_remise_except) $sql.= ", fk_remise_except=".$this->fk_remise_except; + else $sql.= ", fk_remise_except=null"; $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; $sql .= ", tva_tx = ".price2num($this->tva_tx); $sql .= ", localtax1_tx = ".price2num($this->localtax1_tx); @@ -3442,7 +3469,7 @@ class SupplierInvoiceLine extends CommonObjectLine */ public function insert($notrigger = 0) { - global $user, $conf; + global $user, $conf, $langs; $error = 0; @@ -3533,7 +3560,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' (fk_facture_fourn, fk_parent_line, label, description, ref, qty,'; $sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,'; - $sql .= ' fk_product, product_type, remise_percent, pu_ht, pu_ttc,'; + $sql .= ' fk_product, product_type, remise_percent, fk_remise_except, pu_ht, pu_ttc,'; $sql .= ' date_start, date_end, fk_code_ventilation, rang, special_code,'; $sql .= ' info_bits, total_ht, tva, total_ttc, total_localtax1, total_localtax2, fk_unit'; $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; @@ -3554,6 +3581,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ' '.(!empty($this->fk_product) ? $this->fk_product : "null").','; $sql .= " ".$this->product_type.","; $sql .= " ".price2num($this->remise_percent).","; + $sql .= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; $sql .= " ".price2num($this->subprice).","; $sql .= " ".(!empty($this->qty) ?price2num($this->total_ttc / $this->qty) : price2num($this->total_ttc)).","; $sql .= " ".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null").","; @@ -3588,6 +3616,57 @@ class SupplierInvoiceLine extends CommonObjectLine } } + // Si fk_remise_except defini, on lie la remise a la facture + // ce qui la flague comme "consommee". + if ($this->fk_remise_except) + { + $discount=new DiscountAbsolute($this->db); + $result=$discount->fetch($this->fk_remise_except); + if ($result >= 0) + { + // Check if discount was found + if ($result > 0) + { + // Check if discount not already affected to another invoice + if ($discount->fk_facture_line > 0) + { + if (empty($noerrorifdiscountalreadylinked)) + { + $this->error=$langs->trans("ErrorDiscountAlreadyUsed", $discount->id); + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); + $this->db->rollback(); + return -3; + } + } + else + { + $result=$discount->link_to_invoice($this->rowid, 0); + if ($result < 0) + { + $this->error=$discount->error; + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); + $this->db->rollback(); + return -3; + } + } + } + else + { + $this->error=$langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); + $this->db->rollback(); + return -3; + } + } + else + { + $this->error=$discount->error; + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); + $this->db->rollback(); + return -3; + } + } + if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('LINEBILL_SUPPLIER_CREATE', $user); diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 9f17f522bdd..9c67f34fecf 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -230,7 +230,66 @@ class PaiementFourn extends Paiement $alreadypayed = price2num($paiement + $creditnotes + $deposits, 'MT'); $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); if ($remaintopay == 0) { - $result = $invoice->setPaid($user, '', ''); + // If invoice is a down payment, we also convert down payment to discount + if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT) { + $amount_ht = $amount_tva = $amount_ttc = array(); + $multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array(); + + // Insert one discount by VAT rate category + require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php'; + $discount = new DiscountAbsolute($this->db); + $discount->fetch('', $invoice->id); + if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here) + $discount->discount_type = 1; // Supplier discount + $discount->description = '(DEPOSIT)'; + $discount->fk_soc = $invoice->socid; + $discount->fk_invoice_supplier_source = $invoice->id; + + // Loop on each vat rate + $i = 0; + foreach ($invoice->lines as $line) { + if ($line->total_ht != 0) { // no need to create discount if amount is null + $amount_ht[$line->tva_tx] += $line->total_ht; + $amount_tva[$line->tva_tx] += $line->total_tva; + $amount_ttc[$line->tva_tx] += $line->total_ttc; + $multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht; + $multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva; + $multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc; + $i++; + } + } + + foreach ($amount_ht as $tva_tx => $xxx) { + $discount->amount_ht = abs($amount_ht[$tva_tx]); + $discount->amount_tva = abs($amount_tva[$tva_tx]); + $discount->amount_ttc = abs($amount_ttc[$tva_tx]); + $discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]); + $discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]); + $discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]); + $discount->tva_tx = abs($tva_tx); + + $result = $discount->create($user); + if ($result < 0) { + $error++; + break; + } + } + } + + if ($error) { + setEventMessages($discount->error, $discount->errors, 'errors'); + $error++; + } + } + + // Set invoice to paid + if (!$error) { + $result = $invoice->set_paid($user, '', ''); + if ($result < 0) { + $this->error = $invoice->error; + $error++; + } + } } else { dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing."); } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index e59e4583e72..5601151fa22 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1222,7 +1222,7 @@ if (empty($reshook)) { // Edit line $db->begin(); - $object->fetch($id); + if (! $object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); @@ -1271,7 +1271,7 @@ if (empty($reshook)) { $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty); $remise_percent = price2num(GETPOST('remise_percent'), 2); - $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU'); + $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'MU'); // Extrafields Lines $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -1337,7 +1337,7 @@ if (empty($reshook)) { $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); - $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); + $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'MU', 2); // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index e762ddd94e4..09d3fd11c50 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -436,3 +436,5 @@ ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1; +ALTER TABLE llx_facture_fourn_det ADD COLUMN fk_remise_except integer DEFAULT NULL after remise_percent; +ALTER TABLE llx_facture_fourn_det ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_except, fk_facture_fourn); diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.key.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.key.sql index ac261a4c3f4..c454ea1d62a 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det.key.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.key.sql @@ -23,6 +23,7 @@ ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_facture (fk_facture_fourn); ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_product (fk_product); ALTER TABLE llx_facture_fourn_det ADD INDEX idx_facture_fourn_det_fk_code_ventilation (fk_code_ventilation); +ALTER TABLE llx_facture_fourn_det ADD UNIQUE INDEX uk_fk_remise_except (fk_remise_except, fk_facture_fourn); ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_facture FOREIGN KEY (fk_facture_fourn) REFERENCES llx_facture_fourn (rowid); ALTER TABLE llx_facture_fourn_det ADD CONSTRAINT fk_facture_fourn_det_fk_unit FOREIGN KEY (fk_unit) REFERENCES llx_c_units (rowid); diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql index 08d9d944002..40b613d4ac5 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql @@ -31,6 +31,7 @@ create table llx_facture_fourn_det pu_ttc double(24,8), -- unit price with tax qty real, -- quantity of product/service remise_percent real DEFAULT 0, -- % de la remise ligne (exemple 20%) + fk_remise_except integer NULL, -- Lien vers table des remises fixes vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here. tva_tx double(6,3), -- TVA taux product/service localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate From 9f3bcbc39d4498676ab3213c7d3c190da496258c Mon Sep 17 00:00:00 2001 From: kamel Date: Mon, 26 Apr 2021 17:48:42 +0200 Subject: [PATCH 062/135] Fix Stickler CI --- .../fourn/class/fournisseur.facture.class.php | 58 ++++++++----------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b8d46d9bf9d..dd1ea179553 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3618,50 +3618,38 @@ class SupplierInvoiceLine extends CommonObjectLine // Si fk_remise_except defini, on lie la remise a la facture // ce qui la flague comme "consommee". - if ($this->fk_remise_except) - { - $discount=new DiscountAbsolute($this->db); - $result=$discount->fetch($this->fk_remise_except); - if ($result >= 0) - { + if ($this->fk_remise_except) { + $discount = new DiscountAbsolute($this->db); + $result = $discount->fetch($this->fk_remise_except); + if ($result >= 0) { // Check if discount was found - if ($result > 0) - { + if ($result > 0) { // Check if discount not already affected to another invoice - if ($discount->fk_facture_line > 0) - { - if (empty($noerrorifdiscountalreadylinked)) - { - $this->error=$langs->trans("ErrorDiscountAlreadyUsed", $discount->id); - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); + if ($discount->fk_facture_line > 0) { + if (empty($noerrorifdiscountalreadylinked)) { + $this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id); + dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); + $this->db->rollback(); + return -3; + } + } else { + $result = $discount->link_to_invoice($this->rowid, 0); + if ($result < 0) { + $this->error = $discount->error; + dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); $this->db->rollback(); return -3; } } - else - { - $result=$discount->link_to_invoice($this->rowid, 0); - if ($result < 0) - { - $this->error=$discount->error; - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); - $this->db->rollback(); - return -3; - } - } - } - else - { - $this->error=$langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); + } else { + $this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); + dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); $this->db->rollback(); return -3; } - } - else - { - $this->error=$discount->error; - dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); + } else { + $this->error = $discount->error; + dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); $this->db->rollback(); return -3; } From 8f7dd6211e9dee7b6f97d951749e40ed35704d72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Apr 2021 19:55:46 +0200 Subject: [PATCH 063/135] fix css --- htdocs/contrat/note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index bd96eac7b0d..eab56b97a16 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -180,7 +180,7 @@ if ($id > 0 || !empty($ref)) { //print '
'; - $cssclass='fieldtitle'; + $cssclass='titlefield'; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; print dol_get_fiche_end(); From a29c26f299f349d00980e6f380bd0acc0ec2c598 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Apr 2021 21:07:46 +0200 Subject: [PATCH 064/135] Fix amount chosen lost --- htdocs/salaries/paiement_salary.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index 5ab67c71c0e..a266a2ed88b 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -286,9 +286,10 @@ if ($action == 'create') { if (!empty($conf->use_javascript_ajax)) { print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmount' data-rowid='".$namef."' data-value='".($objp->amount - $sumpaid)."'"); } */ - $remaintopay = $objp->amount - $sumpaid; - print ''; - print ''; + $valuetoshow = GETPOSTISSET($namef) ? GETPOST($namef) : ($objp->amount - $sumpaid); + + print ''; + print ''; } else { print '-'; } From 3d5002b8f63bdf3e518ace6ffcc31ef526331017 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Apr 2021 22:42:40 +0200 Subject: [PATCH 065/135] Update list.php --- htdocs/fichinter/list.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 3a09dab777f..77842037763 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -245,13 +245,19 @@ if (!empty($conf->contrat->enabled)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contrat as c on f.fk_contrat = c.rowid"; } -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)"; -if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)"; +} +if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; +} // Add table from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -if (!$user->rights->societe->client->voir && empty($socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->societe->client->voir && empty($socid)) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +} $sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE f.entity IN (".getEntity('intervention').")"; From fa1ad826631b58f85c1272e6df0ba079367f8fd5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Apr 2021 23:42:49 +0200 Subject: [PATCH 066/135] Fix id in comment --- htdocs/install/mysql/data/llx_10_c_regions.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 79d77e6d6af..97fca0f230b 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -100,7 +100,7 @@ insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 0 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 13, 1301, '', 0, 'Algerie'); --- Andorra Regions (id country=18) +-- Andorra Regions (id country=34) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 34, 34000, 'AD', NULL, 'Andorra'); From 5bfedbc248ca10e126dd330a35b35716f4d1a72e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 00:20:51 +0200 Subject: [PATCH 067/135] Fix regression --- htdocs/bookmarks/card.php | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index f71a750027f..198247bb355 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -153,7 +153,7 @@ if ($action == 'create') { print load_fiche_titre($langs->trans("NewBookmark")); - print dol_get_fiche_head($head, $hselected, $langs->trans("Bookmark"), 0, 'bookmark'); + print dol_get_fiche_head($head, $hselected, $langs->trans("Bookmark"), -1, 'bookmark'); print ''; @@ -171,7 +171,7 @@ if ($action == 'create') { // Owner print ''; // Position @@ -193,20 +193,8 @@ if ($action == 'create') { if ($id > 0 && !preg_match('/^add/i', $action)) { - /* - * Fact bookmark mode or visually edition - */ $object->fetch($id); - $hselected = 'card'; - $head = array( - array( - '', - $langs->trans('Card'), - 'card' - ) - ); - if ($action == 'edit') { print ''; print ''; @@ -216,7 +204,6 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { print ''; } - print dol_get_fiche_head($head, $hselected, $langs->trans("Bookmark"), -1, 'bookmark'); $linkback = ''.$langs->trans("BackToList").''; From 29b1f2b58af9febaba2d7624549494871ed25fe7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 00:48:39 +0200 Subject: [PATCH 068/135] Look and feel v14 --- htdocs/bookmarks/card.php | 23 ++++++++++++++--------- htdocs/bookmarks/list.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 1 + 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 198247bb355..207395c267b 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -46,6 +46,9 @@ $position = GETPOST("position", "int"); $backtopage = GETPOST('backtopage', 'alpha'); $object = new Bookmark($db); +if ($id > 0) { + $object->fetch($id); +} /* @@ -133,7 +136,7 @@ $form = new Form($db); $head = array(); $h = 1; -$head[$h][0] = $_SERVER["PHP_SELF"].($object->id ? 'id='.$object->id : ''); +$head[$h][0] = $_SERVER["PHP_SELF"].($object->id ? '?id='.$object->id : ''); $head[$h][1] = $langs->trans("Bookmark"); $head[$h][2] = 'card'; $h++; @@ -157,20 +160,20 @@ if ($action == 'create') { print '
'.$langs->trans("Owner").''; - print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 0, '', 0, GETPOSTISSET('userid') ? GETPOST('userid', 'int') : array($user->id), '', 0, 0, 0, '', ($user->admin) ? 1 : 0, '', 'maxwidth300'); + print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 0, '', 0, ($user->admin ? '' : array($user->id)), '', 0, 0, 0, '', ($user->admin) ? 1 : 0, '', 'maxwidth300'); print ' 
'; - print ''; + print ''; dol_set_focus('#titlebookmark'); // Url - print ''; + print ''; // Target print ''; + print ''; // Owner - print ''; @@ -193,7 +196,6 @@ if ($action == 'create') { if ($id > 0 && !preg_match('/^add/i', $action)) { - $object->fetch($id); if ($action == 'edit') { print ''; @@ -246,7 +248,10 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { if ($action == 'edit') { print 'url).'">'; } else { - print 'target ? ' target="_blank"' : '').'>'.$object->url.''; + print 'target ? ' target="_blank"' : '').'>'; + print img_picto('', 'globe', 'class="paddingright"'); + print $object->url; + print ''; } print ''; @@ -264,7 +269,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { } print ''; - print ''; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 03310c3f593..7d644d3a103 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -181,7 +181,7 @@ print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", $param, 'ali print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "b.title", "", $param, 'align="left"', $sortfield, $sortorder); print_liste_field_titre("Link", $_SERVER["PHP_SELF"], "b.url", "", $param, 'align="left"', $sortfield, $sortorder); print_liste_field_titre("Target", '', '', '', '', 'align="center"'); -print_liste_field_titre("Owner", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Visibility", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "b.dateb", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre(''); @@ -253,7 +253,7 @@ while ($i < min($num, $limit)) { $tmpuser = $cacheOfUsers[$obj->fk_user]; print $tmpuser->getNomUrl(1); } else { - print $langs->trans("Public"); + print ''.$langs->trans("Everybody").''; if (!$user->admin) { $candelete = false; $canedit = false; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 3622d77de2f..1c6f711b154 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -143,6 +143,7 @@ input { input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: var(--inputbackgroundcolor); color: var(--colortext); + border-radius: 2px; } select.vmenusearchselectcombo { background-color: unset; From f54d14bfd6f97d213eea8cfea2195d5757232577 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 01:05:14 +0200 Subject: [PATCH 069/135] Add method checkValForAPI to clean data from API input --- htdocs/api/class/api.class.php | 24 ++++++++++--------- .../action/class/api_agendaevents.class.php | 8 ++++--- .../bank/class/api_bankaccounts.class.php | 5 ++-- .../template/class/api_mymodule.class.php | 4 ++-- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 356caa24ec2..6cb40825ee7 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -73,22 +73,24 @@ class DolibarrApi } /** - * Executed method when API is called without parameter + * Check and convert a string depending on its type/name. * * Display a short message an return a http code 200 * - * @return array + * @param string $field Field name + * @param string $value Value to check/clean + * @param stdClass $object Object + * @return string Value cleaned */ - /* Disabled, most APIs does not share same signature for method index - function index() + protected function checkValForAPI($field, $value, $object) { - return array( - 'success' => array( - 'code' => 200, - 'message' => __class__.' is up and running!' - ) - ); - }*/ + // TODO Use type detected in $object->fields + if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) { + return checkVal($value, 'restricthtml'); + } else { + return checkVal($value, 'alphanohtml'); + } + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 5d57b9624e3..75b9ae355e8 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -217,7 +217,7 @@ class AgendaEvents extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->actioncomm->$field = $value; + $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); } /*if (isset($request_data["lines"])) { $lines = array(); @@ -226,6 +226,7 @@ class AgendaEvents extends DolibarrApi } $this->expensereport->lines = $lines; }*/ + if ($this->actioncomm->create(DolibarrApiAccess::$user) < 0) { throw new RestException(500, "Error creating event", array_merge(array($this->actioncomm->error), $this->actioncomm->errors)); } @@ -268,7 +269,8 @@ class AgendaEvents extends DolibarrApi if ($field == 'id') { continue; } - $this->actioncomm->$field = $value; + + $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); } if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0) { @@ -299,7 +301,7 @@ class AgendaEvents extends DolibarrApi } if (!DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) { - throw new RestException(401, "Insufficient rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id); + throw new RestException(401, "Insufficient rights to delete an Agenda Event of owner id ".$this->actioncomm->userownerid.' Your id is '.DolibarrApiAccess::$user->id); } if (!$result) { diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 8cdd33425d6..4afeac70124 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -29,7 +29,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; */ class BankAccounts extends DolibarrApi { - /** * array $FIELDS Mandatory fields, checked when creating an object */ @@ -158,7 +157,7 @@ class BankAccounts extends DolibarrApi $account = new Account($this->db); foreach ($request_data as $field => $value) { - $account->$field = $value; + $account->$field = $this->checkValForAPI($field, $value, $account); } // Date of the initial balance (required to create an account). $account->date_solde = time(); @@ -333,7 +332,7 @@ class BankAccounts extends DolibarrApi if ($field == 'id') { continue; } - $account->$field = $value; + $account->$field = $this->checkValForAPI($field, $value, $account); } if ($account->update(DolibarrApiAccess::$user) > 0) { diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 47a3ac984f9..e4b5fcca219 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -213,7 +213,7 @@ class MyModuleApi extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->myobject->$field = $value; + $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); } // Clean data @@ -255,7 +255,7 @@ class MyModuleApi extends DolibarrApi if ($field == 'id') { continue; } - $this->myobject->$field = $value; + $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); } // Clean data From d2b91e934af0dd2a745d6329f7332b5a09d15366 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 01:09:46 +0200 Subject: [PATCH 070/135] Clean code --- htdocs/comm/action/class/api_agendaevents.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 75b9ae355e8..f8b9a2a353f 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -400,7 +400,9 @@ class AgendaEvents extends DolibarrApi unset($object->civility_id); unset($object->contact); unset($object->societe); - + unset($object->demand_reason_id); + unset($object->transport_mode_id); + unset($object->region_id); unset($object->actions); unset($object->lines); From 539954f7604e191ecab4513187aa8773e6207554 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 01:12:40 +0200 Subject: [PATCH 071/135] Clean code --- htdocs/comm/action/class/api_agendaevents.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index f8b9a2a353f..68da91d6ce2 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -405,6 +405,7 @@ class AgendaEvents extends DolibarrApi unset($object->region_id); unset($object->actions); unset($object->lines); + unset($object->modelpdf); return $object; } From efbed70286656a5758bfd9be2b0c6f7b9d64e640 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 01:17:26 +0200 Subject: [PATCH 072/135] Update card.php --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 31cc5c3b6f3..8164ece1327 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -196,8 +196,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } - } // Change status of invoice - elseif ($action == 'reopen' && $usercanreopen) { + } elseif ($action == 'reopen' && $usercanreopen) { $result = $object->fetch($id); if ($object->statut == Facture::STATUS_CLOSED || ($object->statut == Facture::STATUS_ABANDONED && ($object->close_code != 'replaced' || $object->getIdReplacingInvoice() == 0)) || ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted From e9b8e817738499d9470c34bbdb54fd2955270d21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 01:45:10 +0200 Subject: [PATCH 073/135] Update advtargetemailing.class.php --- 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 cb539768cf9..b43daf4bf0c 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -641,8 +641,8 @@ class AdvanceTargetingMailing extends CommonObject $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key].")"; } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') { - if ($arrayquery['options_'.$key] > 0){ - $sqlwhere[]= " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")"; + if ($arrayquery['options_'.$key] > 0) { + $sqlwhere[]= " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")"; } } else { if (is_array($arrayquery['options_'.$key])) { From 25e3beb3eeb5e10bd15a243986e27359e99301ef Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 01:55:51 +0200 Subject: [PATCH 074/135] $object::STATUS_RESILIATE --- htdocs/public/payment/paymentok.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 6bbfd1e3b31..ecd74445311 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -394,7 +394,7 @@ if ($ispaymentok) { // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { - $result = $object->status == -2 ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible + $result = $object->status == $object::STATUS_RESILIATE ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible if ($result < 0 || empty($object->datevalid)) { $error++; $errmsg = $object->error; From 12a4bc64adb983e6a76325c8bd6183d7cde962d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 02:01:46 +0200 Subject: [PATCH 075/135] Remove $_REQUEST --- htdocs/compta/paiement/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index ff9f93bc297..680a8c501a2 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -109,14 +109,13 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture if ($object->validate($user) > 0) { $db->commit(); - + // Loop on each invoice linked to this payment to rebuild PDF if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; - if (!empty($_REQUEST['lang_id'])) - { + if (GETPOST('lang_id', 'aZ09')) { $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($_REQUEST['lang_id']); + $outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09')); } $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0; From 27aa7cdb48cb08ee3625f4e5a4042d173b6a35a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 02:08:36 +0200 Subject: [PATCH 076/135] Fix bad merge --- htdocs/compta/paiement/card.php | 2 +- htdocs/public/members/new.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 680a8c501a2..1bc1270e2d6 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -148,7 +148,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture break; } - if ($invoice->generateDocument($fac->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) { + if ($invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) { $errors++; setEventMessages($invoice->error, $invoice->errors, 'errors'); break; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 3d0ecc6fd16..cddfd0524b1 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -212,7 +212,7 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Email'))."
\n"; } elseif (GETPOST("email") && !isValidEmail(GETPOST("email"))) { - + $langs->load('errors'); + $langs->load('errors'); $error++; $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; } From 098582d7a738241d59555107e375cad5f6145e46 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 02:09:43 +0200 Subject: [PATCH 077/135] Fix bad merge --- htdocs/compta/paiement/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 17cfeaca8dc..d9a1d73ec27 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -148,7 +148,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> break; } - if ($invoice->generateDocument($fac->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) { + if ($invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) { $errors++; setEventMessage($invoice->error, $invoice->errors, 'errors'); break; From c7f38c4cf03dffac3291854ee5f0008725167648 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 02:10:52 +0200 Subject: [PATCH 078/135] Fix bad var --- htdocs/compta/paiement/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index f54417b8a6f..3f9e3551edd 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -148,7 +148,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> break; } - if ($invoice->generateDocument($fac->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) { + if ($invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) { $errors++; setEventMessage($invoice->error, $invoice->errors, 'errors'); break; From 2e9cf8d00b0c347cbc6c2bcfe94643f1be30baae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 02:15:58 +0200 Subject: [PATCH 079/135] Fix phpcs --- htdocs/compta/paiement/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 3f9e3551edd..dc892029829 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -165,7 +165,6 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> $errors++; setEventMessage($db->error, $db->errors, 'errors'); } - } if (! $errors) { From ea08dfff5a697fc1d415bb3561ff5277767336ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 02:21:02 +0200 Subject: [PATCH 080/135] Package for v14 --- build/rpm/dolibarr_fedora.spec | 2 ++ build/rpm/dolibarr_generic.spec | 5 ++++- build/rpm/dolibarr_mandriva.spec | 2 ++ build/rpm/dolibarr_opensuse.spec | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index d50c91d1f05..662c80adf6c 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -185,6 +185,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/emailcollector +%_datadir/dolibarr/htdocs/eventorganization %_datadir/dolibarr/htdocs/expedition %_datadir/dolibarr/htdocs/expensereport %_datadir/dolibarr/htdocs/exports @@ -206,6 +207,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/mrp %_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey +%_datadir/dolibarr/htdocs/partnership %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal %_datadir/dolibarr/htdocs/printing diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 4541868a04f..72cb7599b45 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -67,7 +67,8 @@ Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mbstring Requires: mysql-server, mysql Requires: php-mysqli >= 4.1.0 %endif -%endif +%endif%_datadir/dolibarr/htdocs/eventorganization + %endif # Set yes to build test package, no for release (this disable need of /usr/bin/php not found by OpenSuse) @@ -265,6 +266,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/emailcollector +%_datadir/dolibarr/htdocs/eventorganization %_datadir/dolibarr/htdocs/expedition %_datadir/dolibarr/htdocs/expensereport %_datadir/dolibarr/htdocs/exports @@ -286,6 +288,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/mrp %_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey +%_datadir/dolibarr/htdocs/partnership %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal %_datadir/dolibarr/htdocs/printing diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index d618b5729d5..a71a53e690f 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -182,6 +182,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/emailcollector +%_datadir/dolibarr/htdocs/eventorganization %_datadir/dolibarr/htdocs/expedition %_datadir/dolibarr/htdocs/expensereport %_datadir/dolibarr/htdocs/exports @@ -203,6 +204,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/mrp %_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey +%_datadir/dolibarr/htdocs/partnership %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal %_datadir/dolibarr/htdocs/printing diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index 230a8946e99..0d86e4297cc 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -193,6 +193,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/don %_datadir/dolibarr/htdocs/ecm %_datadir/dolibarr/htdocs/emailcollector +%_datadir/dolibarr/htdocs/eventorganization %_datadir/dolibarr/htdocs/expedition %_datadir/dolibarr/htdocs/expensereport %_datadir/dolibarr/htdocs/exports @@ -214,6 +215,7 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/mrp %_datadir/dolibarr/htdocs/multicurrency %_datadir/dolibarr/htdocs/opensurvey +%_datadir/dolibarr/htdocs/partnership %_datadir/dolibarr/htdocs/paybox %_datadir/dolibarr/htdocs/paypal %_datadir/dolibarr/htdocs/printing From db92de2a22874047cd444410ab3fd4d373ed6700 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 02:36:47 +0200 Subject: [PATCH 081/135] Draft and resiliated member could (re)validate --- htdocs/public/payment/paymentok.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index ecd74445311..37efcbadbd0 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -394,7 +394,7 @@ if ($ispaymentok) { // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { - $result = $object->status == $object::STATUS_RESILIATE ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible + $result = $object->status < $object::STATUS_DRAFT ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible if ($result < 0 || empty($object->datevalid)) { $error++; $errmsg = $object->error; From 5bb2531364f968ad77ac9de2cba9e6461e6d0c41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 02:52:24 +0200 Subject: [PATCH 082/135] Enhance ticket module --- htdocs/core/class/html.formticket.class.php | 14 ++++++++++---- htdocs/public/ticket/create_ticket.php | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index c5c3b38b29b..7d012077700 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -169,13 +169,15 @@ class FormTicket if ($this->withref) { // Ref $defaultref = $ticketstat->getDefaultRef(); - print '
'; + print ''; } // TITLE if ($this->withemail) { print ''; } @@ -313,7 +315,7 @@ class FormTicket if ($this->withfile == 2) { // Can add other files $out .= ''; $out .= ' '; - $out .= ''; + $out .= ''; } $out .= "\n"; @@ -453,6 +455,8 @@ class FormTicket } print ''; + print ''."\n"; + print "\n"; print "\n"; } @@ -1083,7 +1087,7 @@ class FormTicket if ($this->withfile == 2) { // Can add other files $out .= ''; $out .= ' '; - $out .= ''; + $out .= ''; } $out .= "\n"; @@ -1100,6 +1104,8 @@ class FormTicket } print "\n"; + print ''."\n"; + print "\n"; print "\n"; } diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 85b40430d4c..1d0339f83f8 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -79,6 +79,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); /* * Actions */ + $parameters = array( 'id' => $id, ); From 0a0b3f414ad691fea848cd7b96dacdbbe1e0c441 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 02:54:33 +0200 Subject: [PATCH 083/135] Fix phpcs --- htdocs/compta/paiement/card.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 1bc1270e2d6..30d2b994959 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -159,9 +159,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture } $db->free($resql); - } - else - { + } else { $errors++; setEventMessages($db->error, $db->errors, 'errors'); } From 3e013ebad0ace178de5f32fd9c31ba54163de8ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 03:16:11 +0200 Subject: [PATCH 084/135] Fix mass action delete of cron jobs --- htdocs/core/lib/functions.lib.php | 7 ++++--- htdocs/core/modules/modFacture.class.php | 2 +- htdocs/cron/list.php | 13 ++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3de1b0d8948..7559b94a740 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3542,7 +3542,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', - 'user-cog', 'website', 'workstation', + 'uncheck', 'user-cog', 'website', 'workstation', 'conferenceorbooth', 'eventorganization' ))) { $pictowithouttext = str_replace('object_', '', $pictowithouttext); @@ -3588,7 +3588,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', - 'uparrow'=>'share', 'vcard'=>'address-card', + 'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card', 'jabber'=>'comment-o', 'website'=>'globe-americas', 'workstation'=>'pallet', 'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram' @@ -3680,7 +3680,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'inventory'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944', 'other'=>'#ddd', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba', - 'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa', + 'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', + 'uncheck'=>'#800', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa', 'website'=>'#304', 'workstation'=>'#a69944' ); if (isset($arrayconvpictotocolor[$pictowithouttext])) { diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 8e9d242a6e3..01a691ed6fb 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -121,7 +121,7 @@ class modFacture extends DolibarrModules $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>1, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), - 1=>array('label'=>'SendEmailsRemindersOnDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsReminderOnDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority)', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), + 1=>array('label'=>'SendEmailsRemindersOnInvoiceDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsReminderOnDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority)', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), ); // Permissions diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index a88bcda9a66..e5d779d8e10 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -350,9 +350,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $stringcurrentdate = $langs->trans("CurrentHour").': '.dol_print_date(dol_now(), 'dayhour'); -if ($action == 'delete') { - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.$param, $langs->trans("CronDelete"), $langs->trans("CronConfirmDelete"), "confirm_delete", '', '', 1); -} if ($action == 'execute') { print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id.'&securitykey='.$securitykey.$param, $langs->trans("CronExecute"), $langs->trans("CronConfirmExecute"), "confirm_execute", '', '', 1); } @@ -362,12 +359,12 @@ $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), 'enable'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("CronStatusActiveBtn"), - 'disable'=>img_picto('', 'title_close', 'class="pictofixedwidth"').$langs->trans("CronStatusInactiveBtn"), + 'disable'=>img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans("CronStatusInactiveBtn"), ); if ($user->rights->cron->delete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (in_array($massaction, array('presend', 'predelete'))) { +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); @@ -406,6 +403,12 @@ if ($mode == 'modulesetup') { print_barre_liste($pagetitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, ($mode == 'modulesetup' ? '' : 'title_setup'), 0, $newcardbutton, '', $limit); +// Add code for pre mass action (confirmation or email presend form) +$topicmail = "SendCronRef"; +$modelmail = "cron"; +$objecttmp = new Cronjob($db); +$trackid = 'cron'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; $text = $langs->trans("HoursOnThisPageAreOnServerTZ").' '.$stringcurrentdate.'
'; if (!empty($conf->global->CRON_WARNING_DELAY_HOURS)) { From 4b204301a9ab0e67a14e90bf2d94377466215f39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 03:25:49 +0200 Subject: [PATCH 085/135] Enhance logs --- htdocs/compta/facture/class/facture.class.php | 14 ++++++++------ htdocs/core/modules/modFacture.class.php | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dfb2d5a3b52..1b0a4a768b1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4902,7 +4902,7 @@ class Facture extends CommonInvoice * @param int|string $template Name (or id) of email template (Must be a template of type 'facture_send') * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) */ - public function sendEmailsReminderOnDueDate($nbdays = 0, $paymentmode = 'all', $template = '') + public function sendEmailsRemindersOnInvoiceDueDate($nbdays = 0, $paymentmode = 'all', $template = '') { global $conf, $langs, $user; @@ -4914,12 +4914,12 @@ class Facture extends CommonInvoice if (empty($conf->facture->enabled)) { // Should not happen. If module disabled, cron job should not be visible. $langs->load("bills"); - $this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Facture")); + $this->output .= $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Facture")); return 0; } /*if (empty($conf->global->FACTURE_REMINDER_EMAIL)) { $langs->load("bills"); - $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Facture")); + $this->output .= $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Facture")); return 0; } */ @@ -4941,7 +4941,7 @@ class Facture extends CommonInvoice $sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp"; } $sql .= " WHERE f.paye = 0"; - $sql .= " AND f.date_lim_reglement = '".$this->db->idate(dol_get_first_hour(dol_time_plus_duree(dol_now(), -1 * $nbdays, 'd'), 'gmt'), 'gmt')."'"; + $sql .= " AND f.date_lim_reglement = '".$this->db->idate(dol_get_first_hour(dol_time_plus_duree($now, -1 * $nbdays, 'd'), 'gmt'), 'gmt')."'"; $sql .= " AND f.entity IN (".getEntity('facture').")"; if (!empty($paymentmode) && $paymentmode != 'all') { $sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'"; @@ -4950,6 +4950,8 @@ class Facture extends CommonInvoice $sql .= $this->db->order("date_lim_reglement", "ASC"); $resql = $this->db->query($sql); + $this->output .= 'Search unpaid invoices with due date = '.$this->db->idate(dol_get_first_hour(dol_time_plus_duree($now, -1 * $nbdays, 'd'), 'gmt'), 'gmt').'
'; + if ($resql) { while ($obj = $this->db->fetch_object($resql)) { if (!$error) { @@ -4969,7 +4971,7 @@ class Facture extends CommonInvoice $arraymessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, (is_numeric($template) ? $template : 0), 1, (is_numeric($template) ? '' : $template)); if (is_numeric($arraymessage) && $arraymessage <= 0) { $langs->load("bills"); - $this->output = $langs->trans('FailedToFindEmailTemplate', $template); + $this->output .= $langs->trans('FailedToFindEmailTemplate', $template); return 0; } @@ -5040,7 +5042,7 @@ class Facture extends CommonInvoice } if (!$error) { - $this->output = 'Nb of emails sent : '.$nbMailSend; + $this->output .= 'Nb of emails sent : '.$nbMailSend; $this->db->commit(); return 0; } else { diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 01a691ed6fb..333ef747cf2 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -121,7 +121,7 @@ class modFacture extends DolibarrModules $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>1, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), - 1=>array('label'=>'SendEmailsRemindersOnInvoiceDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsReminderOnDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority)', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), + 1=>array('label'=>'SendEmailsRemindersOnInvoiceDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsRemindersOnInvoiceDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority)', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), ); // Permissions From 758ba67adc08e0e6d93aca9ef0a28644458cc5ae Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 27 Apr 2021 10:50:45 +0200 Subject: [PATCH 086/135] Fix #17219 : new complement of PR 17161 --- htdocs/core/tpl/filemanager.tpl.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index cf00f60d31d..7c620aa404c 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -99,11 +99,13 @@ if ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm print ""; @@ -154,19 +156,23 @@ if ($action == 'delete_section') { // End confirm if ($action == 'confirmconvertimgwebp') { + $section_dir=GETPOST('section_dir', 'alpha'); + $section=GETPOST('section', 'alpha'); + $form = new Form($db); + $formquestion['section_dir']=array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); + $formquestion['section']=array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); if ($module == 'medias') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$website->ref.'&dir='.$_GET['dir'], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); - } else { - print $form->formconfirm($_SERVER["PHP_SELF"].'?dir='.$_GET['dir'], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); + $formquestion['website']=array('type'=>'hidden', 'value'=>$website->ref, 'name'=>'website'); } + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', $formquestion, "yes", 1); $action = 'file_manager'; } if ($action == 'convertimgwebp' && $permtoadd) { if ($module == 'medias') { - $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.$_GET['dir']; + $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.GETPOST('section_dir', 'alpha'); } else { - $imagefolder = $conf->ecm->dir_output.'/'.$_GET['dir']; + $imagefolder = $conf->ecm->dir_output.'/'.GETPOST('section_dir', 'alpha'); } include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; From 0d391ec185d24b99bc9773a54a30951bb2db4bc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 11:20:04 +0200 Subject: [PATCH 087/135] Show name of sitemap file --- htdocs/langs/en_US/website.lang | 2 +- htdocs/website/index.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index e70d88a3aa1..bd23bd39a5c 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -140,7 +140,7 @@ DefineListOfAltLanguagesInWebsiteProperties=Define list of all available languag GenerateSitemaps=Generate website sitemap file ConfirmGenerateSitemaps=If you confirm, you will erase the existing sitemap file... ConfirmSitemapsCreation=Confirm sitemap generation -SitemapGenerated=Sitemap file generated +SitemapGenerated=Sitemap file %s generated ImportFavicon=Favicon ErrorFaviconType=Favicon must be png ErrorFaviconSize=Favicon must be sized 16x16, 32x32 or 64x64 diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 547f6ac217a..68df5208d84 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2260,7 +2260,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $domtree->formatOutput = true; - $xmlname = 'sitemap.'.$websitekey.'.xml'; + $xmlname = 'sitemap.xml'; $sql = "SELECT wp.rowid, wp.type_container , wp.pageurl, wp.lang, wp.fk_page, wp.tms as tms,"; $sql .= " w.virtualhost, w.fk_default_home"; @@ -2396,7 +2396,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { if (!empty($conf->global->MAIN_UMASK)) { @chmod($tempdir.$xmlname, octdec($conf->global->MAIN_UMASK)); } - setEventMessages($langs->trans("SitemapGenerated"), null, 'mesgs'); + setEventMessages($langs->trans("SitemapGenerated", $xmlname), null, 'mesgs'); } else { setEventMessages($object->error, $object->errors, 'errors'); } From 071fe087fd2a953aa2109bb8f223402bba1f585b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 11:29:47 +0200 Subject: [PATCH 088/135] Fix replacement of sitemap entry in robot.txt --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 68df5208d84..e9af12a7dd6 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2414,7 +2414,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $robotsitemap = "Sitemap: ".$domainname."/".$xmlname; $result = strpos($robotcontent, 'Sitemap: '); if ($result) { - $result = preg_replace("/Sitemap.*\n/", $robotsitemap, $robotcontent); + $result = preg_replace('/Sitemap:.*/', $robotsitemap, $robotcontent); $robotcontent = $result ? $result : $robotcontent; } else { $robotcontent .= $robotsitemap."\n"; From 9941236d76acbbab2ff96fa667f2df1038a77c5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 11:47:33 +0200 Subject: [PATCH 089/135] Fix alternate into sitemap --- htdocs/website/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index e9af12a7dd6..61a62fbf8df 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2285,7 +2285,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $shortlangcode = substr($objp->lang, 0, 2); // en_US or en-US -> en } if (empty($shortlangcode)) { - $shortlangcode = substr($object->lang, 0, 2); // en_US or en-US -> en + $shortlangcode = substr($object->lang, 0, 2); // Use short lang code of website } // Forge $pageurl, adding language prefix if it is an alternative language @@ -2344,7 +2344,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $xhtmllink = $domtree->createElement('xhtml:link', ''); $xhtmllink->setAttribute("rel", "alternante"); $xhtmllink->setAttribute("hreflang", $tmpshortlangcode); - $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php')); + $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php')); $url->appendChild($xhtmllink); $alternatefound++; @@ -2367,7 +2367,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $xhtmllink = $domtree->createElement('xhtml:link', ''); $xhtmllink->setAttribute("rel", "alternate"); $xhtmllink->setAttribute("hreflang", $tmpshortlangcode); - $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $objhastrans->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$objhastrans->pageurl.'.php')); + $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $objhastrans->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$objhastrans->pageurl.'.php')); $url->appendChild($xhtmllink); $alternatefound++; From c645241327c72c813c3d651b61d7025ae88e1e87 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 27 Apr 2021 12:11:28 +0200 Subject: [PATCH 090/135] Corrections --- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/fourn/facture/card.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 9c67f34fecf..9a664489e4f 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -284,7 +284,7 @@ class PaiementFourn extends Paiement // Set invoice to paid if (!$error) { - $result = $invoice->set_paid($user, '', ''); + $result = $invoice->setPaid($user, '', ''); if ($result < 0) { $this->error = $invoice->error; $error++; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 5601151fa22..4ebd6b7d6f1 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1964,7 +1964,7 @@ if ($action == 'create') { print $desc; print ''; - if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid)))) { + if (empty($origin) || ($origin == 'order_supplier' && !empty($originid))) { // Deposit - Down payment if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { print '
'; @@ -2004,7 +2004,7 @@ if ($action == 'create') { print '
'; - if (($origin == 'propal') || ($origin == 'commande')) { + if ($origin == 'order_supplier') { print ''; print ''; From b1d8ca0701c5f0f9411ed794d430df7e640ed530 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 17:43:12 +0200 Subject: [PATCH 099/135] Fix phpcs --- htdocs/bookmarks/card.php | 1 - htdocs/compta/paiement/card.php | 87 +++++++++---------- .../compta/paiement/class/paiement.class.php | 6 +- 3 files changed, 45 insertions(+), 49 deletions(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 207395c267b..1094eabf0c6 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -196,7 +196,6 @@ if ($action == 'create') { if ($id > 0 && !preg_match('/^add/i', $action)) { - if ($action == 'edit') { print '
'; print ''; diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 8419756a127..c971ccbf4fd 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -110,61 +110,58 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture $db->commit(); // Loop on each invoice linked to this payment to rebuild PDF - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - $outputlangs = $langs; - if (GETPOST('lang_id', 'aZ09')) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09')); - } + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $outputlangs = $langs; + if (GETPOST('lang_id', 'aZ09')) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09')); + } - $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0; - $hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0; - $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0; + $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0; + $hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0; + $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0; - $sql = 'SELECT f.rowid as facid'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s'; - $sql .= ' WHERE pf.fk_facture = f.rowid'; - $sql .= ' AND f.fk_soc = s.rowid'; - $sql .= ' AND f.entity IN ('.getEntity('invoice').')'; - $sql .= ' AND pf.fk_paiement = '.$object->id; - $resql = $db->query($sql); - if ($resql) - { - $i = 0; - $num = $db->num_rows($resql); + $sql = 'SELECT f.rowid as facid'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s'; + $sql .= ' WHERE pf.fk_facture = f.rowid'; + $sql .= ' AND f.fk_soc = s.rowid'; + $sql .= ' AND f.entity IN ('.getEntity('invoice').')'; + $sql .= ' AND pf.fk_paiement = '.$object->id; + $resql = $db->query($sql); + if ($resql) { + $i = 0; + $num = $db->num_rows($resql); - if ($num > 0) - { - while ($i < $num) - { - $objp = $db->fetch_object($resql); + if ($num > 0) { + while ($i < $num) { + $objp = $db->fetch_object($resql); - $invoice = new Facture($db); + $invoice = new Facture($db); - if ($invoice->fetch($objp->facid) <= 0) { - $errors++; - setEventMessages($invoice->error, $invoice->errors, 'errors'); - break; - } + if ($invoice->fetch($objp->facid) <= 0) { + $errors++; + setEventMessages($invoice->error, $invoice->errors, 'errors'); + break; + } - if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) { - $errors++; - setEventMessages($invoice->error, $invoice->errors, 'errors'); - break; - } + if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) { + $errors++; + setEventMessages($invoice->error, $invoice->errors, 'errors'); + break; + } - $i++; - } - } + $i++; + } + } - $db->free($resql); - } else { - $errors++; - setEventMessages($db->error, $db->errors, 'errors'); - } + $db->free($resql); + } else { + $errors++; + setEventMessages($db->error, $db->errors, 'errors'); + } } - if (! $errors) { + if (! $errors) { header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); exit; } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index dff546fa827..138891ea31d 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -414,9 +414,9 @@ class Paiement extends CommonObject $outputlangs->setDefaultLang($newlang); } - $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0; - $hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0; - $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0; + $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0; + $hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0; + $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0; $ret = $invoice->fetch($facid); // Reload to get new records From 328e70c3098aaaef71fa063a372753cc180ac63a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 17:52:57 +0200 Subject: [PATCH 100/135] Update replenish.php --- htdocs/product/stock/replenish.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 9a35816735d..813e9556e8a 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -75,7 +75,8 @@ if ($fk_entrepot == "-1" && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_E } $resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); if ($db->num_rows($resWar) == 1) { - $fk_entrepot = $db->fetch_object($resWar)->rowid; + $tmpobj = $db->fetch_object($resWar); + $fk_entrepot = $tmpobj->rowid; } }; From f5d18a00230a5f0efc7ce655045e5f91a81cd664 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 18:00:45 +0200 Subject: [PATCH 101/135] Update replenish.php --- htdocs/product/stock/replenish.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 813e9556e8a..7421e71f05c 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -340,8 +340,8 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON ent.entity IN('.getEntity('stock').')'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot = ent.rowid'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; if ($fk_supplier > 0) { $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')'; } From 4b490d434c745ba9ef87a6a9ac3f98302e286daf Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 27 Apr 2021 18:08:05 +0200 Subject: [PATCH 102/135] Corrections --- htdocs/fourn/facture/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 3f0fd1cc74e..801abaa7407 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -986,7 +986,10 @@ if (empty($reshook)) { $result = $srcobject->fetch(GETPOST('originid', 'int')); // If deposit invoice - down payment with 1 line (fixed amount or percent) + $typeamount = GETPOST('typedeposit', 'alpha'); if (GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) { + $valuedeposit = price2num(GETPOST('valuedeposit', 'alpha'), 'MU'); + // Define the array $amountdeposit $amountdeposit = array(); if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) { @@ -1099,9 +1102,7 @@ if (empty($reshook)) { $subprice_diff = $object->lines[0]->subprice - $diff / (1 + $object->lines[0]->tva_tx / 100); $object->updateline($object->lines[0]->id, $object->lines[0]->desc, $subprice_diff, $object->lines[0]->qty, $object->lines[0]->remise_percent, $object->lines[0]->date_start, $object->lines[0]->date_end, $object->lines[0]->tva_tx, 0, 0, 'HT', $object->lines[0]->info_bits, $object->lines[0]->product_type, 0, 0, 0, $object->lines[0]->pa_ht, $object->lines[0]->label, 0, array(), 100); } - } - - if ($result > 0) { + } elseif ($result > 0) { $lines = $srcobject->lines; if (empty($lines) && method_exists($srcobject, 'fetch_lines')) { $srcobject->fetch_lines(); From c7c1756703f83775a5f7679863eba7375035cb94 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Tue, 27 Apr 2021 18:22:31 +0200 Subject: [PATCH 103/135] Update supplier_proposal.class.php --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 1bf27c92b86..6e3230f871b 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1403,9 +1403,9 @@ class SupplierProposal extends CommonObject // Numbering module definition $soc = new Societe($this->db); - $soc->fetch($this->socid); + $result = $soc->fetch($this->socid); - if ($soc < 0) return -1; + if ($result < 0) return -1; // Define new ref if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life From 3f7f166fb664a8eb8425ebd16cbd39fdcdfc624d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 19:33:11 +0200 Subject: [PATCH 104/135] Make option label easier to understand. --- htdocs/langs/en_US/cashdesk.lang | 2 +- htdocs/takepos/admin/bar.php | 24 ++++++++++++------------ htdocs/takepos/invoice.php | 6 +++--- htdocs/takepos/receipt.php | 3 ++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index a24109fa3d0..4bcf8439271 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -58,7 +58,7 @@ BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr TakeposNeedsCategories=TakePOS needs at least one product categorie to work TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category %s to work -OrderNotes=Order Notes +OrderNotes=Printing the receipt will set all items to 'Order confirmed' CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration TicketVatGrouped=Group VAT by rate in tickets|receipts diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 09f3b13d4d1..863b6eda42c 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -118,14 +118,14 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print '
'; print '
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("UrlOrLink").''.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'
'.$langs->trans("UrlOrLink").''.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'
'.$langs->trans("BehaviourOnClick").''; $liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow")); print $form->selectarray('target', $liste, 1); - print ''.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'
'.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'
'.$langs->trans("Owner").''; + print '
'.$langs->trans("Visibility").''; print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 0, '', 0, ($user->admin ? '' : array($user->id)), '', 0, 0, 0, '', ($user->admin) ? 1 : 0, '', 'maxwidth300'); print ' 
'.$langs->trans("Owner").''; + print '
'.$langs->trans("Visibility").''; if ($action == 'edit' && $user->admin) { print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); } else { @@ -273,7 +278,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { $fuser->fetch($object->fk_user); print $fuser->getNomUrl(1); } else { - print $langs->trans("Public"); + print ''.$langs->trans("Everybody").''; } } print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").''; + print ''; + print '
'; - print ''; + print ''; print '
'; print $desc; print ''; $arraylist = array( 'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), From ae773ff9385c3439829264b37f3c655880426616 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 12:12:45 +0200 Subject: [PATCH 091/135] FIX Disabled pages must not appears into sitemap --- htdocs/website/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 61a62fbf8df..fe37cb68418 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2353,7 +2353,8 @@ if ($action == 'generatesitemaps' && $usercanedit) { } // Add "has translation pages" - $sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objp->rowid.($translationof ? ', '.$translationof : '')).")"; + $sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page'; + $sql .= ' WHERE status = '.WebsitePage::STATUS_VALIDATED.' AND fk_page IN ('.$db->sanitize($objp->rowid.($translationof ? ', '.$translationof : '')).")"; $resqlhastrans = $db->query($sql); if ($resqlhastrans) { $num_rows_hastrans = $db->num_rows($resqlhastrans); From 6fd172609302c44ba0171949938b0553c7a2d9ee Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Tue, 27 Apr 2021 12:14:36 +0200 Subject: [PATCH 092/135] Fix Bug replenish + Auto Filter # Fix Replenish Calculation Bug + Auto Filter ## Environment * Version: 13 * URL(s): product/stock/replenish.php ## Configuration MultiCompany needed with Stock Sharing ON, 2 entities and 1 warehouse per entity **Entity A** * Options: don't share stocks with other entities * Warehouse : only 1 (WAR_A) * Stock : 1 product (PROD) Qty : 4 **Entity B :** * Options: don't share stocks with other entities * Warehouse : only 1 (WAR_B) * Stock : 1 product --the same-- (PROD) Qty : 17 **Product :** * Desired Stock : 20 * Alert : 10 **WAR_A :** * For the product * Desired Stock : 16 * Alert : 6 ## Fixed behavior : * Entity A -> Replenish * If WAR_A selected should show the product and fill with 12 the qty to order. Physical Stock (All) and Physical Stock (this warehouse) should be 4. * If no Warehouse selected show the product and fill with 12 (because only one warehouse seen by this entity) the qty to order. Physical Stock (All) should be 4. ## Actual behavior : * Entity A -> Replenish * The product isn't showed. * If I intentionally incrementes the Desired Stock value. The product will be shown with the good filter (Warehouse if desired stock has been incremented on the combination ProductDesired <-> Warehouse). The qty for the order are correct and the physical stock shown is correct. ## Conclusion : * 1 bug and 1 improvment **BUG** : The value of the stock taken to whether or not show the product line is wrong. It is considering the stock in warehouses not shared with the entity. **IMPROVMENT** : If only one Warehouse, take automatically the desired and alert values for this warehouse and not the general ones. --- htdocs/product/stock/replenish.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index c9109b348d6..ab95c29eadd 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -6,6 +6,7 @@ * Copyright (C) 2016 ATM Consulting * Copyright (C) 2019 Frédéric France * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2021 Antonin MARCHAL * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -64,6 +65,20 @@ $draftorder = GETPOST('draftorder', 'alpha'); $fourn_id = GETPOST('fourn_id', 'int'); $fk_supplier = GETPOST('fk_supplier', 'int'); $fk_entrepot = GETPOST('fk_entrepot', 'int'); + +//MultiCompany : If only 1 Warehouse is visible, filter will automatically be set to it. +if ($fk_entrepot == "-1" && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { + global $mc; + $visibleWarehousesEntities = $conf->entity; + if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { + $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); + } + $resWar = $db->query ("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); + if($db->num_rows($resWar) == 1){ + $fk_entrepot = $db->fetch_object($resWar)->rowid; + } +}; + $texte = ''; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -324,8 +339,8 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON ent.entity IN('.getEntity('stock').')'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot = ent.rowid'; if ($fk_supplier > 0) { $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')'; } From 109124fdac2d1a2ab9fc7a6e7ab7e09b0e72f1b4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 27 Apr 2021 10:16:59 +0000 Subject: [PATCH 093/135] Fixing style errors. --- htdocs/product/stock/replenish.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index ab95c29eadd..9a35816735d 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -73,8 +73,8 @@ if ($fk_entrepot == "-1" && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_E if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); } - $resWar = $db->query ("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); - if($db->num_rows($resWar) == 1){ + $resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); + if ($db->num_rows($resWar) == 1) { $fk_entrepot = $db->fetch_object($resWar)->rowid; } }; From 80be0c32e49fad1f17f1871f5d7f7d2e1bc01aa5 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 27 Apr 2021 14:13:59 +0200 Subject: [PATCH 094/135] Corrections --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 4ebd6b7d6f1..3f0fd1cc74e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -986,7 +986,7 @@ if (empty($reshook)) { $result = $srcobject->fetch(GETPOST('originid', 'int')); // If deposit invoice - down payment with 1 line (fixed amount or percent) - if (GETPOST('type') == Facture::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) { + if (GETPOST('type') == FactureFournisseur::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable'))) { // Define the array $amountdeposit $amountdeposit = array(); if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) { From 52f3c95429496172b6bf7abbec35eddee31fff82 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Tue, 27 Apr 2021 15:59:13 +0200 Subject: [PATCH 095/135] Update supplier_proposal.class.php --- .../class/supplier_proposal.class.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 0320a663ea8..768302af188 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -290,7 +290,9 @@ class SupplierProposal extends CommonObject $line->tva_tx = $tva_tx; $this->lines[] = $line; + return 1; } + return -1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -1402,9 +1404,11 @@ class SupplierProposal extends CommonObject // Numbering module definition $soc = new Societe($this->db); $soc->fetch($this->socid); + + if ($soc < 0) return -1; // Define new ref - if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life + if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life $num = $this->getNextNumRef($soc); } else { $num = $this->ref; @@ -1525,6 +1529,7 @@ class SupplierProposal extends CommonObject return -1; } } + return 0; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -1555,6 +1560,7 @@ class SupplierProposal extends CommonObject return -1; } } + return 0; } @@ -1589,6 +1595,7 @@ class SupplierProposal extends CommonObject return -1; } } + return 0; } @@ -1663,7 +1670,9 @@ class SupplierProposal extends CommonObject public function cloture($user, $status, $note) { global $langs, $conf; - + $hidedetails = 0; + $hidedesc = 0; + $hideref = 0; $this->statut = $status; $error = 0; $now = dol_now(); @@ -1785,6 +1794,7 @@ class SupplierProposal extends CommonObject $this->db->rollback(); return -1; } + return 1; } /** @@ -1847,6 +1857,7 @@ class SupplierProposal extends CommonObject $this->db->rollback(); return -1; } + return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2908,8 +2919,10 @@ class SupplierProposalLine extends CommonObjectLine $this->fk_unit = $objp->fk_unit; $this->db->free($result); + return 1; } else { dol_print_error($this->db); + return -1; } } From 3d38301be96b977d902ad99b995c922adabf8042 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 27 Apr 2021 14:06:10 +0000 Subject: [PATCH 096/135] Fixing style errors. --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 768302af188..1bf27c92b86 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1404,7 +1404,7 @@ class SupplierProposal extends CommonObject // Numbering module definition $soc = new Societe($this->db); $soc->fetch($this->socid); - + if ($soc < 0) return -1; // Define new ref From 97633e34f23c1af04f47e517b3ed470f466a947e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 27 Apr 2021 16:47:27 +0200 Subject: [PATCH 097/135] Fix : Bug facture.class.php --- htdocs/compta/facture/class/facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1b0a4a768b1..ac9a6c505d7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4949,8 +4949,8 @@ class Facture extends CommonInvoice // TODO Add filter to check there is no payment started $sql .= $this->db->order("date_lim_reglement", "ASC"); $resql = $this->db->query($sql); - - $this->output .= 'Search unpaid invoices with due date = '.$this->db->idate(dol_get_first_hour(dol_time_plus_duree($now, -1 * $nbdays, 'd'), 'gmt'), 'gmt').'
'; + $tmpidate=$this->db->idate(dol_get_first_hour(dol_time_plus_duree($now, -1 * $nbdays, 'd'), 'gmt'), 'gmt'); + $this->output .= 'Search unpaid invoices with due date = '.$tmpidate.'
'; if ($resql) { while ($obj = $this->db->fetch_object($resql)) { From 11437a8077068fbc678b7ad154bcdec897f4ebfc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 17:28:28 +0200 Subject: [PATCH 098/135] css --- htdocs/reception/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 5ed59cf922b..4fed66d8960 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -784,6 +784,7 @@ if ($action == 'create') { $langs->load("projects"); print '
'.$langs->trans("Project").''; + print img_picto('', 'project', 'class="paddingright"'); $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); print '   id).'">'; print '
'; print ''; - print ''; + print ''; print "\n"; - if ($conf->global->TAKEPOS_PRINT_METHOD != "browser") { + if ($conf->global->TAKEPOS_PRINT_METHOD != "browser") { // Why this ? print ''; - print ''; @@ -133,7 +133,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print ''; - print ''; @@ -142,7 +142,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print ''; - print ''; @@ -150,7 +150,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print ''; - print ''; @@ -159,7 +159,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print ''; - print '\n"; @@ -168,14 +168,14 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print ''; - print ''; print ''; - print ''; @@ -187,7 +187,7 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print '
'; } -if ($conf->global->TAKEPOS_BAR_RESTAURANT) { +if (!empty($conf->global->TAKEPOS_BAR_RESTAURANT)) { if ($conf->global->TAKEPOS_QR_MENU) { $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file @@ -197,10 +197,10 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print ''; print "\n"; print ''; print ''; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Parameters").''.$langs->trans("Value").'
'; print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; print ''; + print ''; print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); //print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1); print '
'; print $langs->trans("OrderNotes"); print ''; + print ''; print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); print '
'; print $langs->trans("BasicPhoneLayout"); print ''; + print ''; //print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1); print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0); print '
'; print $langs->trans("ProductSupplements"); print ''; + print ''; //print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1); print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); print '
'; print $langs->trans("SupplementCategory"); print ''; + print ''; print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); print "
'; print 'QR - '.$langs->trans("CustomerMenu"); print ''; + print ''; print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); print '
'; print 'QR - '.$langs->trans("AutoOrder"); print ''; + print ''; print ajax_constantonoff("TAKEPOS_AUTO_ORDER", array(), $conf->entity, 0, 0, 1, 0); print '
'.$langs->trans("URL").''.$langs->trans("QR").'
'; - print "".$urlwithroot."/takepos/public/menu.php"; + print ''.$urlwithroot.'/takepos/public/menu.php'; print ''; - print ""; + print ''; print '
'; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index c7a01e5d8bc..a4fc10c788a 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -974,12 +974,12 @@ if ($action == "search") { function SendTicket(id) { console.log("Open box to select the Print/Send form"); - $.colorbox({href:"send.php?facid="+id, width:"70%", height:"30%", transition:"none", iframe:"true", title:"trans("SendTicket"); ?>"}); + $.colorbox({href:"send.php?facid="+id, width:"70%", height:"30%", transition:"none", iframe:"true", title:'trans("SendTicket")); ?>'}); } function Print(id, gift){ - $.colorbox({href:"receipt.php?facid="+id+"&gift="+gift, width:"40%", height:"90%", transition:"none", iframe:"true", title:"trans("PrintTicket"); ?>"}); + console.log("Call Print() to generate the receipt."); + $.colorbox({href:"receipt.php?facid="+id+"&gift="+gift, width:"40%", height:"90%", transition:"none", iframe:"true", title:'trans("PrintTicket")); ?>'}); } function TakeposPrinting(id){ diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index e9d721a44e3..d978d2ac792 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -50,7 +50,7 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $langs->loadLangs(array("main", "cashdesk", "companies")); -$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant $facid = GETPOST('facid', 'int'); @@ -318,5 +318,6 @@ if (!empty($conf->global->TAKEPOS_FOOTER) || !empty($conf->global->{$constFreeTe + From 035828ba511d3a77fd43a29c29d083f0a80b7179 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 19:45:56 +0200 Subject: [PATCH 105/135] Add missing constants --- htdocs/adherents/class/adherent.class.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 829c6ab8faa..1d4f2029039 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -44,7 +44,6 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; */ class Adherent extends CommonObject { - /** * @var string ID to identify managed object */ @@ -332,6 +331,23 @@ class Adherent extends CommonObject 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805) ); + /** + * Draft status + */ + const STATUS_DRAFT = 0; + /** + * Validated status + */ + const STATUS_VALIDATED = 1; + /** + * Resiliated + */ + const STATUS_RESILIATED = -1; + /** + * Excluded + */ + const STATUS_EXCLUDED = -2; + /** * Constructor From e6d2bad6e051d59b0ef6c4eb6b49fe4d958d77b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 19:46:26 +0200 Subject: [PATCH 106/135] Update paymentok.php --- htdocs/public/payment/paymentok.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 37efcbadbd0..7918a5b6f55 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -394,7 +394,7 @@ if ($ispaymentok) { // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { - $result = $object->status < $object::STATUS_DRAFT ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible + $result = ($object->status == $object::STATUS_EXCLUDED) ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible if ($result < 0 || empty($object->datevalid)) { $error++; $errmsg = $object->error; From 5b74676e549f45d05a0e57e1f57d1e5240a0feb4 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 20:14:03 +0200 Subject: [PATCH 107/135] fix infinite loop --- htdocs/public/payment/paymentok.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 7918a5b6f55..10c27baf044 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -414,7 +414,7 @@ if ($ispaymentok) { if ($datesubscription && $defaultdelay && $defaultdelayunit) { $datesubend = dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit); // the new end date of subscription must be in futur - while (dol_time_plus_duree($datesubend, -1, 'd') < $now) { + while ($datesubend < $now) { $datesubend = dol_time_plus_duree($datesubend, $defaultdelay, $defaultdelayunit); $datesubscription = dol_time_plus_duree($datesubscription, $defaultdelay, $defaultdelayunit); } From d3c7ab402d95a3ad9047cf424a412820ec9f4e55 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 20:45:04 +0200 Subject: [PATCH 108/135] Fix wrong set of constant --- htdocs/adherents/class/adherent.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1d4f2029039..aaf194adf38 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -206,7 +206,7 @@ class Adherent extends CommonObject public $public; - // -2:exclu, -1:brouillon, 0:resilie, >=1:valide,paye + // -2:excluded, -1:draft, 0:resiliated, >=1:valided,payed // def in common object //public $status; @@ -334,7 +334,7 @@ class Adherent extends CommonObject /** * Draft status */ - const STATUS_DRAFT = 0; + const STATUS_DRAFT = -1; /** * Validated status */ @@ -342,7 +342,7 @@ class Adherent extends CommonObject /** * Resiliated */ - const STATUS_RESILIATED = -1; + const STATUS_RESILIATED = 0; /** * Excluded */ From 7f3810e703604b4fee348789e627fe1094cc252d Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 20:53:14 +0200 Subject: [PATCH 109/135] update $field also --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index aaf194adf38..c0645cb14d4 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -326,7 +326,7 @@ class Adherent extends CommonObject 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 190), 'canvas' => array('type' => 'varchar(32)', 'label' => 'Canvas', 'enabled' => 1, 'visible' => -1, 'position' => 195), 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 500, - 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', -1 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')), + 'arrayofkeyval' => array(-1 => 'Draft', 1 => 'Validated', 0 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 800), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805) ); From 082423efa03007dce72b299156ed643b8c250480 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 21:09:37 +0200 Subject: [PATCH 110/135] libstatut --- htdocs/adherents/class/adherent.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index c0645cb14d4..75787276543 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1862,7 +1862,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = 1"; + $sql .= " statut = ".STATUS_VALIDATED; $sql .= ", datevalid = '".$this->db->idate($now)."'"; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1914,7 +1914,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = 0"; + $sql .= " statut = ".STATUS_RESILIATED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1964,7 +1964,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = -2"; + $sql .= " statut = ".STATUS_EXCLUDED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -2275,11 +2275,11 @@ class Adherent extends CommonObject $labelStatus = ''; $labelStatusShort = ''; - if ($status == -1) { + if ($status == STATUS_DRAFT) { $statusType = 'status0'; $labelStatus = $langs->trans("MemberStatusDraft"); $labelStatusShort = $langs->trans("MemberStatusDraftShort"); - } elseif ($status >= 1) { + } elseif ($status >= STATUS_VALIDATED) { if ($need_subscription == 0) { $statusType = 'status4'; $labelStatus = $langs->trans("MemberStatusNoSubscription"); @@ -2297,11 +2297,11 @@ class Adherent extends CommonObject $labelStatus = $langs->trans("MemberStatusPaid"); $labelStatusShort = $langs->trans("MemberStatusPaidShort"); } - } elseif ($status == 0) { + } elseif ($status == STATUS_RESILIATED) { $statusType = 'status6'; $labelStatus = $langs->trans("MemberStatusResiliated"); $labelStatusShort = $langs->trans("MemberStatusResiliatedShort"); - } elseif ($status == -2) { + } elseif ($status == STATUS_EXCLUDED) { $statusType = 'status10'; $labelStatus = $langs->trans("MemberStatusExcluded"); $labelStatusShort = $langs->trans("MemberStatusExcludedShort"); From d0d034672d839c41f876b48faedef1796e4226e8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 27 Apr 2021 19:10:01 +0000 Subject: [PATCH 111/135] Fixing style errors. --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 75787276543..b3b78939e06 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2301,7 +2301,7 @@ class Adherent extends CommonObject $statusType = 'status6'; $labelStatus = $langs->trans("MemberStatusResiliated"); $labelStatusShort = $langs->trans("MemberStatusResiliatedShort"); - } elseif ($status == STATUS_EXCLUDED) { + } elseif ($status == STATUS_EXCLUDED) { $statusType = 'status10'; $labelStatus = $langs->trans("MemberStatusExcluded"); $labelStatusShort = $langs->trans("MemberStatusExcludedShort"); From 3d3e8786afc622df02ae883a3c4749613d2761a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 21:24:59 +0200 Subject: [PATCH 112/135] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b3b78939e06..28f7c6e933e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1862,7 +1862,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = ".STATUS_VALIDATED; + $sql .= " statut = ".self::STATUS_VALIDATED; $sql .= ", datevalid = '".$this->db->idate($now)."'"; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1914,7 +1914,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = ".STATUS_RESILIATED; + $sql .= " statut = ".self::STATUS_RESILIATED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1964,7 +1964,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = ".STATUS_EXCLUDED; + $sql .= " statut = ".self::STATUS_EXCLUDED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -2275,11 +2275,11 @@ class Adherent extends CommonObject $labelStatus = ''; $labelStatusShort = ''; - if ($status == STATUS_DRAFT) { + if ($status == self::STATUS_DRAFT) { $statusType = 'status0'; $labelStatus = $langs->trans("MemberStatusDraft"); $labelStatusShort = $langs->trans("MemberStatusDraftShort"); - } elseif ($status >= STATUS_VALIDATED) { + } elseif ($status >= self::STATUS_VALIDATED) { if ($need_subscription == 0) { $statusType = 'status4'; $labelStatus = $langs->trans("MemberStatusNoSubscription"); @@ -2297,11 +2297,11 @@ class Adherent extends CommonObject $labelStatus = $langs->trans("MemberStatusPaid"); $labelStatusShort = $langs->trans("MemberStatusPaidShort"); } - } elseif ($status == STATUS_RESILIATED) { + } elseif ($status == self::STATUS_RESILIATED) { $statusType = 'status6'; $labelStatus = $langs->trans("MemberStatusResiliated"); $labelStatusShort = $langs->trans("MemberStatusResiliatedShort"); - } elseif ($status == STATUS_EXCLUDED) { + } elseif ($status == self::STATUS_EXCLUDED) { $statusType = 'status10'; $labelStatus = $langs->trans("MemberStatusExcluded"); $labelStatusShort = $langs->trans("MemberStatusExcludedShort"); From e3653374406d7661aa8e889108811774004b6f57 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 21:43:13 +0200 Subject: [PATCH 113/135] Use status constant instead of integer --- htdocs/adherents/class/adherent.class.php | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 28f7c6e933e..59ea7dbb2dc 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -357,7 +357,7 @@ class Adherent extends CommonObject public function __construct($db) { $this->db = $db; - $this->statut = -1; + $this->statut = self::STATUS_DRAFT; // shouldn't this be $status ? // l'adherent n'est pas public par defaut $this->public = 0; // les champs optionnels sont vides @@ -1854,7 +1854,7 @@ class Adherent extends CommonObject $now = dol_now(); // Check parameters - if ($this->statut == 1) { + if ($this->statut == self::STATUS_VALIDATED) { dol_syslog(get_class($this)."::validate statut of member does not allow this", LOG_WARNING); return 0; } @@ -1870,7 +1870,7 @@ class Adherent extends CommonObject dol_syslog(get_class($this)."::validate", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - $this->statut = 1; + $this->statut = self::STATUS_VALIDATED; // Call trigger $result = $this->call_trigger('MEMBER_VALIDATE', $user); @@ -1906,7 +1906,7 @@ class Adherent extends CommonObject $error = 0; // Check parameters - if ($this->statut == 0) { + if ($this->statut == self::STATUS_RESILIATED) { dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING); return 0; } @@ -1920,7 +1920,7 @@ class Adherent extends CommonObject $result = $this->db->query($sql); if ($result) { - $this->statut = 0; + $this->statut = self::STATUS_RESILIATED; // Call trigger $result = $this->call_trigger('MEMBER_RESILIATE', $user); @@ -1956,7 +1956,7 @@ class Adherent extends CommonObject $error = 0; // Check parameters - if ($this->statut == 0) { + if ($this->statut == self::STATUS_EXCLUDED) { dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING); return 0; } @@ -1970,7 +1970,7 @@ class Adherent extends CommonObject $result = $this->db->query($sql); if ($result) { - $this->statut = 0; + $this->statut = self::STATUS_EXCLUDED; // Call trigger $result = $this->call_trigger('MEMBER_EXCLUDE', $user); @@ -2367,11 +2367,11 @@ class Adherent extends CommonObject $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE a.fk_adherent_type = t.rowid"; if ($mode == 'expired') { - $sql .= " AND a.statut = 1"; + $sql .= " AND a.statut = ".self::STATUS_VALIDATED; $sql .= " AND a.entity IN (".getEntity('adherent').")"; $sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = '1')"; } elseif ($mode == 'shift') { - $sql .= " AND a.statut = -1"; + $sql .= " AND a.statut = ".self::STATUS_DRAFT; $sql .= " AND a.entity IN (".getEntity('adherent').")"; } @@ -2388,10 +2388,10 @@ class Adherent extends CommonObject $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; $label = $langs->trans("MembersWithSubscriptionToReceive"); $labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort"); - $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; + $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_VALIDATED.'&filter=outofdate'; } elseif ($mode == 'shift') { $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; - $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=-1'; + $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_DRAFT; $label = $langs->trans("MembersListToValid"); $labelShort = $langs->trans("ToValidate"); } @@ -2504,7 +2504,7 @@ class Adherent extends CommonObject $this->birth = $now; $this->photo = ''; $this->public = 1; - $this->statut = 0; + $this->statut = self::STATUS_DARFT; $this->datefin = $now; $this->datevalid = $now; @@ -2823,7 +2823,7 @@ class Adherent extends CommonObject global $conf; //Only valid members - if ($this->statut <= 0) { + if ($this->statut != self::STATUS_VALIDATED) { return false; } if (!$this->datefin) { From c1d07a457b429ed05306d248d21bc2be882b0d6f Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 22:00:21 +0200 Subject: [PATCH 114/135] Mispelling --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 59ea7dbb2dc..54589a049ff 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2504,7 +2504,7 @@ class Adherent extends CommonObject $this->birth = $now; $this->photo = ''; $this->public = 1; - $this->statut = self::STATUS_DARFT; + $this->statut = self::STATUS_DRAFT; $this->datefin = $now; $this->datevalid = $now; From cb72a010cdcdb6f4f4cf4e2d6239d0017bf936b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 22:14:19 +0200 Subject: [PATCH 115/135] FIX notifications for expense report has disappeared. --- htdocs/admin/notification.php | 38 ++++++++++++------- htdocs/core/lib/functions.lib.php | 6 +-- ..._50_modNotification_Notification.class.php | 6 ++- htdocs/theme/eldy/main_menu_fa_icons.inc.php | 7 ++-- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index e1cf115626f..c0c6b45464f 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -243,7 +243,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { $elementLabel = $langs->trans('Intervention'); } elseif ($notifiedevent['elementtype'] == 'shipping') { $elementLabel = $langs->trans('Shipping'); - } elseif ($notifiedevent['elementtype'] == 'expensereport') { + } elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') { $elementLabel = $langs->trans('ExpenseReport'); } @@ -271,6 +271,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { $helptext = ''; form_constantes($constantes, 3, $helptext); + + print '
'; } else { print ''; print ''; @@ -300,7 +302,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { $elementLabel = $langs->trans('Intervention'); } elseif ($notifiedevent['elementtype'] == 'shipping') { $elementLabel = $langs->trans('Shipping'); - } elseif ($notifiedevent['elementtype'] == 'expensereport') { + } elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') { $elementLabel = $langs->trans('ExpenseReport'); } @@ -316,7 +318,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print '
'; } -print '
'; + +print '
'; +print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; +if (!empty($conf->societe->enabled)) { + print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; +} +print '
'; print ''; @@ -343,28 +351,38 @@ print "\n"; foreach ($listofnotifiedevents as $notifiedevent) { $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; + $elementPicto = $notifiedevent['elementtype']; $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); // Special cases if ($notifiedevent['elementtype'] == 'order_supplier') { + $elementPicto = 'supplier_order'; $elementLabel = $langs->trans('SupplierOrder'); } elseif ($notifiedevent['elementtype'] == 'propal') { $elementLabel = $langs->trans('Proposal'); } elseif ($notifiedevent['elementtype'] == 'facture') { + $elementPicto = 'bill'; $elementLabel = $langs->trans('Bill'); } elseif ($notifiedevent['elementtype'] == 'commande') { + $elementPicto = 'order'; $elementLabel = $langs->trans('Order'); } elseif ($notifiedevent['elementtype'] == 'ficheinter') { + $elementPicto = 'intervention'; $elementLabel = $langs->trans('Intervention'); } elseif ($notifiedevent['elementtype'] == 'shipping') { + $elementPicto = 'shipment'; $elementLabel = $langs->trans('Shipping'); - } elseif ($notifiedevent['elementtype'] == 'expensereport') { + } elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') { + $elementPicto = 'expensereport'; $elementLabel = $langs->trans('ExpenseReport'); } print ''; - print ''.$elementLabel.''; + print ''; + print img_picto('', $elementPicto, 'class="pictofixedwidth"'); + print $elementLabel; + print ''; print ''.$notifiedevent['code'].''; - print ''.$label.''; + print ''.$label.''; print ''; // Notification with threshold foreach ($conf->global as $key => $val) { @@ -417,14 +435,6 @@ foreach ($listofnotifiedevents as $notifiedevent) { } print ''; -print '
'; -print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; -if (!empty($conf->societe->enabled)) { - print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; -} - -print '
'; - print '
'; print '
'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7559b94a740..d4b94deba51 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3510,7 +3510,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset', 'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building', 'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'cron', 'cubes', - 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'establishment', 'external-link-alt', 'external-link-square-alt', + 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'help', 'holiday', @@ -3572,7 +3572,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'generic'=>'file', 'holiday'=>'umbrella-beach', 'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'label'=>'layer-group', 'loan'=>'money-bill-alt', 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', - 'trip'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', + 'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'sign-out'=>'sign-out-alt', 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star', 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter', @@ -3662,7 +3662,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'resource'=>'infobox-action', 'salary'=>'infobox-bank_account', 'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier', 'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal', - 'ticket'=>'infobox-contrat', 'title_accountancy'=>'infobox-bank_account', 'title_hrm'=>'infobox-holiday', 'trip'=>'infobox-expensereport', 'title_agenda'=>'infobox-action', + 'ticket'=>'infobox-contrat', 'title_accountancy'=>'infobox-bank_account', 'title_hrm'=>'infobox-holiday', 'expensereport'=>'infobox-expensereport', 'trip'=>'infobox-expensereport', 'title_agenda'=>'infobox-action', //'title_setup'=>'infobox-action', 'tools'=>'infobox-action', 'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode' ); diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 69903ce45f3..18c27a8e36e 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -128,7 +128,7 @@ class InterfaceNotification extends DolibarrTriggers } // Check if module for this event is active if ($qualified) { - //print 'xx'.$obj->code; + //print 'xx'.$obj->code.' '.$obj->elementtype.'
'; $element = $obj->elementtype; // Exclude events if related module is disabled @@ -142,7 +142,9 @@ class InterfaceNotification extends DolibarrTriggers $qualified = 0; } elseif ($element == 'member' && empty($conf->adherent->enabled)) { $qualified = 0; - } elseif (!in_array($element, array('order_supplier', 'invoice_supplier', 'withdraw', 'shipping', 'member', 'expensereport')) && empty($conf->$element->enabled)) { + } elseif (($element == 'expense_report' || $element == 'expensereport') && empty($conf->expensereport->enabled)) { + $qualified = 0; + } elseif (!in_array($element, array('order_supplier', 'invoice_supplier', 'withdraw', 'shipping', 'member', 'expense_report', 'expensereport')) && empty($conf->$element->enabled)) { $qualified = 0; } } diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index 9b119fa593c..a9e5e80c009 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -203,14 +203,15 @@ div.mainmenu.generic4::before { margin-left: 30px; } -.menu_titre .em092 { + +.em092 { font-size: 0.92em; } -.menu_titre .em088 { +.em088 { font-size: 0.88em; } -.menu_titre .em080 { +.em080 { font-size: 0.80em; } From 1e7a778eccd7191f0cc51864a150b05bb689f5a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 22:28:28 +0200 Subject: [PATCH 116/135] Debug v14 --- htdocs/commande/card.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 12117a5f1cb..1b82bc0c20f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2468,7 +2468,7 @@ if ($action == 'create' && $usercancreate) { if (empty($reshook)) { // Reopen a closed order if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) { - print ''; + print ''.$langs->trans('ReOpen').''; } // Send @@ -2551,39 +2551,39 @@ if ($action == 'create' && $usercancreate) { // Set to shipped if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) { - print ''; + print ''.$langs->trans('ClassifyShipped').''; } // Create bill and Classify billed // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { - print ''; + print ''.$langs->trans("CreateBill").''; } if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { - print ''; + print ''.$langs->trans("ClassifyBilled").''; } } if ($object->statut > Commande::STATUS_DRAFT && $object->billed) { if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { - print ''; + print ''.$langs->trans("ClassifyUnBilled").''; } } // Clone if ($usercancreate) { - print ''; + print ''.$langs->trans("ToClone").''; } // Cancel order if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) { - print ''; + print ''.$langs->trans("Cancel").''; } // Delete order if ($usercandelete) { if ($numshipping == 0) { - print ''; + print ''.$langs->trans('Delete').''; } else { - print ''; + print ''.$langs->trans("Delete").''; } } } From e01c5313a7593605ce6318f4e45cba523dc12d58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 22:36:25 +0200 Subject: [PATCH 117/135] Debug v14 --- htdocs/product/stock/card.php | 4 +++- htdocs/product/stock/info.php | 32 ++++++++++++++++++++++++++ htdocs/product/stock/movement_list.php | 32 ++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 64204e327b7..983e0089fe5 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -460,8 +460,10 @@ if ($action == 'create') { print ''; } + print ''; + // Description - print ''.$langs->trans("Description").''.nl2br($object->description).''; + print ''.$langs->trans("Description").''.dol_htmlentitiesbr($object->description).''; $calcproductsunique = $object->nb_different_products(); $calcproducts = $object->nb_products(); diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php index 84c0111f290..9fc4e81075a 100644 --- a/htdocs/product/stock/info.php +++ b/htdocs/product/stock/info.php @@ -57,6 +57,38 @@ $linkback = ''; $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu; + +// Project +if (!empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref .= '
'.img_picto('', 'project').' '.$langs->trans('Project').' '; + if ($usercancreate) { + if ($action != 'classify') { + $morehtmlref .= '
'.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + } + if ($action == 'classify') { + $projectid = $object->fk_project; + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } +} $morehtmlref .= ''; $shownav = 1; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 4a9a0bb9613..0f2cec28ec9 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -623,6 +623,38 @@ if ($resql) { $morehtmlref = '
'; $morehtmlref .= $langs->trans("LocationSummary").' : '.$object->lieu; + + // Project + if (!empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref .= '
'.img_picto('', 'project').' '.$langs->trans('Project').' '; + if ($usercancreate && 1 == 2) { + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + } + if ($action == 'classify') { + $projectid = $object->fk_project; + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ''; + $morehtmlref .= $proj->ref; + $morehtmlref .= ''; + } else { + $morehtmlref .= ''; + } + } + } $morehtmlref .= '
'; $shownav = 1; From 2e108e1e2f64d24f41e5611c54bc4f12e129e3da Mon Sep 17 00:00:00 2001 From: kastoras Date: Wed, 28 Apr 2021 00:32:37 +0300 Subject: [PATCH 118/135] Close/CLOSE #13739 Product API route added to get product stock Using GET /products/{id}/stock user can get product stock from all warehouses. Using warehouse id will get stock of warehouse given. --- htdocs/product/class/api_products.class.php | 44 +++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 9b06b30765d..7805d7c7f52 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1793,6 +1793,50 @@ class Products extends DolibarrApi return $result; } + /** + * Get stock data for the product id given. + * Optionaly with $selected_warehouse_id parameter user can get stock of specific warehouse + * + * @param int $id ID of Product + * @param int $selected_warehouse_id ID of warehouse + * @return int + * + * @throws RestException 500 + * @throws RestException 401 + * @throws RestException 404 + * + * @url GET {id}/stock + */ + public function getStock($id,$selected_warehouse_id=null){ + + if (!DolibarrApiAccess::$user->rights->produit->lire) { + throw new RestException(401); + } + + if (!DolibarrApi::_checkAccessToResource('product', $id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $product_model = new Product($this->db); + $product_model->fetch($id); + $product_model->load_stock(); + + $stockData = $this->_cleanObjectDatas($product_model)->stock_warehouse; + if($selected_warehouse_id){ + foreach($stockData as $warehouse_id => $warehouse){ + if($warehouse_id != $selected_warehouse_id){ + unset($stockData[$warehouse_id]); + } + } + } + + if(empty($stockData)){ + throw new RestException(404, 'No stock found'); + } + + return ['stock_warehouses'=>$stockData]; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas From 925c32487267387d47de20882bf969466b80c7c0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 27 Apr 2021 21:38:03 +0000 Subject: [PATCH 119/135] Fixing style errors. --- htdocs/product/class/api_products.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 7805d7c7f52..8d4b2f29522 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1794,7 +1794,7 @@ class Products extends DolibarrApi } /** - * Get stock data for the product id given. + * Get stock data for the product id given. * Optionaly with $selected_warehouse_id parameter user can get stock of specific warehouse * * @param int $id ID of Product @@ -1807,7 +1807,8 @@ class Products extends DolibarrApi * * @url GET {id}/stock */ - public function getStock($id,$selected_warehouse_id=null){ + public function getStock($id, $selected_warehouse_id = null) + { if (!DolibarrApiAccess::$user->rights->produit->lire) { throw new RestException(401); @@ -1815,22 +1816,22 @@ class Products extends DolibarrApi if (!DolibarrApi::_checkAccessToResource('product', $id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + } $product_model = new Product($this->db); $product_model->fetch($id); $product_model->load_stock(); $stockData = $this->_cleanObjectDatas($product_model)->stock_warehouse; - if($selected_warehouse_id){ - foreach($stockData as $warehouse_id => $warehouse){ - if($warehouse_id != $selected_warehouse_id){ + if ($selected_warehouse_id) { + foreach ($stockData as $warehouse_id => $warehouse) { + if ($warehouse_id != $selected_warehouse_id) { unset($stockData[$warehouse_id]); } } } - if(empty($stockData)){ + if (empty($stockData)) { throw new RestException(404, 'No stock found'); } From 65a83036edddec5e9114c86347f1741707b3654f Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 28 Apr 2021 07:45:36 +0200 Subject: [PATCH 120/135] Clean code use const adh statut instead of integer --- htdocs/adherents/card.php | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 9b28cc6473e..3f92efe0e72 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1747,12 +1747,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $langs->trans("SubscriptionNotNeeded"); } elseif (!$adht->subscription) { print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) { + if (Adherent::STATUS_VALIDATED == $object->statut) { print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } else { print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) { + if (Adherent::STATUS_VALIDATED == $object->statut) { print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } @@ -1862,7 +1862,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($action != 'editlogin' && $action != 'editthirdparty') { // Send if (empty($user->socid)) { - if ($object->statut == 1) { + if (Adherent::STATUS_VALIDATED == $object->statut) { print ''."\n"; } } @@ -1870,20 +1870,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Send card by email // TODO Remove this to replace with a template /* - if ($user->rights->adherent->creer) - { - if ($object->statut >= 1) - { + if ($user->rights->adherent->creer) { + if (Adherent::STATUS_VALIDATED == $object->statut) { if ($object->email) print '\n"; else print '\n"; - } - else - { + } else { print '
'.$langs->trans("SendCardByMail")."
"; } - } - else - { + } else { print '
'.$langs->trans("SendCardByMail")."
"; }*/ @@ -1895,7 +1889,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Validate - if ($object->statut == -1) { + if (Adherent::STATUS_DRAFT == object->statut) { if ($user->rights->adherent->creer) { print ''."\n"; } else { @@ -1904,7 +1898,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Reactivate - if ($object->statut == 0 || $object->statut == -2) { + if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $Object->statut) { if ($user->rights->adherent->creer) { print '\n"; } else { @@ -1913,7 +1907,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Resiliate - if ($object->statut >= 1) { + if (Adherent::STATUS_VALIDATED == $object->statut) { if ($user->rights->adherent->supprimer) { print '\n"; } else { @@ -1922,7 +1916,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Exclude - if ($object->statut >= 1) { + if (Adherent::STATUS_VALIDATED == $object->statut) { if ($user->rights->adherent->supprimer) { print '\n"; } else { @@ -1933,7 +1927,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Create third party if (!empty($conf->societe->enabled) && !$object->socid) { if ($user->rights->societe->creer) { - if ($object->statut != -1) { + if (Adherent::STATUS_DRAFT != $object->statut) { print ''."\n";; } else { print ''."\n"; @@ -1946,7 +1940,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Create user if (!$user->socid && !$object->user_id) { if ($user->rights->user->user->creer) { - if ($object->statut != -1) { + if (Adherent::STATUS_DRAFT != $object->statut) { print ''."\n"; } else { print ''."\n"; From 972b325a51649b5f0e6bfa2b13806e225ba05a94 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 28 Apr 2021 08:14:18 +0200 Subject: [PATCH 121/135] Clean code --- htdocs/adherents/card.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 3f92efe0e72..222d34d38d9 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -937,17 +937,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { document.formsoc.action.value="create"; document.formsoc.submit(); }); - function initfieldrequired() - { + function initfieldrequired() { jQuery("#tdcompany").removeClass("fieldrequired"); jQuery("#tdlastname").removeClass("fieldrequired"); jQuery("#tdfirstname").removeClass("fieldrequired"); - if (jQuery("#morphy").val() == \'mor\') - { + if (jQuery("#morphy").val() == \'mor\') { jQuery("#tdcompany").addClass("fieldrequired"); } - if (jQuery("#morphy").val() == \'phy\') - { + if (jQuery("#morphy").val() == \'phy\') { jQuery("#tdlastname").addClass("fieldrequired"); jQuery("#tdfirstname").addClass("fieldrequired"); } @@ -1167,17 +1164,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { document.formsoc.action.value="edit"; document.formsoc.submit(); }); - function initfieldrequired() - { + function initfieldrequired() { jQuery("#tdcompany").removeClass("fieldrequired"); jQuery("#tdlastname").removeClass("fieldrequired"); jQuery("#tdfirstname").removeClass("fieldrequired"); - if (jQuery("#morphy").val() == \'mor\') - { + if (jQuery("#morphy").val() == \'mor\') { jQuery("#tdcompany").addClass("fieldrequired"); } - if (jQuery("#morphy").val() == \'phy\') - { + if (jQuery("#morphy").val() == \'phy\') { jQuery("#tdlastname").addClass("fieldrequired"); jQuery("#tdfirstname").addClass("fieldrequired"); } @@ -2004,7 +1998,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Show links to link elements /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); - if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + if ($linktoelem) { + print ($somethingshown?'':'
').$linktoelem; + } */ // Show online payment link From 7782e849e2ecc26e22c9a79366f35fd5c485946e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 28 Apr 2021 09:22:10 +0200 Subject: [PATCH 122/135] changes to implement eldy's advices --- htdocs/core/tpl/filemanager.tpl.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 7c620aa404c..592c3283a1b 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -99,12 +99,14 @@ if ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm print ""; @@ -170,9 +172,9 @@ if ($action == 'confirmconvertimgwebp') { if ($action == 'convertimgwebp' && $permtoadd) { if ($module == 'medias') { - $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.GETPOST('section_dir', 'alpha'); + $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.dol_sanitizeFileName(GETPOST('section_dir', 'alpha')); } else { - $imagefolder = $conf->ecm->dir_output.'/'.GETPOST('section_dir', 'alpha'); + $imagefolder = $conf->ecm->dir_output.'/'.dol_sanitizePathName(GETPOST('section_dir', 'alpha')); } include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; From 29cb154028e2870a9119b42edb215d83ac5e7251 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 28 Apr 2021 09:38:19 +0200 Subject: [PATCH 123/135] Update llx_10_c_regions.sql China Taiwan sorting completed --- .../install/mysql/data/llx_10_c_regions.sql | 136 +++++++++--------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 97fca0f230b..65b3af4950e 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -61,6 +61,7 @@ -- Brazil -> for Departmements -- Canada -> for Departmements -- Chile +-- China -- Colombie -> for Departmements -- Denmark -- France @@ -84,6 +85,7 @@ -- Slovenia -- Spain -- Switzerland/Suisse -> for Departmements/Cantons +-- Taiwan -> for Departmements -- Tunesia -- United Arab Emirates -> for Departmements -- United Kingdom @@ -93,7 +95,7 @@ -- TEMPLATE ------------------------------------------------------------------------------------------ -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 0, 0, '0', 0, '-'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 0, 0, '0', 0, '-'); -- Algeria Regions (id country=13) @@ -172,6 +174,43 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 6 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 67, 6715, NULL, NULL, 'Arica y Parinacota'); +-- China Regions (rowid country=9) +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 901, '京',0,'北京市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 902, '津',0,'天津市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 903, '沪',0,'上海市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 904, '渝',0,'重庆市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 905, '冀',0,'河北省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 906, '晋',0,'山西省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 907, '辽',0,'辽宁省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 908, '吉',0,'吉林省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 909, '黑',0,'黑龙江省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 910, '苏',0,'江苏省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 911, '浙',0,'浙江省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 912, '皖',0,'安徽省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 913, '闽',0,'福建省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 914, '赣',0,'江西省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 915, '鲁',0,'山东省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 916, '豫',0,'河南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 917, '鄂',0,'湖北省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 918, '湘',0,'湖南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 919, '粤',0,'广东省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 920, '琼',0,'海南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 921, '川',0,'四川省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 922, '贵',0,'贵州省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 923, '云',0,'云南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 924, '陕',0,'陕西省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 925, '甘',0,'甘肃省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 926, '青',0,'青海省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 927, '台',0,'台湾省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 928, '蒙',0,'内蒙古自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 929, '桂',0,'广西壮族自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 930, '藏',0,'西藏自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 931, '宁',0,'宁夏回族自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 932, '新',0,'新疆维吾尔自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 933, '港',0,'香港特别行政区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 934, '澳',0,'澳门特别行政区'); + + -- Colombie Regions (id country=70) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 70, 7001, '', 0, 'Colombie'); @@ -399,31 +438,35 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 4 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 6, 601, '', 1, 'Cantons'); +-- Taiwan Regions (rowid country=213) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 213, 21301, 'TW', NULL, 'Taiwan'); + + -- Tunisia Regions (id country=10) -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1001, '', 0, 'Ariana'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1002, '', 0, 'Béja'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1003, '', 0, 'Ben Arous'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1004, '', 0, 'Bizerte'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1005, '', 0, 'Gabès'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1006, '', 0, 'Gafsa'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1007, '', 0, 'Jendouba'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1008, '', 0, 'Kairouan'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1009, '', 0, 'Kasserine'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1010, '', 0, 'Kébili'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1011, '', 0, 'La Manouba'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1012, '', 0, 'Le Kef'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1013, '', 0, 'Mahdia'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1014, '', 0, 'Médenine'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1015, '', 0, 'Monastir'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1016, '', 0, 'Nabeul'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1017, '', 0, 'Sfax'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1018, '', 0, 'Sidi Bouzid'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1019, '', 0, 'Siliana'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1020, '', 0, 'Sousse'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1021, '', 0, 'Tataouine'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1022, '', 0, 'Tozeur'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1023, '', 0, 'Tunis'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1024, '', 0, 'Zaghouan'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1001, '', 0, 'Ariana'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1002, '', 0, 'Béja'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1003, '', 0, 'Ben Arous'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1004, '', 0, 'Bizerte'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1005, '', 0, 'Gabès'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1006, '', 0, 'Gafsa'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1007, '', 0, 'Jendouba'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1008, '', 0, 'Kairouan'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1009, '', 0, 'Kasserine'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1010, '', 0, 'Kébili'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1011, '', 0, 'La Manouba'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1012, '', 0, 'Le Kef'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1013, '', 0, 'Mahdia'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1014, '', 0, 'Médenine'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1015, '', 0, 'Monastir'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1016, '', 0, 'Nabeul'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1017, '', 0, 'Sfax'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1018, '', 0, 'Sidi Bouzid'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1019, '', 0, 'Siliana'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1020, '', 0, 'Sousse'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1021, '', 0, 'Tataouine'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1022, '', 0, 'Tozeur'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1023, '', 0, 'Tunis'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1024, '', 0, 'Zaghouan'); -- United Arab Emirates (UAE) Regions (rowid country=227) @@ -452,46 +495,3 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 2 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23208, '', 0, 'Nor-Oriental'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23209, '', 0, 'Zuliana'); - - - --- Regions China (rowid country=9) -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 901, '京',0,'北京市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 902, '津',0,'天津市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 903, '沪',0,'上海市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 904, '渝',0,'重庆市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 905, '冀',0,'河北省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 906, '晋',0,'山西省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 907, '辽',0,'辽宁省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 908, '吉',0,'吉林省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 909, '黑',0,'黑龙江省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 910, '苏',0,'江苏省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 911, '浙',0,'浙江省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 912, '皖',0,'安徽省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 913, '闽',0,'福建省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 914, '赣',0,'江西省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 915, '鲁',0,'山东省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 916, '豫',0,'河南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 917, '鄂',0,'湖北省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 918, '湘',0,'湖南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 919, '粤',0,'广东省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 920, '琼',0,'海南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 921, '川',0,'四川省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 922, '贵',0,'贵州省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 923, '云',0,'云南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 924, '陕',0,'陕西省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 925, '甘',0,'甘肃省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 926, '青',0,'青海省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 927, '台',0,'台湾省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 928, '蒙',0,'内蒙古自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 929, '桂',0,'广西壮族自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 930, '藏',0,'西藏自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 931, '宁',0,'宁夏回族自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 932, '新',0,'新疆维吾尔自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 933, '港',0,'香港特别行政区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 934, '澳',0,'澳门特别行政区'); - - --- Regions Taiwan (rowid country=213) -INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES (213, 21301, 'TW', NULL, 'Taiwan'); - From 26a7c2613ac73c41c733d18e2180eb67684c5659 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 28 Apr 2021 10:03:02 +0200 Subject: [PATCH 124/135] Update llx_20_c_departements.sql Taiwan Slovenia (need to check SI-Id) Panama --- .../mysql/data/llx_20_c_departements.sql | 125 +++++++++--------- 1 file changed, 65 insertions(+), 60 deletions(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index e1e363e9c62..96431caf5b1 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -55,7 +55,10 @@ -- Luxembourg -- Netherlands -- (Moroco) +-- Panama -- Romania +-- Slovenia (need to check code SI-Id) +-- Taiwan -- Tunisia @@ -759,6 +762,19 @@ 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('MA19B', 1214, '', 0, '', 'Province de Tan-Tan', 1); +-- Panama - 10 Provinces (id country=178) +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-1', '', 0, '', 'Bocas del Toro'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-2', '', 0, '', 'Coclé'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-3', '', 0, '', 'Colón'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-4', '', 0, '', 'Chiriquí'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-5', '', 0, '', 'Darién'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-6', '', 0, '', 'Herrera'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-7', '', 0, '', 'Los Santos'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-8', '', 0, '', 'Panamá'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-9', '', 0, '', 'Veraguas'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-13', '', 0, '', 'Panamá Oeste'); + + -- Romania Provinces (id country=188) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'AB', '', 0, '', 'Alba'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'AR', '', 0, '', 'Arad'); @@ -804,6 +820,55 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'VN', '', 0, '', 'Vrancea'); +-- Slovenia Provinces (rowid country=202) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI031', NULL, NULL, 'MURA', 'Mura'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI032', NULL, NULL, 'DRAVA', 'Drava'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI033', NULL, NULL, 'CARINTHIA', 'Carinthia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI034', NULL, NULL, 'SAVINJA', 'Savinja'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI035', NULL, NULL, 'CENTRAL SAVA', 'Central Sava'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI036', NULL, NULL, 'LOWER SAVA', 'Lower Sava'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI037', NULL, NULL, 'SOUTHEAST SLOVENIA', 'Southeast Slovenia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI038', NULL, NULL, 'LITTORAL–INNER CARNIOLA', 'Littoral–Inner Carniola'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI041', NULL, NULL, 'CENTRAL SLOVENIA', 'Central Slovenia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI038', NULL, NULL, 'UPPER CARNIOLA', 'Upper Carniola'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI043', NULL, NULL, 'GORIZIA', 'Gorizia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI044', NULL, NULL, 'COASTAL–KARST', 'Coastal–Karst'); + + +-- Taiwan Divisions / Provinces / Counties (rowid country=886) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KLU', 'KLU', NULL, '基隆市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPE', 'TPE', NULL, '臺北市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPH', 'TPH', NULL, '新北市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TYC', 'TYC', NULL, '桃園市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSH', 'HSH', NULL, '新竹縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSC', 'HSC', NULL, '新竹市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAL', 'MAL', NULL, '苗栗縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAC', 'MAC', NULL, '苗栗市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TXG', 'TXG', NULL, '臺中市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWH', 'CWH', NULL, '彰化縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWS', 'CWS', NULL, '彰化市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTC', 'NTC', NULL, '南投市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTO', 'NTO', NULL, '南投縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-YLH', 'YLH', NULL, '雲林縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CHY', 'CHY', NULL, '嘉義縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CYI', 'CYI', NULL, '嘉義市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TNN', 'TNN', NULL, '臺南市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KHH', 'KHH', NULL, '高雄市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-IUH', 'IUH', NULL, '屏東縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PTS', 'PTS', NULL, '屏東市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILN', 'ILN', NULL, '宜蘭縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILC', 'ILC', NULL, '宜蘭市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWA', 'HWA', NULL, '花蓮縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWC', 'HWC', NULL, '花蓮市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTC', 'TTC', NULL, '臺東市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTT', 'TTT', NULL, '臺東縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PEH', 'PEH', NULL, '澎湖縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-GNI', 'GNI', NULL, '綠島'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KYD', 'KYD', NULL, '蘭嶼'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KMN', 'KMN', NULL, '金門縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-LNN', 'LNN', NULL, '連江縣'); + + -- Tunisia Governorates / Provinces / Wilaya (id country=10) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN01', '', 0, '', 'Ariana'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN02', '', 0, '', 'Béja'); @@ -1628,17 +1693,6 @@ 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 ('2503', 18126, '', 0, '', 'Padre Abad', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2504', 18126, '', 0, '', 'Purús', 1); --- Provinces Panama (id country=178) -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-1', 17801, '', 0, '', 'Bocas del Toro', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-2', 17801, '', 0, '', 'Coclé', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-3', 17801, '', 0, '', 'Colón', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-4', 17801, '', 0, '', 'Chiriquí', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-5', 17801, '', 0, '', 'Darién', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-6', 17801, '', 0, '', 'Herrera', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-7', 17801, '', 0, '', 'Los Santos', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-8', 17801, '', 0, '', 'Panamá', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-9', 17801, '', 0, '', 'Veraguas', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-13', 17801, '', 0, '', 'Panamá Oeste', 1); -- Provinces United Arab Emirates (id country=227) INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-1', 22701, '', 0, '', 'Abu Dhabi', 1); @@ -1673,52 +1727,3 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('15001', 'PT-VR', NULL, NULL, 'VILA REAL', 'Vila Real'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('15001', 'PT-VI', NULL, NULL, 'VISEU', 'Viseu'); --- Provinces Slovenia (rowid country=202) -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI031', NULL, NULL, 'MURA', 'Mura'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI032', NULL, NULL, 'DRAVA', 'Drava'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI033', NULL, NULL, 'CARINTHIA', 'Carinthia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI034', NULL, NULL, 'SAVINJA', 'Savinja'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI035', NULL, NULL, 'CENTRAL SAVA', 'Central Sava'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI036', NULL, NULL, 'LOWER SAVA', 'Lower Sava'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI037', NULL, NULL, 'SOUTHEAST SLOVENIA', 'Southeast Slovenia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI038', NULL, NULL, 'LITTORAL–INNER CARNIOLA', 'Littoral–Inner Carniola'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI041', NULL, NULL, 'CENTRAL SLOVENIA', 'Central Slovenia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI038', NULL, NULL, 'UPPER CARNIOLA', 'Upper Carniola'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI043', NULL, NULL, 'GORIZIA', 'Gorizia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI044', NULL, NULL, 'COASTAL–KARST', 'Coastal–Karst'); - - --- Provinces Taiwan (rowid country=886) -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KLU', 'KLU', NULL, '基隆市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPE', 'TPE', NULL, '臺北市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPH', 'TPH', NULL, '新北市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TYC', 'TYC', NULL, '桃園市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSH', 'HSH', NULL, '新竹縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSC', 'HSC', NULL, '新竹市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAL', 'MAL', NULL, '苗栗縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAC', 'MAC', NULL, '苗栗市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TXG', 'TXG', NULL, '臺中市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWH', 'CWH', NULL, '彰化縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWS', 'CWS', NULL, '彰化市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTC', 'NTC', NULL, '南投市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTO', 'NTO', NULL, '南投縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-YLH', 'YLH', NULL, '雲林縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CHY', 'CHY', NULL, '嘉義縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CYI', 'CYI', NULL, '嘉義市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TNN', 'TNN', NULL, '臺南市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KHH', 'KHH', NULL, '高雄市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-IUH', 'IUH', NULL, '屏東縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PTS', 'PTS', NULL, '屏東市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILN', 'ILN', NULL, '宜蘭縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILC', 'ILC', NULL, '宜蘭市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWA', 'HWA', NULL, '花蓮縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWC', 'HWC', NULL, '花蓮市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTC', 'TTC', NULL, '臺東市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTT', 'TTT', NULL, '臺東縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PEH', 'PEH', NULL, '澎湖縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-GNI', 'GNI', NULL, '綠島'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KYD', 'KYD', NULL, '蘭嶼'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KMN', 'KMN', NULL, '金門縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-LNN', 'LNN', NULL, '連江縣'); - - From e50494152d3f305cb8551cfa1f221336b5ddbdde Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 11:22:45 +0200 Subject: [PATCH 125/135] Fix label --- htdocs/core/modules/modFacture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 333ef747cf2..e51a77ba085 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -121,7 +121,7 @@ class modFacture extends DolibarrModules $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>1, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), - 1=>array('label'=>'SendEmailsRemindersOnInvoiceDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsRemindersOnInvoiceDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority)', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), + 1=>array('label'=>'SendEmailsRemindersOnInvoiceDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsRemindersOnInvoiceDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days. First param is the offset n of days, second parameter is "all" or a payment mode code, last paramater is the code of email template to use (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority).', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), ); // Permissions From c25b044da586f67d89420dc23497a78f03576868 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 28 Apr 2021 11:56:07 +0200 Subject: [PATCH 126/135] FIX : several fixes on salary and vat --- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/salaries/class/salary.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index ff35ece947b..465e6f27fd6 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -144,7 +144,7 @@ class Tva extends CommonObject $sql .= " '".$this->db->escape($this->note)."',"; $sql .= " '".$this->db->escape($this->fk_account)."',"; $sql .= " '".$this->db->escape($this->type_payment)."',"; - $sql .= " '".$this->db->escape($this->fk_user_creat)."',"; + $sql .= " '".($this->fk_user_creat > 0 ? (int)$this->fk_user_creat : (int)$user->id)."',"; $sql .= " '".$this->db->escape($this->fk_user_modif)."'"; $sql .= ")"; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index e3dbb9b735d..9e009543fe0 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -146,7 +146,7 @@ class Salary extends CommonObject $sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; $sql .= " fk_user_author=".((int) $this->fk_user_author).","; - $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null'); + $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int)$this->fk_user_modif : (int)$user->id); $sql .= " WHERE rowid=".((int) $this->id); From 4af2f8871a26448fddc2d038cb355aa0ace34d54 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 28 Apr 2021 12:27:07 +0200 Subject: [PATCH 127/135] FIX : on update current_timestamp --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_salary.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 10822a8ec2a..48095160c69 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -259,7 +259,7 @@ create table llx_salary rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) label varchar(255), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, datep date, -- payment date diff --git a/htdocs/install/mysql/tables/llx_salary.sql b/htdocs/install/mysql/tables/llx_salary.sql index af4b869d9bf..b68ac1e7a1e 100644 --- a/htdocs/install/mysql/tables/llx_salary.sql +++ b/htdocs/install/mysql/tables/llx_salary.sql @@ -21,7 +21,7 @@ create table llx_salary ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, datep date, -- payment date From 01ddc13b2ef8fb9665ea0b8805cb3e50df4612ed Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 28 Apr 2021 13:06:19 +0200 Subject: [PATCH 128/135] FIX : on update current_timestamp for postgres --- htdocs/install/pgsql/functions/functions.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 17339c1f605..d73678bcbab 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -169,6 +169,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitm CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_address FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From 762378c04468f37613f2844680d824c0bde197da Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 28 Apr 2021 11:12:01 +0000 Subject: [PATCH 129/135] Fixing style errors. --- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/salaries/class/salary.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 465e6f27fd6..daed5b19f5e 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -144,7 +144,7 @@ class Tva extends CommonObject $sql .= " '".$this->db->escape($this->note)."',"; $sql .= " '".$this->db->escape($this->fk_account)."',"; $sql .= " '".$this->db->escape($this->type_payment)."',"; - $sql .= " '".($this->fk_user_creat > 0 ? (int)$this->fk_user_creat : (int)$user->id)."',"; + $sql .= " '".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id)."',"; $sql .= " '".$this->db->escape($this->fk_user_modif)."'"; $sql .= ")"; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 9e009543fe0..e7f1af66e0c 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -146,7 +146,7 @@ class Salary extends CommonObject $sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; $sql .= " fk_user_author=".((int) $this->fk_user_author).","; - $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int)$this->fk_user_modif : (int)$user->id); + $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id); $sql .= " WHERE rowid=".((int) $this->id); From dfb4a1c30a9bb9c53a9c80e08bcf686d0f38ce05 Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Wed, 28 Apr 2021 13:37:05 +0200 Subject: [PATCH 130/135] lint (code) Apply remarks and upgrade codee - Sets List of all Visible Warehouses at the beginning with getEntity method (removed the call to global $mc) - Better check for warehouse auto select (`$count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) && ...`) - Better SQL applying eldy's remarks --- htdocs/product/stock/replenish.php | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 7421e71f05c..73124fd7bad 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -66,18 +66,22 @@ $fourn_id = GETPOST('fourn_id', 'int'); $fk_supplier = GETPOST('fk_supplier', 'int'); $fk_entrepot = GETPOST('fk_entrepot', 'int'); +//List all visible warehouses +$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) .")"); +$listofqualifiedwarehousesid = ""; +$count = 0; +while ($tmpobj = $db->fetch_object($resWar)) { + if (!empty($listofqualifiedwarehousesid)) { + $listofqualifiedwarehousesid .= ","; + } + $listofqualifiedwarehousesid .= $tmpobj->rowid; + $lastWarehouseID = $tmpobj->rowid; + $count++; +}; + //MultiCompany : If only 1 Warehouse is visible, filter will automatically be set to it. -if ($fk_entrepot == "-1" && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { - global $mc; - $visibleWarehousesEntities = $conf->entity; - if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { - $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); - } - $resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); - if ($db->num_rows($resWar) == 1) { - $tmpobj = $db->fetch_object($resWar); - $fk_entrepot = $tmpobj->rowid; - } +if ($count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { + $fk_entrepot = $lastWarehouseID; }; $texte = ''; @@ -340,8 +344,8 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot IN ('.$db->sanitize($listofqualifiedwarehousesid).')'; +//$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; if ($fk_supplier > 0) { $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')'; } From 143417d7270b43f8ed9ce7877dcbfa2354e05a31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 14:17:00 +0200 Subject: [PATCH 131/135] Fix duplicate line --- dev/setup/codesniffer/ruleset.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index e99b8673981..f4f64f40141 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -16,7 +16,6 @@ htdocs/conf.php */nltechno* */htdocs/includes - */htdocs/includes .git From 8bb8d846adbae3031da5f08bae8edaeb31f8af7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 14:18:15 +0200 Subject: [PATCH 132/135] More complete setup file --- dev/setup/codesniffer/ruleset.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index f4f64f40141..e78438d8791 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -16,6 +16,7 @@ htdocs/conf.php */nltechno* */htdocs/includes + source .git From bc61fdd4878522488ff13c5357c32dbab1a80cde Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 28 Apr 2021 14:58:13 +0200 Subject: [PATCH 133/135] Missing $ --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 222d34d38d9..6235ea1fa5b 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1883,7 +1883,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Validate - if (Adherent::STATUS_DRAFT == object->statut) { + if (Adherent::STATUS_DRAFT == $object->statut) { if ($user->rights->adherent->creer) { print ''."\n"; } else { From 4926ac1e24f8f04e5ed7d7a7bf10284390c500dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 15:25:06 +0200 Subject: [PATCH 134/135] Fix make protected method not visible --- htdocs/api/class/api.class.php | 4 +++- htdocs/comm/action/class/api_agendaevents.class.php | 4 ++-- htdocs/compta/bank/class/api_bankaccounts.class.php | 4 ++-- htdocs/modulebuilder/template/class/api_mymodule.class.php | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 6cb40825ee7..c760903aca4 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -72,6 +72,7 @@ class DolibarrApi //$this->r->setSupportedFormats('jsonFormat'); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Check and convert a string depending on its type/name. * @@ -82,8 +83,9 @@ class DolibarrApi * @param stdClass $object Object * @return string Value cleaned */ - protected function checkValForAPI($field, $value, $object) + protected function _checkValForAPI($field, $value, $object) { + // phpcs:enable // TODO Use type detected in $object->fields if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) { return checkVal($value, 'restricthtml'); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 68da91d6ce2..c2961db7bbb 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -217,7 +217,7 @@ class AgendaEvents extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); + $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm); } /*if (isset($request_data["lines"])) { $lines = array(); @@ -270,7 +270,7 @@ class AgendaEvents extends DolibarrApi continue; } - $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); + $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm); } if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0) { diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 4afeac70124..762bcc506da 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -157,7 +157,7 @@ class BankAccounts extends DolibarrApi $account = new Account($this->db); foreach ($request_data as $field => $value) { - $account->$field = $this->checkValForAPI($field, $value, $account); + $account->$field = $this->_checkValForAPI($field, $value, $account); } // Date of the initial balance (required to create an account). $account->date_solde = time(); @@ -332,7 +332,7 @@ class BankAccounts extends DolibarrApi if ($field == 'id') { continue; } - $account->$field = $this->checkValForAPI($field, $value, $account); + $account->$field = $this->_checkValForAPI($field, $value, $account); } if ($account->update(DolibarrApiAccess::$user) > 0) { diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index e4b5fcca219..769c1529aff 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -213,7 +213,7 @@ class MyModuleApi extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); + $this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject); } // Clean data @@ -255,7 +255,7 @@ class MyModuleApi extends DolibarrApi if ($field == 'id') { continue; } - $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); + $this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject); } // Clean data From 0108826ee58cc3207c839acdf3aee9b0f5a5f8a5 Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Wed, 28 Apr 2021 16:03:40 +0200 Subject: [PATCH 135/135] add column instead of just add --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 652be6ec035..3c21284363a 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -437,5 +437,5 @@ ALTER TABLE llx_entrepot ADD COLUMN fk_project INTEGER DEFAULT NULL AFTER entity UPDATE llx_const SET value = 'github' WHERE __DECRYPT('name')__ = 'MAIN_BUGTRACK_ENABLELINK' AND __DECRYPT('value')__ = 1; -- For MultiCompany PMP per entity -ALTER TABLE llx_product_perentity ADD pmp FLOAT NULL DEFAULT NULL AFTER accountancy_code_buy_export +ALTER TABLE llx_product_perentity ADD COLUMN pmp FLOAT NULL DEFAULT NULL AFTER accountancy_code_buy_export