diff --git a/ChangeLog b/ChangeLog index 0d1bbfbf379..2449730bf8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -86,7 +86,7 @@ NEW: Add a tab to specify accountant/auditor of the company NEW: Add Date delivery and Availability on Propals List NEW: Add date in goods reception supplier order table NEW: Add delivery_time_days of suppliers in export profile -NEW: Add Docments'tab to expedition module +NEW: Add Documents'tab to expedition module NEW: Use dol_print_phone in thirdparty list page to format phone NEW: Add entry for the GDPR contact NEW: Add extrafield type "html" diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 671a3d6cbc3..73de27cafac 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1376,7 +1376,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl if ($detail->eatby) $dte[]=$outputlangs->transnoentitiesnoconv('printEatby',dol_print_date($detail->eatby, $format, false, $outputlangs)); if ($detail->sellby) $dte[]=$outputlangs->transnoentitiesnoconv('printSellby',dol_print_date($detail->sellby, $format, false, $outputlangs)); if ($detail->batch) $dte[]=$outputlangs->transnoentitiesnoconv('printBatch',$detail->batch); - $dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->dluo_qty); + $dte[]=$outputlangs->transnoentitiesnoconv('printQty',$detail->qty); $libelleproduitservice.= "__N__ ".implode(" - ", $dte); } } diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 71c287f7119..b79b1d094da 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -364,7 +364,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $detail.= $langs->trans("Batch").': '.$dbatch->batch; $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->dluo_qty; + $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail.= '
'; } print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 49bded5a45b..0f45ca61804 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -649,7 +649,7 @@ if (empty($reshook)) $qty = "qtyl".$detail_batch->fk_expeditiondet.'_'.$detail_batch->id; $batch_id = GETPOST($batch,'int'); $batch_qty = GETPOST($qty, 'int'); - if (! empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->dluo_qty)) + if (! empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->qty)) { if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_expeditiondet) > 0) // $line is ExpeditionLine { @@ -666,7 +666,7 @@ if (empty($reshook)) $line->detail_batch->batch = $lotStock->batch; $line->detail_batch->id = $detail_batch->id; $line->detail_batch->entrepot_id = $lotStock->warehouseid; - $line->detail_batch->dluo_qty = $batch_qty; + $line->detail_batch->qty = $batch_qty; if ($line->update($user) < 0) { setEventMessages($line->error, $line->errors, 'errors'); $error++; @@ -720,7 +720,7 @@ if (empty($reshook)) $line->detail_batch->fk_origin_stock = $batch_id; $line->detail_batch->batch = $lotStock->batch; $line->detail_batch->entrepot_id = $lotStock->warehouseid; - $line->detail_batch->dluo_qty = $batch_qty; + $line->detail_batch->qty = $batch_qty; if ($line->update($user) < 0) { setEventMessages($line->error, $line->errors, 'errors'); $error++; @@ -741,7 +741,7 @@ if (empty($reshook)) $line->detail_batch[0]->fk_origin_stock = $batch_id; $line->detail_batch[0]->batch = $lotStock->batch; $line->detail_batch[0]->entrepot_id = $lotStock->warehouseid; - $line->detail_batch[0]->dluo_qty = $batch_qty; + $line->detail_batch[0]->qty = $batch_qty; if ($object->create_line_batch($line, $line->array_options) < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -1306,6 +1306,7 @@ if ($action == 'create') { // Product need lot print ''; // end line and start a new one for lot/serial + print ''; $staticwarehouse=new Entrepot($db); if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id); @@ -1323,7 +1324,7 @@ if ($action == 'create') print ''; if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) { - foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) + foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) // $dbatch is instance of Productbatch { //var_dump($dbatch); $batchStock = + $dbatch->qty; // To get a numeric @@ -1344,7 +1345,7 @@ if ($action == 'create') $detail.= $langs->trans("Batch").': '.$dbatch->batch; $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->dluo_qty; + $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail.= '
'; print $detail; @@ -2242,7 +2243,7 @@ else if ($id || $ref) { print ''; // Qty to ship or shipped - print '' . '' . ''; + print '' . '' . ''; // Batch number managment if ($lines[$i]->entrepot_id == 0) { @@ -2354,12 +2355,12 @@ else if ($id || $ref) if ($lines[$i]->product_tobatch) { $detail = ''; - foreach ($lines[$i]->detail_batch as $dbatch) + foreach ($lines[$i]->detail_batch as $dbatch) // $dbatch is instance of ExpeditionLineBatch { $detail.= $langs->trans("Batch").': '.$dbatch->batch; $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->dluo_qty; + $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; $detail.= '
'; } print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 5728d60932a..5848c1b9d9d 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -415,7 +415,7 @@ class Expedition extends CommonObject { if ($detbatch->entrepot_id) { - $stockLocationQty[$detbatch->entrepot_id] += $detbatch->dluo_qty; + $stockLocationQty[$detbatch->entrepot_id] += $detbatch->qty; } } // create shipment lines @@ -931,7 +931,7 @@ class Expedition extends CommonObject $this->error=$linebatch->error; return -1; } - $linebatch->dluo_qty=$value['q']; + $linebatch->qty=$value['q']; $tab[]=$linebatch; if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) @@ -940,7 +940,7 @@ class Expedition extends CommonObject $prod_batch = new Productbatch($this->db); $prod_batch->fetch($value['id_batch']); - if ($prod_batch->qty < $linebatch->dluo_qty) + if ($prod_batch->qty < $linebatch->qty) { $langs->load("errors"); $this->errors[]=$langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $prod_batch->fk_product); @@ -1164,7 +1164,7 @@ class Expedition extends CommonObject // We use warehouse selected for each line foreach($lotArray as $lot) { - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->dluo_qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed + $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->qty, 0, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch); // Price is set to 0, because we don't want to see WAP changed if ($result < 0) { $error++;$this->errors=$this->errors + $mouvS->errors; @@ -2572,7 +2572,7 @@ class ExpeditionLigne extends CommonObjectLine $this->errors[]='ErrorBadParameters'; $error++; } - $qty = price2num($this->detail_batch[0]->dluo_qty); + $qty = price2num($this->detail_batch[0]->qty); } } else if (! empty($this->detail_batch)) @@ -2586,7 +2586,7 @@ class ExpeditionLigne extends CommonObjectLine $this->errors[]='ErrorBadParameters'; $error++; } - $qty = price2num($this->detail_batch->dluo_qty); + $qty = price2num($this->detail_batch->qty); } // check parameters @@ -2624,7 +2624,7 @@ class ExpeditionLigne extends CommonObjectLine { if ($expedition_batch_id != $lot->id) { - $remainingQty += $lot->dluo_qty; + $remainingQty += $lot->qty; } } $qty += $remainingQty; @@ -2652,7 +2652,7 @@ class ExpeditionLigne extends CommonObjectLine $error++; } } - if (! $error && $this->detail_batch->dluo_qty > 0) + if (! $error && $this->detail_batch->qty > 0) { // create lot expedition line if (isset($lot->id)) @@ -2662,7 +2662,7 @@ class ExpeditionLigne extends CommonObjectLine $shipmentLot->eatby = $lot->eatby; $shipmentLot->sellby = $lot->sellby; $shipmentLot->entrepot_id = $this->detail_batch->entrepot_id; - $shipmentLot->dluo_qty = $this->detail_batch->dluo_qty; + $shipmentLot->qty = $this->detail_batch->qty; $shipmentLot->fk_origin_stock = $batch_id; if ($shipmentLot->create($this->id) < 0) { diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index d94baee2a43..227566d8382 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -34,7 +34,7 @@ class ExpeditionLineBatch extends CommonObject var $sellby; var $eatby; var $batch; - var $dluo_qty; + var $qty; var $entrepot_id; var $fk_origin_stock; var $fk_expeditiondet; @@ -58,41 +58,41 @@ class ExpeditionLineBatch extends CommonObject */ function fetchFromStock($id_stockdluo) { - $sql = "SELECT"; - $sql.= " pb.batch,"; - $sql.= " pl.sellby,"; - $sql.= " pl.eatby,"; - $sql.= " ps.fk_entrepot"; + $sql = "SELECT"; + $sql.= " pb.batch,"; + $sql.= " pl.sellby,"; + $sql.= " pl.eatby,"; + $sql.= " ps.fk_entrepot"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_batch as pb"; - $sql.= " JOIN ".MAIN_DB_PREFIX."product_stock as ps on pb.fk_product_stock=ps.rowid"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."product_lot as pl on pl.batch = pb.batch AND pl.fk_product = ps.fk_product"; - $sql.= " WHERE pb.rowid = ".(int) $id_stockdluo; + $sql.= " FROM ".MAIN_DB_PREFIX."product_batch as pb"; + $sql.= " JOIN ".MAIN_DB_PREFIX."product_stock as ps on pb.fk_product_stock=ps.rowid"; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."product_lot as pl on pl.batch = pb.batch AND pl.fk_product = ps.fk_product"; + $sql.= " WHERE pb.rowid = ".(int) $id_stockdluo; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); + dol_syslog(get_class($this)."::fetch", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); $this->sellby = $this->db->jdate($obj->sellby); $this->eatby = $this->db->jdate($obj->eatby); $this->batch = $obj->batch; $this->entrepot_id= $obj->fk_entrepot; $this->fk_origin_stock=(int) $id_stockdluo; - } - $this->db->free($resql); + } + $this->db->free($resql); - return 1; - } - else - { - $this->error="Error ".$this->db->lasterror(); - return -1; - } - } + return 1; + } + else + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } + } /** * Create an expeditiondet_batch DB record link to an expedtiondet record @@ -118,7 +118,7 @@ class ExpeditionLineBatch extends CommonObject $sql.= " ".(! isset($this->sellby) || dol_strlen($this->sellby)==0?'NULL':("'".$this->db->idate($this->sellby))."'").","; $sql.= " ".(! isset($this->eatby) || dol_strlen($this->eatby)==0?'NULL':("'".$this->db->idate($this->eatby))."'").","; $sql.= " ".(! isset($this->batch)?'NULL':("'".$this->db->escape($this->batch)."'")).","; - $sql.= " ".(! isset($this->dluo_qty)?'NULL':$this->dluo_qty).","; + $sql.= " ".(! isset($this->qty)?'NULL':$this->qty).","; $sql.= " ".(! isset($this->fk_origin_stock)?'NULL':$this->fk_origin_stock); $sql.= ")"; @@ -218,7 +218,7 @@ class ExpeditionLineBatch extends CommonObject $tmp->id = $obj->rowid; $tmp->fk_origin_stock = $obj->fk_origin_stock; $tmp->fk_expeditiondet = $obj->fk_expeditiondet; - $tmp->dluo_qty = $obj->qty; + $tmp->qty = $obj->qty; $ret[]=$tmp; $i++;