29require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
55 $type =
'members_labels';
58 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
79function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir =
'', $template =
'standardlabel', $filename =
'tmp_address_sheet.pdf')
83 $langs->load(
"members");
88 $err = error_reporting();
91 error_reporting($err);
94 $srctemplatepath =
'';
108 $tmp = explode(
':', $template, 2);
109 if (!empty($tmp[1])) {
111 $srctemplatepath = $tmp[1];
113 $srctemplatepath = $code;
116 dol_syslog(
"modele=".$modele.
" outputdir=".$outputdir.
" template=".$template.
" code=".$code.
" srctemplatepath=".$srctemplatepath.
" filename=".$filename, LOG_DEBUG);
121 $dirmodels = array(
'/');
122 if (is_array($conf->modules_parts[
'models'])) {
123 $dirmodels = array_merge($dirmodels, $conf->modules_parts[
'models']);
125 foreach ($dirmodels as $reldir) {
126 foreach (array(
'doc',
'pdf') as $prefix) {
127 $file = $prefix.
"_".$template.
".class.php";
130 $file =
dol_buildpath($reldir.
"core/modules/printsheet/doc/".$file, 0);
131 if (file_exists($file)) {
132 $classname = $prefix.
'_'.$template;
136 if ($classname !==
'') {
142 if ($classname !==
'') {
145 $obj =
new $classname($db);
146 '@phan-var-force CommonStickerGenerator $obj';
150 $sav_charset_output = $outputlangs->charset_output;
151 if ($obj->write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir, $filename) > 0) {
152 $outputlangs->charset_output = $sav_charset_output;
154 $fullpath = $obj->result[
'fullpath'];
167 header(
'Content-Type: '.$type);
170 header(
'Content-Disposition: attachment; filename="'.$filename.
'"');
172 header(
'Content-Disposition: inline; filename="'.$filename.
'"');
176 header(
'Cache-Control: Public, must-revalidate');
177 header(
'Pragma: public');
183 $outputlangs->charset_output = $sav_charset_output;
188 dol_print_error(
null, $langs->trans(
"Error").
" ".$langs->trans(
"ErrorFileDoesNotExists", $file));
Parent class of document generator for address sheet.
liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
getListOfModels($db, $type, $maxfilenamelength=0)
Return list of activated modules usable for document generation.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.