mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: uniformize code
This commit is contained in:
parent
9aaf440b0d
commit
502bb75d2c
|
|
@ -569,7 +569,7 @@ if ($socid > 0)
|
|||
print '<td align="right" width="80">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
|
||||
print '<td width="20"> </td>';
|
||||
print '<td align="right" nowrap="nowrap">';
|
||||
$contrat->fetch_lignes();
|
||||
$contrat->fetch_lines();
|
||||
print $contrat->getLibStatut(4);
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
|
|
|||
|
|
@ -1066,7 +1066,8 @@ class Commande extends CommonObject
|
|||
$this->date_livraison = $this->db->jdate($obj->date_livraison);
|
||||
$this->fk_delivery_address = $obj->fk_adresse_livraison;
|
||||
$this->propale_id = $obj->fk_source;
|
||||
$this->lignes = array();
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
|
|
@ -1196,7 +1197,6 @@ class Commande extends CommonObject
|
|||
*/
|
||||
function fetch_lines($only_product=0)
|
||||
{
|
||||
$this->lignes=array(); // deprecated
|
||||
$this->lines=array();
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.fk_commande, l.description, l.price, l.qty, l.tva_tx,';
|
||||
|
|
@ -1257,8 +1257,8 @@ class Commande extends CommonObject
|
|||
$line->date_start = $this->db->jdate($objp->date_start);
|
||||
$line->date_end = $this->db->jdate($objp->date_end);
|
||||
|
||||
$this->lignes[$i] = $line; // For backward compatibility
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
|
|
@ -1281,9 +1281,9 @@ class Commande extends CommonObject
|
|||
function getNbOfProductsLines()
|
||||
{
|
||||
$nb=0;
|
||||
foreach($this->lines as $ligne)
|
||||
foreach($this->lines as $line)
|
||||
{
|
||||
if ($ligne->fk_product_type == 0) $nb++;
|
||||
if ($line->fk_product_type == 0) $nb++;
|
||||
}
|
||||
return $nb;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ class FactureRec extends Facture
|
|||
var $rang;
|
||||
var $special_code;
|
||||
|
||||
var $lignes=array(); // TODO deprecated
|
||||
var $lines=array();
|
||||
|
||||
|
||||
|
|
@ -142,7 +141,7 @@ class FactureRec extends Facture
|
|||
/*
|
||||
* Lines
|
||||
*/
|
||||
for ($i = 0 ; $i < sizeof($facsrc->lignes) ; $i++)
|
||||
for ($i = 0 ; $i < sizeof($facsrc->lines) ; $i++)
|
||||
{
|
||||
$result_insert = $this->addline($this->id,
|
||||
$facsrc->lines[$i]->desc,
|
||||
|
|
@ -304,7 +303,7 @@ class FactureRec extends Facture
|
|||
|
||||
|
||||
/**
|
||||
* \brief Recupere les lignes de factures predefinies dans this->lignes
|
||||
* \brief Recupere les lignes de factures predefinies dans this->lines
|
||||
* \return int 1 if OK, < 0 if KO
|
||||
*/
|
||||
function fetch_lines()
|
||||
|
|
@ -359,7 +358,6 @@ class FactureRec extends Facture
|
|||
$line->price = $objp->price;
|
||||
$line->remise = $objp->remise;
|
||||
|
||||
$this->lignes[$i] = $line; // TODO deprecated
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ class Facture extends CommonObject
|
|||
var $mode_reglement_code; // Code in llx_c_paiement
|
||||
var $modelpdf;
|
||||
var $products=array(); // TODO deprecated
|
||||
var $lignes=array(); // TODO deprecated
|
||||
var $lines=array();
|
||||
var $line;
|
||||
//! Pour board
|
||||
|
|
@ -708,7 +707,6 @@ class Facture extends CommonObject
|
|||
* Lines
|
||||
*/
|
||||
|
||||
$this->lignes = array(); // deprecated
|
||||
$this->lines = array();
|
||||
|
||||
$result=$this->fetch_lines();
|
||||
|
|
@ -737,7 +735,7 @@ class Facture extends CommonObject
|
|||
|
||||
|
||||
/**
|
||||
* \brief Recupere les lignes de factures dans this->lignes
|
||||
* \brief Recupere les lignes de factures dans this->lines
|
||||
* \return int 1 if OK, < 0 if KO
|
||||
*/
|
||||
function fetch_lines()
|
||||
|
|
@ -798,7 +796,6 @@ class Facture extends CommonObject
|
|||
$line->price = $objp->price;
|
||||
$line->remise = $objp->remise;
|
||||
|
||||
$this->lignes[$i] = $line; // TODO deprecated
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
|
|
@ -1502,14 +1499,14 @@ class Facture extends CommonObject
|
|||
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||
|
||||
// Loop on each line
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
|
||||
{
|
||||
if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0)
|
||||
if ($this->lines[$i]->fk_product > 0 && $this->lines[$i]->product_type == 0)
|
||||
{
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We decrease stock for product
|
||||
$entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvP->livraison($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
|
||||
$result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice);
|
||||
if ($result < 0) { $error++; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1610,14 +1607,14 @@ class Facture extends CommonObject
|
|||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
|
||||
{
|
||||
if ($this->lignes[$i]->fk_product && $this->lignes[$i]->product_type == 0)
|
||||
if ($this->lines[$i]->fk_product && $this->lines[$i]->product_type == 0)
|
||||
{
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We decrease stock for product
|
||||
$entrepot_id = "1"; // TODO ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
|
||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1792,7 +1789,7 @@ class Facture extends CommonObject
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->error=$ligne->error;
|
||||
$this->error=$this->line->error;
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
|
@ -2536,9 +2533,9 @@ class Facture extends CommonObject
|
|||
{
|
||||
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees
|
||||
$ventilExportCompta = 0 ;
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
|
||||
{
|
||||
if ($this->lignes[$i]->export_compta <> 0 && $this->lignes[$i]->code_ventilation <> 0)
|
||||
if ($this->lines[$i]->export_compta <> 0 && $this->lines[$i]->code_ventilation <> 0)
|
||||
{
|
||||
$ventilExportCompta++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ else
|
|||
print '<td align="center">'.$langs->trans("ReductionShort").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Qty").'</td></tr>';
|
||||
|
||||
$num = sizeof($fac->lignes);
|
||||
$num = sizeof($fac->lines);
|
||||
$i = 0;
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
|
|
@ -421,7 +421,7 @@ else
|
|||
$product_static=new Product($db);
|
||||
|
||||
// Show product and description
|
||||
$type=$fac->lignes[$i]->product_type?$fac->lignes[$i]->product_type:$fac->lignes[$i]->fk_product_type;
|
||||
$type=$fac->lines[$i]->product_type?$fac->lines[$i]->product_type:$fac->lines[$i]->fk_product_type;
|
||||
// Try to enhance type detection using date_start and date_end for free lines when type
|
||||
// was not saved.
|
||||
if (! empty($objp->date_start)) $type=1;
|
||||
|
|
@ -429,26 +429,26 @@ else
|
|||
|
||||
// Show line
|
||||
print "<tr $bc[$var]>";
|
||||
if ($fac->lignes[$i]->fk_product > 0)
|
||||
if ($fac->lines[$i]->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
print '<a name="'.$fac->lignes[$i]->id.'"></a>'; // ancre pour retourner sur la ligne
|
||||
print '<a name="'.$fac->lines[$i]->id.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
// Show product and description
|
||||
$product_static->type=$fac->lignes[$i]->fk_product_type;
|
||||
$product_static->id=$fac->lignes[$i]->fk_product;
|
||||
$product_static->ref=$fac->lignes[$i]->product_ref;
|
||||
$product_static->libelle=$fac->lignes[$i]->libelle;
|
||||
$product_static->type=$fac->lines[$i]->fk_product_type;
|
||||
$product_static->id=$fac->lines[$i]->fk_product;
|
||||
$product_static->ref=$fac->lines[$i]->product_ref;
|
||||
$product_static->libelle=$fac->lines[$i]->libelle;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
$text.= ' - '.$fac->lignes[$i]->libelle;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($fac->lignes[$i]->desc));
|
||||
$text.= ' - '.$fac->lines[$i]->libelle;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($fac->lines[$i]->desc));
|
||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
|
||||
// Show range
|
||||
print_date_range($fac->lignes[$i]->date_start,$fac->lignes[$i]->date_end);
|
||||
print_date_range($fac->lines[$i]->date_start,$fac->lines[$i]->date_end);
|
||||
|
||||
// Add description in form
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM) print ($fac->lignes[$i]->desc && $fac->lignes[$i]->desc!=$fac->lignes[$i]->libelle)?'<br>'.dol_htmlentitiesbr($fac->lignes[$i]->desc):'';
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM) print ($fac->lines[$i]->desc && $fac->lines[$i]->desc!=$fac->lines[$i]->libelle)?'<br>'.dol_htmlentitiesbr($fac->lines[$i]->desc):'';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
|
|
@ -458,16 +458,16 @@ else
|
|||
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
print $text.' '.nl2br($fac->lignes[$i]->desc);
|
||||
print $text.' '.nl2br($fac->lines[$i]->desc);
|
||||
|
||||
// Show range
|
||||
print_date_range($fac->lignes[$i]->date_start,$fac->lignes[$i]->date_end);
|
||||
print_date_range($fac->lines[$i]->date_start,$fac->lines[$i]->date_end);
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print "<td align=\"right\">".price($fac->lignes[$i]->price)."</td>";
|
||||
print '<td align="center">'.$fac->lignes[$i]->remise_percent.' %</td>';
|
||||
print "<td align=\"center\">".$fac->lignes[$i]->qty."</td></tr>\n";
|
||||
print "<td align=\"right\">".price($fac->lines[$i]->price)."</td>";
|
||||
print '<td align="center">'.$fac->lines[$i]->remise_percent.' %</td>';
|
||||
print "<td align=\"center\">".$fac->lines[$i]->qty."</td></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
|
|
|
|||
|
|
@ -96,20 +96,20 @@ class BonPrelevement extends CommonObject
|
|||
function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number)
|
||||
{
|
||||
$result = 0;
|
||||
$ligne_id = 0;
|
||||
$line_id = 0;
|
||||
|
||||
$result = $this->AddLigne($ligne_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number);
|
||||
$result = $this->AddLigne($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number);
|
||||
|
||||
if ($result == 0)
|
||||
{
|
||||
if ($ligne_id > 0)
|
||||
if ($line_id > 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture (";
|
||||
$sql.= "fk_facture";
|
||||
$sql.= ",fk_prelevement_lignes";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= $facture_id;
|
||||
$sql.= ", ".$ligne_id;
|
||||
$sql.= ", ".$line_id;
|
||||
$sql.= ")";
|
||||
|
||||
if ($this->db->query($sql))
|
||||
|
|
@ -149,7 +149,7 @@ class BonPrelevement extends CommonObject
|
|||
* @param number bank account number
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function AddLigne(&$ligne_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number)
|
||||
function AddLigne(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number)
|
||||
{
|
||||
$result = -1;
|
||||
$concat = 0;
|
||||
|
|
@ -202,7 +202,7 @@ class BonPrelevement extends CommonObject
|
|||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$ligne_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
|
||||
$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
|
||||
$result = 0;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class Contrat extends CommonObject
|
|||
|
||||
var $fk_projet;
|
||||
|
||||
var $lignes=array();
|
||||
var $lines=array();
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -192,10 +192,10 @@ class Contrat extends CommonObject
|
|||
$this->db->begin();
|
||||
|
||||
// Load lines
|
||||
$this->fetch_lignes();
|
||||
$this->fetch_lines();
|
||||
|
||||
$ok=true;
|
||||
foreach($this->lignes as $contratline)
|
||||
foreach($this->lines as $contratline)
|
||||
{
|
||||
// Close line not already closed
|
||||
if ($contratline->statut != 5)
|
||||
|
|
@ -335,10 +335,10 @@ class Contrat extends CommonObject
|
|||
}
|
||||
|
||||
/**
|
||||
* Load lignes array into this->lignes
|
||||
* Load lignes array into this->lines
|
||||
* @return Array Return array of contract lines
|
||||
*/
|
||||
function fetch_lignes()
|
||||
function fetch_lines()
|
||||
{
|
||||
$this->nbofserviceswait=0;
|
||||
$this->nbofservicesopened=0;
|
||||
|
|
@ -369,7 +369,7 @@ class Contrat extends CommonObject
|
|||
$sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid";
|
||||
$sql.= " ORDER by d.rowid ASC";
|
||||
|
||||
dol_syslog("Contrat::fetch_lignes sql=".$sql);
|
||||
dol_syslog("Contrat::fetch_lines sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
|
@ -378,58 +378,60 @@ class Contrat extends CommonObject
|
|||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$ligne = new ContratLigne($this->db);
|
||||
$ligne->id = $objp->rowid;
|
||||
$ligne->ref = $objp->rowid;
|
||||
$ligne->fk_contrat = $objp->fk_contrat;
|
||||
$ligne->desc = $objp->description; // Description ligne
|
||||
$ligne->qty = $objp->qty;
|
||||
$ligne->tva_tx = $objp->tva_tx;
|
||||
$ligne->localtax1_tx = $objp->localtax1_tx;
|
||||
$ligne->localtax2_tx = $objp->localtax2_tx;
|
||||
$ligne->subprice = $objp->subprice;
|
||||
$ligne->statut = $objp->statut;
|
||||
$ligne->remise_percent = $objp->remise_percent;
|
||||
$ligne->price_ht = $objp->price_ht;
|
||||
$ligne->price = $objp->price; // For backward compatibility
|
||||
$ligne->total_ht = $objp->total_ht;
|
||||
$ligne->total_tva = $objp->total_tva;
|
||||
$ligne->total_localtax1= $objp->total_localtax1;
|
||||
$ligne->total_localtax2= $objp->total_localtax2;
|
||||
$ligne->total_ttc = $objp->total_ttc;
|
||||
$ligne->fk_product = $objp->fk_product;
|
||||
$ligne->info_bits = $objp->info_bits;
|
||||
$line = new ContratLigne($this->db);
|
||||
$line->id = $objp->rowid;
|
||||
$line->ref = $objp->rowid;
|
||||
$line->fk_contrat = $objp->fk_contrat;
|
||||
$line->desc = $objp->description; // Description ligne
|
||||
$line->qty = $objp->qty;
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
$line->localtax1_tx = $objp->localtax1_tx;
|
||||
$line->localtax2_tx = $objp->localtax2_tx;
|
||||
$line->subprice = $objp->subprice;
|
||||
$line->statut = $objp->statut;
|
||||
$line->remise_percent = $objp->remise_percent;
|
||||
$line->price_ht = $objp->price_ht;
|
||||
$line->price = $objp->price; // For backward compatibility
|
||||
$line->total_ht = $objp->total_ht;
|
||||
$line->total_tva = $objp->total_tva;
|
||||
$line->total_localtax1 = $objp->total_localtax1;
|
||||
$line->total_localtax2 = $objp->total_localtax2;
|
||||
$line->total_ttc = $objp->total_ttc;
|
||||
$line->fk_product = $objp->fk_product;
|
||||
$line->info_bits = $objp->info_bits;
|
||||
|
||||
$ligne->fk_user_author = $objp->fk_user_author;
|
||||
$ligne->fk_user_ouverture= $objp->fk_user_ouverture;
|
||||
$ligne->fk_user_cloture = $objp->fk_user_cloture;
|
||||
$line->fk_user_author = $objp->fk_user_author;
|
||||
$line->fk_user_ouverture= $objp->fk_user_ouverture;
|
||||
$line->fk_user_cloture = $objp->fk_user_cloture;
|
||||
|
||||
$ligne->ref = $objp->ref;
|
||||
$ligne->libelle = $objp->label; // Label produit
|
||||
$ligne->label = $objp->label; // For backward compatibility
|
||||
$ligne->product_desc = $objp->product_desc; // Description produit
|
||||
$line->ref = $objp->ref;
|
||||
$line->libelle = $objp->label; // Label produit
|
||||
$line->label = $objp->label; // For backward compatibility
|
||||
$line->product_desc = $objp->product_desc; // Description produit
|
||||
|
||||
$ligne->description = $objp->description;
|
||||
$line->description = $objp->description;
|
||||
|
||||
$ligne->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
||||
$ligne->date_ouverture = $this->db->jdate($objp->date_ouverture);
|
||||
$ligne->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
|
||||
$ligne->date_cloture = $this->db->jdate($objp->date_cloture);
|
||||
$line->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
||||
$line->date_ouverture = $this->db->jdate($objp->date_ouverture);
|
||||
$line->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
|
||||
$line->date_cloture = $this->db->jdate($objp->date_cloture);
|
||||
// For backward compatibility
|
||||
$ligne->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
||||
$ligne->date_debut_reel = $this->db->jdate($objp->date_ouverture);
|
||||
$ligne->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
||||
$ligne->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
||||
$this->lignes[] = $ligne;
|
||||
//dol_syslog("1 ".$ligne->desc);
|
||||
//dol_syslog("2 ".$ligne->product_desc);
|
||||
$line->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
||||
$line->date_debut_reel = $this->db->jdate($objp->date_ouverture);
|
||||
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
||||
$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
||||
|
||||
$this->lines[] = $line;
|
||||
|
||||
//dol_syslog("1 ".$line->desc);
|
||||
//dol_syslog("2 ".$line->product_desc);
|
||||
|
||||
if ($ligne->statut == 0) $this->nbofserviceswait++;
|
||||
if ($ligne->statut == 4 && (empty($ligne->date_fin_prevue) || $ligne->date_fin_prevue >= $now)) $this->nbofservicesopened++;
|
||||
if ($ligne->statut == 4 && $ligne->date_fin_prevue < $now) $this->nbofservicesexpired++;
|
||||
if ($ligne->statut == 5) $this->nbofservicesclosed++;
|
||||
if ($line->statut == 0) $this->nbofserviceswait++;
|
||||
if ($line->statut == 4 && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++;
|
||||
if ($line->statut == 4 && $line->date_fin_prevue < $now) $this->nbofservicesexpired++;
|
||||
if ($line->statut == 5) $this->nbofservicesclosed++;
|
||||
|
||||
$total_ttc+=$objp->total_ttc; // TODO Not saved into database
|
||||
$total_vat+=$objp->total_tva;
|
||||
|
|
@ -472,51 +474,51 @@ class Contrat extends CommonObject
|
|||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$ligne = new ContratLigne($this->db);
|
||||
$ligne->id = $objp->rowid;
|
||||
$ligne->fk_contrat = $objp->fk_contrat;
|
||||
$ligne->libelle = $objp->description;
|
||||
$ligne->desc = $objp->description;
|
||||
$ligne->qty = $objp->qty;
|
||||
$ligne->statut = $objp->statut;
|
||||
$ligne->ref = $objp->ref;
|
||||
$ligne->tva_tx = $objp->tva_tx;
|
||||
$ligne->localtax1_tx = $objp->localtax1_tx;
|
||||
$ligne->localtax2_tx = $objp->localtax2_tx;
|
||||
$ligne->subprice = $objp->subprice;
|
||||
$ligne->remise_percent = $objp->remise_percent;
|
||||
$ligne->price_ht = $objp->price_ht;
|
||||
$ligne->price = $objp->price; // For backward compatibility
|
||||
$ligne->total_ht = $objp->total_ht;
|
||||
$ligne->total_tva = $objp->total_tva;
|
||||
$ligne->total_localtax1= $objp->total_localtax1;
|
||||
$ligne->total_localtax2= $objp->total_localtax2;
|
||||
$ligne->total_ttc = $objp->total_ttc;
|
||||
$ligne->fk_product = 0;
|
||||
$ligne->info_bits = $objp->info_bits;
|
||||
$line = new ContratLigne($this->db);
|
||||
$line->id = $objp->rowid;
|
||||
$line->fk_contrat = $objp->fk_contrat;
|
||||
$line->libelle = $objp->description;
|
||||
$line->desc = $objp->description;
|
||||
$line->qty = $objp->qty;
|
||||
$line->statut = $objp->statut;
|
||||
$line->ref = $objp->ref;
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
$line->localtax1_tx = $objp->localtax1_tx;
|
||||
$line->localtax2_tx = $objp->localtax2_tx;
|
||||
$line->subprice = $objp->subprice;
|
||||
$line->remise_percent = $objp->remise_percent;
|
||||
$line->price_ht = $objp->price_ht;
|
||||
$line->price = $objp->price; // For backward compatibility
|
||||
$line->total_ht = $objp->total_ht;
|
||||
$line->total_tva = $objp->total_tva;
|
||||
$line->total_localtax1= $objp->total_localtax1;
|
||||
$line->total_localtax2= $objp->total_localtax2;
|
||||
$line->total_ttc = $objp->total_ttc;
|
||||
$line->fk_product = 0;
|
||||
$line->info_bits = $objp->info_bits;
|
||||
|
||||
$ligne->fk_user_author = $objp->fk_user_author;
|
||||
$ligne->fk_user_ouverture= $objp->fk_user_ouverture;
|
||||
$ligne->fk_user_cloture = $objp->fk_user_cloture;
|
||||
$line->fk_user_author = $objp->fk_user_author;
|
||||
$line->fk_user_ouverture= $objp->fk_user_ouverture;
|
||||
$line->fk_user_cloture = $objp->fk_user_cloture;
|
||||
|
||||
$ligne->description = $objp->description;
|
||||
$line->description = $objp->description;
|
||||
|
||||
$ligne->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
||||
$ligne->date_ouverture = $this->db->jdate($objp->date_ouverture);
|
||||
$ligne->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
|
||||
$ligne->date_cloture = $this->db->jdate($objp->date_cloture);
|
||||
$line->date_ouverture_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
||||
$line->date_ouverture = $this->db->jdate($objp->date_ouverture);
|
||||
$line->date_fin_validite = $this->db->jdate($objp->date_fin_validite);
|
||||
$line->date_cloture = $this->db->jdate($objp->date_cloture);
|
||||
// For backward compatibility
|
||||
$ligne->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
||||
$ligne->date_debut_reel = $this->db->jdate($objp->date_ouverture);
|
||||
$ligne->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
||||
$ligne->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
||||
$line->date_debut_prevue = $this->db->jdate($objp->date_ouverture_prevue);
|
||||
$line->date_debut_reel = $this->db->jdate($objp->date_ouverture);
|
||||
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
||||
$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
||||
|
||||
if ($ligne->statut == 0) $this->nbofserviceswait++;
|
||||
if ($ligne->statut == 4 && (empty($ligne->date_fin_prevue) || $ligne->date_fin_prevue >= $now)) $this->nbofservicesopened++;
|
||||
if ($ligne->statut == 4 && $ligne->date_fin_prevue < $now) $this->nbofservicesexpired++;
|
||||
if ($ligne->statut == 5) $this->nbofservicesclosed++;
|
||||
if ($line->statut == 0) $this->nbofserviceswait++;
|
||||
if ($line->statut == 4 && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++;
|
||||
if ($line->statut == 4 && $line->date_fin_prevue < $now) $this->nbofservicesexpired++;
|
||||
if ($line->statut == 5) $this->nbofservicesclosed++;
|
||||
|
||||
$this->lignes[] = $ligne;
|
||||
$this->lines[] = $line;
|
||||
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
$total_vat+=$objp->total_tva;
|
||||
|
|
@ -534,12 +536,12 @@ class Contrat extends CommonObject
|
|||
return -2;
|
||||
}
|
||||
|
||||
$this->nbofservices=sizeof($this->lignes);
|
||||
$this->nbofservices=sizeof($this->lines);
|
||||
$this->total_ttc = price2num($total_ttc); // TODO For the moment value is false as value is not stored in database for line linked to products
|
||||
$this->total_vat = price2num($total_vat); // TODO For the moment value is false as value is not stored in database for line linked to products
|
||||
$this->total_ht = price2num($total_ht); // TODO For the moment value is false as value is not stored in database for line linked to products
|
||||
|
||||
return $this->lignes;
|
||||
return $this->lines;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1024,11 +1026,11 @@ class Contrat extends CommonObject
|
|||
// If draft, we keep it (should not happen)
|
||||
if ($this->statut == 0) return 1;
|
||||
|
||||
// Load $this->lignes array
|
||||
// $this->fetch_lignes();
|
||||
// Load $this->lines array
|
||||
// $this->fetch_lines();
|
||||
|
||||
$newstatut=1;
|
||||
foreach($this->lignes as $key => $contractline)
|
||||
foreach($this->lines as $key => $contractline)
|
||||
{
|
||||
// if ($contractline) // Loop on each service
|
||||
}
|
||||
|
|
@ -1418,19 +1420,19 @@ class Contrat extends CommonObject
|
|||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
$ligne=new ContratLigne($this->db);
|
||||
$ligne->desc=$langs->trans("Description")." ".$xnbp;
|
||||
$ligne->qty=1;
|
||||
$ligne->subprice=100;
|
||||
$ligne->price=100;
|
||||
$ligne->tva_tx=19.6;
|
||||
$ligne->remise_percent=10;
|
||||
$ligne->total_ht=90;
|
||||
$ligne->total_ttc=107.64; // 90 * 1.196
|
||||
$ligne->total_tva=17.64;
|
||||
$line=new ContratLigne($this->db);
|
||||
$line->desc=$langs->trans("Description")." ".$xnbp;
|
||||
$line->qty=1;
|
||||
$line->subprice=100;
|
||||
$line->price=100;
|
||||
$line->tva_tx=19.6;
|
||||
$line->remise_percent=10;
|
||||
$line->total_ht=90;
|
||||
$line->total_ttc=107.64; // 90 * 1.196
|
||||
$line->total_tva=17.64;
|
||||
$prodid = rand(1, $num_prods);
|
||||
$ligne->fk_product=$prodids[$prodid];
|
||||
$this->lignes[$xnbp]=$ligne;
|
||||
$line->fk_product=$prodids[$prodid];
|
||||
$this->lines[$xnbp]=$line;
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ else
|
|||
if ($result > 0)
|
||||
{
|
||||
$id = $contrat->id; // if $_GET['ref']
|
||||
$result=$contrat->fetch_lignes();
|
||||
$result=$contrat->fetch_lines();
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
|
|
@ -655,7 +655,7 @@ else
|
|||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
$nbofservices=sizeof($contrat->lignes);
|
||||
$nbofservices=sizeof($contrat->lines);
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($contrat->user_author_id);
|
||||
|
|
@ -805,7 +805,7 @@ else
|
|||
$sql.= " p.ref, p.label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
|
||||
$sql.= " WHERE cd.rowid = ".$contrat->lignes[$cursorline-1]->id;
|
||||
$sql.= " WHERE cd.rowid = ".$contrat->lines[$cursorline-1]->id;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
|
@ -982,7 +982,7 @@ else
|
|||
/*
|
||||
* Confirmation to delete service line of contract
|
||||
*/
|
||||
if ($_REQUEST["action"] == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lignes[$cursorline-1]->id == $_GET["rowid"])
|
||||
if ($_REQUEST["action"] == 'deleteline' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lines[$cursorline-1]->id == $_GET["rowid"])
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$contrat->id."&lineid=".$_GET["rowid"],$langs->trans("DeleteContractLine"),$langs->trans("ConfirmDeleteContractLine"),"confirm_deleteline",'',0,1);
|
||||
if ($ret == 'html') print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[false].' height="6"><td></td></tr></table>';
|
||||
|
|
@ -991,7 +991,7 @@ else
|
|||
/*
|
||||
* Confirmation to move service toward another contract
|
||||
*/
|
||||
if ($_REQUEST["action"] == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lignes[$cursorline-1]->id == $_GET["rowid"])
|
||||
if ($_REQUEST["action"] == 'move' && ! $_REQUEST["cancel"] && $user->rights->contrat->creer && $contrat->lines[$cursorline-1]->id == $_GET["rowid"])
|
||||
{
|
||||
$arraycontractid=array();
|
||||
foreach($arrayothercontracts as $contractcursor)
|
||||
|
|
@ -1011,7 +1011,7 @@ else
|
|||
/*
|
||||
* Confirmation de la validation activation
|
||||
*/
|
||||
if ($_REQUEST["action"] == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $contrat->lignes[$cursorline-1]->id == $_GET["ligne"])
|
||||
if ($_REQUEST["action"] == 'active' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $contrat->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
{
|
||||
$dateactstart = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
$dateactend = dol_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
|
||||
|
|
@ -1023,7 +1023,7 @@ else
|
|||
/*
|
||||
* Confirmation de la validation fermeture
|
||||
*/
|
||||
if ($_REQUEST["action"] == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $contrat->lignes[$cursorline-1]->id == $_GET["ligne"])
|
||||
if ($_REQUEST["action"] == 'closeline' && ! $_REQUEST["cancel"] && $user->rights->contrat->activer && $contrat->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
{
|
||||
$dateactstart = dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
$dateactend = dol_mktime(12, 0 , 0, $_POST["endmonth"], $_POST["endday"], $_POST["endyear"]);
|
||||
|
|
@ -1039,7 +1039,7 @@ else
|
|||
print '<table class="notopnoleft" width="100%">';
|
||||
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td>'.$langs->trans("ServiceStatus").': '.$contrat->lignes[$cursorline-1]->getLibStatut(4).'</td>';
|
||||
print '<td>'.$langs->trans("ServiceStatus").': '.$contrat->lines[$cursorline-1]->getLibStatut(4).'</td>';
|
||||
print '<td width="30" align="right">';
|
||||
if ($user->societe_id == 0)
|
||||
{
|
||||
|
|
@ -1047,7 +1047,7 @@ else
|
|||
{
|
||||
$action='activateline';
|
||||
if ($objp->statut == 4) $action='unactivateline';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$contrat->id.'&ligne='.$contrat->lignes[$cursorline-1]->id.'&action='.$action.'">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$contrat->id.'&ligne='.$contrat->lines[$cursorline-1]->id.'&action='.$action.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
}
|
||||
|
|
@ -1086,7 +1086,7 @@ else
|
|||
print '</table>';
|
||||
}
|
||||
|
||||
if ($user->rights->contrat->activer && $_REQUEST["action"] == 'activateline' && $contrat->lignes[$cursorline-1]->id == $_GET["ligne"])
|
||||
if ($user->rights->contrat->activer && $_REQUEST["action"] == 'activateline' && $contrat->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
{
|
||||
/**
|
||||
* Activer la ligne de contrat
|
||||
|
|
@ -1136,12 +1136,12 @@ else
|
|||
print '</form>';
|
||||
}
|
||||
|
||||
if ($user->rights->contrat->activer && $_REQUEST["action"] == 'unactivateline' && $contrat->lignes[$cursorline-1]->id == $_GET["ligne"])
|
||||
if ($user->rights->contrat->activer && $_REQUEST["action"] == 'unactivateline' && $contrat->lines[$cursorline-1]->id == $_GET["ligne"])
|
||||
{
|
||||
/**
|
||||
* Desactiver la ligne de contrat
|
||||
*/
|
||||
print '<form name="closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$contrat->id.'&ligne='.$contrat->lignes[$cursorline-1]->id.'&action=closeline" method="post">';
|
||||
print '<form name="closeline" action="'.$_SERVER["PHP_SELF"].'?id='.$contrat->id.'&ligne='.$contrat->lines[$cursorline-1]->id.'&action=closeline" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ $var=true;
|
|||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
$linkedObjectBlock->fetch($objectid[$i]);
|
||||
$linkedObjectBlock->fetch_lignes();
|
||||
$linkedObjectBlock->fetch_lines();
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> ><td>
|
||||
|
|
|
|||
|
|
@ -229,11 +229,11 @@ class Translate {
|
|||
{
|
||||
if ($usecachekey) $tabtranslatedomain=array(); // To save lang content in cache
|
||||
|
||||
while ($ligne = fgets($fp,4096)) // Ex: Need 225ms for all fgets on all lang file for Third party page. Same speed than file_get_contents
|
||||
while ($line = fgets($fp,4096)) // Ex: Need 225ms for all fgets on all lang file for Third party page. Same speed than file_get_contents
|
||||
{
|
||||
if ($ligne[0] != "\n" && $ligne[0] != " " && $ligne[0] != "#")
|
||||
if ($line[0] != "\n" && $line[0] != " " && $line[0] != "#")
|
||||
{
|
||||
$tab=explode('=',$ligne,2);
|
||||
$tab=explode('=',$line,2);
|
||||
$key=trim($tab[0]);
|
||||
//print "Domain=$domain, found a string for $tab[0] with value $tab[1]<br>";
|
||||
if (empty($this->tab_translate[$key]) && isset($tab[1]))
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ class Expedition extends CommonObject
|
|||
var $modelpdf;
|
||||
var $origin;
|
||||
var $origin_id;
|
||||
var $lignes=array(); // TODO deprecated
|
||||
var $lines=array();
|
||||
var $expedition_method_id;
|
||||
var $statut;
|
||||
|
|
@ -77,7 +76,7 @@ class Expedition extends CommonObject
|
|||
function Expedition($DB)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->lignes = array();
|
||||
$this->lines = array();
|
||||
$this->products = array();
|
||||
|
||||
// List of long language codes for status
|
||||
|
|
@ -158,9 +157,9 @@ class Expedition extends CommonObject
|
|||
if ($this->db->query($sql))
|
||||
{
|
||||
// Insertion des lignes
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
|
||||
{
|
||||
if (! $this->create_line($this->lignes[$i]->entrepot_id, $this->lignes[$i]->origin_line_id, $this->lignes[$i]->qty) > 0)
|
||||
if (! $this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty) > 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
|
@ -410,9 +409,9 @@ class Expedition extends CommonObject
|
|||
dol_syslog("Expedition::valid movement index ".$i);
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($this->lignes[$i]->fk_product > 0 && $this->lignes[$i]->product_type == 0)
|
||||
if ($this->lines[$i]->fk_product > 0 && $this->lines[$i]->product_type == 0)
|
||||
{
|
||||
//var_dump($this->lignes[$i]);
|
||||
//var_dump($this->lines[$i]);
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
// We decrement stock of product (and sub-products)
|
||||
// We use warehouse selected for each line
|
||||
|
|
@ -529,14 +528,14 @@ class Expedition extends CommonObject
|
|||
*/
|
||||
function addline( $entrepot_id, $id, $qty )
|
||||
{
|
||||
$num = sizeof($this->lignes);
|
||||
$num = sizeof($this->lines);
|
||||
$line = new ExpeditionLigne($this->db);
|
||||
|
||||
$line->entrepot_id = $entrepot_id;
|
||||
$line->origin_line_id = $id;
|
||||
$line->qty = $qty;
|
||||
|
||||
$this->lignes[$num] = $line;
|
||||
$this->lines[$num] = $line;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -783,7 +782,6 @@ class Expedition extends CommonObject
|
|||
$line->volume = $obj->volume;
|
||||
$line->volume_units = $obj->volume_units;
|
||||
|
||||
$this->lignes[$i] = $line; // TODO deprecated
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
|
|
@ -920,15 +918,15 @@ class Expedition extends CommonObject
|
|||
$xnbp = 0;
|
||||
while ($xnbp < $nbp)
|
||||
{
|
||||
$ligne=new ExpeditionLigne($this->db);
|
||||
$ligne->desc=$langs->trans("Description")." ".$xnbp;
|
||||
$ligne->libelle=$langs->trans("Description")." ".$xnbp;
|
||||
$ligne->qty=10;
|
||||
$ligne->qty_asked=5;
|
||||
$ligne->qty_shipped=4;
|
||||
$ligne->fk_product=$this->commande->lignes[$xnbp]->fk_product;
|
||||
$line=new ExpeditionLigne($this->db);
|
||||
$line->desc=$langs->trans("Description")." ".$xnbp;
|
||||
$line->libelle=$langs->trans("Description")." ".$xnbp;
|
||||
$line->qty=10;
|
||||
$line->qty_asked=5;
|
||||
$line->qty_shipped=4;
|
||||
$line->fk_product=$this->commande->lines[$xnbp]->fk_product;
|
||||
|
||||
$this->lignes[]=$ligne;
|
||||
$this->lines[]=$line;
|
||||
$xnbp++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ if ($_POST["action"] == 'add')
|
|||
$expedition->tracking_number = $_POST["tracking_number"];
|
||||
|
||||
//var_dump($_POST);exit;
|
||||
for ($i = 0 ; $i < sizeof($object->lignes) ; $i++)
|
||||
for ($i = 0 ; $i < sizeof($object->lines) ; $i++)
|
||||
{
|
||||
$qty = "qtyl".$i;
|
||||
if ($_POST[$qty] > 0)
|
||||
|
|
@ -447,8 +447,8 @@ if ($_GET["action"] == 'create')
|
|||
*/
|
||||
print '<br><table class="nobordernopadding" width="100%">';
|
||||
|
||||
//$lignes = $object->fetch_lines(1);
|
||||
$numAsked = sizeof($object->lignes);
|
||||
//$lines = $object->fetch_lines(1);
|
||||
$numAsked = sizeof($object->lines);
|
||||
|
||||
/* Lecture des expeditions deja effectuees */
|
||||
$object->loadExpeditions();
|
||||
|
|
@ -654,8 +654,8 @@ else
|
|||
dol_print_error($db,$expedition->error);
|
||||
exit -1;
|
||||
}
|
||||
$lignes = $expedition->lignes;
|
||||
$num_prod = sizeof($lignes);
|
||||
$lines = $expedition->lines;
|
||||
$num_prod = sizeof($lines);
|
||||
|
||||
if ($expedition->id > 0)
|
||||
{
|
||||
|
|
@ -723,30 +723,30 @@ else
|
|||
{
|
||||
$weightUnit=0;
|
||||
$volumeUnit=0;
|
||||
if (! empty($lignes[$i]->weight_units)) $weightUnit = $lignes[$i]->weight_units;
|
||||
if (! empty($lignes[$i]->volume_units)) $volumeUnit = $lignes[$i]->volume_units;
|
||||
if (! empty($lines[$i]->weight_units)) $weightUnit = $lines[$i]->weight_units;
|
||||
if (! empty($lines[$i]->volume_units)) $volumeUnit = $lines[$i]->volume_units;
|
||||
// TODO Use a function addvalueunits(val1,unit1,val2,unit2)=>(val,unit)
|
||||
if ($lignes[$i]->weight_units < 50)
|
||||
if ($lines[$i]->weight_units < 50)
|
||||
{
|
||||
$trueWeightUnit=pow(10,$weightUnit);
|
||||
$totalWeight += $lignes[$i]->weight*$lignes[$i]->qty_shipped*$trueWeightUnit;
|
||||
$totalWeight += $lines[$i]->weight*$lines[$i]->qty_shipped*$trueWeightUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$trueWeightUnit=$weightUnit;
|
||||
$totalWeight += $lignes[$i]->weight*$lignes[$i]->qty_shipped;
|
||||
$totalWeight += $lines[$i]->weight*$lines[$i]->qty_shipped;
|
||||
}
|
||||
if ($lignes[$i]->volume_units < 50)
|
||||
if ($lines[$i]->volume_units < 50)
|
||||
{
|
||||
//print $lignes[$i]->volume."x".$lignes[$i]->volume_units."x".($lignes[$i]->volume_units < 50)."x".$volumeUnit;
|
||||
//print $lines[$i]->volume."x".$lines[$i]->volume_units."x".($lines[$i]->volume_units < 50)."x".$volumeUnit;
|
||||
$trueVolumeUnit=pow(10,$volumeUnit);
|
||||
//print $lignes[$i]->volume;
|
||||
$totalVolume += $lignes[$i]->volume*$lignes[$i]->qty_shipped*$trueVolumeUnit;
|
||||
//print $lines[$i]->volume;
|
||||
$totalVolume += $lines[$i]->volume*$lines[$i]->qty_shipped*$trueVolumeUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$trueVolumeUnit=$volumeUnit;
|
||||
$totalVolume += $lignes[$i]->volume*$lignes[$i]->qty_shipped;
|
||||
$totalVolume += $lines[$i]->volume*$lines[$i]->qty_shipped;
|
||||
}
|
||||
}
|
||||
$totalVolume=$totalVolume;
|
||||
|
|
@ -966,64 +966,64 @@ else
|
|||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Predefined product or service
|
||||
if ($lignes[$i]->fk_product > 0)
|
||||
if ($lines[$i]->fk_product > 0)
|
||||
{
|
||||
print '<td>';
|
||||
|
||||
// Affiche ligne produit
|
||||
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$lignes[$i]->fk_product.'">';
|
||||
if ($lignes[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
|
||||
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$lines[$i]->fk_product.'">';
|
||||
if ($lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
|
||||
else $text.= img_object($langs->trans('ShowProduct'),'product');
|
||||
$text.= ' '.$lignes[$i]->ref.'</a>';
|
||||
$text.= ' - '.$lignes[$i]->label;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($lignes[$i]->description));
|
||||
$text.= ' '.$lines[$i]->ref.'</a>';
|
||||
$text.= ' - '.$lines[$i]->label;
|
||||
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($lines[$i]->description));
|
||||
//print $description;
|
||||
print $html->textwithtooltip($text,$description,3,'','',$i);
|
||||
print_date_range($lignes[$i]->date_start,$lignes[$i]->date_end);
|
||||
print_date_range($lines[$i]->date_start,$lines[$i]->date_end);
|
||||
if ($conf->global->PRODUIT_DESC_IN_FORM)
|
||||
{
|
||||
print ($lignes[$i]->description && $lignes[$i]->description!=$lignes[$i]->product)?'<br>'.dol_htmlentitiesbr($lignes[$i]->description):'';
|
||||
print ($lines[$i]->description && $lines[$i]->description!=$lines[$i]->product)?'<br>'.dol_htmlentitiesbr($lines[$i]->description):'';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td>";
|
||||
if ($lignes[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
if ($lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
print $text.' '.nl2br($lignes[$i]->description);
|
||||
print_date_range($lignes[$i]->date_start,$lignes[$i]->date_end);
|
||||
print $text.' '.nl2br($lines[$i]->description);
|
||||
print_date_range($lines[$i]->date_start,$lines[$i]->date_end);
|
||||
print "</td>\n";
|
||||
}
|
||||
|
||||
// Qte commande
|
||||
print '<td align="center">'.$lignes[$i]->qty_asked.'</td>';
|
||||
print '<td align="center">'.$lines[$i]->qty_asked.'</td>';
|
||||
|
||||
// Qte a expedier ou expedier
|
||||
print '<td align="center">'.$lignes[$i]->qty_shipped.'</td>';
|
||||
print '<td align="center">'.$lines[$i]->qty_shipped.'</td>';
|
||||
|
||||
// Weight
|
||||
print '<td align="center">';
|
||||
if ($lignes[$i]->fk_product_type == 0) print $lignes[$i]->weight*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->weight_units,"weight");
|
||||
if ($lines[$i]->fk_product_type == 0) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units,"weight");
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Volume
|
||||
print '<td align="center">';
|
||||
if ($lignes[$i]->fk_product_type == 0) print $lignes[$i]->volume*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->volume_units,"volume");
|
||||
if ($lines[$i]->fk_product_type == 0) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume");
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Size
|
||||
//print '<td align="center">'.$lignes[$i]->volume*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->volume_units,"volume").'</td>';
|
||||
//print '<td align="center">'.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").'</td>';
|
||||
|
||||
// Entrepot source
|
||||
if ($conf->stock->enabled)
|
||||
{
|
||||
print '<td align="left">';
|
||||
if ($lignes[$i]->entrepot_id > 0)
|
||||
if ($lines[$i]->entrepot_id > 0)
|
||||
{
|
||||
$entrepot = new Entrepot($db);
|
||||
$entrepot->fetch($lignes[$i]->entrepot_id);
|
||||
$entrepot->fetch($lines[$i]->entrepot_id);
|
||||
print $entrepot->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Fichinter extends CommonObject
|
|||
var $fk_project;
|
||||
var $modelpdf;
|
||||
|
||||
var $lignes = array();
|
||||
var $lines = array();
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
|
|
@ -674,14 +674,14 @@ class Fichinter extends CommonObject
|
|||
$this->db->begin();
|
||||
|
||||
// Insertion ligne
|
||||
$ligne=new FichinterLigne($this->db);
|
||||
$line=new FichinterLigne($this->db);
|
||||
|
||||
$ligne->fk_fichinter = $fichinterid;
|
||||
$ligne->desc = $desc;
|
||||
$ligne->datei = $date_intervention;
|
||||
$ligne->duration = $duration;
|
||||
$line->fk_fichinter = $fichinterid;
|
||||
$line->desc = $desc;
|
||||
$line->datei = $date_intervention;
|
||||
$line->duration = $duration;
|
||||
|
||||
$result=$ligne->insert();
|
||||
$result=$line->insert();
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
|
@ -780,18 +780,16 @@ class Fichinter extends CommonObject
|
|||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$fichinterligne = new FichinterLigne($this->db);
|
||||
$fichinterligne->id = $objp->rowid;
|
||||
$line = new FichinterLigne($this->db);
|
||||
$line->id = $objp->rowid;
|
||||
//...
|
||||
|
||||
$this->lines[$i] = $fichinterligne;
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($result);
|
||||
|
||||
$this->lignes=$this->lines; // For backward compatibility
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ class CommandeFournisseur extends Commande
|
|||
{
|
||||
$this->db = $DB;
|
||||
$this->products = array();
|
||||
$this->lignes = array(); // TODO deprecated
|
||||
$this->lines = array();
|
||||
|
||||
// List of language codes for status
|
||||
|
|
@ -187,7 +186,6 @@ class CommandeFournisseur extends Commande
|
|||
$line->ref = $objp->ref; // Reference
|
||||
$line->ref_fourn = $objp->ref_fourn; // Reference supplier
|
||||
|
||||
$this->lignes[$i] = $line; // TODO deprecated
|
||||
$this->lines[$i] = $line;
|
||||
|
||||
$i++;
|
||||
|
|
@ -527,15 +525,15 @@ class CommandeFournisseur extends Commande
|
|||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
|
||||
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
|
||||
{
|
||||
// Product with reference
|
||||
if (!empty($this->lignes[$i]->fk_product))
|
||||
if (!empty($this->lines[$i]->fk_product))
|
||||
{
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We decrement stock of product (and sub-products)
|
||||
$entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
|
||||
$result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty, $this->lignes[$i]->subprice);
|
||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $entrepot_id, $this->lines[$i]->qty, $this->lines[$i]->subprice);
|
||||
if ($result < 0) { $error++; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1197,10 +1195,10 @@ class CommandeFournisseur extends Commande
|
|||
|
||||
$this->lines = array();
|
||||
|
||||
for ($i = 0 ; $i < sizeof($comclient->lignes) ; $i++)
|
||||
for ($i = 0 ; $i < sizeof($comclient->lines) ; $i++)
|
||||
{
|
||||
$prod = new Product($this->db, $comclient->lignes[$i]->fk_product);
|
||||
if ($prod->fetch($comclient->lignes[$i]->fk_product) > 0)
|
||||
$prod = new Product($this->db, $comclient->lines[$i]->fk_product);
|
||||
if ($prod->fetch($comclient->lines[$i]->fk_product) > 0)
|
||||
{
|
||||
$libelle = $prod->libelle;
|
||||
$ref = $prod->ref;
|
||||
|
|
@ -1208,10 +1206,10 @@ class CommandeFournisseur extends Commande
|
|||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
|
||||
$sql .= " (fk_commande,label,description,fk_product, price, qty, tva_tx, remise_percent, subprice, remise, ref)";
|
||||
$sql .= " VALUES (".$idc.", '" . addslashes($libelle) . "','" . addslashes($comclient->lignes[$i]->desc) . "'";
|
||||
$sql .= ",".$comclient->lignes[$i]->fk_product.",'".price2num($comclient->lignes[$i]->price)."'";
|
||||
$sql .= ", '".$comclient->lignes[$i]->qty."', ".$comclient->lignes[$i]->tva_tx.", ".$comclient->lignes[$i]->remise_percent;
|
||||
$sql .= ", '".price2num($comclient->lignes[$i]->subprice)."','0','".$ref."') ;";
|
||||
$sql .= " VALUES (".$idc.", '" . addslashes($libelle) . "','" . addslashes($comclient->lines[$i]->desc) . "'";
|
||||
$sql .= ",".$comclient->lines[$i]->fk_product.",'".price2num($comclient->lines[$i]->price)."'";
|
||||
$sql .= ", '".$comclient->lines[$i]->qty."', ".$comclient->lines[$i]->tva_tx.", ".$comclient->lines[$i]->remise_percent;
|
||||
$sql .= ", '".price2num($comclient->lines[$i]->subprice)."','0','".$ref."') ;";
|
||||
if ( $this->db->query( $sql) )
|
||||
{
|
||||
$this->update_price();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user