27require
'../../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/productlot.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
41$langs->loadLangs(array(
"admin",
"products",
"productbatch"));
48$action =
GETPOST(
'action',
'alpha');
49$value =
GETPOST(
'value',
'alpha');
50$label =
GETPOST(
'label',
'alpha');
51$scandir =
GETPOST(
'scan_dir',
'alpha');
52$type =
'product_batch';
61include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
63if ($action ==
'updateMaskLot') {
64 $maskconstbatch =
GETPOST(
'maskconstLot',
'aZ09');
65 $maskbatch =
GETPOST(
'maskLot',
'alpha');
67 if ($maskconstbatch && preg_match(
'/_MASK$/', $maskconstbatch)) {
75 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
77 setEventMessages($langs->trans(
"Error"),
null,
'errors');
79} elseif ($action ==
'updateMaskSN') {
80 $maskconstbatch =
GETPOST(
'maskconstSN',
'aZ09');
81 $maskbatch =
GETPOST(
'maskSN',
'alpha');
83 if ($maskconstbatch && preg_match(
'/_MASK$/', $maskconstbatch)) {
91 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
93 setEventMessages($langs->trans(
"Error"),
null,
'errors');
95} elseif ($action ==
'setmodlot') {
97} elseif ($action ==
'setmodsn') {
99} elseif ($action ==
'setmaskslot') {
101 if ($value ==
'1' &&
getDolGlobalString(
'PRODUCTBATCH_LOT_ADDONS') !==
'mod_lot_advanced') {
104} elseif ($action ==
'setmaskssn') {
106 if ($value ==
'1' &&
getDolGlobalString(
'PRODUCTBATCH_SN_ADDONS') !==
'mod_sn_advanced') {
109} elseif ($action ==
'set') {
112} elseif ($action ==
'del') {
119} elseif ($action ==
'specimen') {
120 $modele =
GETPOST(
'module',
'alpha');
123 $product_batch->initAsSpecimen();
128 $dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
129 foreach ($dirmodels as $reldir) {
130 $file =
dol_buildpath($reldir .
"core/modules/product_batch/doc/pdf_" . $modele .
".modules.php", 0);
131 if (file_exists($file)) {
132 $classname =
"pdf_" . $modele;
137 if ($classname !==
'') {
142 '@phan-var-force ModelePDFProductBatch $module';
144 if (
$module->write_file($product_batch, $langs) > 0) {
145 header(
"Location: " . DOL_URL_ROOT .
"/document.php?modulepart=product_batch&file=SPECIMEN.pdf");
152 setEventMessages($langs->trans(
"ErrorModuleNotFound"),
null,
'errors');
153 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
155} elseif ($action ==
'setdoc') {
160 $conf->global->PRODUCT_BATCH_ADDON_PDF = $value;
174$form =
new Form($db);
176$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
178llxHeader(
"", $langs->trans(
"ProductLotSetup"),
'',
'', 0, 0,
'',
'',
'',
'mod-product page-admin_product_lot');
180$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
181print
load_fiche_titre($langs->trans(
"ProductLotSetup"), $linkback,
'title_setup');
194 $batch->initAsSpecimen();
196 printNumberingModuleList(
'product_batch',
'mod_lot_',
'PRODUCTBATCH_LOT_ADDON', $langs->trans(
"BatchLotNumberingModules"), $batch,
'setmodlot');
205 $batch->initAsSpecimen();
207 printNumberingModuleList(
'product_batch',
'mod_sn_',
'PRODUCTBATCH_SN_ADDON', $langs->trans(
"BatchSerialNumberingModules"), $batch,
'setmodsn');
216$sql .=
" FROM " . MAIN_DB_PREFIX .
"document_model";
217$sql .=
" WHERE type = '" . $db->escape($type) .
"'";
218$sql .=
" AND entity = " . ((int)
$conf->entity);
219$resql = $db->query($sql);
222 $num_rows = $db->num_rows($resql);
223 while ($i < $num_rows) {
224 $array = $db->fetch_array($resql);
225 if (is_array($array)) {
226 array_push($def, $array[0]);
231 dol_print_error($db);
238 printDocumentModelList($type,
'product_batch',
'PRODUCT_BATCH_ADDON_PDF', $langs->trans(
"ProductBatchDocumentTemplates"), array(
239 'Logo' =>
'option_logo',
240 'MultiLanguage' =>
'option_multilang',
250 print $langs->trans(
"NothingToSetup");
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class with list of lots and properties.
if(! $sortfield) if(! $sortorder) $module
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
product_lot_admin_prepare_head()
Return array head with list of tabs to view object information.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.