diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index 8f839b08452ccc06d1140f5632470da4dfa6682e..280ea8cec2ea3450bb8840d54105422bcd2ede1a 100755
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -154,7 +154,7 @@ class ProductFournisseur extends Product
* @param float $remise_percent Discount regarding qty (percent)
* @param float $remise Discount regarding qty (amount)
* @param int $newnpr Set NPR or not
- * @param int $delivery_time_days Delay in days for delivery (max)
+ * @param int $delivery_time_days Delay in days for delivery (max). May be '' if not defined.
* @return int <0 if KO, >=0 if OK
*/
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0)
@@ -167,7 +167,7 @@ class ProductFournisseur extends Product
if (empty($charges)) $charges=0;
if (empty($availability)) $availability=0;
if (empty($remise_percent)) $remise_percent=0;
- if (empty($delivery_time_days)) $delivery_time_days=0;
+ if ($delivery_time_days != '' && ! is_numeric($delivery_time_days)) $delivery_time_days = '';
if ($price_base_type == 'TTC')
{
//$ttx = get_default_tva($fourn,$mysoc,$this->id); // We must use the VAT rate defined by user and not calculate it
@@ -202,7 +202,7 @@ class ProductFournisseur extends Product
$sql.= " entity = ".$conf->entity.",";
$sql.= " info_bits = ".$newnpr.",";
$sql.= " charges = ".$charges.",";
- $sql.= " delivery_time_days = ".$delivery_time_days;
+ $sql.= " delivery_time_days = ".($delivery_time_days != '' ? $delivery_time_days : 'null');
$sql.= " WHERE rowid = ".$this->product_fourn_price_id;
// TODO Add price_base_type and price_ttc
@@ -437,16 +437,16 @@ class ProductFournisseur extends Product
$prodfourn->fourn_remise_percent = $record["remise_percent"];
$prodfourn->fourn_remise = $record["remise"];
$prodfourn->fourn_unitprice = $record["unitprice"];
- $prodfourn->fourn_charges = $record["charges"];
- $prodfourn->fourn_unitcharges = $record["unitcharges"];
+ $prodfourn->fourn_charges = $record["charges"];
+ $prodfourn->fourn_unitcharges = $record["unitcharges"];
$prodfourn->fourn_tva_tx = $record["tva_tx"];
$prodfourn->fourn_id = $record["fourn_id"];
$prodfourn->fourn_name = $record["supplier_name"];
$prodfourn->fk_availability = $record["fk_availability"];
$prodfourn->delivery_time_days = $record["delivery_time_days"];
$prodfourn->id = $prodid;
- $prodfourn->fourn_tva_npr = $record["info_bits"];
- $prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
+ $prodfourn->fourn_tva_npr = $record["info_bits"];
+ $prodfourn->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
if (!empty($prodfourn->fk_supplier_price_expression)) {
$priceparser = new PriceParser($this->db);
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 33b5eaf79e39d99920b8fc399fa3f969d9a53d6b..b1d20b723716abe9494fba43a5edc9e49ba77329 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1911,7 +1911,7 @@ elseif (! empty($object->id))
print '</td></tr>';
- // Delai livraison jours
+ // Delivery delay (in days)
print '<tr>';
print '<td>'.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').'</td>';
print '<td>'.$object->getMaxDeliveryTimeDay($langs).'</td>';
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 2d0b9a81576ec8cd804569344211813b081c2365..9d7a9215ef1502a1c604ad6ccf679fcfc4426f1c 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -201,7 +201,7 @@ if (empty($reshook))
{
$error++;
- setEventMessage($product->error, 'errors');
+ setEventMessage($product->error, $product->errors, 'errors');
}
else
{
@@ -528,13 +528,9 @@ if ($id || $ref)
print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre" align="right">'.$langs->trans("VATRate").'</td>';
print '<td class="liste_titre" align="right">'.$langs->trans("PriceQtyMinHT").'</td>';
- // Charges ????
- if ($conf->global->PRODUCT_CHARGES)
- {
- if (! empty($conf->margin->enabled)) print '<td align="right">'.$langs->trans("Charges").'</td>';
- }
print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre" align="right">'.$langs->trans("DiscountQtyMin").'</td>';
+ print_liste_field_titre($langs->trans("NbDaysToDelivery"),$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder);
// Charges ????
if ($conf->global->PRODUCT_CHARGES)
{
@@ -606,6 +602,11 @@ if ($id || $ref)
print price2num($productfourn->fourn_remise_percent).'%';
print '</td>';
+ // Delivery delay
+ print '<td align="right">';
+ print $productfourn->delivery_time_days;
+ print '</td>';
+
// Charges ????
if ($conf->global->PRODUCT_CHARGES)
{