From d300b943e122df7e4793fdf86c5c73dba3693335 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 23 Feb 2018 15:10:25 +0100 Subject: [PATCH 01/11] Fix wrong price on supplier order line --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index d952eb771da..4441d7159af 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1089,7 +1089,7 @@ if (empty($reshook)) $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product > 0 ? $lines[$i]->fk_product : 0, - $productsupplier->product_fourn_price_id, + 0, $productsupplier->ref_supplier, $lines[$i]->remise_percent, 'HT', From ebb4da8417549128c4e358aae38bf94f4908a4c2 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Mon, 5 Mar 2018 16:58:35 +0100 Subject: [PATCH 02/11] Fix keep supplier proposal price in supplier order --- .../class/fournisseur.commande.class.php | 2 +- htdocs/fourn/commande/card.php | 68 +++++++++---------- 2 files changed, 32 insertions(+), 38 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7c7837e75fe..4d492bf2bbe 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1417,7 +1417,7 @@ class CommandeFournisseur extends CommonOrder if ($fk_product > 0) { - if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) + if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED) && $origin !== 'supplier_proposal') { // Check quantity is enough dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 4441d7159af..aa833d49b6e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1044,8 +1044,6 @@ if (empty($reshook)) $fk_parent_line = 0; $num = count($lines); - $productsupplier = new ProductFournisseur($db); - for($i = 0; $i < $num; $i ++) { @@ -1068,45 +1066,41 @@ if (empty($reshook)) $lines[$i]->fetch_optionals($lines[$i]->rowid); $array_option = $lines[$i]->array_options; } + + $tva_tx = $lines[$i]->tva_tx; - $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid); - if ($result>=0) + if ($origin=="commande") { - $tva_tx = $lines[$i]->tva_tx; - - if ($origin=="commande") - { - $soc=new societe($db); - $soc->fetch($socid); - $tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id); - } - - $result = $object->addline( - $desc, - $lines[$i]->subprice, - $lines[$i]->qty, - $tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, - $lines[$i]->fk_product > 0 ? $lines[$i]->fk_product : 0, - 0, - $productsupplier->ref_supplier, - $lines[$i]->remise_percent, - 'HT', - 0, - $lines[$i]->product_type, - '', - '', - null, - null, - array(), - $lines[$i]->fk_unit, - 0, - $element, - !empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid - ); + $soc=new societe($db); + $soc->fetch($socid); + $tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id); } + $result = $object->addline( + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product > 0 ? $lines[$i]->fk_product : 0, + 0, + $lines[$i]->ref_fourn, + $lines[$i]->remise_percent, + 'HT', + 0, + $lines[$i]->product_type, + '', + '', + null, + null, + array(), + $lines[$i]->fk_unit, + 0, + $element, + !empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid + ); + if ($result < 0) { $error++; break; From 5971cd8e59d435c15e5f0b30531a60d87e038a85 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Mon, 5 Mar 2018 17:18:03 +0100 Subject: [PATCH 03/11] Fix label goes in desc and lost fourn ref --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- htdocs/fourn/commande/card.php | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 4d492bf2bbe..eacc27e29c1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1368,7 +1368,7 @@ class CommandeFournisseur extends CommonOrder * @param int $origin_id Id of origin object * @return int <=0 if KO, >0 if OK */ - public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0) + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0, $label='') { global $langs,$mysoc,$conf; @@ -1401,7 +1401,7 @@ class CommandeFournisseur extends CommonOrder $pu=$pu_ttc; } $desc=trim($desc); - $ref_supplier=''; // Ref of supplier price when we add line + $ref_supplier=$fourn_ref; // Ref of supplier price when we add line // Check parameters if ($qty < 1 && ! $fk_product) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index aa833d49b6e..fe26bcdc672 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1050,8 +1050,8 @@ if (empty($reshook)) if (empty($lines[$i]->subprice) || $lines[$i]->qty <= 0) continue; - $label = (! empty($lines[$i]->label) ? $lines[$i]->label : ''); - $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle); + $label = (! empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label); + $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->product_desc); $product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0); // Reset fk_parent_line for no child products and special product @@ -1098,7 +1098,8 @@ if (empty($reshook)) $lines[$i]->fk_unit, 0, $element, - !empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid + !empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid, + $label ); if ($result < 0) { From 53ce297ab343ac6f00d66b9c23850f68de6e1473 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 9 Mar 2018 09:30:11 +0100 Subject: [PATCH 04/11] Fix travis - missing documentation of new param --- htdocs/fourn/class/fournisseur.commande.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index eacc27e29c1..0aa6acc1ede 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1366,6 +1366,7 @@ class CommandeFournisseur extends CommonOrder * @param string $pu_ht_devise Amount in currency * @param string $origin 'order', ... * @param int $origin_id Id of origin object + * @param string $label Label * @return int <=0 if KO, >0 if OK */ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0, $label='') From 657fa48c3f6270f6095d1c3209b15bb6d9fde24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 23 Apr 2018 15:31:55 +0200 Subject: [PATCH 05/11] Update api_products.class.php --- htdocs/product/class/api_products.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index b21a6a34046..2e53237659d 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -289,7 +289,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve category list : '.$categories->error); + throw new RestException(503, 'Error when retrieve category list : '.array_merge(array($categories->error), $categories->errors)); } return $result; @@ -323,7 +323,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.$categories->error); + throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors)); } return array( @@ -365,7 +365,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.$categories->error); + throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors)); } throw new RestException(501, 'Feature not yet available'); @@ -400,7 +400,7 @@ class Products extends DolibarrApi } if ($result < 0) { - throw new RestException(503, 'Error when retrieve prices list : '.$categories->error); + throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors)); } return array( From 736c56705b98d364be3e17d1b881523fee70ca93 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 24 Apr 2018 10:02:26 +0200 Subject: [PATCH 06/11] FIX : Related contact printed in societe agenda --- htdocs/core/lib/company.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 663821db0c2..b38f770e071 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1468,7 +1468,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, 'align="center"', $sortfield, $sortorder); $out.=getTitleFieldOfList(''); - $out.=getTitleFieldOfList(''); + $out.=getTitleFieldOfList($langs->trans("ActionOnContact"), 0, $_SERVER["PHP_SELF"], 'a.fk_contact', '', $param, '', $sortfield, $sortorder); $out.=getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder); $out.=getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch '); $out.=''; @@ -1609,7 +1609,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=''; // Contact pour cette action - if (! empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) + if (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0) { $contactstatic->lastname=$histo[$key]['lastname']; $contactstatic->firstname=$histo[$key]['firstname']; From 67329b8805ca46805b39246974ceadff978c2a78 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 24 Apr 2018 12:33:07 +0200 Subject: [PATCH 07/11] fix commonobject double style --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 21631b86cac..1b888efc8ca 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4847,7 +4847,8 @@ abstract class CommonObject $type = 'varchar'; // convert varchar(xx) int varchar $size = $reg[1]; } - elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) int varchar + elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) into varchar + elseif (preg_match('/double/', $type)) $type = 'double'; // convert double(xx) into double if (is_array($val['arrayofkeyval'])) $type='select'; if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link'; @@ -4922,7 +4923,6 @@ abstract class CommonObject } } //var_dump($showsize.' '.$size); - if (in_array($type,array('date','datetime'))) { $tmp=explode(',',$size); From 70961bd075ae7417fbabad17ed52cfd6967c46be Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 24 Apr 2018 12:46:16 +0200 Subject: [PATCH 08/11] fix perms --- htdocs/modulebuilder/template/myobject_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 68cefa714c3..c4f92994d7a 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -112,7 +112,7 @@ if (empty($reshook)) { $error=0; - $permissiontoadd = $user->rights->mymodule->create; + $permissiontoadd = $user->rights->mymodule->write; $permissiontodelete = $user->rights->mymodule->delete; $backurlforlist = dol_buildpath('/mymodule/myobject_list.php',1); From 4c87cbf6441933396314757e2c66b8c7c179010d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Apr 2018 12:14:51 +0200 Subject: [PATCH 09/11] Update card.php --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index fe26bcdc672..fa1cef8fe0e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1050,7 +1050,7 @@ if (empty($reshook)) if (empty($lines[$i]->subprice) || $lines[$i]->qty <= 0) continue; - $label = (! empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label); + $label = (! empty($lines[$i]->label) ? $lines[$i]->label : ''); $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->product_desc); $product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0); From ecd84f6c4592c029f2bd268913f4406ae63a598f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Apr 2018 12:18:45 +0200 Subject: [PATCH 10/11] Update fournisseur.commande.class.php --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 0aa6acc1ede..e79d1e06a6e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1418,7 +1418,7 @@ class CommandeFournisseur extends CommonOrder if ($fk_product > 0) { - if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED) && $origin !== 'supplier_proposal') + if (empty($conf->global->SUPPLIER_ORDER_WITH_NOPRICEDEFINED)) { // Check quantity is enough dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." fk_prod_fourn_price=".$fk_prod_fourn_price." qty=".$qty." fourn_ref=".$fourn_ref); From d179cafa9ce0c7a04772bc22c904875940b2de35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Apr 2018 12:19:32 +0200 Subject: [PATCH 11/11] Update fournisseur.commande.class.php --- htdocs/fourn/class/fournisseur.commande.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e79d1e06a6e..09f47f385f4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1366,10 +1366,9 @@ class CommandeFournisseur extends CommonOrder * @param string $pu_ht_devise Amount in currency * @param string $origin 'order', ... * @param int $origin_id Id of origin object - * @param string $label Label * @return int <=0 if KO, >0 if OK */ - public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0, $label='') + public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_options=0, $fk_unit=null, $pu_ht_devise=0, $origin='', $origin_id=0) { global $langs,$mysoc,$conf;