NEW Table with list of lots/serial can be viewed (module product batch).

This commit is contained in:
Laurent Destailleur 2016-08-08 20:31:03 +02:00
parent 50a7046bd4
commit 2133b1c3b5
19 changed files with 251 additions and 158 deletions

View File

@ -103,7 +103,7 @@ $arrayfields=array(
't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1),
't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1),
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
't.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
//'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
@ -179,10 +179,10 @@ $form=new Form($db);
//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
$help_url='';
llxHeader('','MyPageName',$help_url);
$title = $langs->trans('MyModuleListTitle');
llxHeader('', $title, $help_url);
// Put here content of your page
$title = $langs->trans('MyModuleListTitle');
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
@ -274,7 +274,7 @@ if ($resql)
'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->commande->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($user->rights->mymodule->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
@ -516,9 +516,7 @@ if ($resql)
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
/*
* Show list of available documents
*/
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);

View File

@ -99,9 +99,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?leftmenu=product&amp;type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?leftmenu=product&amp;action=create&amp;type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?leftmenu=product&amp;type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?type=0', 'Stocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?type=0', 'StocksByProducts', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?type=0', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stats/card.php?id=all&amp;leftmenu=stats&amp;type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stock/productlot_list.php', 'LotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stats/card.php?id=all&amp;leftmenu=stats&amp;type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 7, __ENTITY__);
-- Product - Services
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?leftmenu=service&amp;type=1', 'Services', 0, 'products', '$user->rights->service->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->service->enabled', __HANDLER__, 'left', 2901__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/card.php?leftmenu=service&amp;action=create&amp;type=1', 'NewService', 1, 'products', '$user->rights->service->creer', '', 2, 0, __ENTITY__);

View File

@ -1115,12 +1115,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/product/list.php?leftmenu=product&amp;type=0", $langs->trans("List"), 1, $user->rights->produit->lire);
if (! empty($conf->stock->enabled))
{
$newmenu->add("/product/reassort.php?type=0", $langs->trans("Stocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
$newmenu->add("/product/reassort.php?type=0", $langs->trans("StocksByProducts"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
}
if (! empty($conf->productbatch->enabled))
{
$langs->load("stocks");
$newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
$newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire);
}
if (! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled))
{

View File

@ -145,7 +145,7 @@ class modStock extends DolibarrModules
$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_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'=>'EatByDate','pb.sellby'=>'SellByDate','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'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date','pb.batch'=>'Text','pb.eatby'=>'Date','pb.sellby'=>'Date','pb.qty'=>'Numeric');
$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

View File

@ -404,8 +404,8 @@ if ($id > 0 || ! empty($ref)) {
print '<tr class="liste_titre">';
print '<td></td>';
print '<td>' . $langs->trans("batch_number") . '</td>';
print '<td>' . $langs->trans("l_eatby") . '</td>';
print '<td>' . $langs->trans("l_sellby") . '</td>';
print '<td>' . $langs->trans("EatByDate") . '</td>';
print '<td>' . $langs->trans("SellByDate") . '</td>';
print '<td colspan="4">&nbsp;</td>';
print "</tr>\n";
}
@ -595,8 +595,8 @@ if ($id > 0 || ! empty($ref)) {
print '<td>' . $langs->trans("Description") . '</td>';
if (! empty($conf->productbatch->enabled)) {
print '<td>' . $langs->trans("batch_number") . '</td>';
print '<td>' . $langs->trans("l_eatby") . '</td>';
print '<td>' . $langs->trans("l_sellby") . '</td>';
print '<td>' . $langs->trans("EatByDate") . '</td>';
print '<td>' . $langs->trans("SellByDate") . '</td>';
}
print '<td align="right">' . $langs->trans("QtyDispatched") . '</td>';
print '<td></td>';

View File

@ -245,6 +245,10 @@ DateBuild=Report build date
DatePayment=Date of payment
DateApprove=Approving date
DateApprove2=Approving date (second approval)
UserCreation=Creation user
UserModification=Modification user
UserCreationShort=Creat. user
UserModificationShort=Modif. user
DurationYear=year
DurationMonth=month
DurationWeek=week

View File

@ -8,8 +8,8 @@ Batch=Lot/Serial
atleast1batchfield=Eat-by date or Sell-by date or Lot/Serial number
batch_number=Lot/Serial number
BatchNumberShort=Lot/Serial
l_eatby=Eat-by date
l_sellby=Sell-by date
EatByDate=Eat-by date
SellByDate=Sell-by date
DetailBatchNumber=Lot/Serial details
DetailBatchFormat=Lot/Serial: %s - Eat by: %s - Sell by: %s (Qty : %d)
printBatch=Lot/Serial: %s

View File

@ -18,8 +18,8 @@ ProductVatMassChange=Mass VAT change
ProductVatMassChangeDesc=This page can be used to modify a VAT rate defined on products or services from a value to another. Warning, this change is done on all database.
MassBarcodeInit=Mass barcode init
MassBarcodeInitDesc=This page can be used to initialize a barcode on objects that does not have barcode defined. Check before that setup of module barcode is complete.
ProductAccountancyBuyCode=Accountancy code (buy)
ProductAccountancySellCode=Accountancy code (sell)
ProductAccountancyBuyCode=Accountancy code (purchase)
ProductAccountancySellCode=Accountancy code (sale)
ProductOrService=Product or Service
ProductsAndServices=Products and Services
ProductsOrServices=Products or Services

View File

@ -14,7 +14,10 @@ CancelSending=Cancel sending
DeleteSending=Delete sending
Stock=Stock
Stocks=Stocks
StocksByProducts=Stocks by products
StocksByLotSerial=Stocks by lot/serial
LotSerial=Lots/Serials
LotSerialList=List of lot/serials
Movements=Movements
ErrorWarehouseRefRequired=Warehouse reference name is required
ListOfWarehouses=List of warehouses

View File

@ -194,7 +194,7 @@ if ($resql)
} else {
$texte = $langs->trans("ProductsAndServices");
}
$texte.=' ('.$langs->trans("Stocks").')';
$texte.=' ('.$langs->trans("StocksByProducts").')';
llxHeader("", $texte, $helpurl);

View File

@ -265,8 +265,8 @@ if ($resql)
print_liste_field_titre($langs->trans("Warehouse"), $_SERVER["PHP_SELF"], "",$param,"",'',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Batch"), $_SERVER["PHP_SELF"], "pb.batch",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("l_eatby"), $_SERVER["PHP_SELF"], "pb.eatby",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("l_sellby"), $_SERVER["PHP_SELF"], "pb.sellby",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EatByDate"), $_SERVER["PHP_SELF"], "pb.eatby",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SellByDate"), $_SERVER["PHP_SELF"], "pb.sellby",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder);
// TODO Add info of running suppliers/customers orders
//print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder);

View File

@ -36,6 +36,7 @@ $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height',160);
$langs->load("companies");
$langs->load("products");
$langs->load("stocks");
$langs->load("bills");
$langs->load("other");

View File

@ -136,8 +136,8 @@ if ($resql)
if (! empty($conf->productbatch->enabled))
{
print '<td>'.$langs->trans("Batch").'</td>';
print '<td>'.$langs->trans("l_eatby").'</td>';
print '<td>'.$langs->trans("l_sellby").'</td>';
print '<td>'.$langs->trans("EatByDate").'</td>';
print '<td>'.$langs->trans("SellByDate").'</td>';
}
print '<td>'.$langs->trans("Warehouse").'</td>';
print '<td align="right"><a href="'.DOL_URL_ROOT.'/product/stock/mouvement.php">'.$langs->trans("FullList").'</a></td>';

View File

@ -611,8 +611,8 @@ if ($resql)
{
$langs->load("productbatch");
print_liste_field_titre($langs->trans("BatchNumberShort"),$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("l_eatby"),$_SERVER["PHP_SELF"],'m.eatby','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("l_sellby"),$_SERVER["PHP_SELF"],'m.sellby','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EatByDate"),$_SERVER["PHP_SELF"],'m.eatby','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SellByDate"),$_SERVER["PHP_SELF"],'m.sellby','',$param,'align="center"',$sortfield,$sortorder);
}
if (! $id > 0) print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible
print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder);

View File

@ -689,8 +689,8 @@ if ((! empty($conf->productbatch->enabled)) && $object->hasbatch())
{
print '<tr class="liste_titre"><td width="10%"></td>';
print '<td align="right" width="10%">'.$langs->trans("batch_number").'</td>';
print '<td align="center" width="10%">'.$langs->trans("l_eatby").'</td>';
print '<td align="center" width="10%">'.$langs->trans("l_sellby").'</td>';
print '<td align="center" width="10%">'.$langs->trans("EatByDate").'</td>';
print '<td align="center" width="10%">'.$langs->trans("SellByDate").'</td>';
print '<td align="right" colspan="5"></td>';
print '</tr>';
}

View File

@ -17,7 +17,7 @@
*/
/**
* \file stock/productlot_card.php
* \file product/stock/productlot_card.php
* \ingroup stock
* \brief This file is an example of a php page
* Initialy built by build_class_from_table on 2016-05-17 12:22

View File

@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,7 +16,7 @@
*/
/**
* \file stock/productlot_list.php
* \file product/stock/productlot_list.php
* \ingroup stock
* \brief This file is an example of a php page
* Initialy built by build_class_from_table on 2016-05-17 12:22
@ -46,11 +45,14 @@ if (! $res) die("Include of main fails");
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
dol_include_once('/stock/class/productlot.class.php');
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
dol_include_once('/product/stock/class/productlot.class.php');
// Load traductions files requiredby by page
$langs->load("stock");
$langs->load("stocks");
$langs->load("productbatch");
$langs->load("other");
$langs->load("users");
// Get parameters
$id = GETPOST('id','int');
@ -91,34 +93,31 @@ if ($user->societe_id > 0)
}
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('productlotlist'));
$hookmanager->initHooks(array('productbatchlist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('stock');
$extralabels = $extrafields->fetch_name_optionals_label('productbatch');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// Load object if id or ref is provided as parameter
$object=new Productlot($db);
if (($id > 0 || ! empty($ref)) && $action != 'add')
{
$result=$object->fetch($id,$ref);
if ($result < 0) dol_print_error($db);
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
't.ref'=>'Ref',
't.note_public'=>'NotePublic',
);
// Definition of fields for list
$arrayfields=array(
't.entity'=>array('label'=>$langs->trans("Fieldentity"), 'checked'=>1),
't.fk_product'=>array('label'=>$langs->trans("Fieldfk_product"), 'checked'=>1),
't.batch'=>array('label'=>$langs->trans("Fieldbatch"), 'checked'=>1),
't.fk_user_creat'=>array('label'=>$langs->trans("Fieldfk_user_creat"), 'checked'=>1),
't.fk_user_modif'=>array('label'=>$langs->trans("Fieldfk_user_modif"), 'checked'=>1),
't.import_key'=>array('label'=>$langs->trans("Fieldimport_key"), 'checked'=>1),
//'t.entity'=>array('label'=>$langs->trans("Fieldentity"), 'checked'=>1),
't.fk_product'=>array('label'=>$langs->trans("Product"), 'checked'=>1),
't.batch'=>array('label'=>$langs->trans("Batch"), 'checked'=>1),
't.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>1),
't.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>1),
//'t.import_key'=>array('label'=>$langs->trans("ImportKey"), 'checked'=>1),
//'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))),
't.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
//'t.fk_user_creat'=>array('label'=>$langs->trans("UserCreationShort"), 'checked'=>0, 'position'=>500),
//'t.fk_user_modif'=>array('label'=>$langs->trans("UserModificationShort"), 'checked'=>0, 'position'=>500),
't.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500),
't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
//'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
);
@ -131,17 +130,22 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
}
}
// Load object if id or ref is provided as parameter
$object=new Productlot($db);
if (($id > 0 || ! empty($ref)) && $action != 'add')
{
$result=$object->fetch($id,$ref);
if ($result < 0) dol_print_error($db);
}
/*******************************************************************
* ACTIONS
*
* Put here all code to do according to value of "action" parameter
********************************************************************/
/*
* Actions
*/
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction')) { $massaction=''; }
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -149,72 +153,50 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
{
$search_entity='';
$search_fk_product='';
$search_batch='';
$search_fk_user_creat='';
$search_fk_user_modif='';
$search_import_key='';
$search_entity='';
$search_fk_product='';
$search_batch='';
$search_fk_user_creat='';
$search_fk_user_modif='';
$search_import_key='';
$search_date_creation='';
$search_date_update='';
$toselect='';
$search_array_options=array();
}
if (empty($reshook))
{
// Mass actions. Controls on number of lines checked
$maxformassaction=1000;
if (! empty($massaction) && count($toselect) < 1)
{
$error++;
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
}
if (! $error && count($toselect) > $maxformassaction)
{
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++;
}
// Action to delete
if ($action == 'confirm_delete')
{
$result=$object->delete($user);
if ($result > 0)
{
// Delete OK
setEventMessages("RecordDeleted", null, 'mesgs');
header("Location: ".dol_buildpath('/stock/list.php',1));
exit;
}
else
{
if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors');
else setEventMessages($object->error,null,'errors');
}
}
$objectclass='ProductLot';
$objectlabel='LotSerial';
$permtoread = $user->rights->stock->read;
$permtodelete = $user->rights->stock->delete;
$uploaddir = $conf->stock->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
/***************************************************
* VIEW
*
* Put here all code to build page
****************************************************/
/*
* VIEW
*/
llxHeader('','MyPageName','');
$now=dol_now();
$form=new Form($db);
$productstatic=new Product($db);
//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
$help_url='';
$title = $langs->trans('LotSerialList');
llxHeader('', $title, $help_url);
// Put here content of your page
$title = $langs->trans('MyModuleListTitle');
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
@ -234,19 +216,19 @@ jQuery(document).ready(function() {
$sql = "SELECT";
$sql.= " t.rowid,";
$sql .= " t.entity,";
$sql .= " t.fk_product,";
$sql .= " t.batch,";
$sql .= " t.eatby,";
$sql .= " t.sellby,";
$sql .= " t.datec,";
$sql .= " t.tms,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif,";
$sql .= " t.import_key";
$sql.= " t.entity,";
$sql.= " t.fk_product,";
$sql.= " t.batch,";
$sql.= " t.eatby,";
$sql.= " t.sellby,";
$sql.= " t.datec as date_creation,";
$sql.= " t.tms as date_update,";
$sql.= " t.fk_user_creat,";
$sql.= " t.fk_user_modif,";
$sql.= " t.import_key,";
$sql.= " p.fk_product_type as product_type,";
$sql.= " p.ref as product_ref,";
$sql.= " p.label as product_label";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
@ -255,7 +237,8 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // N
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."product_lot as t";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot_extrafields as ef on (u.rowid = ef.fk_object)";
$sql.= " WHERE 1 = 1";
$sql.= ", ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE p.rowid = t.fk_product";
//$sql.= " WHERE u.entity IN (".getEntity('mytable',1).")";
if ($search_entity) $sql.= natural_search("entity",$search_entity);
@ -303,6 +286,8 @@ $resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array();
$params='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
@ -322,8 +307,13 @@ if ($resql)
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
//if ($user->rights->stock->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -333,36 +323,46 @@ if ($resql)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if ($sall)
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
$moreforfilter = '';
/*$moreforfilter = '';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escpae_htmltag($search_myfield).'">';
$moreforfilter.= '</div>';
$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
$moreforfilter.= '</div>';*/
if (! empty($moreforfilter))
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Fields title
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.entity']['checked'])) print_liste_field_titre($arrayfields['t.entity']['label'],$_SERVER['PHP_SELF'],'t.entity','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.fk_product']['checked'])) print_liste_field_titre($arrayfields['t.fk_product']['label'],$_SERVER['PHP_SELF'],'t.fk_product','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.batch']['checked'])) print_liste_field_titre($arrayfields['t.batch']['label'],$_SERVER['PHP_SELF'],'t.batch','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.eatby']['checked'])) print_liste_field_titre($arrayfields['t.eatby']['label'],$_SERVER['PHP_SELF'],'t.eatby','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.sellby']['checked'])) print_liste_field_titre($arrayfields['t.sellby']['label'],$_SERVER['PHP_SELF'],'t.sellby','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.fk_user_creat']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_creat']['label'],$_SERVER['PHP_SELF'],'t.fk_user_creat','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.fk_user_modif']['checked'])) print_liste_field_titre($arrayfields['t.fk_user_modif']['label'],$_SERVER['PHP_SELF'],'t.fk_user_modif','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['t.import_key']['checked'])) print_liste_field_titre($arrayfields['t.import_key']['label'],$_SERVER['PHP_SELF'],'t.import_key','',$param,'',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -387,15 +387,14 @@ if ($resql)
// Fields title search
print '<tr class="liste_titre">';
if (! empty($arrayfields['t.entity']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_entity" value="'.$search_entity.'" size="10"></td>';
if (! empty($arrayfields['t.fk_product']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_fk_product" value="'.$search_fk_product.'" size="10"></td>';
if (! empty($arrayfields['t.batch']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_batch" value="'.$search_batch.'" size="10"></td>';
if (! empty($arrayfields['t.fk_user_creat']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_fk_user_creat" value="'.$search_fk_user_creat.'" size="10"></td>';
if (! empty($arrayfields['t.fk_user_modif']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_fk_user_modif" value="'.$search_fk_user_modif.'" size="10"></td>';
if (! empty($arrayfields['t.import_key']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_import_key" value="'.$search_import_key.'" size="10"></td>';
if (! empty($arrayfields['t.entity']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_entity" value="'.$search_entity.'" size="10"></td>';
if (! empty($arrayfields['t.fk_product']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_fk_product" value="'.$search_fk_product.'" size="10"></td>';
if (! empty($arrayfields['t.batch']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_batch" value="'.$search_batch.'" size="10"></td>';
if (! empty($arrayfields['t.eatby']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['t.sellby']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['t.fk_user_creat']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_fk_user_creat" value="'.$search_fk_user_creat.'" size="10"></td>';
if (! empty($arrayfields['t.fk_user_modif']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_fk_user_modif" value="'.$search_fk_user_modif.'" size="10"></td>';
if (! empty($arrayfields['t.import_key']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_import_key" value="'.$search_import_key.'" size="10"></td>';
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -444,7 +443,7 @@ if (! empty($arrayfields['t.import_key']['checked'])) print '<td class="liste_ti
}*/
// Action column
print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
print $searchpitco;
print '</td>';
print '</tr>'."\n";
@ -458,19 +457,55 @@ if (! empty($arrayfields['t.import_key']['checked'])) print '<td class="liste_ti
$obj = $db->fetch_object($resql);
if ($obj)
{
$var = !$var;
// You can use here results
print '<tr>';
if (! empty($arrayfields['t.field1']['checked']))
print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['t.entity']['checked']))
{
print '<td>'.$obj->field1.'</td>';
print '<td>'.$obj->entity.'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['t.field2']['checked']))
if (! empty($arrayfields['t.fk_product']['checked']))
{
print '<td>'.$obj->field2.'</td>';
$productstatic->id=$obj->fk_product;
$productstatic->type=$obj->product_type;
$productstatic->ref=$obj->product_ref;
$productstatic->label=$obj->product_label;
print '<td>'.$productstatic->getNomUrl(1).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Extra fields
if (! empty($arrayfields['t.batch']['checked']))
{
print '<td>'.$obj->batch.'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['t.eatby']['checked']))
{
print '<td>'.dol_print_date($db->jdate($obj->eatby), 'day').'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['t.sellby']['checked']))
{
print '<td>'.dol_print_date($db->jdate($obj->sellby), 'day').'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['t.fk_user_creat']['checked']))
{
print '<td>'.$obj->fk_user_creat.'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['t.fk_user_modif']['checked']))
{
print '<td>'.$obj->fk_user_modif.'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['t.import_key']['checked']))
{
print '<td>'.$obj->import_key.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
@ -517,24 +552,74 @@ if (! empty($arrayfields['t.import_key']['checked'])) print '<td class="liste_ti
}*/
// Action column
print '<td></td>';
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print '</tr>';
}
$i++;
}
// Show total line
if (isset($totalarray['totalhtfield']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if ($i == 1)
{
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
}
elseif ($totalarray['totalhtfield'] == $i) print '<td align="right">'.price($totalarray['totalht']).'</td>';
elseif ($totalarray['totalvatfield'] == $i) print '<td align="right">'.price($totalarray['totalvat']).'</td>';
elseif ($totalarray['totalttcfield'] == $i) print '<td align="right">'.price($totalarray['totalttc']).'</td>';
else print '<td></td>';
}
print '</tr>';
}
$db->free($resql);
$parameters=array('sql' => $sql);
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";
print '</table>'."\n";
print '</form>'."\n";
$db->free($result);
/*
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction;
$genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->lire;
print '<br><a name="show_files"></a>';
$paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
$title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
*/
}
else
{

View File

@ -91,12 +91,12 @@
print '<input type="text" name="batch_number" size="40" value="'.GETPOST("batch_number").'">';
print '</td>';
print '</tr><tr>';
print '<td colspan="2">'.$langs->trans("l_eatby").'</td><td>';
print '<td colspan="2">'.$langs->trans("EatByDate").'</td><td>';
$eatbyselected=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear'));
$form->select_date($eatbyselected,'eatby','','',1,"");
print '</td>';
print '<td></td>';
print '<td>'.$langs->trans("l_sellby").'</td><td>';
print '<td>'.$langs->trans("SellByDate").'</td><td>';
$sellbyselected=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear'));
$form->select_date($sellbyselected,'sellby','','',1,"");
print '</td>';

View File

@ -100,10 +100,10 @@
}
print '</td>';
print '</tr><tr>';
print '<td>'.$langs->trans("l_eatby").'</td><td>';
print '<td>'.$langs->trans("EatByDate").'</td><td>';
print $form->select_date(($d_eatby?$d_eatby:$pdluo->eatby),'eatby','','',1,"", 1, 0, 1, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
print '</td>';
print '<td>'.$langs->trans("l_sellby").'</td><td>';
print '<td>'.$langs->trans("SellByDate").'</td><td>';
print $form->select_date(($d_sellby?$d_sellby:$pdluo->sellby),'sellby','','',1,"", 1, 0, 1, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
print '</td>';
print '<td colspan="2"></td>';