From 3e29b118905855807fb9ff1cb08843cd6b06b977 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Thu, 11 Oct 2018 17:30:14 +0200 Subject: [PATCH] NEW add field list if reception --- htdocs/fourn/commande/dispatch.php | 10 +++- htdocs/reception/class/reception.class.php | 53 +--------------------- 2 files changed, 10 insertions(+), 53 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 2e0e53d0ef7..25a4202fcf2 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -744,11 +744,12 @@ if ($id > 0 || ! empty($ref)) { // List of lines already dispatched $sql = "SELECT p.ref, p.label,"; $sql .= " e.rowid as warehouse_id, e.label as entrepot,"; - $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status"; - if($conf->reception->enabled)$sql.=" ,cfd.fk_reception"; + $sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec"; + if($conf->reception->enabled)$sql.=" ,cfd.fk_reception, r.date_delivery"; $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"; + if($conf->reception->enabled)$sql.=" LEFT JOIN " . MAIN_DB_PREFIX . "reception as r ON cfd.fk_reception = r.rowid"; $sql .= " WHERE cfd.fk_commande = " . $object->id; $sql .= " AND cfd.fk_product = p.rowid"; $sql .= " ORDER BY cfd.rowid ASC"; @@ -768,7 +769,10 @@ if ($id > 0 || ! empty($ref)) { print ''; if($conf->reception->enabled)print '' . $langs->trans("Reception") . ''; + print '' . $langs->trans("Product") . ''; + print '' . $langs->trans("DateCreation") . ''; + print '' . $langs->trans("DateDeliveryPlanned") . ''; if (! empty($conf->productbatch->enabled)) { print '' . $langs->trans("batch_number") . ''; print '' . $langs->trans("EatByDate") . ''; @@ -807,6 +811,8 @@ if ($id > 0 || ! empty($ref)) { print '' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . ''; print ' - ' . $objp->label; print "\n"; + print ''.dol_print_date($db->jdate($objp->datec),'day').''; + print ''.dol_print_date($db->jdate($objp->date_delivery),'day').''; if (! empty($conf->productbatch->enabled)) { print '' . $objp->batch . ''; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index d95895dd2cf..cb74462ac22 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -73,11 +73,7 @@ class Reception extends CommonObject var $trueSize; var $date_delivery; // Date delivery planed - /** - * @deprecated - * @see date_reception - */ - var $date; + /** * Effective delivery date @@ -355,52 +351,7 @@ class Reception extends CommonObject } } - /** - * Create the detail (eat-by date) of the reception line - * - * @param object $line_ext full line informations - * @param array $array_options extrafields array - * @return int <0 if KO, >0 if OK - */ - function create_line_batch($line_ext,$array_options=0) - { - $error = 0; - $stockLocationQty = array(); // associated array with batch qty in stock location - - $tab=$line_ext->detail_batch; - // create stockLocation Qty array - foreach ($tab as $detbatch) - { - if ($detbatch->entrepot_id) - { - $stockLocationQty[$detbatch->entrepot_id] += $detbatch->dluo_qty; - } - } - // create reception lines - foreach ($stockLocationQty as $stockLocation => $qty) - { - if (($line_id = $this->create_line($stockLocation,$line_ext->origin_line_id,$qty,$array_options)) < 0) - { - $error++; - } - else - { - // create reception batch lines for stockLocation - foreach ($tab as $detbatch) - { - if ($detbatch->entrepot_id == $stockLocation){ - if (! ($detbatch->create($line_id) >0)) // Create an receptionlinebatch - { - $error++; - } - } - } - } - } - - if (! $error) return 1; - else return -1; - } + /** * Get object and lines from database