diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php
index 2ed50dc6f2a..4230ffe4ba2 100644
--- a/htdocs/barcode/printsheet.php
+++ b/htdocs/barcode/printsheet.php
@@ -47,11 +47,49 @@ $mesg='';
$action=GETPOST('action');
+$producttmp=new Product($db);
+$thirdpartytmp=new Societe($db);
+
/*
* 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')
{
$result=0; $error=0;
@@ -150,8 +188,8 @@ if ($action == 'builddoc')
// For labels
if ($mode == 'label')
{
- if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="%PHOTO%";
- $textleft=make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
+ $txtforsticker="%PHOTO%";
+ $textleft=make_substitutions($txtforsticker, $substitutionarray);
$textheader='';
$textfooter='';
$textright='';
@@ -253,19 +291,94 @@ print '';
print '
';
+
+// Add javascript to make choice dynamic
+print '';
+
// Checkbox to select from free text
-print ' '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
+print ' '.$langs->trans("FillBarCodeTypeAndValueManually").' ';
print '
';
-/*
-print ' '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
+print ' '.$langs->trans("FillBarCodeTypeAndValueFromProduct").' ';
+print '
';
+print '
';
print $form->select_produits(GETPOST('productid'), 'productid', '');
+print ' ';
+print '
';
+
+print ' '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
+print '
';
+print '';
+print $form->select_company(GETPOST('socid'), 'socid', '', 1);
+print ' ';
+print '
';
+
print '
';
-print ' '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
-print $form->select_company(GETPOST('socid'), 'socid', '', 1);
-print '
';
-*/
+if ($producttmp->id > 0)
+{
+ print $langs->trans("BarCodeDataForProduct",$producttmp->getNomUrl(1)).'
';
+}
+if ($thirdpartytmp->id > 0)
+{
+ print $langs->trans("BarCodeDataForThirdparty",$thirdpartytmp->getNomUrl(1)).'
';
+}
print '';
@@ -284,7 +397,7 @@ print '
';
/*
@@ -294,7 +407,9 @@ print '
';
+
+print '
trans("BuildPageToPrint").'">';
print '';
print '
';
diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php
index 93d991ac11c..a5614c98071 100644
--- a/htdocs/core/class/html.formbarcode.class.php
+++ b/htdocs/core/class/html.formbarcode.class.php
@@ -122,13 +122,13 @@ class FormBarCode
if ($useempty && $num > 0)
{
- print '