dolibarr 21.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 MDW <mdeweerd@users.noreply.github.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Do not use GETPOST, the function does not exists yet.
28if (!empty($_POST['mode']) && $_POST['mode'] === 'label') { // Page is called to build a PDF and output, we must not renew the token.
29 if (!defined('NOTOKENRENEWAL')) {
30 define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
31 }
32}
33
34// Load Dolibarr environment
35require '../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
40
41// Load translation files required by the page
42$langs->loadLangs(array('admin', 'members', 'errors'));
43
44// Choice of print year or current year.
45$now = dol_now();
46$year = dol_print_date($now, '%Y');
47$month = dol_print_date($now, '%m');
48$day = dol_print_date($now, '%d');
49$forbarcode = GETPOST('forbarcode', 'alphanohtml');
50$fk_barcode_type = GETPOSTINT('fk_barcode_type');
51$mode = GETPOST('mode', 'aZ09');
52$modellabel = GETPOST("modellabel", 'aZ09'); // Doc template to use
53$numberofsticker = GETPOSTINT('numberofsticker');
54
55$mesg = '';
56
57$action = GETPOST('action', 'aZ09');
58
59$producttmp = new Product($db);
60$thirdpartytmp = new Societe($db);
61
62// Security check (enable the most restrictive one)
63//if ($user->socid > 0) accessforbidden();
64//if ($user->socid > 0) $socid = $user->socid;
65if (!isModEnabled('barcode')) {
66 accessforbidden('Module not enabled');
67}
68if (!$user->hasRight('barcode', 'read')) {
70}
71// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
72$hookmanager->initHooks(array('printsheettools'));
73
74restrictedArea($user, 'barcode');
75
76$parameters = array();
77
78// Note that $action and $object may have been modified by some
79$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
80if ($reshook < 0) {
81 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
82}
83
84/*
85 * Actions
86 */
87
88if (empty($reshook)) {
89 if (GETPOST('submitproduct') && GETPOST('submitproduct')) {
90 $action = ''; // We reset because we don't want to build doc
91 if (GETPOSTINT('productid') > 0) {
92 $result = $producttmp->fetch(GETPOSTINT('productid'));
93 if ($result < 0) {
94 setEventMessage($producttmp->error, 'errors');
95 }
96 $forbarcode = $producttmp->barcode;
97 $fk_barcode_type = $producttmp->barcode_type;
98
99 if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) {
100 $fk_barcode_type = getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE');
101 }
102
103 if (empty($forbarcode) || empty($fk_barcode_type)) {
104 setEventMessages($langs->trans("DefinitionOfBarCodeForProductNotComplete", $producttmp->getNomUrl()), null, 'warnings');
105 }
106 }
107 }
108 if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty')) {
109 $action = ''; // We reset because we don't want to build doc
110 if (GETPOSTINT('socid') > 0) {
111 $thirdpartytmp->fetch(GETPOSTINT('socid'));
112 $forbarcode = $thirdpartytmp->barcode;
113 $fk_barcode_type = $thirdpartytmp->barcode_type_code;
114
115 if (empty($fk_barcode_type) && getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY')) {
116 $fk_barcode_type = getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY');
117 }
118
119 if (empty($forbarcode) || empty($fk_barcode_type)) {
120 setEventMessages($langs->trans("DefinitionOfBarCodeForThirdpartyNotComplete", $thirdpartytmp->getNomUrl()), null, 'warnings');
121 }
122 }
123 }
124
125 if ($action == 'builddoc' && $user->hasRight('barcode', 'read')) {
126 $result = 0;
127 $error = 0;
128
129 if (empty($forbarcode)) { // barcode value
130 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeValue")), null, 'errors');
131 $error++;
132 }
133 $MAXLENGTH = 51200; // Limit set to 50Ko
134 if (dol_strlen($forbarcode) > $MAXLENGTH) { // barcode value
135 setEventMessages($langs->trans("ErrorFieldTooLong", $langs->transnoentitiesnoconv("BarcodeValue")).' ('.$langs->trans("RequireXStringMax", $MAXLENGTH).')', null, 'errors');
136 $error++;
137 }
138 if (empty($fk_barcode_type)) { // barcode type = barcode encoding
139 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeType")), null, 'errors');
140 $error++;
141 }
142
143 $stdobject = null;
144 if (!$error) {
145 // Get encoder (barcode_type_coder) from barcode type id (barcode_type)
146 $stdobject = new GenericObject($db);
147 $stdobject->barcode_type = $fk_barcode_type;
148 $result = $stdobject->fetch_barcode();
149 if ($result <= 0) {
150 $error++;
151 setEventMessages('Failed to get bar code type information '.$stdobject->error, $stdobject->errors, 'errors');
152 }
153 }
154
155 $encoding = null;
156 $diroutput = null;
157 $template = null;
158 $is2d = false;
159
160 if (!$error && $stdobject !== null) {
161 $code = $forbarcode;
162 $generator = $stdobject->barcode_type_coder; // coder (loaded by fetch_barcode). Engine.
163 $encoding = strtoupper($stdobject->barcode_type_code); // code (loaded by fetch_barcode). Example 'ean', 'isbn', ...
164
165 $diroutput = $conf->barcode->dir_temp;
166 dol_mkdir($diroutput);
167
168 // Generate barcode
169 $dirbarcode = array_merge(array("/core/modules/barcode/doc/"), $conf->modules_parts['barcode']);
170
171 foreach ($dirbarcode as $reldir) {
172 $dir = dol_buildpath($reldir, 0);
173 $newdir = dol_osencode($dir);
174
175 // Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
176 if (!is_dir($newdir)) {
177 continue;
178 }
179
180 $result = @include_once $newdir.$generator.'.modules.php';
181 if ($result) {
182 break;
183 }
184 }
185
186 // Load barcode class for generating barcode image
187 $classname = "mod".ucfirst($generator);
188 // $module can be modTcpdfbarcode or modPhpbarcode that both extends ModeleBarCode
189 $module = new $classname($db);
190
191 // Build the file on disk for generator not able to return the document on the fly.
192 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).
193 '@phan-var-force modPhpbarcode $module';
194 $template = 'standardlabel';
195 if ($module->encodingIsSupported($encoding)) {
196 $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
197 dol_delete_file($barcodeimage);
198 // File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
199 $result = $module->writeBarCode($code, $encoding, 'Y', 4, 1);
200 if ($result <= 0 || !dol_is_file($barcodeimage)) {
201 $error++;
202 setEventMessages('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), null, 'errors');
203 setEventMessages($module->error, null, 'errors');
204 }
205 } else {
206 $error++;
207 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');
208 }
209 } else {
210 '@phan-var-force modTcpdfbarcode $module';
211 $template = 'tcpdflabel';
212 $encoding = $module->getTcpdfEncodingType($encoding); //convert to TCPDF compatible encoding types
213 $is2d = $module->is2d;
214 }
215 }
216
217 if (!$error) {
218 // List of values to scan for a replacement
219 $substitutionarray = array(
220 '%LOGIN%' => $user->login,
221 '%COMPANY%' => $mysoc->name,
222 '%ADDRESS%' => $mysoc->address,
223 '%ZIP%' => $mysoc->zip,
224 '%TOWN%' => $mysoc->town,
225 '%COUNTRY%' => $mysoc->country,
226 '%COUNTRY_CODE%' => $mysoc->country_code,
227 '%EMAIL%' => $mysoc->email,
228 '%YEAR%' => $year,
229 '%MONTH%' => $month,
230 '%DAY%' => $day,
231 '%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT,
232 '%SERVER%' => "http://".$_SERVER["SERVER_NAME"]."/",
233 );
234 complete_substitutions_array($substitutionarray, $langs);
235
236 $arrayofrecords = array();
237 // For labels
238 if ($mode == 'label') {
239 $txtforsticker = "%PHOTO%"; // Photo will be barcode image, %BARCODE% possible when using TCPDF generator
240 $textleft = make_substitutions(getDolGlobalString('BARCODE_LABEL_LEFT_TEXT', $txtforsticker), $substitutionarray);
241 $textheader = make_substitutions(getDolGlobalString('BARCODE_LABEL_HEADER_TEXT'), $substitutionarray);
242 $textfooter = make_substitutions(getDolGlobalString('BARCODE_LABEL_FOOTER_TEXT'), $substitutionarray);
243 $textright = make_substitutions(getDolGlobalString('BARCODE_LABEL_RIGHT_TEXT'), $substitutionarray);
244 $forceimgscalewidth = getDolGlobalString('BARCODE_FORCEIMGSCALEWIDTH', 1);
245 $forceimgscaleheight = getDolGlobalString('BARCODE_FORCEIMGSCALEHEIGHT', 1);
246
247 $MAXSTICKERS = 1000;
248 if ($numberofsticker <= $MAXSTICKERS) {
249 for ($i = 0; $i < $numberofsticker; $i++) {
250 $arrayofrecords[] = array(
251 'textleft' => $textleft,
252 'textheader' => $textheader,
253 'textfooter' => $textfooter,
254 'textright' => $textright,
255 'code' => $code,
256 'encoding' => $encoding,
257 'is2d' => $is2d,
258 'photo' => !empty($barcodeimage) ? $barcodeimage : '' // Photo must be a file that exists with format supported by TCPDF
259 );
260 }
261 } else {
262 $mesg = $langs->trans("ErrorQuantityIsLimitedTo", $MAXSTICKERS);
263 $error++;
264 }
265 }
266
267 // Build and output PDF
268 if (!$error && $mode == 'label') {
269 if (!count($arrayofrecords)) {
270 $mesg = $langs->trans("ErrorRecordNotFound");
271 }
272 if (empty($modellabel) || $modellabel == '-1') {
273 $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
274 }
275
276 $outfile = $langs->trans("BarCode").'_sheets_'.dol_print_date(dol_now(), 'dayhourlog').'.pdf';
277
278 if (!$mesg) {
279 $outputlangs = $langs;
280
281 $previousConf = getDolGlobalInt('TCPDF_THROW_ERRORS_INSTEAD_OF_DIE');
282 $conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE = 1;
283
284 // This generates and send PDF to output
285 // TODO Move
286 try {
287 $result = doc_label_pdf_create($db, $arrayofrecords, $modellabel, $outputlangs, $diroutput, $template, dol_sanitizeFileName($outfile));
288 } catch (Exception $e) {
289 $mesg = $langs->trans('ErrorGeneratingBarcode');
290 }
291
292 $conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE = $previousConf;
293 }
294 }
295
296 if ($result <= 0 || $mesg || $error) {
297 if (empty($mesg)) {
298 $mesg = 'Error '.$result;
299 }
300
301 setEventMessages($mesg, null, 'errors');
302 } else {
303 $db->close();
304 exit;
305 }
306 }
307 }
308}
309
310
311/*
312 * View
313 */
314
315$form = new Form($db);
316
317llxHeader('', $langs->trans("BarCodePrintsheet"), '', '', 0, 0, '', '', '', 'mod-barcode page-printsheet');
318
319print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'barcode');
320print '<br>';
321
322print '<span class="opacitymedium">'.$langs->trans("PageToGenerateBarCodeSheets", $langs->transnoentitiesnoconv("BuildPageToPrint")).'</span><br>';
323print '<br>';
324
325//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
326//print '<br>';
327
328print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; // The target is for brothers that open the file instead of downloading it
329print '<input type="hidden" name="mode" value="label">';
330print '<input type="hidden" name="action" value="builddoc">';
331print '<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
332
333print '<div class="tagtable">';
334
335// Sheet format
336print ' <div class="tagtr">';
337print ' <div class="tagtd">';
338print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' &nbsp; ';
339print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
340// List of possible labels (defined into $_Avery_Labels variable set into core/lib/format_cards.lib.php)
341$arrayoflabels = array();
342foreach (array_keys($_Avery_Labels) as $codecards) {
343 $labeltoshow = $_Avery_Labels[$codecards]['name'];
344 //$labeltoshow.=' ('.$_Avery_Labels[$row['code']]['paper-size'].')';
345 $arrayoflabels[$codecards] = $labeltoshow;
346}
347asort($arrayoflabels);
348print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : getDolGlobalString('ADHERENT_ETIQUETTE_TYPE')), 1, 0, 0, '', 0, 0, 0, '', '', 1);
349print '</div></div>';
350
351// Number of stickers to print
352print ' <div class="tagtr">';
353print ' <div class="tagtd">';
354print $langs->trans("NumberOfStickers").' &nbsp; ';
355print '</div><div class="tagtd maxwidthonsmartphone" style="overflow: hidden; white-space: nowrap;">';
356print '<input size="4" type="text" name="numberofsticker" value="'.(GETPOST('numberofsticker') ? GETPOSTINT('numberofsticker') : 10).'">';
357print '</div></div>';
358
359print '</div>';
360
361
362print '<br>';
363
364
365// Add javascript to make choice dynamic
366print '<script type="text/javascript">
367jQuery(document).ready(function() {
368 function init_selectors()
369 {
370 if (jQuery("#fillmanually:checked").val() == "fillmanually")
371 {
372 jQuery("#submitproduct").prop("disabled", true);
373 jQuery("#submitthirdparty").prop("disabled", true);
374 jQuery("#search_productid").prop("disabled", true);
375 jQuery("#socid").prop("disabled", true);
376 jQuery(".showforproductselector").hide();
377 jQuery(".showforthirdpartyselector").hide();
378 }
379 if (jQuery("#fillfromproduct:checked").val() == "fillfromproduct")
380 {
381 jQuery("#submitproduct").removeAttr("disabled");
382 jQuery("#submitthirdparty").prop("disabled", true);
383 jQuery("#search_productid").removeAttr("disabled");
384 jQuery("#socid").prop("disabled", true);
385 jQuery(".showforproductselector").show();
386 jQuery(".showforthirdpartyselector").hide();
387 }
388 if (jQuery("#fillfromthirdparty:checked").val() == "fillfromthirdparty")
389 {
390 jQuery("#submitproduct").prop("disabled", true);
391 jQuery("#submitthirdparty").removeAttr("disabled");
392 jQuery("#search_productid").prop("disabled", true);
393 jQuery("#socid").removeAttr("disabled");
394 jQuery(".showforproductselector").hide();
395 jQuery(".showforthirdpartyselector").show();
396 }
397 }
398 init_selectors();
399 jQuery(".radiobarcodeselect").click(function() {
400 init_selectors();
401 });
402
403 function init_gendoc_button()
404 {
405 if (jQuery("#select_fk_barcode_type").val() > 0 && jQuery("#forbarcode").val())
406 {
407 jQuery("#submitformbarcodegen").removeAttr("disabled");
408 }
409 else
410 {
411 jQuery("#submitformbarcodegen").prop("disabled", true);
412 }
413 }
414 init_gendoc_button();
415 jQuery("#select_fk_barcode_type").change(function() {
416 init_gendoc_button();
417 });
418 jQuery("#forbarcode").keyup(function() {
419 init_gendoc_button()
420 });
421});
422</script>';
423
424// Checkbox to select from free text
425print '<input id="fillmanually" type="radio" '.((!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually') ? 'checked ' : '').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"><label for="fillmanually"> '.$langs->trans("FillBarCodeTypeAndValueManually").'</label>';
426print '<br>';
427
428if ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')) {
429 print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"><label for="fillfromproduct"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'</label>';
430 print '<br>';
431 print '<div class="showforproductselector">';
432 $form->select_produits(GETPOSTINT('productid'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1);
433 print ' &nbsp; <input type="submit" class="button small" id="submitproduct" name="submitproduct" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
434 print '</div>';
435}
436
437if ($user->hasRight('societe', 'lire')) {
438 print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromthirdparty') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"><label for="fillfromthirdparty"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").'</label>';
439 print '<br>';
440 print '<div class="showforthirdpartyselector">';
441 print $form->select_company(GETPOSTINT('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
442 print ' &nbsp; <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector small" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
443 print '</div>';
444}
445
446print '<br>';
447
448if ($producttmp->id > 0) {
449 print $langs->trans("BarCodeDataForProduct", '').' '.$producttmp->getNomUrl(1).'<br>';
450}
451if ($thirdpartytmp->id > 0) {
452 print $langs->trans("BarCodeDataForThirdparty", '').' '.$thirdpartytmp->getNomUrl(1).'<br>';
453}
454
455print '<div class="tagtable">';
456
457// Barcode type
458print ' <div class="tagtr">';
459print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
460print $langs->trans("BarcodeType").' &nbsp; ';
461print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
462require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
463$formbarcode = new FormBarCode($db);
464print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1);
465print '</div></div>';
466
467// Barcode value
468print ' <div class="tagtr">';
469print ' <div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
470print $langs->trans("BarcodeValue").' &nbsp; ';
471print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
472print '<input size="16" type="text" name="forbarcode" id="forbarcode" value="'.$forbarcode.'">';
473print '</div></div>';
474
475/*
476$barcodestickersmask=GETPOST('barcodestickersmask');
477print '<br>'.$langs->trans("BarcodeStickersMask").':<br>';
478print '<textarea cols="40" type="text" name="barcodestickersmask" value="'.GETPOST('barcodestickersmask').'">'.$barcodestickersmask.'</textarea>';
479print '<br>';
480*/
481
482print '</div>';
483
484print '<br><input type="submit" class="button" id="submitformbarcodegen" '.((GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode")) ? '' : 'disabled ').'value="'.$langs->trans("BuildPageToPrint").'">';
485
486print '</form>';
487print '<br>';
488
489// End of page
490llxFooter();
491$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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:70
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...)
llxFooter()
Footer empty.
Definition document.php:107
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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, $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.