dolibarr 24.0.3
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';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php';
41require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
42
54// Load translation files required by the page
55$langs->loadLangs(array('admin', 'members', 'errors'));
56
57// Choice of print year or current year.
58$now = dol_now();
59$year = dol_print_date($now, '%Y');
60$month = dol_print_date($now, '%m');
61$day = dol_print_date($now, '%d');
62$forbarcode = GETPOST('forbarcode', 'alphanohtml');
63$fk_barcode_type = GETPOSTINT('fk_barcode_type');
64$mode = GETPOST('mode', 'aZ09');
65$modellabel = GETPOST("modellabel", 'aZ09'); // Doc template to use
66$numberofsticker = GETPOSTINT('numberofsticker');
67
68$label_product_ref_option = GETPOSTISSET('label_product_ref_option');
69$label_product_label_option = GETPOSTISSET('label_product_label_option');
70
71if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) {
72 $security_check = 'nohtml';
73} else {
74 $security_check = !getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML') ? 'alphanohtml' : 'restricthtml';
75}
76$label_product_ref = (GETPOSTISSET('label_product_ref') ? GETPOST('label_product_ref', $security_check) : null);
77$label_product_label = (GETPOSTISSET('label_product_label') ? GETPOST('label_product_label', $security_check) : null);
78
79$mesg = '';
80
81$action = GETPOST('action', 'aZ09');
82
83$producttmp = new Product($db);
84$thirdpartytmp = new Societe($db);
85
86// Security check (enable the most restrictive one)
87//if ($user->socid > 0) accessforbidden();
88//if ($user->socid > 0) $socid = $user->socid;
89if (!isModEnabled('barcode')) {
90 accessforbidden('Module not enabled');
91}
92if (!$user->hasRight('barcode', 'read')) {
94}
95// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
96$hookmanager->initHooks(array('printsheettools'));
97
98restrictedArea($user, 'barcode');
99
100$object = new stdClass();
101
102
103/*
104 * Actions
105 */
106
107// Note that $action and $object may have been modified by some
108$parameters = array();
109$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
110if ($reshook < 0) {
111 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
112}
113
114if (empty($reshook)) {
115 if (GETPOST('submitproduct')) {
116 $action = ''; // We reset because we don't want to build doc
117 if (GETPOSTINT('productid') > 0) {
118 $result = $producttmp->fetch(GETPOSTINT('productid'));
119 if ($result < 0) {
120 setEventMessage($producttmp->error, 'errors');
121 }
122 $forbarcode = $producttmp->barcode;
123 $fk_barcode_type = $producttmp->barcode_type;
124
125 if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) {
126 $fk_barcode_type = getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE');
127 }
128
129 if (empty($forbarcode) || empty($fk_barcode_type)) {
130 setEventMessages($langs->trans("DefinitionOfBarCodeForProductNotComplete", $producttmp->getNomUrl()), null, 'warnings');
131 }
132
133 if (empty($label_product_ref) && $label_product_ref_option) {
134 $label_product_ref = $producttmp->ref;
135 }
136
137 if (empty($label_product_label) && $label_product_label_option) {
138 $label_product_label = $producttmp->label;
139 }
140 }
141 }
142 if (GETPOST('submitthirdparty')) {
143 $action = ''; // We reset because we don't want to build doc
144 if (GETPOSTINT('socid') > 0) {
145 $thirdpartytmp->fetch(GETPOSTINT('socid'));
146 $forbarcode = $thirdpartytmp->barcode;
147 $fk_barcode_type = $thirdpartytmp->barcode_type_code;
148
149 if (empty($fk_barcode_type) && getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY')) {
150 $fk_barcode_type = getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY');
151 }
152
153 if (empty($forbarcode) || empty($fk_barcode_type)) {
154 setEventMessages($langs->trans("DefinitionOfBarCodeForThirdpartyNotComplete", $thirdpartytmp->getNomUrl()), null, 'warnings');
155 }
156 }
157 }
158
159 if ($action == 'builddoc' && $user->hasRight('barcode', 'read')) {
160 $result = 0;
161 $error = 0;
162
163 if (empty($forbarcode)) { // barcode value
164 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeValue")), null, 'errors');
165 $error++;
166 }
167 $MAXLENGTH = 51200; // Limit set to 50Ko
168 if (dol_strlen($forbarcode) > $MAXLENGTH) { // barcode value
169 setEventMessages($langs->trans("ErrorFieldTooLong", $langs->transnoentitiesnoconv("BarcodeValue")).' ('.$langs->trans("RequireXStringMax", $MAXLENGTH).')', null, 'errors');
170 $error++;
171 }
172 if (empty($fk_barcode_type)) { // barcode type = barcode encoding
173 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeType")), null, 'errors');
174 $error++;
175 }
176
177 if (GETPOSTINT('productid') > 0) {
178 $result = $producttmp->fetch(GETPOSTINT('productid'));
179 if ($result < 0) {
180 setEventMessage($producttmp->error, 'errors');
181 }
182 if (empty($label_product_ref) && $label_product_ref_option) {
183 $label_product_ref = $producttmp->ref;
184 }
185
186 if (empty($label_product_label) && $label_product_label_option) {
187 $label_product_label = $producttmp->label;
188 }
189 }
190
191 $stdobject = null;
192 if (!$error) {
193 // Get encoder (barcode_type_coder) from barcode type id (barcode_type)
194 $stdobject = new GenericObject($db);
195 $stdobject->barcode_type = $fk_barcode_type;
196 $result = $stdobject->fetchBarCode();
197 if ($result <= 0) {
198 $error++;
199 setEventMessages('Failed to get bar code type information '.$stdobject->error, $stdobject->errors, 'errors');
200 }
201 }
202
203 $encoding = null;
204 $diroutput = null;
205 $template = null;
206 $is2d = false;
207 $code = $forbarcode;
208
209 if (!$error && $stdobject !== null) {
210 $generator = $stdobject->barcode_type_coder; // coder (loaded by fetchBarCode). Engine.
211 $encoding = strtoupper($stdobject->barcode_type_code); // code (loaded by fetchBarCode). Example 'ean', 'isbn', ...
212
213 $diroutput = $conf->barcode->dir_temp;
214 dol_mkdir($diroutput);
215
216 // Generate barcode
217 $dirbarcode = array_merge(array("/core/modules/barcode/doc/"), $conf->modules_parts['barcode']);
218
219 foreach ($dirbarcode as $reldir) {
220 $dir = dol_buildpath($reldir, 0);
221 $newdir = dol_osencode($dir);
222
223 // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
224 if (!is_dir($newdir)) {
225 continue;
226 }
227
228 $result = @include_once $newdir.$generator.'.modules.php';
229 if ($result) {
230 break;
231 }
232 }
233
234 // Load barcode class for generating barcode image
235 $classname = "mod".ucfirst($generator);
236 // $module can be modTcpdfbarcode or modPhpbarcode that both extends ModeleBarCode
237 $module = new $classname($db);
238
239 // Build the file on disk for generator not able to return the document on the fly.
240 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).
241 '@phan-var-force modPhpbarcode $module';
242 $template = 'standardlabel';
243 if ($module->encodingIsSupported($encoding)) {
244 $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
245 dol_delete_file($barcodeimage);
246 // File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
247 $result = $module->writeBarCode($code, $encoding, 'Y', 4, 1);
248 if ($result <= 0 || !dol_is_file($barcodeimage)) {
249 $error++;
250 setEventMessages('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), null, 'errors');
251 setEventMessages($module->error, null, 'errors');
252 }
253 } else {
254 $error++;
255 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');
256 }
257 } else {
258 '@phan-var-force modTcpdfbarcode $module';
259 $template = 'tcpdflabel';
260 $encoding = $module->getTcpdfEncodingType($encoding); //convert to TCPDF compatible encoding types
261 $is2d = $module->is2d;
262 }
263 }
264
265 if (!$error) {
267 // List of values to scan for a replacement
268 $substitutionarray = array(
269 // old
270 '%LOGIN%' => $user->login,
271 '%COMPANY%' => $mysoc->name,
272 '%ADDRESS%' => $mysoc->address,
273 '%ZIP%' => $mysoc->zip,
274 '%TOWN%' => $mysoc->town,
275 '%COUNTRY%' => $mysoc->country,
276 '%COUNTRY_CODE%' => $mysoc->country_code,
277 '%EMAIL%' => $mysoc->email,
278 '%YEAR%' => $year,
279 '%MONTH%' => $month,
280 '%DAY%' => $day,
281 '%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT,
282 '%SERVER%' => $dolibarr_main_url_root,
283 // new
284 '__LOGIN__' => $user->login,
285 '__COMPANY__' => $mysoc->name,
286 '__ADDRESS__' => $mysoc->address,
287 '__ZIP__' => $mysoc->zip,
288 '__TOWN__' => $mysoc->town,
289 '__COUNTRY__' => $mysoc->country,
290 '__COUNTRY_CODE__' => $mysoc->country_code,
291 '__EMAIL__' => $mysoc->email,
292 '__YEAR__' => $year,
293 '__MONTH__' => $month,
294 '__DAY__' => $day,
295 '__DOL_MAIN_URL_ROOT__' => DOL_MAIN_URL_ROOT,
296 '__SERVER__' => $dolibarr_main_url_root,
297 );
298 complete_substitutions_array($substitutionarray, $langs);
299
300 $arrayofrecords = array();
301 // For labels
302 if ($mode == 'label') {
303 $txtforsticker = "%PHOTO%"; // Photo will be barcode image, %BARCODE% possible when using TCPDF generator
304 $textleft = make_substitutions(getDolGlobalString('BARCODE_LABEL_LEFT_TEXT', $txtforsticker), $substitutionarray);
305 if ((GETPOSTINT('productid') > 0) && $label_product_ref_option) {
306 $textheader = $label_product_ref;
307 } else {
308 $textheader = make_substitutions(getDolGlobalString('BARCODE_LABEL_HEADER_TEXT'), $substitutionarray);
309 }
310 if ((GETPOSTINT('productid') > 0) && $label_product_label_option) {
311 $textfooter = $label_product_label;
312 } else {
313 $textfooter = make_substitutions(getDolGlobalString('BARCODE_LABEL_FOOTER_TEXT'), $substitutionarray);
314 }
315 $textright = make_substitutions(getDolGlobalString('BARCODE_LABEL_RIGHT_TEXT'), $substitutionarray);
316 $forceimgscalewidth = getDolGlobalString('BARCODE_FORCEIMGSCALEWIDTH', 1);
317 $forceimgscaleheight = getDolGlobalString('BARCODE_FORCEIMGSCALEHEIGHT', 1);
318
319 $MAXSTICKERS = 1000;
320 if ($numberofsticker <= $MAXSTICKERS) {
321 for ($i = 0; $i < $numberofsticker; $i++) {
322 $arrayofrecords[] = array(
323 'textleft' => $textleft,
324 'textheader' => $textheader,
325 'textfooter' => $textfooter,
326 'textright' => $textright,
327 'code' => $code,
328 'encoding' => $encoding,
329 'is2d' => $is2d,
330 'photo' => !empty($barcodeimage) ? $barcodeimage : '' // Photo must be a file that exists with format supported by TCPDF
331 );
332 }
333 } else {
334 $mesg = $langs->trans("ErrorQuantityIsLimitedTo", $MAXSTICKERS);
335 $error++;
336 }
337 }
338
339 // Build and output PDF
340 if (!$error && $mode == 'label') {
341 if (!count($arrayofrecords)) {
342 $mesg = $langs->trans("ErrorRecordNotFound");
343 }
344 if (empty($modellabel) || $modellabel == '-1') {
345 $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
346 }
347
348 $outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf';
349
350 if (!$mesg) {
351 $outputlangs = $langs;
352
353 $previousConf = getDolGlobalInt('TCPDF_THROW_ERRORS_INSTEAD_OF_DIE');
354 $conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE = 1;
355
356 // This generates and send PDF to output
357 // TODO Move
358 try {
359 $result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, (string) $diroutput, (string) $template, dol_sanitizeFileName($outfile));
360 } catch (Exception $e) {
361 $mesg = $langs->trans('ErrorGeneratingBarcode');
362 $error++;
363 }
364
365 $conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE = $previousConf;
366 }
367 }
368
369 if ($result <= 0 || $mesg || $error) {
370 if (empty($mesg)) {
371 $mesg = 'Error '.$result;
372 }
373
374 setEventMessages($mesg, null, 'errors');
375 } else {
376 $db->close();
377 exit;
378 }
379 }
380 }
381}
382
383
384/*
385 * View
386 */
387
388$form = new Form($db);
389
390llxHeader('', $langs->trans("BarCodePrintsheet"), '', '', 0, 0, '', '', '', 'mod-barcode page-printsheet');
391
392print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'barcode');
393print '<br>';
394
395print '<span class="opacitymedium">'.$langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'</span><br>';
396print '<br>';
397
398//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
399//print '<br>';
400
401print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; // The target is for brothers that open the file instead of downloading it
402print '<input type="hidden" name="mode" value="label">';
403print '<input type="hidden" name="action" value="builddoc">';
404print '<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
405
406print '<div class="tagtable">';
407
408// Sheet format
409print ' <div class="tagtr">';
410print ' <div class="tagtd">';
411print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' &nbsp; ';
412print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
413// List of possible labels (defined into $_Avery_Labels variable set into core/lib/format_cards.lib.php)
414$arrayoflabels = array();
415foreach (array_keys($_Avery_Labels) as $codecards) {
416 $labeltoshow = $_Avery_Labels[$codecards]['name'];
417 //$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')';
418 $arrayoflabels[$codecards] = $labeltoshow;
419}
420asort($arrayoflabels);
421print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : getDolGlobalString('ADHERENT_ETIQUETTE_TYPE')), 1, 0, 0, '', 0, 0, 0, '', '', 1);
422print '</div></div>';
423
424// Number of stickers to print
425print ' <div class="tagtr">';
426print ' <div class="tagtd">';
427print $langs->trans("NumberOfStickers").' &nbsp; ';
428print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
429print '<input size="4" type="text" name="numberofsticker" value="'.(GETPOST('numberofsticker') ? GETPOSTINT('numberofsticker') : 10).'">';
430print '</div></div>';
431
432print '</div>';
433
434
435print '<br>';
436
437
438// Add javascript to make choice dynamic
439print '<script type="text/javascript">
440jQuery(document).ready(function() {
441 function init_selectors()
442 {
443 if (jQuery("#fillmanually:checked").val() == "fillmanually")
444 {
445 jQuery("#submitproduct").prop("disabled", true);
446 jQuery("#submitthirdparty").prop("disabled", true);
447 jQuery("#search_productid").prop("disabled", true);
448 jQuery("#socid").prop("disabled", true);
449 jQuery(".showforproductselector").hide();
450 jQuery(".showforthirdpartyselector").hide();
451 }
452 if (jQuery("#fillfromproduct:checked").val() == "fillfromproduct")
453 {
454 jQuery("#submitproduct").removeAttr("disabled");
455 jQuery("#submitthirdparty").prop("disabled", true);
456 jQuery("#search_productid").removeAttr("disabled");
457 jQuery("#socid").prop("disabled", true);
458 jQuery(".showforproductselector").show();
459 jQuery(".showforthirdpartyselector").hide();
460 }
461 if (jQuery("#fillfromthirdparty:checked").val() == "fillfromthirdparty")
462 {
463 jQuery("#submitproduct").prop("disabled", true);
464 jQuery("#submitthirdparty").removeAttr("disabled");
465 jQuery("#search_productid").prop("disabled", true);
466 jQuery("#socid").removeAttr("disabled");
467 jQuery(".showforproductselector").hide();
468 jQuery(".showforthirdpartyselector").show();
469 }
470 }
471 init_selectors();
472 jQuery(".radiobarcodeselect").click(function() {
473 init_selectors();
474 });
475
476 function init_gendoc_button()
477 {
478 if (jQuery("#select_fk_barcode_type").val() > 0 && jQuery("#forbarcode").val())
479 {
480 jQuery("#submitformbarcodegen").removeAttr("disabled");
481 }
482 else
483 {
484 jQuery("#submitformbarcodegen").prop("disabled", true);
485 }
486 }
487 init_gendoc_button();
488 jQuery("#select_fk_barcode_type").change(function() {
489 init_gendoc_button();
490 });
491 jQuery("#forbarcode").keyup(function() {
492 init_gendoc_button()
493 });
494});
495</script>';
496
497// Checkbox to select from free text
498print '<input id="fillmanually" type="radio" '.((!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually') ? 'checked ' : '').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"><label for="fillmanually"> '.$langs->trans("FillBarCodeTypeAndValueManually").'</label>';
499print '<br>';
500
501if ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')) {
502 print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"><label for="fillfromproduct"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'</label>';
503 print '<br>';
504 print '<div class="showforproductselector">';
505 $form->select_produits(GETPOSTINT('productid'), 'productid', '', 0, 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1);
506 print ' &nbsp; <input type="submit" class="button small" id="submitproduct" name="submitproduct" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
507 print '</div>';
508}
509
510if ($user->hasRight('societe', 'lire')) {
511 print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromthirdparty') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"><label for="fillfromthirdparty"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").'</label>';
512 print '<br>';
513 print '<div class="showforthirdpartyselector">';
514 print $form->select_company(GETPOSTINT('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
515 print ' &nbsp; <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector small" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
516 print '</div>';
517}
518
519print '<br><br>';
520
521if ($producttmp->id > 0) {
522 print $langs->trans("BarCodeDataForProduct", '').' '.$producttmp->getNomUrl(1).'<br>';
523}
524if ($thirdpartytmp->id > 0) {
525 print $langs->trans("BarCodeDataForThirdparty", '').' '.$thirdpartytmp->getNomUrl(1).'<br>';
526}
527
528print '<div class="tagtable">';
529
530// Barcode type
531print ' <div class="tagtr">';
532print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
533print $langs->trans("BarcodeType").' &nbsp; ';
534print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
535require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
536$formbarcode = new FormBarCode($db);
537print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1);
538print '</div></div>';
539
540// Barcode value
541print ' <div class="tagtr">';
542print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
543print $langs->trans("BarcodeValue").' &nbsp; ';
544print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
545print '<input size="16" type="text" name="forbarcode" id="forbarcode" value="'.$forbarcode.'">';
546print '</div></div>';
547
548// Product ref & label
549
550if ($producttmp->id > 0) {
551 print ' <div class="tagtr">';
552 print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 500px;">';
553 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>';
554 print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 500px;">';
555 print '<input type="text" name="label_product_ref" id="label_product_ref" placeholder="'.$langs->trans("BarcodeLabelProductRefPlaceholder").'" value="'.$label_product_ref.'">';
556 print '</div></div>';
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_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>';
560 print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 500px;">';
561 print '<input type="text" name="label_product_label" id="label_product_label" placeholder="'.$langs->trans("BarcodeLabelProductLabelPlaceholder").'" value="'.$label_product_label.'">';
562 print '</div></div>';
563}
564
565/*
566$barcodestickersmask=GETPOST('barcodestickersmask');
567print '<br>'.$langs->trans("BarcodeStickersMask").':<br>';
568print '<textarea cols="40" type="text" name="barcodestickersmask" value="'.GETPOST('barcodestickersmask').'">'.$barcodestickersmask.'</textarea>';
569print '<br>';
570*/
571
572print '</div>';
573
574print '<br><input type="submit" class="button" id="submitformbarcodegen" '.(GETPOST("selectorforbarcode") ? '' : 'disabled ').'value="'.$langs->trans("BuildPageToPrint").'">';
575
576print '</form>';
577print '<br>';
578
579// End of page
580llxFooter();
581$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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
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).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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)
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, $nodie=0, $mode='')
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.