diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 280b0ddb882..6bdba55e562 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1385,7 +1385,7 @@ if ($_GET['action'] == 'create')
{
$projectid=GETPOST('originid');
}
- else if (in_array($element,array('order','commande','propal','contrat','contract')))
+ else
{
// For compatibility
if ($element == 'commande') { $subelement = 'customerorder'; }
@@ -1398,7 +1398,7 @@ if ($_GET['action'] == 'create')
$objectsrc->fetch(GETPOST('originid'));
if (empty($objectsrc->object->lines) && method_exists($objectsrc->object,'fetch_lines')) $objectsrc->object->fetch_lines();
$objectsrc->object->fetch_thirdparty();
-
+
$projectid = (!empty($objectsrc->object->fk_project)?$object->fk_project:'');
$ref_client = (!empty($objectsrc->object->ref_client)?$object->ref_client:'');
@@ -1776,10 +1776,8 @@ if ($_GET['action'] == 'create')
print "\n";
- // Try to read line from origin
- $sql='';
- // TODO deplacer dans la classe
+ // View origin lines
if (is_object($objectsrc))
{
$title=$langs->trans('ProductsAndServices');
@@ -1792,150 +1790,6 @@ if ($_GET['action'] == 'create')
$objectsrc->printOriginLinesList($object);
print '';
- /*
- $title=$langs->trans('ProductsAndServices');
-
- $sql = 'SELECT pt.rowid, pt.description, pt.fk_remise_except,';
- $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.product_type, pt.info_bits,';
- $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
- $sql.= ' WHERE pt.fk_propal = '.$objectsrc->object->id;
- $sql.= ' ORDER BY pt.rang ASC, pt.rowid';
- }
- // TODO deplacer dans la classe
- if ($_GET['origin'] == 'commande')
- {
- $title=$langs->trans('Products');
-
- $sql = 'SELECT pt.rowid, pt.description, pt.fk_remise_except,';
- $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.product_type, pt.info_bits,';
- $sql.= ' pt.date_start as date_debut_prevue, pt.date_end as date_fin_prevue,';
- $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as pt';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
- $sql.= ' WHERE pt.fk_commande = '.$objectsrc->object->id;
- $sql.= ' ORDER BY pt.rowid ASC';
- }
- // TODO deplacer dans la classe
- if ($_GET['origin'] == 'contrat')
- {
- $title=$langs->trans('Services');
-
- $sql = 'SELECT pt.rowid, pt.description,';
- $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
- $sql.= ' pt.date_ouverture_prevue as date_debut_prevue, pt.date_ouverture as date_debut_reel,';
- $sql.= ' pt.date_fin_validite as date_fin_prevue, pt.date_cloture as date_fin_reel,';
- $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'contratdet as pt';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product = p.rowid';
- $sql.= ' WHERE pt.fk_contrat = '.$objectsrc->object->id;
- $sql.= ' ORDER BY pt.rowid ASC';
- }
-
- if ($sql)
- {
- print '
';
- print_titre($title);
-
- print '
| '.$langs->trans('Ref').' | '; - print ''.$langs->trans('Description').' | '; - print ''.$langs->trans('VAT').' | '; - print ''.$langs->trans('PriceUHT').' | '; - print ''.$langs->trans('Qty').' | '; - print ''.$langs->trans('ReductionShort').' |
| '; - if (($objp->info_bits & 2) == 2) - { - print ''; - print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); - print ''; - } - else if ($objp->prodid) - { - print ''; - print ($objp->fk_product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product')); - print ' '.$objp->ref.''; - print $objp->product?' - '.$objp->product:''; - // Dates - if ($date_start || $date_end) - { - print_date_range($date_start,$date_end); - } - } - else - { - print ($objp->product_type == -1 ? ' ' : ($objp->product_type == 1 ? img_object($langs->trans(''),'service') : img_object($langs->trans(''),'product'))); - // Dates - if ($date_start || $date_end) - { - print_date_range($date_start,$date_end); - } - } - print " | \n"; - print ''; - if ($objp->description) - { - if ($objp->description == '(CREDIT_NOTE)') - { - $discount=new DiscountAbsolute($db); - $discount->fetch($objp->fk_remise_except); - print $langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0)); - } - elseif ($obj->description == '(DEPOSIT)') - { - $discount=new DiscountAbsolute($db); - $discount->fetch($objp->fk_remise_except); - print $langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0)); - } - else - { - print dol_trunc($objp->description,60); - } - } - else - { - print ' '; - } - print ' | '; - print ''.vatrate($objp->tva_tx).'% | '; - print ''.price($objp->subprice).' | '; - print ''; - print (($objp->info_bits & 2) != 2) ? $objp->qty : ' '; - print ' | '; - print ''; - print (($objp->info_bits & 2) != 2) ? $objp->remise_percent.'%' : ' '; - print ' | '; - print '