Make module productbatch stable
This commit is contained in:
parent
15531a7ebc
commit
530650b857
@ -51,7 +51,7 @@ class modProductBatch extends DolibarrModules
|
||||
|
||||
$this->rights_class = 'productbatch';
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'experimental';
|
||||
$this->version = 'dolibarr';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where dluo is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
$this->special = 0;
|
||||
@ -113,15 +113,15 @@ class modProductBatch extends DolibarrModules
|
||||
function init($options='')
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
|
||||
$sql = array();
|
||||
|
||||
|
||||
if(! empty($conf->cashdesk->enabled)) {
|
||||
if (!$conf->global->CASHDESK_NO_DECREASE_STOCK) {
|
||||
$res = dolibarr_set_const($db,"CASHDESK_NO_DECREASE_STOCK",1,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class modStock extends DolibarrModules
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $langs;
|
||||
|
||||
$this->db = $db;
|
||||
$this->numero = 52;
|
||||
@ -123,16 +123,35 @@ class modStock extends DolibarrModules
|
||||
$this->export_label[$r]="WarehousesAndProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("stock","lire"));
|
||||
$this->export_fields_array[$r]=array('e.rowid'=>'IdWarehouse','e.label'=>'LocationSummary','e.description'=>'DescWareHouse','e.lieu'=>'LieuWareHouse','e.address'=>'Address','e.zip'=>'Zip','e.town'=>'Town','p.rowid'=>"ProductId",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"Price",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification','ps.reel'=>'Stock');
|
||||
$this->export_TypeFields_array[$r]=array('e.rowid'=>'List:entrepot:LabelWareHouse','e.label'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text','p.rowid'=>"List:produit:label",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",'p.price'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date','ps.reel'=>'Number');
|
||||
$this->export_TypeFields_array[$r]=array('e.rowid'=>'List:entrepot:label','e.label'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text','p.rowid'=>"List:product:label",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",'p.price'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date','ps.reel'=>'Number');
|
||||
$this->export_entities_array[$r]=array('e.rowid'=>'warehouse','e.label'=>'warehouse','e.description'=>'warehouse','e.lieu'=>'warehouse','e.address'=>'warehouse','e.zip'=>'warehouse','e.town'=>'warehouse','p.rowid'=>"product",'p.ref'=>"product",'p.fk_product_type'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.tva_tx'=>'product','p.tosell'=>"product",'p.duration'=>"product",'p.datec'=>'product','p.tms'=>'product','ps.reel'=>'stock');
|
||||
$this->export_aggregate_array[$r]=array('ps.reel'=>'SUM'); // TODO Not used yet
|
||||
$this->export_dependencies_array[$r]=array('stock'=>array('p.rowid','e.rowid')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
|
||||
$this->export_dependencies_array[$r]=array('stock'=>array('p.rowid','e.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e';
|
||||
$this->export_sql_end[$r] .=' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid';
|
||||
$this->export_sql_end[$r] .=' AND e.entity IN ('.getEntity('stock',1).')';
|
||||
|
||||
if ($conf->productbatch->enabled)
|
||||
{
|
||||
$langs->load("productbatch");
|
||||
|
||||
// This request is same than previous but without field ps.stock (real stock in warehouse) and with link to subtable productbatch
|
||||
$r++;
|
||||
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]="WarehousesAndProductsBatchDetail"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("stock","lire"));
|
||||
$this->export_fields_array[$r]=array('e.rowid'=>'IdWarehouse','e.label'=>'LocationSummary','e.description'=>'DescWareHouse','e.lieu'=>'LieuWareHouse','e.address'=>'Address','e.zip'=>'Zip','e.town'=>'Town','p.rowid'=>"ProductId",'p.ref'=>"Ref",'p.fk_product_type'=>"Type",'p.label'=>"Label",'p.description'=>"Description",'p.note'=>"Note",'p.price'=>"Price",'p.tva_tx'=>'VAT','p.tosell'=>"OnSell",'p.duration'=>"Duration",'p.datec'=>'DateCreation','p.tms'=>'DateModification','pb.rowid'=>'Id','pb.batch'=>'Batch','pb.eatby'=>'l_eatby','pb.sellby'=>'l_sellby','pb.qty'=>'Qty');
|
||||
$this->export_TypeFields_array[$r]=array('e.rowid'=>'List:entrepot:label','e.label'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text','p.rowid'=>"List:product:label",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",'p.price'=>"Number",'p.tva_tx'=>'Number','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date','pb.batch'=>'Text','pb.eatby'=>'Date','pb.sellby'=>'Date','pb.qty'=>'Number');
|
||||
$this->export_entities_array[$r]=array('e.rowid'=>'warehouse','e.label'=>'warehouse','e.description'=>'warehouse','e.lieu'=>'warehouse','e.address'=>'warehouse','e.zip'=>'warehouse','e.town'=>'warehouse','p.rowid'=>"product",'p.ref'=>"product",'p.fk_product_type'=>"product",'p.label'=>"product",'p.description'=>"product",'p.note'=>"product",'p.price'=>"product",'p.tva_tx'=>'product','p.tosell'=>"product",'p.duration'=>"product",'p.datec'=>'product','p.tms'=>'product','pb.rowid'=>'batch','pb.batch'=>'batch','pb.eatby'=>'batch','pb.sellby'=>'batch','pb.qty'=>'batch');
|
||||
$this->export_aggregate_array[$r]=array('ps.reel'=>'SUM'); // TODO Not used yet
|
||||
$this->export_dependencies_array[$r]=array('batch'=>array('pb.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e, '.MAIN_DB_PREFIX.'product_batch as pb';
|
||||
$this->export_sql_end[$r] .=' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid AND ps.rowid = pb.fk_product_stock';
|
||||
$this->export_sql_end[$r] .=' AND e.entity IN ('.getEntity('stock',1).')';
|
||||
}
|
||||
|
||||
// Imports
|
||||
//--------
|
||||
|
||||
@ -58,6 +58,7 @@ $entitytoicon = array(
|
||||
'account' => 'account',
|
||||
'product' => 'product',
|
||||
'warehouse' => 'stock',
|
||||
'batch' => 'stock',
|
||||
'category' => 'category',
|
||||
'shipment' => 'sending',
|
||||
'shipment_line'=> 'sending',
|
||||
@ -88,7 +89,8 @@ $entitytolang = array(
|
||||
'product' => 'Product',
|
||||
'service' => 'Service',
|
||||
'stock' => 'Stock',
|
||||
'warehouse' => 'Warehouse',
|
||||
'batch' => 'Batch',
|
||||
'warehouse' => 'Warehouse',
|
||||
'category' => 'Category',
|
||||
'other' => 'Other',
|
||||
'trip' => 'TripsAndExpenses',
|
||||
|
||||
@ -2757,6 +2757,7 @@ elseif (! empty($object->id))
|
||||
/*
|
||||
* Commander (action=commande)
|
||||
*/
|
||||
print '<!-- form to record supplier order -->'."\n";
|
||||
print '<form name="commande" action="card.php?id='.$object->id.'&action=commande" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="commande">';
|
||||
@ -2765,7 +2766,7 @@ elseif (! empty($object->id))
|
||||
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("ToOrder").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("OrderDate").'</td><td>';
|
||||
$date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
print $form->select_date($date_com,'','','','',"commande");
|
||||
print $form->select_date($date_com,'',1,1,'',"commande");
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("OrderMode").'</td><td>';
|
||||
@ -2784,6 +2785,7 @@ elseif (! empty($object->id))
|
||||
/*
|
||||
* Receptionner (action=livraison)
|
||||
*/
|
||||
print '<!-- form to record supplier order received -->'."\n";
|
||||
print '<form action="card.php?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="livraison">';
|
||||
@ -2791,7 +2793,7 @@ elseif (! empty($object->id))
|
||||
print '<table class="border" width="100%">';
|
||||
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
|
||||
print $form->select_date('','','','','',"commande");
|
||||
print $form->select_date('','',1,1,'',"commande");
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr><td>".$langs->trans("Delivery")."</td><td>\n";
|
||||
|
||||
@ -78,6 +78,7 @@ IdWarehouse=Id warehouse
|
||||
DescWareHouse=Description warehouse
|
||||
LieuWareHouse=Localisation warehouse
|
||||
WarehousesAndProducts=Warehouses and products
|
||||
WarehousesAndProductsBatchDetail=Warehouses and products (with detail per batch/serial)
|
||||
AverageUnitPricePMPShort=Weighted average input price
|
||||
AverageUnitPricePMP=Weighted average input price
|
||||
SellPriceMin=Selling Unit Price
|
||||
@ -132,4 +133,4 @@ ShowWarehouse=Show warehouse
|
||||
MovementCorrectStock=Stock content correction for product %s
|
||||
MovementTransferStock=Stock transfer of product %s into another warehouse
|
||||
WarehouseMustBeSelectedAtFirstStepWhenProductBatchModuleOn=Source warehouse must be defined here when batch module is on. It will be used to list wich lot/serial is available for product that required lot/serial data for movement. If you want to send products from different warehouses, just make the shipment into several steps.
|
||||
InventoryCodeShort=Inv./Mov. code
|
||||
InventoryCodeShort=Inv./Mov. code
|
||||
|
||||
Loading…
Reference in New Issue
Block a user