--- /tmp/dsg/dolibarr/htdocs/core/modules/printsheet/github_modules_labels.php +++ /tmp/dsg/dolibarr/htdocs/core/modules/printsheet/client_modules_labels.php @@ -40,17 +40,17 @@ public $error = ''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates */ public function liste_modeles($db, $maxfilenamelength = 0) { - // phpcs:enable + // phpcs:enable global $conf; $type = 'members_labels'; @@ -79,7 +79,7 @@ */ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir = '', $template = 'standardlabel', $filename = 'tmp_address_sheet.pdf') { - // phpcs:enable + // phpcs:enable global $conf, $langs; $langs->load("members"); @@ -100,10 +100,13 @@ if (!empty($conf->global->ADHERENT_ETIQUETTE_TYPE)) { $code = $conf->global->ADHERENT_ETIQUETTE_TYPE; - } else { + } + else + { $code = $modele; } - } else $code = $modele; + } + else $code = $modele; // If selected modele is a filename template (then $modele="modelname:filename") $tmp = explode(':', $template, 2); @@ -111,7 +114,8 @@ { $template = $tmp[0]; $srctemplatepath = $tmp[1]; - } else $srctemplatepath = $code; + } + else $srctemplatepath = $code; dol_syslog("modele=".$modele." outputdir=".$outputdir." template=".$template." code=".$code." srctemplatepath=".$srctemplatepath." filename=".$filename, LOG_DEBUG); @@ -150,34 +154,17 @@ if ($obj->write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir, $filename) > 0) { $outputlangs->charset_output = $sav_charset_output; - - $fullpath = $obj->result['fullpath']; - - // Output to http stream - clearstatcache(); - - $attachment = true; - if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false; - $type = dol_mimetype($filename); - - //if ($encoding) header('Content-Encoding: '.$encoding); - if ($type) header('Content-Type: '.$type); - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); - else header('Content-Disposition: inline; filename="'.$filename.'"'); - - // Ajout directives pour resoudre bug IE - header('Cache-Control: Public, must-revalidate'); - header('Pragma: public'); - - readfile($fullpath); - return 1; - } else { + } + else + { $outputlangs->charset_output = $sav_charset_output; dol_print_error($db, "doc_label_pdf_create Error: ".$obj->error); return -1; } - } else { + } + else + { dol_print_error('', $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file)); return -1; }