From 1db9514fed9b6d7f9dc3d1188c823bc9b121f26a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Jun 2014 15:37:10 +0200 Subject: [PATCH 1/2] Fix: When an invoice is replaced with another, amount must not appears on total for project --- htdocs/projet/element.php | 41 +++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 6101f337471..6edaec7b35a 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -246,7 +246,7 @@ foreach ($listofreferent as $key => $value) print ''; } print ''; - + print ''; print ''; print ''; @@ -269,6 +269,12 @@ foreach ($listofreferent as $key => $value) $element->fetch_thirdparty(); //print $classname; + $qualifiedfortotal=true; + if ($key == 'invoice') + { + if ($element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice + } + $var=!$var; print ""; @@ -290,18 +296,35 @@ foreach ($listofreferent as $key => $value) print ''; // Amount - if (empty($value['disableamount'])) print ''; + if (empty($value['disableamount'])) + { + print ''; + } // Amount - if (empty($value['disableamount'])) print ''; + if (empty($value['disableamount'])) + { + print ''; + } // Status print ''; print ''; - $total_ht = $total_ht + $element->total_ht; - $total_ttc = $total_ttc + $element->total_ttc; + if ($qualifiedfortotal) + { + $total_ht = $total_ht + $element->total_ht; + $total_ttc = $total_ttc + $element->total_ttc; + } } print ''; @@ -385,9 +408,11 @@ foreach ($listofreferent as $key => $value) $element->fetch($elementarray[$i]); $element->fetch_thirdparty(); //print $classname; - - $total_ht = $total_ht + $element->total_ht; - $total_ttc = $total_ttc + $element->total_ttc; + if ($qualified) + { + $total_ht = $total_ht + $element->total_ht; + $total_ttc = $total_ttc + $element->total_ttc; + } } print ''; From ffd27f2d49b295fadc9984cae81cc50e054502ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Jun 2014 08:52:57 +0200 Subject: [PATCH 2/2] Fix: Translation Fix: pgsql pb --- htdocs/langs/en_US/companies.lang | 2 +- htdocs/langs/en_US/main.lang | 2 +- htdocs/societe/consumption.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 55eb2dbb91f..000d7496afc 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -400,7 +400,7 @@ UniqueThirdParties=Total of unique third parties InActivity=Open ActivityCeased=Closed ActivityStateFilter=Activity status -ProductsIntoElements=List of products into +ProductsIntoElements=List of products into %s CurrentOutstandingBill=Current outstanding bill OutstandingBill=Max. for outstanding bill OutstandingBillReached=Reached max. for outstanding bill diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index e7cc20286c3..caddad9d997 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -507,7 +507,7 @@ NbOfCustomers=Number of customers NbOfLines=Number of lines NbOfObjects=Number of objects NbOfReferers=Number of referrers -Referers=Consumption +Referers=Refering objects TotalQuantity=Total quantity DateFromTo=From %s to %s DateFrom=From %s diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 520d003305d..dc825ae4eb4 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2013 Juanjo Menent * * Version V1.1 Initial version of Philippe Berthet @@ -176,7 +176,7 @@ if ($type_element == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $documentstatic=new Commande($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, "1" as doc_type, c.date_commande as datePrint, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as datePrint, '; $tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid"; @@ -189,7 +189,7 @@ if ($type_element == 'supplier_invoice') { // Supplier : Show products from invoices. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $documentstatic=new FactureFournisseur($db); - $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, "1" as doc_type, f.datef as datePrint, '; + $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as datePrint, '; $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_facture_fourn = f.rowid"; @@ -201,7 +201,7 @@ if ($type_element == 'supplier_order') { // Supplier : Show products from orders. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $documentstatic=new CommandeFournisseur($db); - $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, "1" as doc_type, c.date_valid as datePrint, '; + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as datePrint, '; $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid";
'.$langs->trans("Ref").''.$langs->trans("Date").'
'.(isset($element->total_ht)?price($element->total_ht):' ').''; + if (! $qualifiedfortotal) print ''; + print (isset($element->total_ht)?price($element->total_ht):' '); + if (! $qualifiedfortotal) print ''; + print ''.(isset($element->total_ttc)?price($element->total_ttc):' ').''; + if (! $qualifiedfortotal) print ''; + print (isset($element->total_ttc)?price($element->total_ttc):' '); + if (! $qualifiedfortotal) print ''; + print ''.$element->getLibStatut(5).'
'.$langs->trans("Number").': '.$i.'