Qual: Nettoyage des paramètres avant traitement
This commit is contained in:
parent
53afd680a1
commit
7e7c3b4f47
@ -896,27 +896,11 @@ class Facture
|
|||||||
*/
|
*/
|
||||||
function addline($facid, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $datestart='', $dateend='', $ventil = 0)
|
function addline($facid, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0, $datestart='', $dateend='', $ventil = 0)
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog("facture.class.php::addline($facid,$desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$datestart,$dateend,$ventil)");
|
||||||
if ($this->brouillon)
|
if ($this->brouillon)
|
||||||
{
|
{
|
||||||
|
// Nettoyage paramètres
|
||||||
/* Lecture du rang max de la facture */
|
if (strlen(trim($qty))==0) $qty=1;
|
||||||
|
|
||||||
$sql = "SELECT max(rang) FROM ".MAIN_DB_PREFIX."facturedet";
|
|
||||||
$sql .= " WHERE fk_facture =".$facid;
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$row = $this->db->fetch_row($resql);
|
|
||||||
$rangmax = $row[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -- */
|
|
||||||
|
|
||||||
if (strlen(trim($qty))==0)
|
|
||||||
{
|
|
||||||
$qty=1;
|
|
||||||
}
|
|
||||||
$remise = 0;
|
$remise = 0;
|
||||||
$_price = $pu;
|
$_price = $pu;
|
||||||
$subprice = $pu;
|
$subprice = $pu;
|
||||||
@ -940,7 +924,17 @@ class Facture
|
|||||||
$_price = ($pu - $remise);
|
$_price = ($pu - $remise);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Formatage des prix */
|
// Lecture du rang max de la facture
|
||||||
|
$sql = "SELECT max(rang) FROM ".MAIN_DB_PREFIX."facturedet";
|
||||||
|
$sql .= " WHERE fk_facture =".$facid;
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$row = $this->db->fetch_row($resql);
|
||||||
|
$rangmax = $row[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formatage des prix
|
||||||
$_price = ereg_replace(",",".",$_price);
|
$_price = ereg_replace(",",".",$_price);
|
||||||
$subprice = ereg_replace(",",".",$subprice);
|
$subprice = ereg_replace(",",".",$subprice);
|
||||||
|
|
||||||
@ -953,7 +947,7 @@ class Facture
|
|||||||
if ($dateend) { $sql.= "'$dateend' "; }
|
if ($dateend) { $sql.= "'$dateend' "; }
|
||||||
else { $sql.=" null "; }
|
else { $sql.=" null "; }
|
||||||
|
|
||||||
$sql .= ",".$ventil;
|
$sql .= ",".$ventil;
|
||||||
$sql .=",".($rangmax + 1).")";
|
$sql .=",".($rangmax + 1).")";
|
||||||
|
|
||||||
if ( $this->db->query( $sql) )
|
if ( $this->db->query( $sql) )
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user