diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index b73eb490296..e3ec12af6b5 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -488,7 +488,7 @@ class Paiement extends CommonObject
$fac->thirdparty->name,
'company'
);
- if ($result <= 0) dol_print_error($this->db);
+ if ($result <= 0) dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
$linkaddedforthirdparty[$fac->thirdparty->id]=$fac->thirdparty->id; // Mark as done for this thirdparty
}
}
@@ -506,7 +506,7 @@ class Paiement extends CommonObject
$fac->thirdparty->name,
'company'
);
- if ($result <= 0) dol_print_error($this->db);
+ if ($result <= 0) dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
$linkaddedforthirdparty[$fac->thirdparty->id]=$fac->thirdparty->id; // Mark as done for this thirdparty
}
}
diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php
index efa7b753101..c1918ed6247 100644
--- a/htdocs/core/datepicker.php
+++ b/htdocs/core/datepicker.php
@@ -194,10 +194,6 @@ function displayBox($selectedDate,$month,$year)
echo '
', $langs->trans($day_names[($i + $startday) % 7]), ' | ', "\n";
}
?>
-<<<<<<< HEAD
-=======
-
->>>>>>> refs/remotes/origin/3.7
commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
-
+ /**
+ * Return the max number delivery delay in day
+ *
+ * @return string
+ */
+ function getMaxDeliveryTimeDay($langs)
+ {
+ if (empty($this->lines)) return $langs->trans('Undefined');
+
+ $nb = 0;
+ foreach ($this->lines as $line) {
+ $obj = new ProductFournisseur($this->db);
+ $idp = $obj->find_min_price_product_fournisseur($line->fk_product, $line->qty);
+ if ($idp) {
+ $obj->fetch($idp);
+ if ($obj->delivery_time_days > $nb) $nb = $obj->delivery_time_days;
+ }
+
+ }
+
+ if ($nb === 0) return $langs->trans('Undefined');
+ else return $nb.' '.$langs->trans('Days');
+ }
}
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index cdfee4c2398..b78d7f2db60 100755
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -42,6 +42,7 @@ class ProductFournisseur extends Product
var $id; // product id
var $fourn_ref; // deprecated
+ var $delivery_time_days;
var $ref_supplier; // ref supplier (can be set by get_buyprice)
var $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
@@ -155,7 +156,7 @@ class ProductFournisseur extends Product
* @param int $newnpr Set NPR or not
* @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)
+ 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)
{
global $conf;
@@ -165,6 +166,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 ($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
@@ -198,7 +200,8 @@ class ProductFournisseur extends Product
$sql.= " fk_availability = ".$availability.",";
$sql.= " entity = ".$conf->entity.",";
$sql.= " info_bits = ".$newnpr.",";
- $sql.= " charges = ".$charges;
+ $sql.= " charges = ".$charges.",";
+ $sql.= " delivery_time_days = ".$delivery_time_days;
$sql.= " WHERE rowid = ".$this->product_fourn_price_id;
// TODO Add price_base_type and price_ttc
@@ -241,7 +244,7 @@ class ProductFournisseur extends Product
{
// Add price for this quantity to supplier
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
- $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity)";
+ $sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, unitcharges, fk_availability, info_bits, entity, delivery_time_days)";
$sql.= " values('".$this->db->idate($now)."',";
$sql.= " ".$this->id.",";
$sql.= " ".$fourn->id.",";
@@ -257,7 +260,8 @@ class ProductFournisseur extends Product
$sql.= " ".$unitCharges.",";
$sql.= " ".$availability.",";
$sql.= " ".$newnpr.",";
- $sql.= $conf->entity;
+ $sql.= $conf->entity.",";
+ $sql.= $this->delivery_time_days;
$sql.=")";
dol_syslog(get_class($this)."::update_buyprice", LOG_DEBUG);
@@ -330,7 +334,7 @@ class ProductFournisseur extends Product
function fetch_product_fournisseur_price($rowid, $ignore_expression = 0)
{
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability,";
- $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.fk_supplier_price_expression"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price
+ $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.unitcharges, pfp.fk_supplier_price_expression, pfp.delivery_time_days"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.rowid = ".$rowid;
@@ -354,6 +358,7 @@ class ProductFournisseur extends Product
$this->product_id = $obj->fk_product; // deprecated
$this->fk_product = $obj->fk_product;
$this->fk_availability = $obj->fk_availability;
+ $this->delivery_time_days = $obj->delivery_time_days;
//$this->fourn_tva_npr = $obj->fourn_tva_npr; // FIXME this field not exist in llx_product_fournisseur_price
$this->fk_supplier_price_expression = $obj->fk_supplier_price_expression;
@@ -403,7 +408,7 @@ class ProductFournisseur extends Product
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
$sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,";
- $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.info_bits";
+ $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.unitcharges, pfp.info_bits, pfp.delivery_time_days";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")";
@@ -431,12 +436,13 @@ 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"];
@@ -496,12 +502,13 @@ class ProductFournisseur extends Product
$this->fourn_unitprice = '';
$this->fourn_id = '';
$this->fourn_name = '';
+ $this->delivery_time_days = '';
$this->id = '';
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
$sql.= " pfp.rowid as product_fourn_price_id, pfp.ref_fourn,";
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.charges, pfp.unitcharges, ";
- $sql.= " pfp.remise, pfp.remise_percent, pfp.fk_supplier_price_expression";
+ $sql.= " pfp.remise, pfp.remise_percent, pfp.fk_supplier_price_expression, pfp.delivery_time_days";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND pfp.fk_product = ".$prodid;
@@ -562,6 +569,7 @@ class ProductFournisseur extends Product
$this->fourn_tva_tx = $record["tva_tx"];
$this->fourn_id = $record["fourn_id"];
$this->fourn_name = $record["supplier_name"];
+ $this->delivery_time_days = $record["delivery_time_days"];
$this->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
$this->id = $prodid;
$min = $this->fourn_unitprice;
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index fe22a154251..ed276d7b328 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1601,6 +1601,13 @@ elseif (! empty($object->id))
}
print '';
+
+ // Delai livraison jours
+ print '';
+ print '| '.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').' | ';
+ print ''.$object->getMaxDeliveryTimeDay($langs).' | ';
+ print '
';
+
// Project
if (! empty($conf->projet->enabled))
{
diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
index 4421ad032eb..f278adb298f 100755
--- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
+++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql
@@ -1155,3 +1155,5 @@ ALTER TABLE llx_resource MODIFY COLUMN entity integer DEFAULT 1 NOT NULL;
-- This request make mysql drop (mysql bug, so we add it at end):
ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type(rowid);
+-- this update change the old formated url on llx_bank_url
+UPDATE llx_bank_url set url = replace( url, 'fiche.php', 'card.php');
diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql
index a96888b5173..22433622f74 100755
--- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql
+++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql
@@ -99,3 +99,5 @@ create table llx_contratdet_extrafields
)ENGINE=innodb;
ALTER TABLE llx_contratdet_extrafields ADD INDEX idx_contratdet_extrafields (fk_object);
+
+ALTER TABLE llx_product_fournisseur_price ADD COLUMN delivery_time_days integer;
diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang
index ca3a81639bf..5919ffea61e 100644
--- a/htdocs/langs/en_US/suppliers.lang
+++ b/htdocs/langs/en_US/suppliers.lang
@@ -41,4 +41,6 @@ ListOfSupplierProductForSupplier=List of products and prices for supplier %s<
NoneOrBatchFileNeverRan=None or batch %s not ran recently
SentToSuppliers=Sent to suppliers
ListOfSupplierOrders=List of supplier orders
-MenuOrdersSupplierToBill=Supplier orders to invoice
\ No newline at end of file
+MenuOrdersSupplierToBill=Supplier orders to invoice
+NbDaysToDelivery=Delivery delay in days
+DescNbDaysToDelivery=The biggest delay is display among order product list
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/suppliers.lang b/htdocs/langs/fr_FR/suppliers.lang
index dab237aeb2d..5ff72bb8d83 100644
--- a/htdocs/langs/fr_FR/suppliers.lang
+++ b/htdocs/langs/fr_FR/suppliers.lang
@@ -42,3 +42,5 @@ NoneOrBatchFileNeverRan=Aucun ou traitement par lot %s non exécuté réc
SentToSuppliers=Envoyés aux fournisseurs
ListOfSupplierOrders=Liste des commandes fournisseurs
MenuOrdersSupplierToBill=Commandes fournisseurs en facture
+NbDaysToDelivery=Delai de livraison en jours
+DescNbDaysToDelivery=Le délai le plus long est affiché parmis la liste des produits de la commande
\ No newline at end of file
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 85e323cca51..97ee64092a2 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -109,6 +109,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
$tva_tx = str_replace('*','', GETPOST('tva_tx','alpha'));
$tva_tx = price2num($tva_tx);
$price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode
+ $delivery_time_days = GETPOST('delivery_time_days', 'int') ? GETPOST('delivery_time_days', 'int') : '';
if ($tva_tx == '')
{
@@ -181,7 +182,7 @@ if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
if (isset($_POST['ref_fourn_price_id']))
$product->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']);
- $ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, $npr);
+ $ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx, $_POST["charges"], $remise_percent, 0, $npr, $delivery_time_days);
if ($ret < 0)
{
@@ -322,7 +323,7 @@ if ($id || $ref)
$supplier->fetch($socid);
print $supplier->getNomUrl(1);
print '';
- print '';
+ print '';
print '';
}
else
@@ -379,8 +380,7 @@ if ($id || $ref)
{
print '';
}
- print '';
-
+ print '';
// Vat rate
$default_vat='';
@@ -450,6 +450,13 @@ if ($id || $ref)
print '';
print '';
+
+ // Delai livraison jours
+ print '';
+ print '| '.$langs->trans('NbDaysToDelivery').' | ';
+ print ' '.$langs->trans('days').' | ';
+ print '
';
+
// Charges ????
if ($conf->global->PRODUCT_CHARGES)
{