Merge pull request #8597 from atm-florian/dev_uniformcode

fix syntax and uniformize code
This commit is contained in:
Laurent Destailleur 2018-04-15 11:26:18 +02:00 committed by GitHub
commit dbfee8117d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 121 additions and 91 deletions

View File

@ -1653,7 +1653,7 @@ class Propal extends CommonObject
$this->db->free($result); $this->db->free($result);
return 1; return $num;
} }
else else
{ {
@ -3814,6 +3814,8 @@ class PropaleLigne extends CommonObjectLine
$this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_tva = $objp->multicurrency_total_tva;
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$this->fetch_optionals();
$this->db->free($result); $this->db->free($result);
return 1; return 1;

View File

@ -318,6 +318,31 @@ class CommandeFournisseur extends CommonOrder
if ($this->statut == 0) $this->brouillon = 1; if ($this->statut == 0) $this->brouillon = 1;
/*
* Lines
*/
$result=$this->fetch_lines();
if ($result < 0)
{
return -3;
}
}
else
{
$this->error=$this->db->error()." sql=".$sql;
return -1;
}
}
/**
* Load array lines
*
* @param int $only_product Return only physical products
* @return int <0 if KO, >0 if OK
*/
function fetch_lines($only_product=0)
{
//$result=$this->fetch_lines(); //$result=$this->fetch_lines();
$this->lines=array(); $this->lines=array();
@ -332,6 +357,7 @@ class CommandeFournisseur extends CommonOrder
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
$sql.= " WHERE l.fk_commande = ".$this->id; $sql.= " WHERE l.fk_commande = ".$this->id;
if ($only_product) $sql .= ' AND p.fk_product_type = 0';
$sql.= " ORDER BY l.rang, l.rowid"; $sql.= " ORDER BY l.rang, l.rowid";
//print $sql; //print $sql;
@ -397,19 +423,17 @@ class CommandeFournisseur extends CommonOrder
$line->rang = $objp->rang; $line->rang = $objp->rang;
// Retreive all extrafield
// fetch optionals attributes and labels
$line->fetch_optionals();
$this->lines[$i] = $line; $this->lines[$i] = $line;
$i++; $i++;
} }
$this->db->free($result); $this->db->free($result);
return 1; return $num;
}
else
{
$this->error=$this->db->error()." sql=".$sql;
return -1;
}
} }
else else
{ {
@ -3161,6 +3185,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
$this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_tva = $objp->multicurrency_total_tva;
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$this->fetch_optionals();
$this->db->free($result); $this->db->free($result);
return 1; return 1;
} }

View File

@ -2695,6 +2695,8 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
$this->fetch_optionals();
return 1; return 1;
} }