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