New: Can call back barcode number from a product ref or thirdparty ref.
This commit is contained in:
parent
30aae38efa
commit
062230050f
@ -47,11 +47,49 @@ $mesg='';
|
|||||||
|
|
||||||
$action=GETPOST('action');
|
$action=GETPOST('action');
|
||||||
|
|
||||||
|
$producttmp=new Product($db);
|
||||||
|
$thirdpartytmp=new Societe($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
||||||
|
{
|
||||||
|
$action=''; // We reset because we dont want to build doc
|
||||||
|
if (GETPOST('productid') > 0)
|
||||||
|
{
|
||||||
|
$producttmp->fetch(GETPOST('productid'));
|
||||||
|
$forbarcode=$producttmp->barcode;
|
||||||
|
$fk_barcode_type=$thirdpartytmp->barcode_type_code;
|
||||||
|
|
||||||
|
if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
|
||||||
|
|
||||||
|
if (empty($forbarcode) || empty($fk_barcode_type))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("DefinitionOfBarCodeForProductNotComplete",$producttmp->getNomUrl()), 'warnings');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty'))
|
||||||
|
{
|
||||||
|
$action=''; // We reset because we dont want to build doc
|
||||||
|
if (GETPOST('socid') > 0)
|
||||||
|
{
|
||||||
|
$thirdpartytmp->fetch(GETPOST('socid'));
|
||||||
|
$forbarcode=$thirdpartytmp->barcode;
|
||||||
|
$fk_barcode_type=$thirdpartytmp->barcode_type_code;
|
||||||
|
|
||||||
|
if (empty($fk_barcode_type) && ! empty($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY)) $fk_barcode_type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
|
||||||
|
|
||||||
|
if (empty($forbarcode) || empty($fk_barcode_type))
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("DefinitionOfBarCodeForProductNotComplete",$thirdpartytmp->getNomUrl()), 'warnings');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'builddoc')
|
if ($action == 'builddoc')
|
||||||
{
|
{
|
||||||
$result=0; $error=0;
|
$result=0; $error=0;
|
||||||
@ -150,8 +188,8 @@ if ($action == 'builddoc')
|
|||||||
// For labels
|
// For labels
|
||||||
if ($mode == 'label')
|
if ($mode == 'label')
|
||||||
{
|
{
|
||||||
if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="%PHOTO%";
|
$txtforsticker="%PHOTO%";
|
||||||
$textleft=make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
|
$textleft=make_substitutions($txtforsticker, $substitutionarray);
|
||||||
$textheader='';
|
$textheader='';
|
||||||
$textfooter='';
|
$textfooter='';
|
||||||
$textright='';
|
$textright='';
|
||||||
@ -253,19 +291,94 @@ print '</div>';
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
// Add javascript to make choice dynamic
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
function init_selectors()
|
||||||
|
{
|
||||||
|
if (jQuery("#fillmanually:checked").val() == "fillmanually")
|
||||||
|
{
|
||||||
|
jQuery("#submitproduct").attr(\'disabled\',\'disabled\');
|
||||||
|
jQuery("#submitthirdparty").attr(\'disabled\',\'disabled\');
|
||||||
|
jQuery("#search_productid").attr(\'disabled\',\'disabled\');
|
||||||
|
jQuery("#socid").attr(\'disabled\',\'disabled\');
|
||||||
|
jQuery(".showforproductselector").hide();
|
||||||
|
jQuery(".showforthirdpartyselector").hide();
|
||||||
|
}
|
||||||
|
if (jQuery("#fillfromproduct:checked").val() == "fillfromproduct")
|
||||||
|
{
|
||||||
|
jQuery("#submitproduct").removeAttr(\'disabled\');
|
||||||
|
jQuery("#submitthirdparty").attr(\'disabled\',\'disabled\');
|
||||||
|
jQuery("#search_productid").removeAttr(\'disabled\');
|
||||||
|
jQuery("#socid").attr(\'disabled\',\'disabled\');
|
||||||
|
jQuery(".showforproductselector").show();
|
||||||
|
jQuery(".showforthirdpartyselector").hide();
|
||||||
|
}
|
||||||
|
if (jQuery("#fillfromthirdparty:checked").val() == "fillfromthirdparty")
|
||||||
|
{
|
||||||
|
jQuery("#submitproduct").attr(\'disabled\',\'disabled\');
|
||||||
|
jQuery("#submitthirdparty").removeAttr(\'disabled\');
|
||||||
|
jQuery("#search_productid").attr(\'disabled\',\'disabled\');
|
||||||
|
jQuery("#socid").removeAttr(\'disabled\');
|
||||||
|
jQuery(".showforproductselector").hide();
|
||||||
|
jQuery(".showforthirdpartyselector").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init_selectors();
|
||||||
|
jQuery(".radiobarcodeselect").click(function() {
|
||||||
|
init_selectors();
|
||||||
|
});
|
||||||
|
|
||||||
|
function init_gendoc_button()
|
||||||
|
{
|
||||||
|
if (jQuery("#select_fk_barcode_type").val() > 0 && jQuery("#forbarcode").val())
|
||||||
|
{
|
||||||
|
jQuery("#submitformbarcodegen").removeAttr(\'disabled\');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jQuery("#submitformbarcodegen").attr(\'disabled\',\'disabled\');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init_gendoc_button();
|
||||||
|
jQuery("#select_fk_barcode_type").change(function() {
|
||||||
|
init_gendoc_button();
|
||||||
|
});
|
||||||
|
jQuery("#forbarcode").keyup(function() {
|
||||||
|
init_gendoc_button()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
// Checkbox to select from free text
|
// Checkbox to select from free text
|
||||||
print '<input id="fillmanually" type="checkbox" checked="checked"> '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
|
print '<input id="fillmanually" type="radio" '.((! GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode")=='fillmanually')?'checked="checked" ':'').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
/*
|
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromproduct')?'checked="checked" ':'').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
||||||
print '<input id="fillfromproduct" type="checkbox" checked="checked" disabled="true"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
|
print '<br>';
|
||||||
|
print '<div class="showforproductselector">';
|
||||||
print $form->select_produits(GETPOST('productid'), 'productid', '');
|
print $form->select_produits(GETPOST('productid'), 'productid', '');
|
||||||
|
print ' <input type="submit" id="submitproduct" name="submitproduct" class="button" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked="checked" ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
||||||
|
print '<br>';
|
||||||
|
print '<div class="showforthirdpartyselector">';
|
||||||
|
print $form->select_company(GETPOST('socid'), 'socid', '', 1);
|
||||||
|
print ' <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<input id="fillfromthirdparty" type="checkbox" checked="checked" disabled="true"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
if ($producttmp->id > 0)
|
||||||
print $form->select_company(GETPOST('socid'), 'socid', '', 1);
|
{
|
||||||
print '<br>';
|
print $langs->trans("BarCodeDataForProduct",$producttmp->getNomUrl(1)).'<br>';
|
||||||
*/
|
}
|
||||||
|
if ($thirdpartytmp->id > 0)
|
||||||
|
{
|
||||||
|
print $langs->trans("BarCodeDataForThirdparty",$thirdpartytmp->getNomUrl(1)).'<br>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<div class="tagtable">';
|
print '<div class="tagtable">';
|
||||||
|
|
||||||
@ -284,7 +397,7 @@ print ' <div class="tagtr">';
|
|||||||
print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
|
print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
|
||||||
print $langs->trans("BarcodeValue").' ';
|
print $langs->trans("BarcodeValue").' ';
|
||||||
print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
|
print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
|
||||||
print '<input size="16" type="text" name="forbarcode" value="'.GETPOST('forbarcode').'">';
|
print '<input size="16" type="text" name="forbarcode" id="forbarcode" value="'.$forbarcode.'">';
|
||||||
print '</div></div>';
|
print '</div></div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -294,7 +407,9 @@ print '<textarea cols="40" type="text" name="barcodestickersmask" value="'.GETPO
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildPageToPrint").'">';
|
print '</div>';
|
||||||
|
|
||||||
|
print '<br><input class="button" type="submit" id="submitformbarcodegen" '.((GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode"))?'':'disabled="checked" ').'value="'.$langs->trans("BuildPageToPrint").'">';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -122,13 +122,13 @@ class FormBarCode
|
|||||||
|
|
||||||
if ($useempty && $num > 0)
|
if ($useempty && $num > 0)
|
||||||
{
|
{
|
||||||
print '<select class="flat" name="'.$htmlname.'">';
|
print '<select class="flat" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
||||||
print '<option value="0"> </option>';
|
print '<option value="0"> </option>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print '<select disabled="disabled" class="flat" name="'.$htmlname.'">';
|
print '<select disabled="disabled" class="flat" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
||||||
print '<option value="0" selected="selected">'.$langs->trans('ErrorNoActivatedBarcode').'</option>';
|
print '<option value="0" selected="selected">'.$langs->trans('ErrorNoActivatedBarcode').'</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1013,6 +1013,7 @@ AddRefInList=Display customer/supplier ref into list (select list or combobox) a
|
|||||||
FieldEdition=Edition of field %s
|
FieldEdition=Edition of field %s
|
||||||
FixTZ=TimeZone fix
|
FixTZ=TimeZone fix
|
||||||
FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
|
FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
|
||||||
|
GetBarCode=Get barcode
|
||||||
##### Module password generation
|
##### Module password generation
|
||||||
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
|
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
|
||||||
PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually.
|
PasswordGenerationNone=Do not suggest any generated password. Password must be type in manually.
|
||||||
|
|||||||
@ -209,8 +209,12 @@ PageToGenerateBarCodeSheets=With this tool, you can print sheets of bar code sti
|
|||||||
NumberOfStickers=Number of stickers to print on page
|
NumberOfStickers=Number of stickers to print on page
|
||||||
PrintsheetForOneBarCode=Print several stickers for one barcode
|
PrintsheetForOneBarCode=Print several stickers for one barcode
|
||||||
BuildPageToPrint=Generate page to print
|
BuildPageToPrint=Generate page to print
|
||||||
FillBarCodeTypeAndValueManually=Fill barcode type and value manually
|
FillBarCodeTypeAndValueManually=Fill barcode type and value manually.
|
||||||
FillBarCodeTypeAndValueFromProduct=Fill barcode type and value from a product
|
FillBarCodeTypeAndValueFromProduct=Fill barcode type and value from barcode of a product.
|
||||||
FillBarCodeTypeAndValueFromThirdParty=Fill barcode type and value from a thirdparty
|
FillBarCodeTypeAndValueFromThirdParty=Fill barcode type and value from barcode of a thirdparty.
|
||||||
|
DefinitionOfBarCodeForProductNotComplete=Definition of type or value of bar code not complete for product %s.
|
||||||
|
DefinitionOfBarCodeForThirdpartyNotComplete=Definition of type or value of bar code non complete for thirdparty %s.
|
||||||
|
BarCodeDataForProduct=Barcode information of product %s :
|
||||||
|
BarCodeDataForThirdparty=Barcode information of thirdparty %s :
|
||||||
BarcodeStickersMask=xxx
|
BarcodeStickersMask=xxx
|
||||||
|
|
||||||
@ -1011,6 +1011,7 @@ AddRefInList=Afficher le code client/fournisseur dans les liste (déroulante ou
|
|||||||
FieldEdition=Édition du champ %s
|
FieldEdition=Édition du champ %s
|
||||||
FixTZ=Correction du Timezone
|
FixTZ=Correction du Timezone
|
||||||
FillThisOnlyIfRequired=Exemple: +2 (ne remplir que si un décalage d'heure est constaté dans l'export)
|
FillThisOnlyIfRequired=Exemple: +2 (ne remplir que si un décalage d'heure est constaté dans l'export)
|
||||||
|
GetBarCode=Récupérer code barre
|
||||||
##### Module password generation
|
##### Module password generation
|
||||||
PasswordGenerationStandard=Renvoie un mot de passe généré selon l'algorithme interne de Dolibarr : 8 caractères, chiffres et caractères en minuscules mélangés.
|
PasswordGenerationStandard=Renvoie un mot de passe généré selon l'algorithme interne de Dolibarr : 8 caractères, chiffres et caractères en minuscules mélangés.
|
||||||
PasswordGenerationNone=Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement.
|
PasswordGenerationNone=Ne propose pas de mots de passe générés. Le mot de passe est à saisir manuellement.
|
||||||
|
|||||||
@ -209,7 +209,11 @@ PageToGenerateBarCodeSheets=Avec cet outils, vous pouvez imprimer une planche d'
|
|||||||
NumberOfStickers=Nombre d'étiquettes à imprimer sur la/les planches
|
NumberOfStickers=Nombre d'étiquettes à imprimer sur la/les planches
|
||||||
PrintsheetForOneBarCode=Imprimer des étiquettes d'un code barre particulier
|
PrintsheetForOneBarCode=Imprimer des étiquettes d'un code barre particulier
|
||||||
BuildPageToPrint=Générer la page à imprimer
|
BuildPageToPrint=Générer la page à imprimer
|
||||||
FillBarCodeTypeAndValueManually=Remplir le type et la valeur du code barre manuellement
|
FillBarCodeTypeAndValueManually=Remplir le type et la valeur du code barre manuellement.
|
||||||
FillBarCodeTypeAndValueFromProduct=Remplir le type et la valeur du code barre depuis un produit
|
FillBarCodeTypeAndValueFromProduct=Remplir le type et la valeur du code barre par celui d'un produit.
|
||||||
FillBarCodeTypeAndValueFromThirdParty=Remplir le type et la valeur du code barre depuis un tiers
|
FillBarCodeTypeAndValueFromThirdParty=Remplir le type et la valeur du code barre par celui d'un tiers.
|
||||||
|
DefinitionOfBarCodeForProductNotComplete=Définition du type ou valeure du code bar incomplète sur le produit %s.
|
||||||
|
DefinitionOfBarCodeForThirdpartyNotComplete=Définition du type ou valeure du code bar incomplète sur le tiers %s.
|
||||||
|
BarCodeDataForProduct=Information de code barre du produit %s :
|
||||||
|
BarCodeDataForThirdparty=Information de code barre du tiers %s :
|
||||||
BarcodeStickersMask=xxx
|
BarcodeStickersMask=xxx
|
||||||
Loading…
Reference in New Issue
Block a user