diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 0e2b6864c3c..191cccae92c 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -1,10 +1,10 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2006-2013 Laurent Destailleur - * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2024-2025 MDW + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,22 +26,22 @@ * \brief Page to output members business cards */ require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php'; - /** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager * @var Translate $langs * @var User $user - * - * @var array $_Avery_Labels */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; +/** @var array $_Avery_Labels */ + +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php'; + $langs->loadLangs(array("members", "errors")); // Choice of printing year or current year. diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 7d99ff22eed..85d5cd6817c 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -1,11 +1,12 @@ - * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2006-2013 Laurent Destailleur - * Copyright (C) 2015 Francis Appels - * Copyright (C) 2024-2025 MDW +/* Copyright (C) 2003 Steve Dillon + * Copyright (C) 2003 Laurent Passebecq + * Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2015 Francis Appels + * Copyright (C) 2024-2025 MDW + * Copyright (C) 2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -112,7 +113,7 @@ abstract class CommonStickerGenerator extends CommonDocGenerator public $Tformat; /** - * @var array + * @var ?array */ public $_Avery_Labels; // 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 63c086e518a..6778397a697 100644 --- a/htdocs/core/modules/member/doc/pdf_standard_member.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard_member.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2015 Francis Appels - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * Copyright (C) 2024-2025 MDW * * This program is free software; you can redistribute it and/or modify @@ -49,7 +49,7 @@ class pdf_standard_member extends CommonStickerGenerator */ public function __construct($db) { - global $langs; + global $langs, $_Avery_Labels; // Translations $langs->loadLangs(array("main", "admin")); @@ -58,6 +58,7 @@ class pdf_standard_member extends CommonStickerGenerator $this->name = "standard"; $this->description = $langs->trans('TemplateforBusinessCards'); //$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + $this->_Avery_Labels = $_Avery_Labels; $this->type = 'pdf-various-sizes'; } @@ -165,7 +166,6 @@ class pdf_standard_member extends CommonStickerGenerator $pdf->Cell($this->_Width - 2 * $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($header), 0, 1, 'C'); } - $ytop += (empty($header) ? 0 : (1 + $this->_Line_Height)); // Define widthtouse and heighttouse @@ -275,7 +275,7 @@ class pdf_standard_member extends CommonStickerGenerator public function write_file($object, $outputlangs, $srctemplatepath, $mode = 'member', $nooutput = '', $filename = 'tmp_cards') { // phpcs:enable - global $user, $conf, $langs, $mysoc, $_Avery_Labels; + global $user, $conf, $langs, $mysoc; $this->code = $srctemplatepath; @@ -356,7 +356,7 @@ class pdf_standard_member extends CommonStickerGenerator $textfooter = make_substitutions(getDolGlobalString("ADHERENT_CARD_FOOTER_TEXT"), $substitutionarray); $textright = make_substitutions(getDolGlobalString("ADHERENT_CARD_TEXT_RIGHT"), $substitutionarray); - $nb = $_Avery_Labels[$this->code]['NX'] * $_Avery_Labels[$this->code]['NY']; + $nb = $this->_Avery_Labels[$this->code]['NX'] * $this->_Avery_Labels[$this->code]['NY']; if ($nb <= 0) { $nb = 1; // Protection to avoid empty page } @@ -380,7 +380,7 @@ class pdf_standard_member extends CommonStickerGenerator $arrayofrecords = $object; } - $this->Tformat = $_Avery_Labels[$this->code]; + $this->Tformat = $this->_Avery_Labels[$this->code]; if (empty($this->Tformat)) { dol_print_error(null, 'ErrorBadTypeForCard'.$this->code); exit; @@ -426,8 +426,6 @@ class pdf_standard_member extends CommonStickerGenerator $file = $dir.'/'.$filename; } - //var_dump($file);exit; - if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir);