diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 76ca7efff3bf7..b0e3da82fb07d 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -124,13 +124,14 @@ public function __construct($db) /** * Function to build PDF on disk, then output on HTTP stream. * - * @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) - * @param Translate $outputlangs Lang object for output language - * @param string $srctemplatepath Full path of source filename for generator using a template file - * @param string $outputdir Output directory for pdf file - * @return int 1=OK, 0=KO + * @param Adherent|array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) + * @param Translate $outputlangs Lang object for output language + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param string $outputdir Output directory for pdf file + * @param string $filename Short file name of output file + * @return int<-1,1> 1=OK, <=0=KO */ - abstract public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = ''); + abstract public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = ''); // phpcs:enable /** diff --git a/htdocs/core/modules/member/doc/pdf_standard_member.class.php b/htdocs/core/modules/member/doc/pdf_standard_member.class.php index 7e9f438443fe9..f6158d45f35a0 100644 --- a/htdocs/core/modules/member/doc/pdf_standard_member.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard_member.class.php @@ -261,15 +261,15 @@ public function Add_PDF_card(&$pdf, $textleft, $header, $footer, $outputlangs, $ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to build PDF on disk, then output on HTTP stream. + * Function to build PDF on disk, then output on HTTP stream. * - * @param Adherent|array $object Member object. Old usage: Array of record information (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>) - * @param Translate $outputlangs Lang object for output language - * @param string $srctemplatepath Full path of source filename for generator using a template file. Example: '5161', 'AVERYC32010', 'CARD', ... - * @param string $mode Tell if doc module is called for 'member', ... - * @param int $nooutput 1=Generate only file on disk and do not return it on response - * @param string $filename Name of output file (without extension) - * @return int 1=OK, 0=KO + * @param Adherent|array $object Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) + * @param Translate $outputlangs Lang object for output language + * @param string $srctemplatepath file. Example: '5161', 'AVERYC32010', 'CARD', ... + * @param string $mode Tell if doc module is called + * @param int<0,1> $nooutput 1=Generate only file on disk and do not return it on response + * @param string $filename Name of output file (without extension) + * @return int<-1,1> 1=OK, <=0=KO */ public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = 0, $filename = 'tmp_cards') { diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index c87e770b5eb8e..2309d07f93a1d 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -227,12 +227,12 @@ public function Add_PDF_label(&$pdf, $textleft, $header, $footer, $outputlangs, /** * Function to build PDF on disk, then output on HTTP stream. * - * @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) + * @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) * @param Translate $outputlangs Lang object for output language * @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $outputdir Output directory for pdf file * @param string $filename Short file name of PDF output file - * @return int 1=OK, 0=KO + * @return int<-1,1> 1=OK, <=0=KO */ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = 'tmp_address_sheet.pdf') { @@ -337,7 +337,7 @@ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $out dolChmod($file); - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; } diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index e133a2309c4d3..e1fa0020e2394 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -250,12 +250,12 @@ public function addSticker(&$pdf, $outputlangs, $param) /** * Function to build PDF on disk, then output on HTTP stream. * - * @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) + * @param array $arrayofrecords Array of record information (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>) * @param Translate $outputlangs Lang object for output language * @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $outputdir Output directory for pdf file * @param string $filename Short file name of PDF output file - * @return int 1=OK, 0=KO + * @return int<-1,1> 1=OK, <=0=KO */ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = '', $filename = 'tmp_address_sheet.pdf') { @@ -360,7 +360,7 @@ public function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $out dolChmod($file); - $this->result = array('fullpath'=>$file); + $this->result = array('fullpath' => $file); return 1; } diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index 47c35ceb59769..443aaa1d3fb9c 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -144,6 +144,8 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp $obj = new $classname($db); + '@phan-var-force CommonStickerGenerator $obj'; + // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charset_output = $outputlangs->charset_output;