From 4377a2d0137907a5a009783252e8374f66d7f8fe Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 28 Aug 2015 18:20:51 +0200
Subject: [PATCH] Fix style and sql error for field fde.ref not found

---
 htdocs/categories/index.php                        | 2 +-
 htdocs/compta/journal/purchasesjournal.php         | 2 +-
 htdocs/compta/journal/sellsjournal.php             | 2 +-
 htdocs/expensereport/class/expensereport.class.php | 4 ++--
 htdocs/projet/class/project.class.php              | 4 ++--
 htdocs/projet/element.php                          | 3 ++-
 6 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php
index 97e037c3e8e..b22b1989673 100644
--- a/htdocs/categories/index.php
+++ b/htdocs/categories/index.php
@@ -179,7 +179,7 @@ if ($nbofentries > 0)
 }
 else
 {
-	print '<tr>';
+	print '<tr '.$bc[0].'>';
 	print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
 	print '<td valign="middle">';
 	print $langs->trans("NoCategoryYet");
diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php
index a4b699b70b7..b8a5779c708 100644
--- a/htdocs/compta/journal/purchasesjournal.php
+++ b/htdocs/compta/journal/purchasesjournal.php
@@ -184,7 +184,7 @@ print "<td>".$langs->trans("Account")."</td>";
 print "<td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
 print "</tr>\n";
 
-$var=true;
+$var=false;
 
 $invoicestatic=new FactureFournisseur($db);
 $companystatic=new Fournisseur($db);
diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php
index 843960e8df4..cddbdcaa064 100644
--- a/htdocs/compta/journal/sellsjournal.php
+++ b/htdocs/compta/journal/sellsjournal.php
@@ -215,7 +215,7 @@ print '<td>'.$langs->trans('Account').'</td>';
 print '<td>'.$langs->trans('Type').'</td><td align="right">'.$langs->trans('Debit').'</td><td align="right">'.$langs->trans('Credit').'</td>';
 print "</tr>\n";
 
-$var=true;
+$var=false;
 
 $invoicestatic=new Facture($db);
 $companystatic=new Client($db);
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 9a802ac7f34..93dcb7ee03d 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -1508,14 +1508,14 @@ class ExpenseReportLine
     }
 
     /**
-     * fetch record
+     * Fetch record for expense report detailed line
      *
      * @param   int     $rowid      Id of object to load
      * @return  int                 <0 if KO, >0 if OK
      */
     function fetch($rowid)
     {
-        $sql = 'SELECT fde.rowid, fde.ref, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
+        $sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
         $sql.= ' fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
         $sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
         $sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index a4bd66bc49d..094ae60c59e 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -1470,8 +1470,8 @@ class Project extends CommonObject
 	/**
 	 *  Create an intervention document on disk using template defined into PROJECT_ADDON_PDF
 	 *
-	 *  @param	string		$modele			force le modele a utiliser ('' par defaut)
-	 *  @param	Translate	$outputlangs	objet lang a utiliser pour traduction
+	 *  @param	string		$modele			Force template to use ('' by default)
+	 *  @param	Translate	$outputlangs	Objet lang to use for translation
 	 *  @param  int			$hidedetails    Hide details of lines
 	 *  @param  int			$hidedesc       Hide description
 	 *  @param  int			$hideref        Hide ref
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 6302994181a..f983e5db5fe 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -602,6 +602,7 @@ foreach ($listofreferent as $key => $value)
 					$expensereport->fetch($element->fk_expensereport);
 				}
 
+				//print 'xxx'.$tablename;
 				//print $classname;
 
 				if ($breakline && $saved_third_id != $element->thirdparty->id)
@@ -620,7 +621,7 @@ foreach ($listofreferent as $key => $value)
 				$qualifiedfortotal=true;
 				if ($key == 'invoice')
 				{
-					if ($element->close_code == 'replaced') $qualifiedfortotal=false;	// Replacement invoice
+					if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false;	// Replacement invoice, do not include into total
 				}
 
 				$var=!$var;
-- 
GitLab