From 7b209fa0be6ee014924e7683768a39b9bf196fdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Feb 2015 18:32:38 +0100 Subject: [PATCH 1/2] New: Add hidden option PDF_SHOW_PROJECT to show project ref onto supplier orders and invoices. --- htdocs/core/class/commonobject.class.php | 3 ++- .../pdf/pdf_canelle.modules.php | 18 ++++++++++--- .../pdf/pdf_muscadet.modules.php | 25 ++++++++++++------- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f3deab3eb04..79f509225f6 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -737,7 +737,8 @@ abstract class CommonObject $project = new Project($this->db); $result = $project->fetch($this->fk_project); - $this->projet = $project; + $this->projet = $project; // deprecated + $this->project = $project; return $result; } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 6b57b961da4..d100a45b828 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -939,16 +939,28 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if ($object->ref_supplier) { - $posy+=5; + $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSupplier")." : " . $object->ref_supplier, '', 'R'); } - $posy+=1; $pdf->SetFont('','', $default_font_size - 1); - $posy+=5; + $posy+=6; + if (! empty($conf->global->PDF_SHOW_PROJECT)) + { + $object->fetch_projet(); + $pdf->SetXY($posx,$posy); + if (! empty($object->project->ref)) + { + $langs->load("projects"); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $posy+=4; + } + } + $pdf->SetXY($posx,$posy); if ($object->date) { diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 29bd483b39b..b26b540e5b1 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -976,15 +976,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('', 'B', $default_font_size + 3); $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $title=$outputlangs->transnoentities("SupplierOrder"); + $title=$outputlangs->transnoentities("SupplierOrder")." ".$outputlangs->convToOutputCharset($object->ref); $pdf->MultiCell(100, 3, $title, '', 'R'); - $pdf->SetFont('','B',$default_font_size); - - $posy+=6; - $pdf->SetXY($posx,$posy); - $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); + $pdf->SetFont('','B', $default_font_size); if ($object->ref_supplier) { @@ -994,10 +989,22 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : " . $outputlangs->convToOutputCharset($object->ref_supplier), '', 'R'); } - $posy+=2; $pdf->SetFont('','', $default_font_size -1); - $posy+=5; + $posy+=6; + if (! empty($conf->global->PDF_SHOW_PROJECT)) + { + $object->fetch_projet(); + $pdf->SetXY($posx,$posy); + if (! empty($object->project->ref)) + { + $langs->load("projects"); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $posy+=4; + } + } + $pdf->SetXY($posx,$posy); if (! empty($object->date_commande)) { From ef3dfbf3a1ad38229a77bee4ea02a92cf570f017 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Mon, 2 Feb 2015 21:04:00 +0100 Subject: [PATCH 2/2] Increase size of localtaxX (10 is not enough in some cases) --- htdocs/install/mysql/migration/3.6.0-3.7.0.sql | 4 ++-- htdocs/install/mysql/tables/llx_c_tva.sql | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 1b99d993ac3..4421ad032eb 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -163,8 +163,8 @@ ALTER TABLE llx_actioncomm_resources ADD UNIQUE INDEX uk_actioncomm_resources(fk -- Localtaxes by thirds -ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(10); -ALTER TABLE llx_c_tva MODIFY COLUMN localtax2 varchar(10); +ALTER TABLE llx_c_tva MODIFY COLUMN localtax1 varchar(20); +ALTER TABLE llx_c_tva MODIFY COLUMN localtax2 varchar(20); ALTER TABLE llx_localtax ADD COLUMN localtaxtype tinyint after entity; ALTER TABLE llx_societe ADD COLUMN localtax1_value double(6,3) after localtax1_assuj; ALTER TABLE llx_societe ADD COLUMN localtax2_value double(6,3) after localtax2_assuj; diff --git a/htdocs/install/mysql/tables/llx_c_tva.sql b/htdocs/install/mysql/tables/llx_c_tva.sql index 2a0b275ce96..9d6d594fe10 100644 --- a/htdocs/install/mysql/tables/llx_c_tva.sql +++ b/htdocs/install/mysql/tables/llx_c_tva.sql @@ -1,6 +1,6 @@ -- ======================================================================== -- Copyright (C) 2005 Laurent Destailleur --- Copyright (C) 2010-2014 Juanjo Menent +-- Copyright (C) 2010-2015 Juanjo Menent -- Copyright (C) 2011-2012 Alexandre Spangaro -- -- This program is free software; you can redistribute it and/or modify @@ -23,9 +23,9 @@ create table llx_c_tva rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, fk_pays integer NOT NULL, taux double NOT NULL, - localtax1 varchar(10) NOT NULL DEFAULT '0', + localtax1 varchar(20) NOT NULL DEFAULT '0', localtax1_type varchar(10) NOT NULL DEFAULT '0', - localtax2 varchar(10) NOT NULL DEFAULT '0', + localtax2 varchar(20) NOT NULL DEFAULT '0', localtax2_type varchar(10) NOT NULL DEFAULT '0', recuperableonly integer NOT NULL DEFAULT 0, note varchar(128),