From 669e0806704d2a48f83a6b6090deb15513ad1afc Mon Sep 17 00:00:00 2001 From: Ion Date: Wed, 6 Dec 2017 14:49:04 +0100 Subject: [PATCH 1/6] More informative error message in dynamics price --- htdocs/langs/en_US/errors.lang | 1 + .../product/dynamic_price/class/price_parser.class.php | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 64dcd06cb65..e51bdfc1be0 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -156,6 +156,7 @@ ErrorPriceExpression20=Empty expression ErrorPriceExpression21=Empty result '%s' ErrorPriceExpression22=Negative result '%s' ErrorPriceExpression23=Unknown or non set variable '%s' in %s +ErrorPriceExpression24=Variable '%s' exists but has no value ErrorPriceExpressionInternal=Internal error '%s' ErrorPriceExpressionUnknown=Unknown error '%s' ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index 088c15b02aa..c281816e99b 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -82,6 +82,7 @@ class PriceParser 17, undefined variable '%s' 21, empty result '%s' 22, negative result '%s' + 24, variable '%s' exists but has no value -2 Args 6, wrong number of arguments (%s given, %s expected) @@ -192,9 +193,12 @@ class PriceParser $expression = str_replace("\n", $this->separator_chr, $expression); foreach ($values as $key => $value) { - if ($value === null) $value = "NULL"; - $expression = str_replace($this->special_chr.$key.$this->special_chr, strval($value), $expression); - } + if ($value === null && strpos($expression, $key) !== false) { + $this->error_parser = array(24, $key); + return -7; + } + $expression = str_replace($this->special_chr.$key.$this->special_chr, strval($value), $expression); + } //Check if there is unfilled variable if (strpos($expression, $this->special_chr) !== false) From 0fa77160d9c5e6c07e148be91d816f05bb906250 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 6 Dec 2017 23:21:58 +0100 Subject: [PATCH 2/6] Fix scrutinizer --- htdocs/comm/propal/class/propal.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 15649f7a627..1b6a98dbdb9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -683,6 +683,7 @@ class Propal extends CommonObject // Anciens indicateurs: $price, $remise (a ne plus utiliser) $price = $pu; + $remise = 0; if ($remise_percent > 0) { $remise = round(($pu * $remise_percent / 100), 2); @@ -1983,7 +1984,7 @@ class Propal extends CommonObject $sql.= " SET fk_availability = '".$id."'"; $sql.= " WHERE rowid = ".$this->id; - dol_syslog(__METHOD__.' availability('.$availability_id.')', LOG_DEBUG); + dol_syslog(__METHOD__.' availability('.$id.')', LOG_DEBUG); $resql=$this->db->query($sql); if (!$resql) { @@ -3103,6 +3104,7 @@ class Propal extends CommonObject global $langs; $langs->load("propal"); + $statuttrans=''; if ($statut==self::STATUS_DRAFT) $statuttrans='statut0'; if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1'; if ($statut==self::STATUS_SIGNED) $statuttrans='statut3'; @@ -3151,6 +3153,9 @@ class Propal extends CommonObject $langs->load("propal"); $now=dol_now(); + $delay_warning = 0; + $statut = 0; + $label = ''; if ($mode == 'opened') { $delay_warning=$conf->propal->cloture->warning_delay; $statut = self::STATUS_VALIDATED; @@ -3981,9 +3986,9 @@ class PropaleLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function delete($user=null, $notrigger=0) + function delete(User $user, $notrigger=0) { - global $conf,$user; + global $conf; $error=0; $this->db->begin(); From 98149ae3167a857267bbc60a60f609c9d8c2d0f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Dec 2017 23:31:42 +0100 Subject: [PATCH 3/6] Fix regression --- htdocs/compta/facture/class/facture-rec.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 9a751157c4a..43d691ca5bd 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -437,8 +437,8 @@ class FactureRec extends CommonInvoice // Retreive all extrafield for line // fetch optionals attributes and labels require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); - $extrafieldsline=new ExtraFields($line->db); - $extrafieldsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true); + $extrafieldsline=new ExtraFields($this->db); + $extrafieldsline=$extrafieldsline->fetch_name_optionals_label('facturedet_rec',true); $sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, '; $sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,'; From 74a63ca18cb7afebaab0c0b3b8ec015381678d3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Dec 2017 23:43:59 +0100 Subject: [PATCH 4/6] Fix scrutinizer --- htdocs/core/class/commoninvoice.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 4c9eb7fdcaf..b9ff5dd8670 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -319,7 +319,8 @@ abstract class CommonInvoice extends CommonObject // TODO If there is payment in bookkeeping, check payment is not dispatched in accounting // ... - if ($this->situation_cycle_ref) { + if ($this->situation_cycle_ref && method_exists($this, 'is_last_in_cycle')) + { $last = $this->is_last_in_cycle(); if (! $last) return -3; } From 8a39e2a413d1079f022f5d3333b5b98f6e3f8645 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 7 Dec 2017 00:28:43 +0100 Subject: [PATCH 5/6] Fix : no need for action button on cards, link is now available --- htdocs/comm/propal/card.php | 4 ++-- htdocs/commande/card.php | 4 ++-- htdocs/fourn/commande/card.php | 4 ++-- htdocs/fourn/facture/card.php | 4 ++-- htdocs/projet/card.php | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 85ba6f56981..50a98fc5e09 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2262,10 +2262,10 @@ if ($action == 'create') print ''; } // Create event - if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. + /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. { print ''; - } + }*/ // Edit if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->creer) { print ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index bf0ee8aa993..304bbd04997 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2465,12 +2465,12 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } // Create event - if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a + /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a // "workflow" action so should appears somewhere else on // page. { print '' . $langs->trans("AddAction") . ''; - } + }*/ // Create intervention if ($conf->ficheinter->enabled) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index c96c42e2297..498d29c6fb4 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2186,10 +2186,10 @@ elseif (! empty($object->id)) } } // Create event - if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. + /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. { print ''; - } + }*/ // Modify if ($object->statut == 1) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a3c068e34bf..febfc28a88a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2832,10 +2832,10 @@ else } // Create event - if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. + /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. { print ''; - } + }*/ // Clone if ($action != 'edit' && $user->rights->fournisseur->facture->creer) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 4b4e6a0ea58..2b8633ca31f 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1034,12 +1034,12 @@ elseif ($object->id > 0) { // Create event - if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a + /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a // "workflow" action so should appears somewhere else on // page. { print ''; - } + }*/ // Modify if ($object->statut != 2 && $user->rights->projet->creer) From 6b278a674050d2a78eb00bfbe9f18ab6e5f2cd1b Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 7 Dec 2017 16:01:52 +0100 Subject: [PATCH 6/6] Add icons on home page menu --- htdocs/core/menus/standard/eldy.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 80e91f9b40d..1ecc84f5c2b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -518,10 +518,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $langs->load("users"); // Home - dashboard - $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', ''); + $newmenu->add("/index.php?mainmenu=home&leftmenu=home", $langs->trans("MyDashboard"), 0, 1, '', $mainmenu, 'home', 0, '', '', '', ''); // Setup - $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup'); + $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', ''); if ($usemenuhider || empty($leftmenu) || $leftmenu=="setup") { $langs->load("admin"); @@ -558,7 +558,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } // System tools - $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools'); + $newmenu->add("/admin/tools/index.php?mainmenu=home&leftmenu=admintools", $langs->trans("AdminTools"), 0, $user->admin, '', $mainmenu, 'admintools', 0, '', '', '', ''); if ($usemenuhider || empty($leftmenu) || preg_match('/^admintools/',$leftmenu)) { $langs->load("admin"); @@ -591,7 +591,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } } - $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users'); + $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', ''); if ($user->rights->user->user->lire) { if ($usemenuhider || empty($leftmenu) || $leftmenu=="users")