From c4513a755dc8b3fb174c9c5c2493ba1c1c65f036 Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Thu, 28 Jun 2018 16:39:37 +0200 Subject: [PATCH 01/10] Fix extrafields resource --- .../core/tpl/extrafields_list_print_fields.tpl.php | 6 ++++++ htdocs/resource/list.php | 13 +++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 58915b7a786..5cf6c827b49 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -58,10 +58,16 @@ else // Old method if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp'))) { $value = $db->jdate($obj->$tmpkey); + if(is_a($obj, "Dolresource")){ + $value = $db->jdate($obj->array_options[$tmpkey]); + } } else { $value = $obj->$tmpkey; + if(is_a($obj, "Dolresource")){ + $value = $obj->array_options[$tmpkey]; + } } print $extrafields->showOutputField($key, $value, ''); print ''; diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 190659628f2..8c8f6c8df54 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -1,6 +1,7 @@ - * + * Copyright (C) 2018 Nicolas ZABOURI + * * 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 * the Free Software Foundation, either version 3 of the License, or @@ -237,14 +238,14 @@ print "\n"; if ($ret) { - foreach ($object->lines as $resource) + foreach ($object->lines as $obj) { print ''; if (! empty($arrayfields['t.ref']['checked'])) { print ''; - print $resource->getNomUrl(5); + print $obj->getNomUrl(5); print ''; if (! $i) $totalarray['nbfield']++; } @@ -252,7 +253,7 @@ if ($ret) if (! empty($arrayfields['ty.label']['checked'])) { print ''; - print $resource->type_label; + print $obj->type_label; print ''; if (! $i) $totalarray['nbfield']++; } @@ -260,11 +261,11 @@ if ($ret) include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; print ''; - print ''; + print ''; print img_edit(); print ''; print ' '; - print ''; + print ''; print img_delete(); print ''; print ''; From 2824afa75c46a5f456ecf754ee84f2c11582f069 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 29 Jun 2018 11:25:30 +0200 Subject: [PATCH 02/10] Fix: avoid a non numeric value !! --- htdocs/core/lib/price.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index eb332b44611..fe2c1d73809 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -89,6 +89,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result=array(); // Clean parameters + if (empty($pu)) $pu=0; if (empty($info_bits)) $info_bits=0; if (empty($txtva)) $txtva=0; if (empty($seller) || ! is_object($seller)) From 964f11491fd454671f3906e317dfac826dab993e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 30 Jun 2018 10:26:50 +0200 Subject: [PATCH 03/10] Revert "Fix: avoid a non numeric value !!" This reverts commit 2824afa75c46a5f456ecf754ee84f2c11582f069. --- htdocs/core/lib/price.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index fe2c1d73809..eb332b44611 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -89,7 +89,6 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result=array(); // Clean parameters - if (empty($pu)) $pu=0; if (empty($info_bits)) $info_bits=0; if (empty($txtva)) $txtva=0; if (empty($seller) || ! is_object($seller)) From 4925624ed9b88f1ce80b39d03a7be5daee5d0b65 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 30 Jun 2018 10:38:30 +0200 Subject: [PATCH 04/10] Fix: avoid NULL value when "subprice" is 0 --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/commande/class/commande.class.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index bedf489467e..eb2c41ac05d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3939,7 +3939,7 @@ class PropaleLigne extends CommonObjectLine $sql.= " ".price2num($this->localtax2_tx).","; $sql.= " '".$this->db->escape($this->localtax1_type)."',"; $sql.= " '".$this->db->escape($this->localtax2_type)."',"; - $sql.= " ".($this->subprice?price2num($this->subprice):"null").","; + $sql.= " ".price2num($this->subprice).","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".(isset($this->info_bits)?"'".$this->db->escape($this->info_bits)."'":"null").","; $sql.= " ".price2num($this->total_ht).","; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d2f1c21654e..073ad0e51de 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4065,7 +4065,7 @@ class OrderLine extends CommonOrderLine $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; $sql.= " '".$this->db->escape($this->product_type)."',"; $sql.= " '".price2num($this->remise_percent)."',"; - $sql.= " ".($this->subprice!=''?"'".price2num($this->subprice)."'":"null").","; + $sql.= " ".price2num($this->subprice).","; $sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").","; $sql.= " '".price2num($this->remise)."',"; $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; @@ -4074,11 +4074,11 @@ class OrderLine extends CommonOrderLine $sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").','; $sql.= ' '.price2num($this->pa_ht).','; $sql.= " '".$this->db->escape($this->info_bits)."',"; - $sql.= " '".price2num($this->total_ht)."',"; - $sql.= " '".price2num($this->total_tva)."',"; - $sql.= " '".price2num($this->total_localtax1)."',"; - $sql.= " '".price2num($this->total_localtax2)."',"; - $sql.= " '".price2num($this->total_ttc)."',"; + $sql.= " ".price2num($this->total_ht).","; + $sql.= " ".price2num($this->total_tva).","; + $sql.= " ".price2num($this->total_localtax1).","; + $sql.= " ".price2num($this->total_localtax2).","; + $sql.= " ".price2num($this->total_ttc).","; $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").','; $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").','; $sql.= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit); From d53f03b5968f6c8c611f8e86670bfc0729313541 Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Thu, 5 Jul 2018 09:14:36 +0200 Subject: [PATCH 05/10] Update after comment --- htdocs/core/tpl/extrafields_list_print_fields.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 5cf6c827b49..e77d0ee0eaf 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -58,14 +58,14 @@ else // Old method if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp'))) { $value = $db->jdate($obj->$tmpkey); - if(is_a($obj, "Dolresource")){ + if (is_array($obj->array_options) && isset($obj->array_options[$tmpkey])){ $value = $db->jdate($obj->array_options[$tmpkey]); } } else { $value = $obj->$tmpkey; - if(is_a($obj, "Dolresource")){ + if (is_array($obj->array_options) && isset($obj->array_options[$tmpkey])){ $value = $obj->array_options[$tmpkey]; } } @@ -80,4 +80,4 @@ else // Old method } } } -} \ No newline at end of file +} From dc7fcc009bfbdcb4e7624fce4475f41a85a0fefc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jul 2018 10:56:45 +0200 Subject: [PATCH 06/10] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index eb2c41ac05d..44d7c7ea1b4 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3939,7 +3939,7 @@ class PropaleLigne extends CommonObjectLine $sql.= " ".price2num($this->localtax2_tx).","; $sql.= " '".$this->db->escape($this->localtax1_type)."',"; $sql.= " '".$this->db->escape($this->localtax2_type)."',"; - $sql.= " ".price2num($this->subprice).","; + $sql.= " ".(is_numeric($this->subprice)?price2num($this->subprice):"null").","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".(isset($this->info_bits)?"'".$this->db->escape($this->info_bits)."'":"null").","; $sql.= " ".price2num($this->total_ht).","; From ed3023f7d990175f70401f771b0b8fcdf60224b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jul 2018 11:09:08 +0200 Subject: [PATCH 07/10] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 44d7c7ea1b4..c5ec7e75955 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3939,14 +3939,14 @@ class PropaleLigne extends CommonObjectLine $sql.= " ".price2num($this->localtax2_tx).","; $sql.= " '".$this->db->escape($this->localtax1_type)."',"; $sql.= " '".$this->db->escape($this->localtax2_type)."',"; - $sql.= " ".(is_numeric($this->subprice)?price2num($this->subprice):"null").","; + $sql.= " ".(price2num($this->subprice)!==''?price2num($this->subprice):"null").","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".(isset($this->info_bits)?"'".$this->db->escape($this->info_bits)."'":"null").","; - $sql.= " ".price2num($this->total_ht).","; - $sql.= " ".price2num($this->total_tva).","; - $sql.= " ".price2num($this->total_localtax1).","; - $sql.= " ".price2num($this->total_localtax2).","; - $sql.= " ".price2num($this->total_ttc).","; + $sql.= " ".(price2num($this->total_ht)!==''?price2num($this->total_ht):"null").","; + $sql.= " ".(price2num($this->total_tva)!==''?price2num($this->total_tva):"null").","; + $sql.= " ".(price2num($this->tottotal_localtax1al_ht)!==''?price2num($this->total_localtax1):"null").","; + $sql.= " ".(price2num($this->total_localtax2)!==''?price2num($this->total_localtax2):"null").","; + $sql.= " ".(price2num($this->total_ttc)!==''?price2num($this->total_ttc):"null").","; $sql.= " ".(!empty($this->fk_fournprice)?"'".$this->db->escape($this->fk_fournprice)."'":"null").","; $sql.= " ".(isset($this->pa_ht)?"'".price2num($this->pa_ht)."'":"null").","; $sql.= ' '.$this->special_code.','; From c0d6aee040266ba5783af1bc66aeccd483708ad9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jul 2018 11:10:01 +0200 Subject: [PATCH 08/10] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c5ec7e75955..56567c24ee3 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3942,11 +3942,11 @@ class PropaleLigne extends CommonObjectLine $sql.= " ".(price2num($this->subprice)!==''?price2num($this->subprice):"null").","; $sql.= " ".price2num($this->remise_percent).","; $sql.= " ".(isset($this->info_bits)?"'".$this->db->escape($this->info_bits)."'":"null").","; - $sql.= " ".(price2num($this->total_ht)!==''?price2num($this->total_ht):"null").","; - $sql.= " ".(price2num($this->total_tva)!==''?price2num($this->total_tva):"null").","; - $sql.= " ".(price2num($this->tottotal_localtax1al_ht)!==''?price2num($this->total_localtax1):"null").","; - $sql.= " ".(price2num($this->total_localtax2)!==''?price2num($this->total_localtax2):"null").","; - $sql.= " ".(price2num($this->total_ttc)!==''?price2num($this->total_ttc):"null").","; + $sql.= " ".price2num($this->total_ht).","; + $sql.= " ".price2num($this->total_tva).","; + $sql.= " ".price2num($this->total_localtax1).","; + $sql.= " ".price2num($this->total_localtax2).","; + $sql.= " ".price2num($this->total_ttc).","; $sql.= " ".(!empty($this->fk_fournprice)?"'".$this->db->escape($this->fk_fournprice)."'":"null").","; $sql.= " ".(isset($this->pa_ht)?"'".price2num($this->pa_ht)."'":"null").","; $sql.= ' '.$this->special_code.','; From bda142d82d70d896570124ac888a1962b64b5677 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Jul 2018 11:10:55 +0200 Subject: [PATCH 09/10] Update commande.class.php --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 073ad0e51de..9007490d421 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4065,7 +4065,7 @@ class OrderLine extends CommonOrderLine $sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").','; $sql.= " '".$this->db->escape($this->product_type)."',"; $sql.= " '".price2num($this->remise_percent)."',"; - $sql.= " ".price2num($this->subprice).","; + $sql.= " ".(price2num($this->subprice)!==''?price2num($this->subprice):"null").","; $sql.= " ".($this->price!=''?"'".price2num($this->price)."'":"null").","; $sql.= " '".price2num($this->remise)."',"; $sql.= ' '.(! empty($this->fk_remise_except)?$this->fk_remise_except:"null").','; From 0c252d9778774585c232b87a01d47c7c0ca651e9 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Wed, 11 Jul 2018 18:09:29 +0200 Subject: [PATCH 10/10] Fix user rights overrided by user group rights --- htdocs/user/class/user.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 220892e74b2..e329d77b1b3 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -804,7 +804,8 @@ class User extends CommonObject else { if(empty($this->rights->$module->$perms)) $this->nb_rights++; - $this->rights->$module->$perms = 1; + // if we have already define a subperm like this $this->rights->$module->level1->level2 with llx_user_rights, we don't want override level1 because the level2 can be not define on user group + if (!is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = 1; } }