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