Restore some broken features

This commit is contained in:
Laurent Destailleur 2010-09-15 15:07:14 +00:00
parent 31b7546cb8
commit eee4350867
4 changed files with 65 additions and 59 deletions

View File

@ -193,7 +193,7 @@ switch ( $_GET['action'] )
$invoiceline->total_ht=$tab_liste[$i]['total_ht']; $invoiceline->total_ht=$tab_liste[$i]['total_ht'];
$invoiceline->total_ttc=$tab_liste[$i]['total_ttc']; $invoiceline->total_ttc=$tab_liste[$i]['total_ttc'];
$invoiceline->total_tva=($tab_liste[$i]['total_ttc']-$tab_liste[$i]['total_ht']); $invoiceline->total_tva=($tab_liste[$i]['total_ttc']-$tab_liste[$i]['total_ht']);
$invoice->lignes[]=$invoiceline; $invoice->lines[]=$invoiceline;
} }
$invoice->socid=$conf_fksoc; $invoice->socid=$conf_fksoc;

View File

@ -694,8 +694,8 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
// TODO mutualiser // TODO mutualiser
$lines = $srcobject->lignes; $lines = $srcobject->lignes;
if (sizeof($lines)) $lines = $srcobject->lines; if (sizeof($lines)) $lines = $srcobject->lines;
if (empty($lines) && method_exists($object,'fetch_lignes')) $lines = $srcobject->fetch_lignes(); if (empty($lines) && method_exists($srcobject,'fetch_lignes')) $lines = $srcobject->fetch_lignes();
if (empty($lines) && method_exists($object,'fetch_lines')) $lines = $srcobject->fetch_lines(); if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
for ($i = 0 ; $i < sizeof($lines) ; $i++) for ($i = 0 ; $i < sizeof($lines) ; $i++)
{ {
@ -1371,7 +1371,7 @@ if ($_GET['action'] == 'create')
{ {
$projectid=$_GET['originid']; $projectid=$_GET['originid'];
} }
else if (in_array($element,array('order','propal','contract'))) else if (in_array($element,array('order','commande','propal','contrat','contract')))
{ {
// For compatibility // For compatibility
if ($element == 'order') { $element = $subelement = 'commande'; } if ($element == 'order') { $element = $subelement = 'commande'; }
@ -1772,7 +1772,7 @@ if ($_GET['action'] == 'create')
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid'; $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt'; $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
$sql.= ' WHERE pt.fk_propal = '.$object->id; $sql.= ' WHERE pt.fk_propal = '.$objectsrc->id;
$sql.= ' ORDER BY pt.rang ASC, pt.rowid'; $sql.= ' ORDER BY pt.rang ASC, pt.rowid';
} }
// TODO deplacer dans la classe // TODO deplacer dans la classe
@ -1786,7 +1786,7 @@ if ($_GET['action'] == 'create')
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid'; $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as pt'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
$sql.= ' WHERE pt.fk_commande = '.$object->id; $sql.= ' WHERE pt.fk_commande = '.$objectsrc->id;
$sql.= ' ORDER BY pt.rowid ASC'; $sql.= ' ORDER BY pt.rowid ASC';
} }
// TODO deplacer dans la classe // TODO deplacer dans la classe
@ -1801,7 +1801,7 @@ if ($_GET['action'] == 'create')
$sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid'; $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'contratdet as pt'; $sql.= ' FROM '.MAIN_DB_PREFIX.'contratdet as pt';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
$sql.= ' WHERE pt.fk_contrat = '.$object->id; $sql.= ' WHERE pt.fk_contrat = '.$objectsrc->id;
$sql.= ' ORDER BY pt.rowid ASC'; $sql.= ' ORDER BY pt.rowid ASC';
} }

View File

@ -269,10 +269,11 @@ class Facture extends CommonObject
} }
/* /*
* Insert lines of invoices in database * Insert lines of invoices into database
*/ */
//dol_syslog("There is ".sizeof($this->lignes)." lines"); if (sizeof($this->lines) && is_object($this->lines[0]))
/* {
dol_syslog("There is ".sizeof($this->lines)." lines that are invoice lines objects");
foreach ($this->lines as $i => $val) foreach ($this->lines as $i => $val)
{ {
$newinvoiceline=new FactureLigne($this->db); $newinvoiceline=new FactureLigne($this->db);
@ -284,11 +285,15 @@ class Facture extends CommonObject
} }
if ($result < 0) if ($result < 0)
{ {
$this->error=$newinvoiceline->error;
$error++; $error++;
break; break;
} }
} }
*/ }
else
{
dol_syslog("There is ".sizeof($this->lines)." lines that are array lines");
for ($i = 0 ; $i < sizeof($this->lines) ; $i++) for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
{ {
if (($this->lines[$i]->info_bits & 0x01) == 0) // We keep only lines with first bit = 0 if (($this->lines[$i]->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
@ -323,6 +328,7 @@ class Facture extends CommonObject
} }
} }
} }
}
/* /*
* Insert lines of predefined invoices * Insert lines of predefined invoices