Merge pull request #2 from altairis-noe/product_masks

Product masks
This commit is contained in:
Christophe Battarel 2021-04-07 16:20:39 +02:00 committed by GitHub
commit 05efc85008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 2 deletions

View File

@ -27,4 +27,7 @@ StockDetailPerBatch=Stock detail per lot
SerialNumberAlreadyInUse=Serial number %s is already used for product %s
TooManyQtyForSerialNumber=You can only have one product %s for serial number %s
BatchLotNumberingModules=Options for automatic generation of batch products managed by lots
BatchSerialNumberingModules=Options for automatic generation of batch products managed by serial numbers
BatchSerialNumberingModules=Options for automatic generation of batch products managed by serial numbers
CustomMasks=Adds an option to define mask in the product card
LotProductTooltip=Adds an option in the product card to define a dedicated batch number mask
SNProductTooltip=Adds an option in the product card to define a dedicated serial number mask

View File

@ -27,4 +27,7 @@ StockDetailPerBatch=Stock détaillé par lot
SerialNumberAlreadyInUse=Le numéro de série %s est déjà utilisé pour le produit %s
TooManyQtyForSerialNumber=Vous ne pouvez avoir qu'un produit %s avec le numéro de série %s
BatchLotNumberingModules=Modèle de génération et contrôle des numéros de lot
BatchSerialNumberingModules=Modèle de génération et contrôle des numéros de série
BatchSerialNumberingModules=Modèle de génération et contrôle des numéros de série
CustomMasks=Ajoute une option pour définir le masque dans la fiche produit
LotProductTooltip=Crée un champ dans la fiche produit pour définir un modèle spécifique de numéro de lot
SNProductTooltip=Crée un champ dans la fiche produit pour définir un modèle spécifique de numéro de série

View File

@ -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, 'bool', 0, '', $conf->entity);
}
if ($action == 'setmaskssn') {
dolibarr_set_const($db, "PRODUCTBATCH_SN_USE_PRODUCT_MASKS", $value, 'bool', 0, '', $conf->entity);
}
/*
@ -176,6 +182,38 @@ foreach ($dirmodels as $reldir) {
}
}
closedir($handle);
print '<tr class="oddeven"><td>Option</td><td>'."\n";
print $langs->trans('CustomMasks');
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp = 'NoExample';
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $langs->trans($tmp);
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&amp;value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskslot&amp;value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
// Info
$htmltooltip = $langs->trans("LotProductTooltip");
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print "</tr>\n";
}
}
}
@ -268,6 +306,38 @@ foreach ($dirmodels as $reldir) {
}
}
closedir($handle);
print '<tr class="oddeven"><td>Option</td><td>'."\n";
print $langs->trans('CustomMasks');
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp = 'NoExample';
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $langs->trans($tmp);
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&amp;value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmaskssn&amp;value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
// Info
$htmltooltip = $langs->trans("SNProductTooltip");
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print "</tr>\n";
}
}
}