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);
|
||||
|
||||
// Clean vat code
|
||||
$reg = array();
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $txtva, $reg))
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* 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
|
||||
$predef = '';
|
||||
$product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : '');
|
||||
$price_ht = GETPOST('price_ht');
|
||||
$price_ht_devise = GETPOST('multicurrency_price_ht');
|
||||
if (GETPOST('prod_entry_mode') == 'free')
|
||||
$price_ht = price2num(GETPOST('price_ht'));
|
||||
$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'));
|
||||
if (GETPOST('prod_entry_mode', 'alpha') == 'free')
|
||||
{
|
||||
$idprod = 0;
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -430,7 +430,7 @@ if (empty($reshook))
|
||||
$tva_tx = '';
|
||||
}
|
||||
|
||||
$qty = GETPOST('qty'.$predef);
|
||||
$qty = price2num(GETPOST('qty'.$predef));
|
||||
$remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0);
|
||||
|
||||
if ($qty == '')
|
||||
@ -438,7 +438,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors');
|
||||
$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');
|
||||
$error++;
|
||||
|
||||
@ -1421,9 +1421,18 @@ class Contrat extends CommonObject
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
$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);
|
||||
$txlocaltax2 = price2num($txlocaltax2);
|
||||
$remise_percent = price2num($remise_percent);
|
||||
@ -1456,15 +1465,7 @@ class Contrat extends CommonObject
|
||||
|
||||
$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.
|
||||
}
|
||||
$localtaxes_type = getLocalTaxesFromRate($txtva.($vat_src_code ? ' ('.$vat_src_code.')' : ''), 0, $this->societe, $mysoc);
|
||||
|
||||
// Calcul du total TTC et de la TVA pour la ligne a partir de
|
||||
// qty, pu, remise_percent et txtva
|
||||
|
||||
Loading…
Reference in New Issue
Block a user