FIX #12617
This commit is contained in:
parent
56fb6dce61
commit
e2e06b47ff
@ -1447,6 +1447,7 @@ class Commande extends CommonOrder
|
|||||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||||
|
|
||||||
// Clean vat code
|
// Clean vat code
|
||||||
|
$reg = array();
|
||||||
$vat_src_code = '';
|
$vat_src_code = '';
|
||||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -417,12 +417,12 @@ if (empty($reshook))
|
|||||||
// Set if we used free entry or predefined product
|
// Set if we used free entry or predefined product
|
||||||
$predef = '';
|
$predef = '';
|
||||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||||
$price_ht = GETPOST('price_ht');
|
$price_ht = price2num(GETPOST('price_ht'));
|
||||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'));
|
||||||
if (GETPOST('prod_entry_mode') == 'free')
|
if (GETPOST('prod_entry_mode', 'alpha') == 'free')
|
||||||
{
|
{
|
||||||
$idprod = 0;
|
$idprod = 0;
|
||||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -430,7 +430,7 @@ if (empty($reshook))
|
|||||||
$tva_tx = '';
|
$tva_tx = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$qty = GETPOST('qty'.$predef);
|
$qty = price2num(GETPOST('qty'.$predef));
|
||||||
$remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0);
|
$remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0);
|
||||||
|
|
||||||
if ($qty == '')
|
if ($qty == '')
|
||||||
@ -438,7 +438,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc))
|
if (GETPOST('prod_entry_mode', 'alpha') == 'free' && empty($idprod) && empty($product_desc))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -1421,9 +1421,18 @@ class Contrat extends CommonObject
|
|||||||
$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);
|
||||||
if (!preg_match('/\((.*)\)/', $txtva)) {
|
|
||||||
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
|
// Clean vat code
|
||||||
|
$reg = array();
|
||||||
|
$vat_src_code = '';
|
||||||
|
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||||
|
{
|
||||||
|
$vat_src_code = $reg[1];
|
||||||
|
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$txtva = price2num($txtva);
|
||||||
|
|
||||||
$txlocaltax1 = price2num($txlocaltax1);
|
$txlocaltax1 = price2num($txlocaltax1);
|
||||||
$txlocaltax2 = price2num($txlocaltax2);
|
$txlocaltax2 = price2num($txlocaltax2);
|
||||||
$remise_percent = price2num($remise_percent);
|
$remise_percent = price2num($remise_percent);
|
||||||
@ -1456,15 +1465,7 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
|
$localtaxes_type = getLocalTaxesFromRate($txtva.($vat_src_code ? ' ('.$vat_src_code.')' : ''), 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.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||||
// qty, pu, remise_percent et txtva
|
// qty, pu, remise_percent et txtva
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user