From 77c716565e6baff527a398eccaca15aa8d3b0896 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 23 Oct 2021 23:42:06 +0200 Subject: [PATCH 01/16] Fix #18922 : multicurrency sync in http with good currencylayer url --- htdocs/multicurrency/class/multicurrency.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 5067a6e91d5..3cdcd30dd70 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -643,13 +643,12 @@ class MultiCurrency extends CommonObject include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; - $urlendpoint = 'http://apilayer.net/api/live?access_key='.$key; - //$urlendpoint.='&format=1'; - $urlendpoint .= (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '' : '&source='.$conf->global->MULTICURRENCY_APP_SOURCE); + $urlendpoint = 'http://api.currencylayer.com/live?access_key='.$key; + $urlendpoint .= '&source=' . (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? 'USD' : $conf->global->MULTICURRENCY_APP_SOURCE); dol_syslog("Call url endpoint ".$urlendpoint); - $resget = getURLContent($urlendpoint, 'GET', '', 1, array(), array('http', 'https'), 1); + $resget = getURLContent($urlendpoint); if ($resget['content']) { $response = $resget['content']; From 0a2c950401ded7ce6af036b045b036ff76f55eb7 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 24 Oct 2021 00:31:57 +0200 Subject: [PATCH 02/16] Fix #18916 : mass stock movements not displayed if error while adding line --- htdocs/product/stock/massstockmove.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 9f3390d34af..ed7095473ea 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -443,6 +443,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') { */ $now = dol_now(); +$error = 0; $form = new Form($db); $formproduct = new FormProduct($db); From 6abd4cc1200abf01c927c349d53b43381c623f1c Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 24 Oct 2021 11:38:45 +0200 Subject: [PATCH 03/16] Fix #8716 : tasks were not shown in ecm auto tree --- htdocs/core/ajax/ajaxdirpreview.php | 8 +++++++- htdocs/core/class/html.formfile.class.php | 20 +++++++++++++++++--- htdocs/ecm/index_auto.php | 2 ++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 09292dd4991..917a9786ab2 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -205,12 +205,14 @@ if ($type == 'directory') { 'product', 'tax', 'project', + 'project_task', 'fichinter', 'user', 'expensereport', 'holiday', 'recruitment-recruitmentcandidature', 'banque', + 'chequereceipt', 'mrp-mo' ); @@ -243,6 +245,8 @@ if ($type == 'directory') { $upload_dir = $conf->tax->dir_output; } elseif ($module == 'project') { $upload_dir = $conf->projet->dir_output; + } elseif ($module == 'project_task') { + $upload_dir = $conf->projet->dir_output; } elseif ($module == 'fichinter') { $upload_dir = $conf->ficheinter->dir_output; } elseif ($module == 'user') { @@ -255,8 +259,10 @@ if ($type == 'directory') { $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature'; } elseif ($module == 'banque') { $upload_dir = $conf->bank->dir_output; + } elseif ($module == 'chequereceipt') { + $upload_dir = $conf->bank->dir_output.'/checkdeposits'; } elseif ($module == 'mrp-mo') { - $upload_dir = $conf->mrp->dir_output.'/mo'; + $upload_dir = $conf->mrp->dir_output; } else { $parameters = array('modulepart'=>$module); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index b5d96a7f1e2..fcca60dad78 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1645,6 +1645,9 @@ class FormFile } elseif ($modulepart == 'project') { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $object_instance = new Project($this->db); + } elseif ($modulepart == 'project_task') { + include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; + $object_instance = new Task($this->db); } elseif ($modulepart == 'fichinter') { include_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; $object_instance = new Fichinter($this->db); @@ -1663,6 +1666,9 @@ class FormFile } elseif ($modulepart == 'banque') { include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $object_instance = new Account($this->db); + } elseif ($modulepart == 'chequereceipt') { + include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; + $object_instance = new RemiseCheque($this->db); } elseif ($modulepart == 'mrp-mo') { include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; $object_instance = new Mo($this->db); @@ -1717,14 +1723,19 @@ class FormFile $id = (isset($reg[1]) ? $reg[1] : ''); } elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); - $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) { + $ref = (isset($reg[1]) ? $reg[1] : ''); + if (is_numeric($ref)) { $id = $ref; $ref = ''; } - } elseif ($modulepart == 'user' || $modulepart == 'holiday') { + } elseif ($modulepart == 'user') { // $ref may be also id with old supplier invoices preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : ''); + } elseif ($modulepart == 'project_task') { + // $ref of task is the sub-directory of the project + $reg = explode("/", $relativefile); + $ref = (isset($reg[1]) ? $reg[1] : ''); } elseif (in_array($modulepart, array( 'invoice', 'propal', @@ -1734,11 +1745,14 @@ class FormFile 'contract', 'product', 'project', + 'project_task', 'fichinter', 'expensereport', 'recruitment-recruitmentcandidature', 'mrp-mo', - 'banque'))) { + 'banque', + 'chequereceipt', + 'holiday'))) { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); } else { diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index d54dcf14d1e..acce421fb9a 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -341,6 +341,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { } if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); + $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project_task', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks"))); } if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); @@ -353,6 +354,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { } if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount"))); + $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'chequereceipt', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt"))); } if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); From dc32350ee71f126f2c95a851584dfe8002dff2f1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Oct 2021 13:02:45 +0200 Subject: [PATCH 04/16] Code comment --- htdocs/core/modules/modPropale.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 83e2b5a0402..eb589fc1759 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -23,7 +23,7 @@ /** * \defgroup propale Module commercial proposals - * \brief Module pour gerer la tenue de propositions commerciales + * \brief Module to manage commercial proposals * \file htdocs/core/modules/modPropale.class.php * \ingroup propale * \brief Description and activation file for the module customer proposal @@ -36,7 +36,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modPropale extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * From ad3297b0ef15d5b4864b16890ce931c527fb8591 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Oct 2021 14:01:23 +0200 Subject: [PATCH 05/16] Use of MAIN_FIRST_PING_OK_ID = 'disabled' works when forcing reinstall. --- htdocs/install/step2.php | 2 +- htdocs/main.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index f95cb218561..9754ae78762 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -571,7 +571,7 @@ dolibarr_install_syslog("Exit ".$ret); dolibarr_install_syslog("- step2: end"); -$out = ' '; +$out = 'global->MAIN_FIRST_PING_OK_ID) && $conf->global->MAIN_FIRST_PING_OK_ID == 'disabled') ? '' : ' value="checked" checked="true"').'> '; $out .= ''; $out .= ''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 07ab0949a10..a588937e2bf 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -3214,7 +3214,7 @@ if (!function_exists("llxFooter")) { print "\n\n"; } elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping) { // Cookie is set when we uncheck the checkbox in the installation wizard. // MAIN_LAST_PING_KO_DATE - // Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent + // Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent (this month) if (!empty($conf->global->MAIN_LAST_PING_KO_DATE) && substr($conf->global->MAIN_LAST_PING_KO_DATE, 0, 6) == dol_print_date(dol_now(), '%Y%m') && !$forceping) { print "\n\n"; } else { From 4ab759b067178dda42a17bc4f52c919c9cd92a51 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Oct 2021 14:23:35 +0200 Subject: [PATCH 06/16] Fix check/uncheck of ping --- htdocs/install/step2.php | 14 +++++++++++--- htdocs/main.inc.php | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 9754ae78762..b3d59b2e741 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -570,6 +570,11 @@ dolibarr_install_syslog("Exit ".$ret); dolibarr_install_syslog("- step2: end"); +// Force here a value we need after because master.inc.php is not loaded into step2. +// This code must be similar with the one into main.inc.php +$conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance + +$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); $out = 'global->MAIN_FIRST_PING_OK_ID) && $conf->global->MAIN_FIRST_PING_OK_ID == 'disabled') ? '' : ' value="checked" checked="true"').'> '; $out .= ''; @@ -577,12 +582,15 @@ $out .= '