From cbb763ab3f6f853bddd5d6ed1f331fbe9dea51a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Wed, 11 Sep 2013 15:48:25 +0200 Subject: [PATCH 1/3] Fixed installer with DoliDB abstract class --- htdocs/install/fileconf.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index e54a3275703..1a26789811e 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -302,6 +302,7 @@ if (! empty($force_install_message)) if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php$/i',$file,$reg)) { $type=$reg[1]; + if ($type === 'DoliDB') continue; // Skip abstract class $class='DoliDB'.ucfirst($type); include_once $dir."/".$file; From a0ce8974b5009e09e398630c2e9a3b4a2dccac65 Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 11 Sep 2013 16:44:34 +0200 Subject: [PATCH 2/3] [ task #1060 ] Register fields localtax(1|2)_type into details tables --- .../class/fournisseur.commande.class.php | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 59c50181eb0..93612387adb 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1228,26 +1228,37 @@ class CommandeFournisseur extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty); + + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty); + + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; $total_localtax1 = $tabprice[9]; $total_localtax2 = $tabprice[10]; + + $localtax1_type=$localtaxes_type[0]; + $localtax2_type=$localtaxes_type[2]; $subprice = price2num($pu,'MU'); $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet"; $sql.= " (fk_commande, label, description,"; $sql.= " fk_product, product_type,"; - $sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, remise_percent, subprice, ref,"; + $sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,"; $sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc"; $sql.= ")"; $sql.= " VALUES (".$this->id.", '" . $this->db->escape($label) . "','" . $this->db->escape($desc) . "',"; if ($fk_product) { $sql.= $fk_product.","; } else { $sql.= "null,"; } $sql.= "'".$product_type."',"; - $sql.= "'".$qty."', ".$txtva.", ".$txlocaltax1.", ".$txlocaltax2.", ".$remise_percent.",'".price2num($subprice,'MU')."','".$ref."',"; + $sql.= "'".$qty."', ".$txtva.", ".$txlocaltax1.", ".$txlocaltax2; + + $sql.= ", '".$localtax1_type."',"; + $sql.= " '".$localtax2_type."'"; + + $sql.= ", ".$remise_percent.",'".price2num($subprice,'MU')."','".$ref."',"; $sql.= "'".price2num($total_ht)."',"; $sql.= "'".price2num($total_tva)."',"; $sql.= "'".price2num($total_localtax1)."',"; @@ -1778,12 +1789,18 @@ class CommandeFournisseur extends CommonOrder // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty); + + $localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty); + + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; $total_localtax1 = $tabprice[9]; $total_localtax2 = $tabprice[10]; + + $localtax1_type=$localtaxes_type[0]; + $localtax2_type=$localtaxes_type[2]; $subprice = price2num($pu,'MU'); @@ -1796,6 +1813,8 @@ class CommandeFournisseur extends CommonOrder $sql.= ",tva_tx='".price2num($txtva)."'"; $sql.= ",localtax1_tx='".price2num($txlocaltax1)."'"; $sql.= ",localtax2_tx='".price2num($txlocaltax2)."'"; + $sql.= ",localtax1_type='".$localtax1_type."'"; + $sql.= ",localtax2_type='".$localtax2_type."'"; $sql.= ",qty='".price2num($qty)."'"; /*if ($date_end) { $sql.= ",date_start='$date_end'"; } else { $sql.=',date_start=null'; } From eb44f272e37818100a6c54f11f4ce3cc8379ddef Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 11 Sep 2013 17:10:06 +0200 Subject: [PATCH 3/3] [ task #1060 ] Register fields localtax(1|2)_type into details tables --- htdocs/fourn/class/fournisseur.facture.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 55f83ea0d03..98608a6af0e 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * @@ -1163,7 +1163,10 @@ class FactureFournisseur extends CommonInvoice // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty); + + $localtaxes_type=getLocalTaxesFromRate($vatrate,0,$this->thirdparty); + + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty,$localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1194,6 +1197,13 @@ class FactureFournisseur extends CommonInvoice $sql.= ", tva_tx = ".price2num($vatrate); $sql.= ", localtax1_tx = ".price2num($txlocaltax1); $sql.= ", localtax2_tx = ".price2num($txlocaltax2); + + if(count($localtaxes_type)) + { + $sql.= ", localtax1_type = '".$localtaxes_type[0]."'"; + $sql.= ", localtax2_type = '".$localtaxes_type[2]."'"; + } + $sql.= ", total_ht = ".price2num($total_ht); $sql.= ", tva= ".price2num($total_tva); $sql.= ", total_localtax1= ".price2num($total_localtax1);