diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 543395e2baf..69a8f70580b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1296,6 +1296,9 @@ class CommandeFournisseur extends CommonOrder return -1; } + $dispatchstatus = 1; + if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) $dispatchstatus = 0; // Setting status will be done manually to 1 if this option is on + $now=dol_now(); if (($this->statut == 3 || $this->statut == 4 || $this->statut == 5)) @@ -1303,8 +1306,8 @@ class CommandeFournisseur extends CommonOrder $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur_dispatch"; - $sql.= " (fk_commande, fk_product, qty, fk_entrepot, fk_user, datec) VALUES "; - $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."')"; + $sql.= " (fk_commande, fk_product, qty, fk_entrepot, fk_user, datec, status, comment) VALUES"; + $sql.= " ('".$this->id."','".$product."','".$qty."',".($entrepot>0?"'".$entrepot."'":"null").",'".$user->id."','".$this->db->idate($now)."', ".$dispatchstatus.", '".$this->db->escape($comment)."')"; dol_syslog(get_class($this)."::DispatchProduct", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 8ac3299d849..731f91485f0 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -449,7 +449,7 @@ if ($id > 0 || ! empty($ref)) // List of already dispatching $sql = "SELECT p.ref, p.label,"; $sql.= " e.rowid as warehouse_id, e.label as entrepot,"; - $sql.= " cfd.fk_product, cfd.qty, cfd.rowid"; + $sql.= " cfd.rowid, cfd.fk_product, cfd.qty, cfd.comment, cfd.status"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p,"; $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; @@ -474,7 +474,10 @@ if ($id > 0 || ! empty($ref)) print ''; print ''.$langs->trans("Description").''; print ''.$langs->trans("QtyDispatched").''; - print ''.$langs->trans("Warehouse").''; + print ''; + print ''.$langs->trans("Warehouse").''; + print ''.$langs->trans("Comment").''; + if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) print ''.$langs->trans("Status").''; print "\n"; $var=false; @@ -488,12 +491,28 @@ if ($id > 0 || ! empty($ref)) print ' - '.$objp->label; print "\n"; + // Qty print ''.$objp->qty.''; - print ''; + print ' '; + + // Warehouse + print ''; $warehouse_static->id=$objp->warehouse_id; $warehouse_static->libelle=$objp->entrepot; print $warehouse_static->getNomUrl(1); print ''; + + // Comment + print ''.dol_trunc($objp->comment).''; + + // Status + if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) + { + print ''; + print $objp->status; + print ''; + } + print "\n"; $i++; @@ -516,6 +535,7 @@ if ($id > 0 || ! empty($ref)) } } -$db->close(); llxFooter(); + +$db->close(); 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 22433622f74..573646b94c3 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 @@ -101,3 +101,10 @@ create table llx_contratdet_extrafields ALTER TABLE llx_contratdet_extrafields ADD INDEX idx_contratdet_extrafields (fk_object); ALTER TABLE llx_product_fournisseur_price ADD COLUMN delivery_time_days integer; + +ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN comment varchar(255); +ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN status integer; +ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN tms timestamp; + + + \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index 849ea9f51f5..56709573721 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -24,7 +24,7 @@ create table llx_commande_fournisseur_dispatch qty float, -- qty fk_entrepot integer, fk_user integer, - comment varchar(255), + comment varchar(255), -- comment on movement status integer, datec datetime, tms timestamp diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement.sql b/htdocs/install/mysql/tables/llx_stock_mouvement.sql index 85b0290681f..345ba8bc478 100644 --- a/htdocs/install/mysql/tables/llx_stock_mouvement.sql +++ b/htdocs/install/mysql/tables/llx_stock_mouvement.sql @@ -28,7 +28,7 @@ create table llx_stock_mouvement price float(13,4) DEFAULT 0, type_mouvement smallint, fk_user_author integer, - label varchar(255), + label varchar(255), -- comment on movement inventorycode varchar(128), fk_origin integer, origintype varchar(32)