From f4786c8a0afdf13b14c6c8ca03eee689bbc3e075 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Sep 2021 19:46:40 +0200 Subject: [PATCH 1/5] Include ref into label of log history Conflicts: htdocs/holiday/card.php --- htdocs/holiday/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 729b4653f64..3ca389176e7 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -561,11 +561,11 @@ if (empty($reshook)) $nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday); $soldeActuel = $object->getCpforUser($object->fk_user, $object->fk_type); $newSolde = ($soldeActuel - $nbopenedday); + $label = $langs->transnoentitiesnoconv("Holidays").' - '.$object->ref; - // On ajoute la modification dans le LOG - $result = $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type); - if ($result < 0) - { + // The modification is added to the LOG + $result = $object->addLogCP($user->id, $object->fk_user, $label, $newSolde, $object->fk_type); + if ($result < 0) { $error++; setEventMessages(null, $object->errors, 'errors'); } From 77247ec43a3589312727478f00ba73e0301fe788 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Sep 2021 20:35:57 +0200 Subject: [PATCH 2/5] Add date valid/approval --- htdocs/holiday/list.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index f801a685d6a..84ba4a3a9d0 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -568,6 +568,12 @@ if ($resql) print ''; } + // End date + if (!empty($arrayfields['cp.date_valid']['checked'])) { + print ''; + print ''; + } + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook @@ -584,7 +590,7 @@ if ($resql) print ''; } - // Create date + // Update date if (!empty($arrayfields['cp.tms']['checked'])) { print ''; @@ -617,6 +623,7 @@ if ($resql) if (!empty($arrayfields['duration']['checked'])) print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right maxwidth100'); if (!empty($arrayfields['cp.date_debut']['checked'])) print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['cp.date_fin']['checked'])) print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['cp.date_valid']['checked'])) print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -733,6 +740,18 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + if (!$i) $totalarray['nbfield']++; + } + /*if (!empty($arrayfields['cp.date_approve']['checked'])) { + print ''; + print dol_print_date($db->jdate($obj->date_approve), 'day'); + print ''; + if (!$i) $totalarray['nbfield']++; + }*/ // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; From 1eb4975a761af9bfd20431c2376e85b9cc157da1 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 10 Sep 2021 11:44:58 +0200 Subject: [PATCH 3/5] fix: Bad date creation for project clone --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c5dd1045f03..aca817e0193 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1448,7 +1448,7 @@ class Project extends CommonObject } } - $clone_project->datec = $now; + $clone_project->date_c = $now; if (!$clone_note) { From 724badb522ebfdfb155969d9b7446b9ead86f5b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Sep 2021 13:29:19 +0200 Subject: [PATCH 4/5] Fix deletion of shipment when there is batch record --- htdocs/expedition/class/expedition.class.php | 8 +++----- htdocs/expedition/class/expeditionbatch.class.php | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 752da8aca04..0d505a46007 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1455,11 +1455,9 @@ class Expedition extends CommonObject } } - // delete batch expedition line - if (!$error && $conf->productbatch->enabled) - { - if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) - { + // delete batch expedition line (we try deletion even if module not enabled in case of the module were enabled and disabled previously) + if (!$error) { + if (ExpeditionLineBatch::deletefromexp($this->db, $this->id) < 0) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index 637f9dd749c..0cf9a3a68e8 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -153,10 +153,8 @@ class ExpeditionLineBatch extends CommonObject */ public static function deletefromexp($db, $id_expedition) { - $id_expedition = (int) $id_expedition; - $sql = "DELETE FROM ".MAIN_DB_PREFIX.self::$_table_element; - $sql .= " WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".$id_expedition.")"; + $sql .= " WHERE fk_expeditiondet in (SELECT rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition=".((int) $id_expedition).")"; dol_syslog(__METHOD__, LOG_DEBUG); if ($db->query($sql)) From 87bb971d75378b0328d5f215233fe6fcba5e683c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Sep 2021 13:17:00 +0200 Subject: [PATCH 5/5] FIX autocalculation of the supplier price in main currency. Conflicts: htdocs/product/fournisseurs.php --- htdocs/product/fournisseurs.php | 64 ++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index b6f09346385..30b31c185a7 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -616,17 +616,19 @@ if ($id > 0 || $ref) '; } - if ($conf->multicurrency->enabled) { - // Currency - print ''.$langs->trans("Currency").''; - print ''; - $currencycodetouse = GETPOST('multicurrency_code') ?GETPOST('multicurrency_code') : (isset($object->fourn_multicurrency_code) ? $object->fourn_multicurrency_code : ''); - if (empty($currencycodetouse) && $object->fourn_multicurrency_tx == 1) $currencycodetouse = $conf->currency; - print $form->selectMultiCurrency($currencycodetouse, "multicurrency_code", 1); - print '   '.$langs->trans("CurrencyRate").' '; - print ''; - print ''; - print ''; + if (!empty($conf->multicurrency->enabled)) { + // Currency + print ''.$langs->trans("Currency").''; + print ''; + $currencycodetouse = GETPOST('multicurrency_code') ? GETPOST('multicurrency_code') : (isset($object->fourn_multicurrency_code) ? $object->fourn_multicurrency_code : ''); + if (empty($currencycodetouse) && $object->fourn_multicurrency_tx == 1) { + $currencycodetouse = $conf->currency; + } + print $form->selectMultiCurrency($currencycodetouse, "multicurrency_code", 1); + print '   '.$langs->trans("CurrencyRate").' '; + print ''; + print ''; + print ''; // Currency price qty min print ''.$langs->trans("PriceQtyMinCurrency").''; @@ -646,43 +648,45 @@ if ($id > 0 || $ref) print ''; $currencies = array(); - $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE entity = '.$conf->entity; + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE entity = '.((int) $conf->entity); $resql = $db->query($sql); if ($resql) { $currency = new MultiCurrency($db); while ($obj = $db->fetch_object($resql)) { $currency->fetch($obj->rowid); - $currencies[$currency->code] = $currency->rate->rate; + $currencies[$currency->code] = ((float) $currency->rate->rate); } } $currencies = json_encode($currencies); - print << -SCRIPT; +END; } else { // Price qty min print ''.$langs->trans("PriceQtyMin").'';