From 4f76545b628e9641a99e15b3054e7be2c7e03c47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Sep 2017 10:47:08 +0200 Subject: [PATCH] Add missing fields to manage localtax on supplier products --- .../install/mysql/migration/6.0.0-7.0.0.sql | 5 ++++ .../tables/llx_product_fournisseur_price.sql | 4 +++ htdocs/langs/en_US/main.lang | 1 + htdocs/product/price.php | 26 +++++++++---------- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index c8f2142684c..0d2a6a7baed 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -41,6 +41,11 @@ ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer; -- For 7.0 +ALTER TABLE llx_product_fournisseur_price ADD COLUMN localtax1_tx double(6,3) DEFAULT 0; +ALTER TABLE llx_product_fournisseur_price ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0'; +ALTER TABLE llx_product_fournisseur_price ADD COLUMN localtax2_tx double(6,3) DEFAULT 0; +ALTER TABLE llx_product_fournisseur_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0'; + insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MEMBER_SENTBYMAIL','Mails sent from member card','Executed when you send email from member card','member',23); diff --git a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql index f341b103edb..1c86bfe04f8 100755 --- a/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql +++ b/htdocs/install/mysql/tables/llx_product_fournisseur_price.sql @@ -38,6 +38,10 @@ create table llx_product_fournisseur_price unitcharges double(24,8) DEFAULT 0, -- deprecated default_vat_code varchar(10), tva_tx double(6,3) NOT NULL, + localtax1_tx double(6,3) DEFAULT 0, + localtax1_type varchar(10) NOT NULL DEFAULT '0', + localtax2_tx double(6,3) DEFAULT 0, + localtax2_type varchar(10) NOT NULL DEFAULT '0', info_bits integer NOT NULL DEFAULT 0, fk_user integer, fk_supplier_price_expression integer, -- Link to the rule for dynamic price calculation diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 7475d1194eb..93d2542ea69 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -382,6 +382,7 @@ LT2ES=IRPF LT1IN=CGST LT2IN=SGST VATRate=Tax Rate +DefaultTaxRate=Default tax rate Average=Average Sum=Sum Delta=Delta diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f3d61b26f81..af9fa2a927f 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -744,7 +744,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { // TVA - print '' . $langs->trans("VATRate") . ''; + print '' . $langs->trans("DefaultTaxRate") . ''; $positiverates=''; if (price2num($object->multiprices_tva_tx[$soc->price_level])) $positiverates.=($positiverates?'/':'').price2num($object->multiprices_tva_tx[$soc->price_level]); @@ -758,7 +758,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) else { // TVA - print '' . $langs->trans("VATRate") . ''; + print '' . $langs->trans("DefaultTaxRate") . ''; $positiverates=''; if (price2num($object->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($object->tva_tx); @@ -781,14 +781,14 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { // We show only vat for level 1 - print '' . $langs->trans("VATRate") . ''; + print '' . $langs->trans("DefaultTaxRate") . ''; print '' . vatrate($object->multiprices_tva_tx[1], true) . ''; print ''; } else { // TVA - print '' . $langs->trans("VATRate") . ''; + print '' . $langs->trans("DefaultTaxRate") . ''; $positiverates=''; if (price2num($object->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($object->tva_tx); @@ -945,7 +945,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) else { // TVA - print '' . $langs->trans("VATRate") . ''; + print '' . $langs->trans("DefaultTaxRate") . ''; $positiverates=''; if (price2num($object->tva_tx)) $positiverates.=($positiverates?'/':'').price2num($object->tva_tx); @@ -1123,7 +1123,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se print ''; // VAT - print ''; @@ -1157,7 +1157,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) print '
' . $langs->trans("VATRate") . ''; + print '
' . $langs->trans("DefaultTaxRate") . ''; print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1); print '
'; // VAT - print ''; @@ -1298,7 +1298,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) print ''; - if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) print ''; + if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) print ''; else print ''; print ''; @@ -1439,7 +1439,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ print ''; print $conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print ''; print ''; print ''; if (! empty($conf->dynamicprices->enabled)) { @@ -1606,7 +1606,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; // VAT - print ''; @@ -1695,7 +1695,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; // VAT - print ''; @@ -1799,7 +1799,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print ''; @@ -1920,7 +1920,7 @@ var_dump($prodcustprice);exit; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") print '';
' . $langs->trans("VATRate") . ''; + print '
' . $langs->trans("DefaultTaxRate") . ''; print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1); print '
'.$langs->trans("PriceLevel").''.$langs->trans("VATRate").''.$langs->trans("DefaultTaxRate").''.$langs->trans("SellingPrice").'' . $langs->trans("PriceBase") . '' . $langs->trans("VATRate") . '' . $langs->trans("DefaultTaxRate") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '
' . $langs->trans("VATRate") . ''; + print '
' . $langs->trans("DefaultTaxRate") . ''; print $form->load_tva("tva_tx", $object->default_vat_code ? $object->tva_tx.' ('.$object->default_vat_code.')' : $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1); print '
' . $langs->trans("VATRate") . ''; + print '
' . $langs->trans("DefaultTaxRate") . ''; print $form->load_tva("tva_tx", $prodcustprice->default_vat_code ? $prodcustprice->tva_tx.' ('.$prodcustprice->default_vat_code.')' : $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly, $object->type, false, 1); print '
' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VATRate") . '' . $langs->trans("DefaultTaxRate") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("INCT") . '' . $langs->trans("ThirdParty") . '' . $langs->trans("AppliedPricesFrom") . '' . $langs->trans("PriceBase") . '' . $langs->trans("VATRate") . '' . $langs->trans("DefaultTaxRate") . '' . $langs->trans("HT") . '' . $langs->trans("TTC") . '' . $langs->trans("INCT") . '