28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/pdf.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
56 $type =
'members_labels';
59 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
80 function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir =
'', $template =
'standardlabel', $filename =
'tmp_address_sheet.pdf')
84 $langs->load(
"members");
89 $err = error_reporting();
92 error_reporting($err);
95 $srctemplatepath =
'';
99 if (!empty($conf->global->ADHERENT_ETIQUETTE_TYPE)) {
100 $code = $conf->global->ADHERENT_ETIQUETTE_TYPE;
109 $tmp = explode(
':', $template, 2);
110 if (!empty($tmp[1])) {
112 $srctemplatepath = $tmp[1];
114 $srctemplatepath = $code;
117 dol_syslog(
"modele=".$modele.
" outputdir=".$outputdir.
" template=".$template.
" code=".$code.
" srctemplatepath=".$srctemplatepath.
" filename=".$filename, LOG_DEBUG);
123 $dirmodels = array(
'/');
124 if (is_array($conf->modules_parts[
'models'])) {
125 $dirmodels = array_merge($dirmodels, $conf->modules_parts[
'models']);
127 foreach ($dirmodels as $reldir) {
128 foreach (array(
'doc',
'pdf') as $prefix) {
129 $file = $prefix.
"_".$template.
".class.php";
132 $file =
dol_buildpath($reldir.
"core/modules/printsheet/doc/".$file, 0);
133 if (file_exists($file)) {
135 $classname = $prefix.
'_'.$template;
148 $obj =
new $classname($db);
152 $sav_charset_output = $outputlangs->charset_output;
153 if ($obj->write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir, $filename) > 0) {
154 $outputlangs->charset_output = $sav_charset_output;
156 $fullpath = $obj->result[
'fullpath'];
162 if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) {
169 header(
'Content-Type: '.$type);
172 header(
'Content-Disposition: attachment; filename="'.$filename.
'"');
174 header(
'Content-Disposition: inline; filename="'.$filename.
'"');
178 header(
'Cache-Control: Public, must-revalidate');
179 header(
'Pragma: public');
185 $outputlangs->charset_output = $sav_charset_output;
190 dol_print_error(
'', $langs->trans(
"Error").
" ".$langs->trans(
"ErrorFileDoesNotExists", $file));