Skip to content
Snippets Groups Projects
Commit a3e461c2 authored by Regis Houssin's avatar Regis Houssin
Browse files

Merge branch 'develop' of git+ssh://git@github.com/Dolibarr/dolibarr.git into develop

parents c9ea31a9 dea5ec5e
No related branches found
No related tags found
No related merge requests found
...@@ -1941,20 +1941,23 @@ class Facture extends CommonObject ...@@ -1941,20 +1941,23 @@ class Facture extends CommonObject
{ {
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
dol_syslog("Facture::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type", LOG_DEBUG); dol_syslog("Facture::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line", LOG_DEBUG);
if ($this->brouillon) if ($this->brouillon)
{ {
$this->db->begin(); $this->db->begin();
// Clean parameters // Clean parameters
if (empty($qty)) $qty=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
$remise_percent = price2num($remise_percent); $remise_percent = price2num($remise_percent);
$qty = price2num($qty); $qty = price2num($qty);
if (! $qty) $qty=0;
$pu = price2num($pu); $pu = price2num($pu);
$txtva = price2num($txtva); $txtva = price2num($txtva);
$txlocaltax1 = price2num($txlocaltax1); $txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2); $txlocaltax2 = price2num($txlocaltax2);
// Check parameters // Check parameters
if ($type < 0) return -1; if ($type < 0) return -1;
...@@ -3593,7 +3596,6 @@ class FactureLigne ...@@ -3593,7 +3596,6 @@ class FactureLigne
if ($this->date_end) { $sql.= ",date_end='".$this->db->idate($this->date_end)."'"; } if ($this->date_end) { $sql.= ",date_end='".$this->db->idate($this->date_end)."'"; }
else { $sql.=',date_end=null'; } else { $sql.=',date_end=null'; }
$sql.= ",product_type=".$this->product_type; $sql.= ",product_type=".$this->product_type;
$sql.= ",rang='".$this->rang."'";
$sql.= ",info_bits='".$this->info_bits."'"; $sql.= ",info_bits='".$this->info_bits."'";
if (empty($this->skip_update_total)) if (empty($this->skip_update_total))
{ {
......
...@@ -839,6 +839,8 @@ abstract class CommonObject ...@@ -839,6 +839,8 @@ abstract class CommonObject
$sql.= ' WHERE '.$this->fk_element.'='.$this->id; $sql.= ' WHERE '.$this->fk_element.'='.$this->id;
if (! $renum) $sql.= ' AND rang = 0'; if (! $renum) $sql.= ' AND rang = 0';
if ($renum) $sql.= ' AND rang <> 0'; if ($renum) $sql.= ' AND rang <> 0';
dol_syslog(get_class($this)."::line_order sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
...@@ -850,6 +852,8 @@ abstract class CommonObject ...@@ -850,6 +852,8 @@ abstract class CommonObject
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' ORDER BY rang ASC, rowid '.$rowidorder; $sql.= ' ORDER BY rang ASC, rowid '.$rowidorder;
dol_syslog(get_class($this)."::line_order sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
...@@ -910,6 +914,8 @@ abstract class CommonObject ...@@ -910,6 +914,8 @@ abstract class CommonObject
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang;
$sql.= ' WHERE rowid = '.$rowid; $sql.= ' WHERE rowid = '.$rowid;
dol_syslog(get_class($this)."::updateRangOfLine sql=".$sql, LOG_DEBUG);
if (! $this->db->query($sql) ) if (! $this->db->query($sql) )
{ {
dol_print_error($this->db); dol_print_error($this->db);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment