dolibarr 25.0.0-alpha
printsheet.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
6 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2025 William Mead <william@m34d.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Do not use GETPOST, the function does not exists yet.
30if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must not renew the token.
31 if (!defined('NOTOKENRENEWAL')) {
32 define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
33 }
34}
35
36// Load Dolibarr environment
37require '../main.inc.php';
46require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
50require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
51require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php';
52require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
53
54
55// Load translation files required by the page
56$langs->loadLangs(array('admin', 'members', 'errors'));
57
58// Choice of print year or current year.
59$now = dol_now();
60$year = dol_print_date($now, '%Y');
61$month = dol_print_date($now, '%m');
62$day = dol_print_date($now, '%d');
63$forbarcode = GETPOST('forbarcode', 'alphanohtml');
64$fk_barcode_type = GETPOSTINT('fk_barcode_type');
65$mode = GETPOST('mode', 'aZ09');
66$modellabel = GETPOST("modellabel", 'aZ09'); // Doc template to use
67$numberofsticker = GETPOSTINT('numberofsticker');
68
69$label_product_ref_option = GETPOSTISSET('label_product_ref_option');
70$label_product_label_option = GETPOSTISSET('label_product_label_option');
71
72if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) {
73 $label_product_ref = (GETPOSTISSET('label_product_ref') ? GETPOST('label_product_ref', 'nohtml') : null);
74} else {
75 $label_product_ref = (GETPOSTISSET('label_product_ref') ? GETPOST('label_product_ref', 'alpha') : null);
76}
77
78if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) {
79 $security_check = 'nohtml';
80} else {
81 $security_check = !getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML') ? 'alphanohtml' : 'restricthtml';
82}
83$label_product_label = (GETPOSTISSET('label_product_label') ? GETPOST('label_product_label', $security_check) : null);
84
85$mesg = '';
86
87$action = GETPOST('action', 'aZ09');
88
89$producttmp = new Product($db);
90$thirdpartytmp = new Societe($db);
91
92// Security check (enable the most restrictive one)
93//if ($user->socid > 0) accessforbidden();
94//if ($user->socid > 0) $socid = $user->socid;
95if (!isModEnabled('barcode')) {
96 accessforbidden('Module not enabled');
97}
98if (!$user->hasRight('barcode', 'read')) {
100}
101// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
102$hookmanager->initHooks(array('printsheettools'));
103
104restrictedArea($user, 'barcode');
105
106$object = new stdClass();
107
108
109/*
110 * Actions
111 */
112
113// Note that $action and $object may have been modified by some
114$parameters = array();
115$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
116if ($reshook < 0) {
117 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
118}
119
120if (empty($reshook)) {
121 if (GETPOST('submitproduct')) {
122 $action = ''; // We reset because we don't want to build doc
123 if (GETPOSTINT('productid') > 0) {
124 $result = $producttmp->fetch(GETPOSTINT('productid'));
125 if ($result < 0) {
126 setEventMessage($producttmp->error, 'errors');
127 }
128 $forbarcode = $producttmp->barcode;
129 $fk_barcode_type = $producttmp->barcode_type;
130
131 if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) {
132 $fk_barcode_type = getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE');
133 }
134
135 if (empty($forbarcode) || empty($fk_barcode_type)) {
136 setEventMessages($langs->trans("DefinitionOfBarCodeForProductNotComplete", $producttmp->getNomUrl()), null, 'warnings');
137 }
138
139 if (empty($label_product_ref) && $label_product_ref_option) {
140 $label_product_ref = $producttmp->ref;
141 }
142
143 if (empty($label_product_label) && $label_product_label_option) {
144 $label_product_label = $producttmp->label;
145 }
146 }
147 }
148 if (GETPOST('submitthirdparty')) {
149 $action = ''; // We reset because we don't want to build doc
150 if (GETPOSTINT('socid') > 0) {
151 $thirdpartytmp->fetch(GETPOSTINT('socid'));
152 $forbarcode = $thirdpartytmp->barcode;
153 $fk_barcode_type = $thirdpartytmp->barcode_type_code;
154
155 if (empty($fk_barcode_type) && getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY')) {
156 $fk_barcode_type = getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY');
157 }
158
159 if (empty($forbarcode) || empty($fk_barcode_type)) {
160 setEventMessages($langs->trans("DefinitionOfBarCodeForThirdpartyNotComplete", $thirdpartytmp->getNomUrl()), null, 'warnings');
161 }
162 }
163 }
164
165 if ($action == 'builddoc' && $user->hasRight('barcode', 'read')) {
166 $result = 0;
167 $error = 0;
168
169 if (empty($forbarcode)) { // barcode value
170 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeValue")), null, 'errors');
171 $error++;
172 }
173 $MAXLENGTH = 51200; // Limit set to 50Ko
174 if (dol_strlen($forbarcode) > $MAXLENGTH) { // barcode value
175 setEventMessages($langs->trans("ErrorFieldTooLong", $langs->transnoentitiesnoconv("BarcodeValue")).' ('.$langs->trans("RequireXStringMax", $MAXLENGTH).')', null, 'errors');
176 $error++;
177 }
178 if (empty($fk_barcode_type)) { // barcode type = barcode encoding
179 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeType")), null, 'errors');
180 $error++;
181 }
182
183 if (GETPOSTINT('productid') > 0) {
184 $result = $producttmp->fetch(GETPOSTINT('productid'));
185 if ($result < 0) {
186 setEventMessage($producttmp->error, 'errors');
187 }
188 if (empty($label_product_ref) && $label_product_ref_option) {
189 $label_product_ref = $producttmp->ref;
190 }
191
192 if (empty($label_product_label) && $label_product_label_option) {
193 $label_product_label = $producttmp->label;
194 }
195 }
196
197 $stdobject = null;
198 if (!$error) {
199 // Get encoder (barcode_type_coder) from barcode type id (barcode_type)
200 $stdobject = new GenericObject($db);
201 $stdobject->barcode_type = $fk_barcode_type;
202 $result = $stdobject->fetchBarCode();
203 if ($result <= 0) {
204 $error++;
205 setEventMessages('Failed to get bar code type information '.$stdobject->error, $stdobject->errors, 'errors');
206 }
207 }
208
209 $encoding = null;
210 $diroutput = null;
211 $template = null;
212 $is2d = false;
213 $code = $forbarcode;
214
215 if (!$error && $stdobject !== null) {
216 $generator = $stdobject->barcode_type_coder; // coder (loaded by fetchBarCode). Engine.
217 $encoding = strtoupper($stdobject->barcode_type_code); // code (loaded by fetchBarCode). Example 'ean', 'isbn', ...
218
219 $diroutput = $conf->barcode->dir_temp;
220 dol_mkdir($diroutput);
221
222 // Generate barcode
223 $dirbarcode = array_merge(array("/core/modules/barcode/doc/"), $conf->modules_parts['barcode']);
224
225 foreach ($dirbarcode as $reldir) {
226 $dir = dol_buildpath($reldir, 0);
227 $newdir = dol_osencode($dir);
228
229 // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
230 if (!is_dir($newdir)) {
231 continue;
232 }
233
234 $result = @include_once $newdir.$generator.'.modules.php';
235 if ($result) {
236 break;
237 }
238 }
239
240 // Load barcode class for generating barcode image
241 $classname = "mod".ucfirst($generator);
242 // $module can be modTcpdfbarcode or modPhpbarcode that both extends ModeleBarCode
243 $module = new $classname($db);
244
245 // Build the file on disk for generator not able to return the document on the fly.
246 if ($generator != 'tcpdfbarcode') { // $generator can be 'phpbarcode' (with this generator, barcode is generated on disk first) or 'tcpdfbarcode' (no need to enter this section with this generator).
247 '@phan-var-force modPhpbarcode $module';
248 $template = 'standardlabel';
249 if ($module->encodingIsSupported($encoding)) {
250 $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
251 dol_delete_file($barcodeimage);
252 // File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
253 $result = $module->writeBarCode($code, $encoding, 'Y', 4, 1);
254 if ($result <= 0 || !dol_is_file($barcodeimage)) {
255 $error++;
256 setEventMessages('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), null, 'errors');
257 setEventMessages($module->error, null, 'errors');
258 }
259 } else {
260 $error++;
261 setEventMessages("Error, encoding ".$encoding." is not supported by encoder ".$generator.'. You must choose another barcode type or install a barcode generation engine that support '.$encoding, null, 'errors');
262 }
263 } else {
264 '@phan-var-force modTcpdfbarcode $module';
265 $template = 'tcpdflabel';
266 $encoding = $module->getTcpdfEncodingType($encoding); //convert to TCPDF compatible encoding types
267 $is2d = $module->is2d;
268 }
269 }
270
271 if (!$error) {
273 // List of values to scan for a replacement
274 $substitutionarray = array(
275 // old
276 '%LOGIN%' => $user->login,
277 '%COMPANY%' => $mysoc->name,
278 '%ADDRESS%' => $mysoc->address,
279 '%ZIP%' => $mysoc->zip,
280 '%TOWN%' => $mysoc->town,
281 '%COUNTRY%' => $mysoc->country,
282 '%COUNTRY_CODE%' => $mysoc->country_code,
283 '%EMAIL%' => $mysoc->email,
284 '%YEAR%' => $year,
285 '%MONTH%' => $month,
286 '%DAY%' => $day,
287 '%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT,
288 '%SERVER%' => $dolibarr_main_url_root,
289 // new
290 '__LOGIN__' => $user->login,
291 '__COMPANY__' => $mysoc->name,
292 '__ADDRESS__' => $mysoc->address,
293 '__ZIP__' => $mysoc->zip,
294 '__TOWN__' => $mysoc->town,
295 '__COUNTRY__' => $mysoc->country,
296 '__COUNTRY_CODE__' => $mysoc->country_code,
297 '__EMAIL__' => $mysoc->email,
298 '__YEAR__' => $year,
299 '__MONTH__' => $month,
300 '__DAY__' => $day,
301 '__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT,
302 '__SERVER__' => $dolibarr_main_url_root,
303 );
304 complete_substitutions_array($substitutionarray, $langs);
305
306 $arrayofrecords = array();
307 // For labels
308 if ($mode == 'label') {
309 $txtforsticker = "%PHOTO%"; // Photo will be barcode image, %BARCODE% possible when using TCPDF generator
310 $textleft = make_substitutions(getDolGlobalString('BARCODE_LABEL_LEFT_TEXT', $txtforsticker), $substitutionarray);
311 if ((GETPOSTINT('productid') > 0) && $label_product_ref_option) {
312 $textheader = $label_product_ref;
313 } else {
314 $textheader = make_substitutions(getDolGlobalString('BARCODE_LABEL_HEADER_TEXT'), $substitutionarray);
315 }
316 if ((GETPOSTINT('productid') > 0) && $label_product_label_option) {
317 $textfooter = $label_product_label;
318 } else {
319 $textfooter = make_substitutions(getDolGlobalString('BARCODE_LABEL_FOOTER_TEXT'), $substitutionarray);
320 }
321 $textright = make_substitutions(getDolGlobalString('BARCODE_LABEL_RIGHT_TEXT'), $substitutionarray);
322 $forceimgscalewidth = getDolGlobalString('BARCODE_FORCEIMGSCALEWIDTH', 1);
323 $forceimgscaleheight = getDolGlobalString('BARCODE_FORCEIMGSCALEHEIGHT', 1);
324
325 $MAXSTICKERS = 1000;
326 if ($numberofsticker <= $MAXSTICKERS) {
327 for ($i = 0; $i < $numberofsticker; $i++) {
328 $arrayofrecords[] = array(
329 'textleft' => $textleft,
330 'textheader' => $textheader,
331 'textfooter' => $textfooter,
332 'textright' => $textright,
333 'code' => $code,
334 'encoding' => $encoding,
335 'is2d' => $is2d,
336 'photo' => !empty($barcodeimage) ? $barcodeimage : '' // Photo must be a file that exists with format supported by TCPDF
337 );
338 }
339 } else {
340 $mesg = $langs->trans("ErrorQuantityIsLimitedTo", $MAXSTICKERS);
341 $error++;
342 }
343 }
344
345 // Build and output PDF
346 if (!$error && $mode == 'label') {
347 if (!count($arrayofrecords)) {
348 $mesg = $langs->trans("ErrorRecordNotFound");
349 }
350 if (empty($modellabel) || $modellabel == '-1') {
351 $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
352 }
353
354 $outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf';
355
356 if (!$mesg) {
357 $outputlangs = $langs;
358
359 $previousConf = getDolGlobalInt('TCPDF_THROW_ERRORS_INSTEAD_OF_DIE');
360 $conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE = 1;
361
362 // This generates and send PDF to output
363 // TODO Move
364 try {
365 $result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, (string) $diroutput, (string) $template, dol_sanitizeFileName($outfile));
366 } catch (Exception $e) {
367 $mesg = $langs->trans('ErrorGeneratingBarcode');
368 $error++;
369 }
370
371 $conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE = $previousConf;
372 }
373 }
374
375 if ($result <= 0 || $mesg || $error) {
376 if (empty($mesg)) {
377 $mesg = 'Error '.$result;
378 }
379
380 setEventMessages($mesg, null, 'errors');
381 } else {
382 $db->close();
383 exit;
384 }
385 }
386 }
387}
388
389
390/*
391 * View
392 */
393
394$form = new Form($db);
395
396llxHeader('', $langs->trans("BarCodePrintsheet"), '', '', 0, 0, '', '', '', 'mod-barcode page-printsheet');
397
398print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'barcode');
399print '<br>';
400
401print '<span class="opacitymedium">'.$langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'</span><br>';
402print '<br>';
403
404//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
405//print '<br>';
406
407print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; // The target is for brothers that open the file instead of downloading it
408print '<input type="hidden" name="mode" value="label">';
409print '<input type="hidden" name="action" value="builddoc">';
410print '<input type="hidden" name="token" value="'.currentToken().'">'; // The page will not renew the token but force download of a file, so we must use here currentToken
411
412print '<div class="tagtable">';
413
414// Sheet format
415print ' <div class="tagtr">';
416print ' <div class="tagtd">';
417print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' &nbsp; ';
418print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
419// List of possible labels (defined into $_Avery_Labels variable set into core/lib/format_cards.lib.php)
420$arrayoflabels = array();
421foreach (array_keys($_Avery_Labels) as $codecards) {
422 $labeltoshow = $_Avery_Labels[$codecards]['name'];
423 //$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')';
424 $arrayoflabels[$codecards] = $labeltoshow;
425}
426asort($arrayoflabels);
427print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : getDolGlobalString('ADHERENT_ETIQUETTE_TYPE')), 1, 0, 0, '', 0, 0, 0, '', '', 1);
428print '</div></div>';
429
430// Number of stickers to print
431print ' <div class="tagtr">';
432print ' <div class="tagtd">';
433print $langs->trans("NumberOfStickers").' &nbsp; ';
434print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
435print '<input size="4" type="text" name="numberofsticker" value="'.(GETPOST('numberofsticker') ? GETPOSTINT('numberofsticker') : 10).'">';
436print '</div></div>';
437
438print '</div>';
439
440
441print '<br>';
442
443
444// Add javascript to make choice dynamic
445print '<script type="text/javascript">
446jQuery(document).ready(function() {
447 function init_selectors()
448 {
449 if (jQuery("#fillmanually:checked").val() == "fillmanually")
450 {
451 jQuery("#submitproduct").prop("disabled", true);
452 jQuery("#submitthirdparty").prop("disabled", true);
453 jQuery("#search_productid").prop("disabled", true);
454 jQuery("#socid").prop("disabled", true);
455 jQuery(".showforproductselector").hide();
456 jQuery(".showforthirdpartyselector").hide();
457 }
458 if (jQuery("#fillfromproduct:checked").val() == "fillfromproduct")
459 {
460 jQuery("#submitproduct").removeAttr("disabled");
461 jQuery("#submitthirdparty").prop("disabled", true);
462 jQuery("#search_productid").removeAttr("disabled");
463 jQuery("#socid").prop("disabled", true);
464 jQuery(".showforproductselector").show();
465 jQuery(".showforthirdpartyselector").hide();
466 }
467 if (jQuery("#fillfromthirdparty:checked").val() == "fillfromthirdparty")
468 {
469 jQuery("#submitproduct").prop("disabled", true);
470 jQuery("#submitthirdparty").removeAttr("disabled");
471 jQuery("#search_productid").prop("disabled", true);
472 jQuery("#socid").removeAttr("disabled");
473 jQuery(".showforproductselector").hide();
474 jQuery(".showforthirdpartyselector").show();
475 }
476 }
477 init_selectors();
478 jQuery(".radiobarcodeselect").click(function() {
479 init_selectors();
480 });
481
482 function init_gendoc_button()
483 {
484 if (jQuery("#select_fk_barcode_type").val() > 0 && jQuery("#forbarcode").val())
485 {
486 jQuery("#submitformbarcodegen").removeAttr("disabled");
487 }
488 else
489 {
490 jQuery("#submitformbarcodegen").prop("disabled", true);
491 }
492 }
493 init_gendoc_button();
494 jQuery("#select_fk_barcode_type").change(function() {
495 init_gendoc_button();
496 });
497 jQuery("#forbarcode").keyup(function() {
498 init_gendoc_button()
499 });
500});
501</script>';
502
503// Checkbox to select from free text
504print '<input id="fillmanually" type="radio" '.((!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually') ? 'checked ' : '').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"><label for="fillmanually"> '.$langs->trans("FillBarCodeTypeAndValueManually").'</label>';
505print '<br>';
506
507if ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')) {
508 print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"><label for="fillfromproduct"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'</label>';
509 print '<br>';
510 print '<div class="showforproductselector">';
511 $form->select_produits(GETPOSTINT('productid'), 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1);
512 print ' &nbsp; <input type="submit" class="button small" id="submitproduct" name="submitproduct" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
513 print '</div>';
514}
515
516if ($user->hasRight('societe', 'lire')) {
517 print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromthirdparty') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"><label for="fillfromthirdparty"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").'</label>';
518 print '<br>';
519 print '<div class="showforthirdpartyselector">';
520 print $form->select_company(GETPOSTINT('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
521 print ' &nbsp; <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector small" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
522 print '</div>';
523}
524
525print '<br><br>';
526
527if ($producttmp->id > 0) {
528 print $langs->trans("BarCodeDataForProduct", '').' '.$producttmp->getNomUrl(1).'<br>';
529}
530if ($thirdpartytmp->id > 0) {
531 print $langs->trans("BarCodeDataForThirdparty", '').' '.$thirdpartytmp->getNomUrl(1).'<br>';
532}
533
534print '<div class="tagtable">';
535
536// Barcode type
537print ' <div class="tagtr">';
538print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
539print $langs->trans("BarcodeType").' &nbsp; ';
540print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
541require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
542$formbarcode = new FormBarCode($db);
543print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1);
544print '</div></div>';
545
546// Barcode value
547print ' <div class="tagtr">';
548print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
549print $langs->trans("BarcodeValue").' &nbsp; ';
550print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
551print '<input size="16" type="text" name="forbarcode" id="forbarcode" value="'.$forbarcode.'">';
552print '</div></div>';
553
554// Product ref & label
555
556if ($producttmp->id > 0) {
557 print ' <div class="tagtr">';
558 print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 500px;">';
559 print '<input id="label_product_ref_option" name="label_product_ref_option" type="checkbox" '.(GETPOSTISSET("label_product_ref_option") ? 'checked ' : '').' class="checkforselect"><label for="label_product_ref_option"> '.$langs->trans("BarcodeLabelProductRef").'</label>';
560 print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 500px;">';
561 print '<input type="text" name="label_product_ref" id="label_product_ref" placeholder="'.$langs->trans("BarcodeLabelProductRefPlaceholder").'" value="'.$label_product_ref.'">';
562 print '</div></div>';
563 print ' <div class="tagtr">';
564 print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 500px;">';
565 print '<input id="label_product_label_option" name="label_product_label_option" type="checkbox" '.(GETPOSTISSET("label_product_label_option") ? 'checked ' : '').' class="checkforselect"><label for="label_product_label_option"> '.$langs->trans("BarcodeLabelProductLabel").'</label>';
566 print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 500px;">';
567 print '<input type="text" name="label_product_label" id="label_product_label" placeholder="'.$langs->trans("BarcodeLabelProductLabelPlaceholder").'" value="'.$label_product_label.'">';
568 print '</div></div>';
569}
570
571/*
572$barcodestickersmask=GETPOST('barcodestickersmask');
573print '<br>'.$langs->trans("BarcodeStickersMask").':<br>';
574print '<textarea cols="40" type="text" name="barcodestickersmask" value="'.GETPOST('barcodestickersmask').'">'.$barcodestickersmask.'</textarea>';
575print '<br>';
576*/
577
578print '</div>';
579
580print '<br><input type="submit" class="button" id="submitformbarcodegen" '.(GETPOST("selectorforbarcode") ? '' : 'disabled ').'value="'.$langs->trans("BuildPageToPrint").'">';
581
582print '</form>';
583print '<br>';
584
585// End of page
586llxFooter();
587$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
Class to manage barcode HTML.
Class to manage generation of HTML components Only common components must be here.
Class of a generic business object.
Class to manage products or services.
Class to manage third parties objects (customers, suppliers, prospects...)
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_is_file($pathoffile)
Return if path is a file.
dol_now($mode='gmt')
Return date for now.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir='', $template='standardlabel', $filename='tmp_address_sheet.pdf')
Create a document onto disk according to template module.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.