From ed48969630ff14a097255ba6cabb5d4dfff136c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 23 May 2012 11:07:18 +0200 Subject: [PATCH] Fix: [ bug #409 ] List of vat rates for supplier prices must use the seller country. Conflicts: htdocs/install/mysql/migration/3.1.0-3.2.0.sql htdocs/product/fournisseurs.php --- .../install/mysql/migration/3.1.0-3.2.0.sql | 2 ++ htdocs/product/fournisseurs.php | 32 +++++++++++-------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index 155c87fc722..ba477d13764 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -450,3 +450,5 @@ ALTER TABLE llx_commande_fournisseur ADD COLUMN extraparams varchar(255) AFTER i ALTER TABLE llx_facture_fourn ADD COLUMN extraparams varchar(255) AFTER import_key; ALTER TABLE llx_boxes ADD COLUMN maxline integer NULL; + +ALTER TABLE llx_product_fournisseur_price MODIFY fk_product_fournisseur integer DEFAULT 0; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index e7670f77974..af0c96f6220 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent @@ -92,7 +92,7 @@ if ($action == 'updateprice' && $_POST["cancel"] <> $langs->trans("Cancel")) $ref_fourn=GETPOST("ref_fourn"); if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn"); $quantity=GETPOST("qty"); - $tva_tx=GETPOST('tva_tx','alpha'); + $tva_tx=price2num(GETPOST('tva_tx','alpha')); if (empty($quantity)) { @@ -282,7 +282,7 @@ if ($id || $ref) $events=array(); $events[]=array('method' => 'getVatRates', 'url' => dol_buildpath('/core/ajax/vatrates.php',1), 'htmlname' => 'tva_tx', 'params' => array()); print $form->select_company(GETPOST("id_fourn"),'id_fourn','fournisseur=1',1,0,0,$events); - + if (is_object($hookmanager)) { $parameters=array('filtre'=>"fournisseur=1",'html_name'=>'id_fourn','selected'=>GETPOST("id_fourn"),'showempty'=>1,'prod_id'=>$product->id); @@ -299,14 +299,17 @@ if ($id || $ref) } else { - print ''; + print ''; } print ''; print ''; - - // Vat rate - print ''.$langs->trans("VATRate").''; - print ''.$form->load_tva('tva_tx',$product->tva_tx,$supplier,$mysoc).''; + + // Vat rate + print ''.$langs->trans("VATRate").''; + print ''; + //print $form->load_tva('tva_tx',$product->tva_tx,$supplier,$mysoc); // Do not use list here as it may be any vat rates for any country + print 'tva_tx).'">'; + print ''; // Availability if (! empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) @@ -332,7 +335,7 @@ if ($id || $ref) print ''; } print ''; - + // Price qty min print ''.$langs->trans("PriceQtyMin").''; print 'fourn_price)?price($product->fourn_price):'')).'">'; @@ -420,10 +423,11 @@ if ($id || $ref) print ''; print $productfourn->fourn_qty; print ''; - - // VAT rate - print ''; - print vatrate($productfourn->fourn_tva_tx,true); + + // VAT rate + print ''; + print vatrate($productfourn->fourn_tva_tx,true); + print ''; // Price quantity @@ -465,4 +469,4 @@ else // End of page llxFooter(); $db->close(); -?> \ No newline at end of file +?>