Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 8.0
Conflicts: htdocs/comm/propal/class/propal.class.php htdocs/commande/class/commande.class.php htdocs/contrat/class/contrat.class.php htdocs/expensereport/class/expensereport.class.php htdocs/fourn/class/fournisseur.commande.class.php htdocs/fourn/class/fournisseur.facture.class.php
This commit is contained in:
commit
d80baaea69
@ -14,6 +14,7 @@
|
|||||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -404,6 +405,8 @@ class Propal extends CommonObject
|
|||||||
global $mysoc, $conf, $langs;
|
global $mysoc, $conf, $langs;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except);
|
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except);
|
||||||
|
if ($this->statut == self::STATUS_DRAFT)
|
||||||
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -418,7 +421,9 @@ class Propal extends CommonObject
|
|||||||
$pu_ht=price2num($pu_ht);
|
$pu_ht=price2num($pu_ht);
|
||||||
$pu_ht_devise=price2num($pu_ht_devise);
|
$pu_ht_devise=price2num($pu_ht_devise);
|
||||||
$pu_ttc=price2num($pu_ttc);
|
$pu_ttc=price2num($pu_ttc);
|
||||||
$txtva=price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||||
|
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||||
|
}
|
||||||
$txlocaltax1=price2num($txlocaltax1);
|
$txlocaltax1=price2num($txlocaltax1);
|
||||||
$txlocaltax2=price2num($txlocaltax2);
|
$txlocaltax2=price2num($txlocaltax2);
|
||||||
$pa_ht=price2num($pa_ht);
|
$pa_ht=price2num($pa_ht);
|
||||||
@ -434,8 +439,6 @@ class Propal extends CommonObject
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
if ($this->statut == self::STATUS_DRAFT)
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$product_type=$type;
|
$product_type=$type;
|
||||||
|
|||||||
@ -9,8 +9,8 @@
|
|||||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
|
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1267,6 +1267,8 @@ class Commande extends CommonOrder
|
|||||||
$logtext.= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise";
|
$logtext.= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise";
|
||||||
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
|
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
|
||||||
|
|
||||||
|
if ($this->statut == self::STATUS_DRAFT)
|
||||||
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -1286,7 +1288,9 @@ class Commande extends CommonOrder
|
|||||||
$pu_ht_devise=price2num($pu_ht_devise);
|
$pu_ht_devise=price2num($pu_ht_devise);
|
||||||
$pu_ttc=price2num($pu_ttc);
|
$pu_ttc=price2num($pu_ttc);
|
||||||
$pa_ht=price2num($pa_ht);
|
$pa_ht=price2num($pa_ht);
|
||||||
$txtva = price2num($txtva);
|
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||||
|
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||||
|
}
|
||||||
$txlocaltax1 = price2num($txlocaltax1);
|
$txlocaltax1 = price2num($txlocaltax1);
|
||||||
$txlocaltax2 = price2num($txlocaltax2);
|
$txlocaltax2 = price2num($txlocaltax2);
|
||||||
if ($price_base_type=='HT')
|
if ($price_base_type=='HT')
|
||||||
@ -1303,8 +1307,6 @@ class Commande extends CommonOrder
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
if ($this->statut == self::STATUS_DRAFT)
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$product_type=$type;
|
$product_type=$type;
|
||||||
|
|||||||
@ -2590,6 +2590,8 @@ class Facture extends CommonInvoice
|
|||||||
global $mysoc, $conf, $langs;
|
global $mysoc, $conf, $langs;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG);
|
dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG);
|
||||||
|
if (! empty($this->brouillon))
|
||||||
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -2605,23 +2607,15 @@ class Facture extends CommonInvoice
|
|||||||
if (empty($fk_prev_id)) $fk_prev_id = 'null';
|
if (empty($fk_prev_id)) $fk_prev_id = 'null';
|
||||||
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
|
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
|
||||||
|
|
||||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
|
||||||
|
|
||||||
// Clean vat code
|
|
||||||
$vat_src_code='';
|
|
||||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
|
||||||
{
|
|
||||||
$vat_src_code = $reg[1];
|
|
||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
|
||||||
}
|
|
||||||
|
|
||||||
$remise_percent=price2num($remise_percent);
|
$remise_percent=price2num($remise_percent);
|
||||||
$qty=price2num($qty);
|
$qty=price2num($qty);
|
||||||
$pu_ht=price2num($pu_ht);
|
$pu_ht=price2num($pu_ht);
|
||||||
$pu_ht_devise=price2num($pu_ht_devise);
|
$pu_ht_devise=price2num($pu_ht_devise);
|
||||||
$pu_ttc=price2num($pu_ttc);
|
$pu_ttc=price2num($pu_ttc);
|
||||||
$pa_ht=price2num($pa_ht);
|
$pa_ht=price2num($pa_ht);
|
||||||
$txtva=price2num($txtva);
|
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||||
|
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||||
|
}
|
||||||
$txlocaltax1=price2num($txlocaltax1);
|
$txlocaltax1=price2num($txlocaltax1);
|
||||||
$txlocaltax2=price2num($txlocaltax2);
|
$txlocaltax2=price2num($txlocaltax2);
|
||||||
|
|
||||||
@ -2637,8 +2631,6 @@ class Facture extends CommonInvoice
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
if (! empty($this->brouillon))
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$product_type=$type;
|
$product_type=$type;
|
||||||
@ -2661,6 +2653,16 @@ class Facture extends CommonInvoice
|
|||||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
// 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.
|
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||||
|
|
||||||
|
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||||
|
|
||||||
|
// Clean vat code
|
||||||
|
$vat_src_code='';
|
||||||
|
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||||
|
{
|
||||||
|
$vat_src_code = $reg[1];
|
||||||
|
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||||
|
}
|
||||||
|
|
||||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx, $pu_ht_devise);
|
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, $situation_percent, $this->multicurrency_tx, $pu_ht_devise);
|
||||||
|
|
||||||
$total_ht = $tabprice[0];
|
$total_ht = $tabprice[0];
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
|
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2015-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1357,11 +1357,23 @@ class Contrat extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
||||||
|
|
||||||
|
// Clean vat code
|
||||||
|
$vat_src_code='';
|
||||||
|
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||||
|
{
|
||||||
|
$vat_src_code = $reg[1];
|
||||||
|
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||||
|
}
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$pu_ht=price2num($pu_ht);
|
$pu_ht=price2num($pu_ht);
|
||||||
$pu_ttc=price2num($pu_ttc);
|
$pu_ttc=price2num($pu_ttc);
|
||||||
$pa_ht=price2num($pa_ht);
|
$pa_ht=price2num($pa_ht);
|
||||||
$txtva=price2num($txtva);
|
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||||
|
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||||
|
}
|
||||||
$txlocaltax1=price2num($txlocaltax1);
|
$txlocaltax1=price2num($txlocaltax1);
|
||||||
$txlocaltax2=price2num($txlocaltax2);
|
$txlocaltax2=price2num($txlocaltax2);
|
||||||
$remise_percent=price2num($remise_percent);
|
$remise_percent=price2num($remise_percent);
|
||||||
@ -1391,16 +1403,6 @@ class Contrat extends CommonObject
|
|||||||
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
|
// 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.
|
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
|
||||||
|
|
||||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
|
||||||
|
|
||||||
// Clean vat code
|
|
||||||
$vat_src_code='';
|
|
||||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
|
||||||
{
|
|
||||||
$vat_src_code = $reg[1];
|
|
||||||
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
|
||||||
}
|
|
||||||
|
|
||||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type);
|
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type);
|
||||||
$total_ht = $tabprice[0];
|
$total_ht = $tabprice[0];
|
||||||
$total_tva = $tabprice[1];
|
$total_tva = $tabprice[1];
|
||||||
|
|||||||
@ -4930,7 +4930,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
|||||||
{
|
{
|
||||||
$vatratecleaned = $vatrate;
|
$vatratecleaned = $vatrate;
|
||||||
$vatratecode = '';
|
$vatratecode = '';
|
||||||
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)"
|
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "x.x (yy)"
|
||||||
{
|
{
|
||||||
$vatratecleaned = $reg[1];
|
$vatratecleaned = $reg[1];
|
||||||
$vatratecode = $reg[2];
|
$vatratecode = $reg[2];
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||||
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1674,6 +1674,8 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG);
|
dol_syslog(get_class($this)."::addline qty=$qty, up=$up, fk_c_type_fees=$fk_c_type_fees, vatrate=$vatrate, date=$date, fk_project=$fk_project, type=$type, comments=$comments", LOG_DEBUG);
|
||||||
|
|
||||||
|
if ($this->fk_statut == self::STATUS_DRAFT)
|
||||||
|
{
|
||||||
if (empty($qty)) $qty = 0;
|
if (empty($qty)) $qty = 0;
|
||||||
if (empty($fk_c_type_fees) || $fk_c_type_fees < 0) $fk_c_type_fees = 0;
|
if (empty($fk_c_type_fees) || $fk_c_type_fees < 0) $fk_c_type_fees = 0;
|
||||||
if (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) $fk_c_exp_tax_cat = 0;
|
if (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) $fk_c_exp_tax_cat = 0;
|
||||||
@ -1682,11 +1684,11 @@ class ExpenseReport extends CommonObject
|
|||||||
if (empty($fk_project)) $fk_project = 0;
|
if (empty($fk_project)) $fk_project = 0;
|
||||||
|
|
||||||
$qty = price2num($qty);
|
$qty = price2num($qty);
|
||||||
$vatrate = price2num($vatrate);
|
if (!preg_match('/\((.*)\)/', $vatrate)) {
|
||||||
|
$vatrate = price2num($vatrate); // $txtva can have format '5.0(XXX)' or '5'
|
||||||
|
}
|
||||||
$up = price2num($up);
|
$up = price2num($up);
|
||||||
|
|
||||||
if ($this->fk_statut == self::STATUS_DRAFT)
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$this->line = new ExpenseReportLine($this->db);
|
$this->line = new ExpenseReportLine($this->db);
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -1449,6 +1450,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id");
|
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $fk_prod_fourn_price, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, $info_bits, $notrigger, $date_start, $date_end, $fk_unit, $pu_ht_devise, $origin, $origin_id");
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
|
if ($this->statut == self::STATUS_DRAFT)
|
||||||
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
@ -1464,7 +1469,9 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$pu_ht=price2num($pu_ht);
|
$pu_ht=price2num($pu_ht);
|
||||||
$pu_ht_devise=price2num($pu_ht_devise);
|
$pu_ht_devise=price2num($pu_ht_devise);
|
||||||
$pu_ttc=price2num($pu_ttc);
|
$pu_ttc=price2num($pu_ttc);
|
||||||
$txtva = price2num($txtva);
|
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||||
|
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
||||||
|
}
|
||||||
$txlocaltax1 = price2num($txlocaltax1);
|
$txlocaltax1 = price2num($txlocaltax1);
|
||||||
$txlocaltax2 = price2num($txlocaltax2);
|
$txlocaltax2 = price2num($txlocaltax2);
|
||||||
if ($price_base_type=='HT')
|
if ($price_base_type=='HT')
|
||||||
@ -1485,8 +1492,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
if ($type < 0) return -1;
|
if ($type < 0) return -1;
|
||||||
|
|
||||||
if ($this->statut == self::STATUS_DRAFT)
|
|
||||||
{
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if ($fk_product > 0)
|
if ($fk_product > 0)
|
||||||
|
|||||||
@ -1510,6 +1510,8 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG);
|
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG);
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
|
if ($this->statut == self::STATUS_DRAFT)
|
||||||
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (empty($remise_percent)) $remise_percent=0;
|
if (empty($remise_percent)) $remise_percent=0;
|
||||||
if (empty($qty)) $qty=0;
|
if (empty($qty)) $qty=0;
|
||||||
@ -1585,6 +1587,9 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$product_type = $type;
|
$product_type = $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!preg_match('/\((.*)\)/', $txtva)) {
|
||||||
|
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
|
||||||
|
}
|
||||||
|
|
||||||
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
|
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
|
||||||
|
|
||||||
@ -1599,7 +1604,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$remise_percent=price2num($remise_percent);
|
$remise_percent=price2num($remise_percent);
|
||||||
$qty=price2num($qty);
|
$qty=price2num($qty);
|
||||||
$pu=price2num($pu);
|
$pu=price2num($pu);
|
||||||
$txtva=price2num($txtva);
|
$txtva = price2num($txtva);
|
||||||
$txlocaltax1=price2num($txlocaltax1);
|
$txlocaltax1=price2num($txlocaltax1);
|
||||||
$txlocaltax2=price2num($txlocaltax2);
|
$txlocaltax2=price2num($txlocaltax2);
|
||||||
|
|
||||||
@ -1707,6 +1712,11 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a line detail into database
|
* Update a line detail into database
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user