diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php
index 97e037c3e8ee39238cf7229607508515f01cdbec..b22b19896739dc9f89871af1afe69f82c5d339e4 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 a4b699b70b77b49fd2d143de6f4c7b47ac7e0f25..b8a5779c708c9d3611fdcc75e84a7c3a61f160ed 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 843960e8df4bb47935e295cda21e25d076cf4692..cddbdcaa064746046f1a9a169dff426847e7a738 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 9a802ac7f34847f5b907690a0694393c459e874b..93dcb7ee03d97713f036510814726fa09437e386 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 a4bd66bc49d17eca7247dcb6b95c680029ead02c..094ae60c59e135dec6ce079a3fd93a2095d09939 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 6302994181aa600474a00979b42a52412467e3e1..f983e5db5fe58b49e454a7569ef42ce1132441ec 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;