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

This commit is contained in:
eldy 2011-10-05 23:11:30 +02:00
commit a939a74e94
6 changed files with 76 additions and 35 deletions

View File

@ -495,24 +495,31 @@ class Propal extends CommonObject
$staticline=new PropaleLigne($this->db);
$staticline->fetch($rowid);
$this->line->oldline = $staticline;
$this->line->rowid=$rowid;
$this->line->desc=$desc;
$this->line->qty=$qty;
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2;
$this->line->remise_percent=$remise_percent;
$this->line->subprice=$pu;
$this->line->info_bits=$info_bits;
$this->line->total_ht=$total_ht;
$this->line->total_tva=$total_tva;
$this->line->total_localtax1=$total_localtax1;
$this->line->total_localtax2=$total_localtax2;
$this->line->total_ttc=$total_ttc;
$this->line->special_code=$special_code;
$this->line->fk_parent_line=$fk_parent_line;
$this->line->skip_update_total=$skip_update_total;
// Reorder if fk_parent_line change
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
{
$rangmax = $this->line_max($fk_parent_line);
$this->line->rang = $rangmax + 1;
}
$this->line->rowid = $rowid;
$this->line->desc = $desc;
$this->line->qty = $qty;
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
$this->line->remise_percent = $remise_percent;
$this->line->subprice = $pu;
$this->line->info_bits = $info_bits;
$this->line->total_ht = $total_ht;
$this->line->total_tva = $total_tva;
$this->line->total_localtax1 = $total_localtax1;
$this->line->total_localtax2 = $total_localtax2;
$this->line->total_ttc = $total_ttc;
$this->line->special_code = $special_code;
$this->line->fk_parent_line = $fk_parent_line;
$this->line->skip_update_total = $skip_update_total;
// TODO deprecated
$this->line->price=$price;
@ -521,6 +528,9 @@ class Propal extends CommonObject
$result=$this->line->update();
if ($result > 0)
{
// Reorder if child line
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
$this->update_price(1);
$this->fk_propal = $this->id;
@ -2646,8 +2656,9 @@ class PropaleLigne
}
/**
* \brief Mise a jour de l'objet ligne de propale en base
* \return int <0 si ko, >0 si ok
* Mise a jour de l'objet ligne de propale en base
*
* @return int <0 si ko, >0 si ok
*/
function update($notrigger=0)
{
@ -2692,9 +2703,10 @@ class PropaleLigne
$sql.= " , info_bits=".$this->info_bits;
if (strlen($this->special_code)) $sql.= " , special_code=".$this->special_code;
$sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
$sql.= " WHERE rowid = ".$this->rowid;
dol_syslog("PropaleLigne::update sql=$sql");
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@ -2714,7 +2726,7 @@ class PropaleLigne
else
{
$this->error=$this->db->error();
dol_syslog("PropaleLigne::update Error ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR);
$this->db->rollback();
return -2;
}

View File

@ -2222,6 +2222,13 @@ class Commande extends CommonObject
$staticline=new OrderLine($this->db);
$staticline->fetch($rowid);
$this->line->oldline = $staticline;
// Reorder if fk_parent_line change
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
{
$rangmax = $this->line_max($fk_parent_line);
$this->line->rang = $rangmax + 1;
}
$this->line->rowid=$rowid;
$this->line->desc=$desc;
@ -2250,6 +2257,9 @@ class Commande extends CommonObject
$result=$this->line->update();
if ($result > 0)
{
// Reorder if child line
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
// Mise a jour info denormalisees
$this->update_price(1);
@ -3095,11 +3105,10 @@ class OrderLine
if ($this->date_end) { $sql.= " , date_end='".$this->db->idate($this->date_end)."'"; }
$sql.= " , product_type=".$this->product_type;
$sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
$sql.= " WHERE rowid = ".$this->rowid;
dol_syslog("OrderLine::update sql=$sql");
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@ -3119,7 +3128,7 @@ class OrderLine
else
{
$this->error=$this->db->error();
dol_syslog("OrderLine::update Error ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR);
$this->db->rollback();
return -2;
}

View File

@ -2016,6 +2016,13 @@ class Facture extends CommonObject
$staticline=new FactureLigne($this->db);
$staticline->fetch($rowid);
$this->line->oldline = $staticline;
// Reorder if fk_parent_line change
if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line)
{
$rangmax = $this->line_max($fk_parent_line);
$this->line->rang = $rangmax + 1;
}
$this->line->rowid = $rowid;
$this->line->desc = $desc;
@ -2044,6 +2051,9 @@ class Facture extends CommonObject
$result=$this->line->update();
if ($result > 0)
{
// Reorder if child line
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
// Mise a jour info denormalisees au niveau facture
$this->update_price(1);
$this->db->commit();
@ -3567,8 +3577,9 @@ class FactureLigne
}
/**
* Update line into database
* @return int <0 if KO, >0 if OK
* Update line into database
*
* @return int <0 if KO, >0 if OK
*/
function update()
{
@ -3621,10 +3632,10 @@ class FactureLigne
$sql.= ",total_localtax1=".price2num($this->total_localtax1)."";
$sql.= ",total_localtax2=".price2num($this->total_localtax2)."";
$sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
$sql.= " WHERE rowid = ".$this->rowid;
dol_syslog("FactureLigne::update sql=".$sql);
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
@ -3643,7 +3654,7 @@ class FactureLigne
else
{
$this->error=$this->db->error();
dol_syslog("FactureLigne::update Error ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR);
$this->db->rollback();
return -2;
}

View File

@ -967,6 +967,8 @@ abstract class CommonObject
{
$sql = 'SELECT rang FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE rowid ='.$rowid;
dol_syslog(get_class($this)."::getRangOfLine sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
@ -1008,13 +1010,18 @@ abstract class CommonObject
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$sql.= ' AND fk_parent_line = '.$fk_parent_line;
dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
if (! empty($row[0])) {
if (! empty($row[0]))
{
return $row[0];
} else {
}
else
{
return $this->getRangOfLine($fk_parent_line);
}
}
@ -1024,6 +1031,8 @@ abstract class CommonObject
{
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
dol_syslog(get_class($this)."::line_max sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{

View File

@ -339,7 +339,7 @@ Module30Desc=Gestió de factures i abonaments de clients. Gestió factures de pr
Module40Name=Proveïdors
Module40Desc=Gestió de proveïdors
Module42Name=Syslog
Module42Desc=Utilització de logs (syslog)
Module42Desc=Generació de logs (arxius, syslog,...)
Module49Name=Editors
Module49Desc=Gestió d'editors
Module50Name=Productes

View File

@ -339,7 +339,7 @@ Module30Desc=Gestión de facturas y abonos a clientes. Gestión facturas de prov
Module40Name=Proveedores
Module40Desc=Gestión de proveedores
Module42Name=Syslog
Module42Desc=Utilización de logs (syslog)
Module42Desc=Generación de logs (archivos, syslog,...)
Module49Name=Editores
Module49Desc=Gestión de editores
Module50Name=Productos