From 74607218eacf3cf6607ca3cc8323a9d9cc5883f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 May 2015 15:59:09 +0200 Subject: [PATCH] Fight against key tva_taux. Removed completely. --- htdocs/core/class/html.form.class.php | 7 ------- .../expensereport/doc/pdf_standard.modules.php | 2 +- htdocs/expensereport/card.php | 10 +++++----- .../expensereport/class/expensereport.class.php | 15 +++++++-------- .../mysql/tables/llx_expensereport_det.sql | 2 +- htdocs/product/class/html.formproduct.class.php | 12 ++++-------- 6 files changed, 18 insertions(+), 30 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8b17eb7b996..406ad24db4b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -56,9 +56,6 @@ class Form var $cache_types_fees=array(); var $cache_vatrates=array(); - var $tva_taux_value; - var $tva_taux_libelle; - /** * Constructor @@ -3969,10 +3966,6 @@ class Form $return.= '>'.vatrate($rate['libtva']); $return.= $rate['nprtva'] ? ' *': ''; $return.= ''; - - $this->tva_taux_value[] = $rate['txtva']; - $this->tva_taux_libelle[] = $rate['libtva']; - $this->tva_taux_npr[] = $rate['nprtva']; } if (! $options_only) $return.= ''; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index d2cdb71e429..b8547c687f6 100755 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -342,7 +342,7 @@ class pdf_standard extends ModeleExpenseReport // VAT Rate $pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($this->posxtva, $curY); - $pdf->MultiCell($this->posxup-$this->posxtva-1, 3,vatrate($object->lines[$i]->tva_taux,true), 0, 'R'); + $pdf->MultiCell($this->posxup-$this->posxtva-1, 3,vatrate($object->lines[$i]->vatrate,true), 0, 'R'); // UP $pdf->SetFont('','', $default_font_size - 1); diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 476a8862041..385e5b86037 100755 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -879,7 +879,7 @@ if ($action == "addline") $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type); $object_ligne->total_ttc = $tmp[2]; - $object_ligne->tva_taux = GETPOST('vatrate'); + $object_ligne->vatrate = GETPOST('vatrate'); $object_ligne->total_ht = $tmp[0]; $object_ligne->total_tva = $tmp[1]; @@ -1649,17 +1649,17 @@ else print ''; print ''; - // Sélection TVA + // VAT print ''; - print $form->load_tva('fk_c_tva', (isset($_POST["fk_c_tva"])?$_POST["fk_c_tva"]:$objp->tva_taux), $mysoc, ''); + print $form->load_tva('fk_c_tva', (isset($_POST["fk_c_tva"])?$_POST["fk_c_tva"]:$objp->vatrate), $mysoc, ''); print ''; - // Prix unitaire + // Unit price print ''; print ''; print ''; - // Quantité + // Qty print ''; print ''; print ''; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 63924d9c952..1a0a94f0266 100755 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -540,7 +540,7 @@ class ExpenseReport extends CommonObject $line->total_ttc=120; $line->qty=1; $line->fk_c_tva=20; - $line->tva_taux=20; + $line->vatrate=20; $line->value_unit=120; $line->fk_expensereport=0; $line->type_fees_code='TRA'; @@ -724,7 +724,7 @@ class ExpenseReport extends CommonObject $this->lines=array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,'; - $sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva,'; + $sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva, de.tva_tx as vatrate,'; $sql.= ' de.total_ht, de.total_tva, de.total_ttc,'; $sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,'; $sql.= ' p.ref as ref_projet, p.title as title_projet'; @@ -761,7 +761,7 @@ class ExpenseReport extends CommonObject $deplig->type_fees_code = $objp->code_type_fees; $deplig->type_fees_libelle = $objp->libelle_type_fees; - $deplig->tva_taux = $objp->taux_tva; + $deplig->vatrate = $objp->vatrate; $deplig->projet_ref = $objp->ref_projet; $deplig->projet_title = $objp->title_projet; @@ -1239,7 +1239,7 @@ class ExpenseReport extends CommonObject $ligne->total_ht = $total_ht; $ligne->total_tva = $total_tva; $ligne->total_ttc = $total_ttc; - $ligne->tva_taux = $objp_tva->taux_tva; + $ligne->vatrate = $objp_tva->vatrate; $ligne->rowid = $rowid; // Select des infos sur le type fees @@ -1487,8 +1487,7 @@ class ExpenseReportLine var $projet_ref; var $projet_title; - var $tva_taux; - + var $vatrate; var $total_ht; var $total_tva; var $total_ttc; @@ -1512,7 +1511,7 @@ class ExpenseReportLine function fetch($rowid) { $sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,'; - $sql.= ' fde.fk_c_tva as tva_taux, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'; + $sql.= ' fde.fk_c_tva as fk_c_tva, fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,'; $sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'; $sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'; $sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde'; @@ -1539,7 +1538,7 @@ class ExpenseReportLine $this->type_fees_libelle = $objp->type_fees_libelle; $this->projet_ref = $objp->projet_ref; $this->projet_title = $objp->projet_title; - $this->tva_taux = $objp->tva_taux; + $this->vatrate = $objp->vatrate; $this->total_ht = $objp->total_ht; $this->total_tva = $objp->total_tva; $this->total_ttc = $objp->total_ttc; diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql index 418f1ce6cc5..ef9f03b9bbb 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_det.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql @@ -28,7 +28,7 @@ CREATE TABLE llx_expensereport_det qty real NOT NULL, value_unit real NOT NULL, remise_percent real, - tva_tx double(6,3), -- Vat rat + tva_tx double(6,3), -- Vat rate localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate localtax1_type varchar(10) NULL, -- localtax1 type localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 6fc649c272e..0215f20e3c6 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -22,9 +22,8 @@ /** - * \class FormProduct - * \brief Class with static methods for building HTML components related to products - * \remarks Only common components must be here. + * Class with static methods for building HTML components related to products + * Only components common to products and services must be here. */ class FormProduct { @@ -34,9 +33,6 @@ class FormProduct // Cache arrays var $cache_warehouses=array(); - var $tva_taux_value; - var $tva_taux_libelle; - /** * Constructor @@ -109,7 +105,7 @@ class FormProduct * @param int $empty 1=Can be empty, 0 if not * @param int $disabled 1=Select is disabled * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. - * @param string $empty_label Empty label if needed (only if $empty=1) + * @param string $empty_label Empty label if needed (only if $empty=1) * @return string HTML select */ function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='') @@ -120,7 +116,7 @@ class FormProduct $this->loadWarehouses($fk_product); $nbofwarehouses=count($this->cache_warehouses); - + $out='