From 0d7ffefc8f9e9bbdf99f75d6814187d0b2b8ac77 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 20 Mar 2018 19:47:25 +0100 Subject: [PATCH] New [*use loadLangs for translation files*] --- .../commande/doc/pdf_einstein.modules.php | 8 +-- .../contract/doc/pdf_strato.modules.php | 9 ++- .../expedition/doc/pdf_merou.modules.php | 6 +- .../doc/pdf_standard.modules.php | 29 ++++++-- .../modules/facture/doc/pdf_crabe.modules.php | 68 +++++++++++++------ 5 files changed, 79 insertions(+), 41 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index c565f55c934..738a49fe81e 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1209,12 +1209,10 @@ class pdf_einstein extends ModelePDFCommandes function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="PdfOrderTitle") { global $conf,$langs,$hookmanager; + + // Translations + $outputlangs->loadLangs(array("main", "bills", "propal", "orders", "companies")); - $outputlangs->load("main"); - $outputlangs->load("bills"); - $outputlangs->load("propal"); - $outputlangs->load("companies"); - $outputlangs->load("orders"); $default_font_size = pdf_getPDFFontSize($outputlangs); pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index a42ac2c7e8d..62501d4881e 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -493,12 +493,11 @@ class pdf_strato extends ModelePDFContract function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; + $default_font_size = pdf_getPDFFontSize($outputlangs); - - $outputlangs->load("main"); - $outputlangs->load("dict"); - $outputlangs->load("companies"); - $outputlangs->load("contract"); + + // Translations + $outputlangs->loadLangs(array("main", "dict", "contract", "companies")); pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index c535d231a67..1609ef8283f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -385,9 +385,9 @@ class pdf_merou extends ModelePdfExpedition { global $langs; $default_font_size = pdf_getPDFFontSize($outputlangs); - - $langs->load("main"); - $langs->load("bills"); + + // Translations + $langs->loadLangs(array("main", "bills")); if (empty($hidetop)) { diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 75db209b6d3..32fe36044b3 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -38,10 +38,25 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; */ class pdf_standard extends ModeleExpenseReport { - var $db; - var $name; - var $description; - var $type; + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var string document type + */ + public $type; var $phpmin = array(4,3,0); // Minimum version of PHP required by module var $version = 'dolibarr'; @@ -512,10 +527,10 @@ class pdf_standard extends ModeleExpenseReport function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs,$hookmanager; + + // Translations + $outputlangs->loadLangs(array("main", "trips", "companies")); - $outputlangs->load("main"); - $outputlangs->load("trips"); - $outputlangs->load("companies"); $default_font_size = pdf_getPDFFontSize($outputlangs); /* diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index e537331625e..17b652ed2db 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -42,24 +42,52 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_crabe extends ModelePDFFactures { - var $db; - var $name; - var $description; - var $update_main_doc_field; // Save the name of generated file as the main doc when generating a doc with this template - var $type; + /** + * @var DoliDb Database handler + */ + public $db; - var $phpmin = array(4,3,0); // Minimum version of PHP required by module - var $version = 'dolibarr'; + /** + * @var string model name + */ + public $name; - var $page_largeur; - var $page_hauteur; - var $format; - var $marge_gauche; - var $marge_droite; - var $marge_haute; - var $marge_basse; + /** + * @var string model description (short text) + */ + public $description; - var $emetteur; // Objet societe qui emet + /** + * @var int Save the name of generated file as the main doc when generating a doc with this template + */ + public $update_main_doc_field; + + /** + * @var string document type + */ + public $type; + + /** + * @var array() Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.3 = array(5, 3) + */ + public $phpmin = array(5, 2); + + /** + * Dolibarr version of the loaded document + * @public string + */ + public $version = 'dolibarr'; + + public $page_largeur; + public $page_hauteur; + public $format; + public $marge_gauche; + public $marge_droite; + public $marge_haute; + public $marge_basse; + + public $emetteur; // Objet societe qui emet /** * @var bool Situation invoice type @@ -1514,12 +1542,10 @@ class pdf_crabe extends ModelePDFFactures */ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { - global $conf,$langs; - - $outputlangs->load("main"); - $outputlangs->load("bills"); - $outputlangs->load("propal"); - $outputlangs->load("companies"); + global $conf, $langs; + + // Translations + $outputlangs->loadLangs(array("main", "bills", "propal", "companies")); $default_font_size = pdf_getPDFFontSize($outputlangs);