diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0fbd5b05949..0c3ddab9e2d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5058,7 +5058,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'; @@ -5132,7 +5133,6 @@ abstract class CommonObject } } //var_dump($showsize.' '.$size); - if (in_array($type,array('date','datetime'))) { $tmp=explode(',',$size); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index aaa7cd9ea18..ea91c4796d2 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1552,7 +1552,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.=''; @@ -1700,7 +1700,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']; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ae4ad7c25be..a32a164ca3b 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1062,8 +1062,6 @@ if (empty($reshook)) $fk_parent_line = 0; $num = count($lines); - $productsupplier = new ProductFournisseur($db); - for($i = 0; $i < $num; $i ++) { @@ -1071,7 +1069,7 @@ if (empty($reshook)) continue; $label = (! empty($lines[$i]->label) ? $lines[$i]->label : ''); - $desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle); + $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 @@ -1087,43 +1085,57 @@ if (empty($reshook)) $array_option = $lines[$i]->array_options; } - $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid); - if ($result>=0) + $ref_supplier = ''; + $product_fourn_price_id = 0; + if ($origin == "commande") { - $tva_tx = $lines[$i]->tva_tx; - - if ($origin=="commande") + $productsupplier = new ProductFournisseur($db); + $result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid); + if ($result > 0) { - $soc=new societe($db); - $soc->fetch($socid); - $tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id); + $ref_supplier = $productsupplier->ref_supplier; + $product_fourn_price_id = $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, - $productsupplier->product_fourn_price_id, - $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 - ); } + else + { + $ref_supplier = $lines[$i]->ref_fourn; + $product_fourn_price_id = 0; + } + + $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, $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, + $product_fourn_price_id, + $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 + ); if ($result < 0) { $error++; diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 8d4c435b18e..8ba4eaaecc8 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -340,7 +340,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; @@ -374,7 +374,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( @@ -416,7 +416,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'); @@ -451,7 +451,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(