diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index b73eb490296568063966130d0e8ee7055dbd0705..e3ec12af6b5e6db23791d12542d1367ca8b721a9 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 efa7b753101bf8cdbd908171fa7073997958801e..c1918ed62470943b39540b1cc2b31a1f82bc34ca 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -194,10 +194,6 @@ function displayBox($selectedDate,$month,$year) echo '<td width="', (int) (($i+1)*100/7) - (int) ($i*100/7), '%">', $langs->trans($day_names[($i + $startday) % 7]), '</td>', "\n"; } ?> -<<<<<<< HEAD -======= - ->>>>>>> refs/remotes/origin/3.7 </tr> <?php //print "x ".$thedate." y"; // $thedate = first day of month @@ -292,5 +288,4 @@ function displayBox($selectedDate,$month,$year) </tr> </table> <?php -}//end function - +}//end function \ No newline at end of file diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 7f2237859ead398e96fd952672e524099bb6f9fc..d33c20189b0eb693ee423cb11e80f4bff4b4c13e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2106,7 +2106,29 @@ class CommandeFournisseur extends CommonOrder return $this->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 cdfee4c23985233e80e392e9b81216cdc65b3881..b78d7f2db6096674aa07d03bc0e202a8af7743a7 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 fe22a15425188596b6ed89e8f685f7b596d26ffe..ed276d7b328436e171cad6917d9df66cb3528098 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1601,6 +1601,13 @@ elseif (! empty($object->id)) } print '</td></tr>'; + + // Delai livraison jours + print '<tr>'; + print '<td>'.$langs->trans('NbDaysToDelivery').' '.img_picto($langs->trans('DescNbDaysToDelivery'), 'info', 'style="cursor:help"').'</td>'; + print '<td>'.$object->getMaxDeliveryTimeDay($langs).'</td>'; + print '</tr>'; + // 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 4421ad032eb221623a290182d10b048b54ca8d06..f278adb298fb371a6ef999ee10444e6d705ca913 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 a96888b517390da64e844c2d71c6efb8f63c92fd..22433622f741df7e8133a078e24e1b5538286325 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 ca3a81639bf72bd38263c1a0e6107fb726894094..5919ffea61ebb28adf815296dffa21c942b42739 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 <b>%s< NoneOrBatchFileNeverRan=None or batch <b>%s</b> 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 dab237aeb2d3b4856d02740bf3f1c6bf03d96266..5ff72bb8d8336a7fd114a7af6b6190a215163ec8 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 <b>%s</b> 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 85e323cca517513d088e1687a1e4619c8cd83f2e..97ee64092a2d82da91f8940ef92d697192a1cbe9 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 '<input type="hidden" name="id_fourn" value="'.$socid.'">'; - print '<input type="hidden" name="ref_fourn" value="'.$product->fourn_ref.'">'; + print '<input type="hidden" name="ref_fourn" value="'.$product->fourn_ref.'">'; print '<input type="hidden" name="ref_fourn_price_id" value="'.$rowid.'">'; } else @@ -379,8 +380,7 @@ if ($id || $ref) { print '<input class="flat" name="qty" size="5" value="'.$quantity.'">'; } - print '</td></tr>'; - + print '</td></tr>'; // Vat rate $default_vat=''; @@ -450,6 +450,13 @@ if ($id || $ref) print '</td>'; print '</tr>'; + + // Delai livraison jours + print '<tr>'; + print '<td>'.$langs->trans('NbDaysToDelivery').'</td>'; + print '<td><input class="flat" name="delivery_time_days" size="4" value="'.($rowid ? $product->delivery_time_days : '').'"> '.$langs->trans('days').'</td>'; + print '</tr>'; + // Charges ???? if ($conf->global->PRODUCT_CHARGES) {