From 4015e1607f49f4db183fa2d527d2db688746c494 Mon Sep 17 00:00:00 2001 From: altairis-noe Date: Tue, 6 Apr 2021 17:34:50 +0200 Subject: [PATCH] add masks to product_lot --- htdocs/product/admin/product_lot.php | 94 ++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index d1b87bf0b14..79e64940d8f 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.php @@ -72,6 +72,12 @@ if ($action == 'updateMaskLot') { dolibarr_set_const($db, "PRODUCTBATCH_LOT_ADDON", $value, 'chaine', 0, '', $conf->entity); } elseif ($action == 'setmodsn') { dolibarr_set_const($db, "PRODUCTBATCH_SN_ADDON", $value, 'chaine', 0, '', $conf->entity); +} +if ($action == 'setmaskslot') { + dolibarr_set_const($db, "PRODUCTBATCH_LOT_USE_PRODUCT_MASKS", $value, 'chaine', 0, '', $conf->entity); +} +if ($action == 'setmaskssn') { + dolibarr_set_const($db, "PRODUCTBATCH_SN_USE_PRODUCT_MASKS", $value, 'chaine', 0, '', $conf->entity); } /* @@ -176,6 +182,50 @@ foreach ($dirmodels as $reldir) { } } closedir($handle); + print 'lot_product'."\n"; + print $langs->trans('CustomMasks'); + print ''; + + // Show example of numbering model + print ''; + $tmp = 'NoExample'; + if (preg_match('/^Error/', $tmp)) print '
'.$langs->trans($tmp).'
'; + elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); + else print $langs->trans($tmp); + print ''."\n"; + + print ''; + if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS == 'true') { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } + print ''; + + // Info + $htmltooltip = ''; + $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; + $nextval = $module->getNextValue($mysoc, $batch); + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip .= ''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip .= $nextval.'
'; + } else { + $htmltooltip .= $langs->trans($module->error).'
'; + } + } + + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''; + + print "\n"; } } } @@ -268,6 +318,50 @@ foreach ($dirmodels as $reldir) { } } closedir($handle); + print 'sn_product'."\n"; + print $langs->trans('CustomMasks'); + print ''; + + // Show example of numbering model + print ''; + $tmp = 'NoExample'; + if (preg_match('/^Error/', $tmp)) print '
'.$langs->trans($tmp).'
'; + elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); + else print $langs->trans($tmp); + print ''."\n"; + + print ''; + if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS == 'true') { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } + print ''; + + // Info + $htmltooltip = ''; + $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; + $nextval = $module->getNextValue($mysoc, $batch); + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip .= ''.$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip .= $nextval.'
'; + } else { + $htmltooltip .= $langs->trans($module->error).'
'; + } + } + + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''; + + print "\n"; } } }