From 59783cf5567c81faed0d6054d9ba161b1ab4fc44 Mon Sep 17 00:00:00 2001 From: simnandez Date: Sun, 15 Sep 2013 11:52:57 +0200 Subject: [PATCH] [ task #1060 ] Register fields localtax(1|2)_type into details tables --- .../pdf/pdf_muscadet.modules.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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 e08f9418c21..923930d5252 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -1,8 +1,8 @@ +/* Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2010-2013 Juanjo Menent * * 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 @@ -377,11 +377,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (! empty($object->remise_percent)) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; $vatrate=(string) $object->lines[$i]->tva_tx; - // TODO : store local taxes types into object lines and remove this - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); - if ((! isset($localtax1_type)) || $localtax1_type=='') $localtax1_type = $localtaxtmp_array[0]; - if ((! isset($localtax2_type)) || $localtax2_type=='') $localtax2_type = $localtaxtmp_array[2]; - //end TODO + + // Retrieve type from database for backward compatibility with old records + if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined + && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax + { + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtax1_type = $localtaxtmp_array[0]; + $localtax2_type = $localtaxtmp_array[2]; + } // retrieve global local tax if ($localtax1_type && $localtax1ligne != 0)