mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 00:52:01 +01:00
Fix: dplacement de la fonction fetch_adresse_livraison dans la partie commune
This commit is contained in:
@@ -1163,20 +1163,7 @@ class Commande extends CommonObject
|
||||
if ($ligne->fk_product_type == 0) $nb++;
|
||||
}
|
||||
return $nb;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function fetch_adresse_livraison($id)
|
||||
{
|
||||
$idadresse = $id;
|
||||
$adresse = new Societe($this->db);
|
||||
$adresse->fetch_adresse_livraison($idadresse);
|
||||
$this->adresse = $adresse;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Charge tableau avec les exp<78>ditions par ligne
|
||||
@@ -1303,8 +1290,8 @@ class Commande extends CommonObject
|
||||
{
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "SELECT fk_product, qty";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet";
|
||||
$sql.= " WHERE rowid = '$idligne'";
|
||||
@@ -1313,59 +1300,59 @@ class Commande extends CommonObject
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
if ($obj)
|
||||
|
||||
if ($obj)
|
||||
{
|
||||
$product = new Product($this->db);
|
||||
$product->id = $obj->fk_product;
|
||||
|
||||
|
||||
$result=$product->ajust_stock_commande($obj->qty, 1);
|
||||
|
||||
// Supprime ligne
|
||||
|
||||
// Supprime ligne
|
||||
$ligne = new CommandeLigne($this->db);
|
||||
$ligne->id = $idligne;
|
||||
$ligne->fk_commande = $this->id; // On en a besoin dans les triggers
|
||||
$result=$ligne->delete();
|
||||
|
||||
if ($result > 0)
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$result=$this->update_price();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
$result=$this->update_price();
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1908,7 +1895,7 @@ class Commande extends CommonObject
|
||||
{
|
||||
global $conf, $lang;
|
||||
|
||||
$err = 0;
|
||||
$err = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@@ -2411,9 +2398,9 @@ class CommandeLigne
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->id."';";
|
||||
|
||||
dolibarr_syslog("CommandeLigne::delete sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
dolibarr_syslog("CommandeLigne::delete sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Appel des triggers
|
||||
@@ -2425,7 +2412,7 @@ class CommandeLigne
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dolibarr_syslog("CommandeLigne::delete ".$this->error);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user