Frédéric FRANCE il y a 5 ans
Parent
commit
f5688b2eec
100 fichiers modifiés avec 783 ajouts et 1547 suppressions
  1. 4 8
      htdocs/compta/accounting-files.php
  2. 2 4
      htdocs/compta/ajaxpayment.php
  3. 9 18
      htdocs/compta/bank/annuel.php
  4. 24 47
      htdocs/compta/bank/bankentries_list.php
  5. 1 2
      htdocs/compta/bank/budget.php
  6. 10 20
      htdocs/compta/bank/card.php
  7. 1 2
      htdocs/compta/bank/categ.php
  8. 24 48
      htdocs/compta/bank/class/account.class.php
  9. 3 6
      htdocs/compta/bank/class/api_bankaccounts.class.php
  10. 8 16
      htdocs/compta/bank/class/paymentvarious.class.php
  11. 18 36
      htdocs/compta/bank/graph.php
  12. 17 34
      htdocs/compta/bank/line.php
  13. 2 4
      htdocs/compta/bank/list.php
  14. 8 16
      htdocs/compta/bank/releve.php
  15. 3 6
      htdocs/compta/bank/transfer.php
  16. 3 6
      htdocs/compta/bank/treso.php
  17. 7 14
      htdocs/compta/bank/various_payment/card.php
  18. 1 2
      htdocs/compta/bank/various_payment/document.php
  19. 2 4
      htdocs/compta/bank/various_payment/list.php
  20. 8 16
      htdocs/compta/cashcontrol/cashcontrol_card.php
  21. 1 2
      htdocs/compta/cashcontrol/cashcontrol_list.php
  22. 2 4
      htdocs/compta/cashcontrol/report.php
  23. 6 12
      htdocs/compta/charges/index.php
  24. 1 2
      htdocs/compta/clients.php
  25. 15 30
      htdocs/compta/deplacement/card.php
  26. 7 14
      htdocs/compta/deplacement/class/deplacement.class.php
  27. 1 2
      htdocs/compta/deplacement/document.php
  28. 1 2
      htdocs/compta/deplacement/index.php
  29. 1 2
      htdocs/compta/deplacement/list.php
  30. 1 2
      htdocs/compta/deplacement/stats/index.php
  31. 33 66
      htdocs/compta/facture/card-rec.php
  32. 44 87
      htdocs/compta/facture/card.php
  33. 3 6
      htdocs/compta/facture/class/api_invoices.class.php
  34. 33 64
      htdocs/compta/facture/class/facture-rec.class.php
  35. 72 142
      htdocs/compta/facture/class/facture.class.php
  36. 6 12
      htdocs/compta/facture/class/paymentterm.class.php
  37. 4 8
      htdocs/compta/facture/contact.php
  38. 2 4
      htdocs/compta/facture/document.php
  39. 5 10
      htdocs/compta/facture/invoicetemplate_list.php
  40. 7 14
      htdocs/compta/facture/list.php
  41. 16 32
      htdocs/compta/facture/prelevement.php
  42. 4 5
      htdocs/compta/facture/stats/index.php
  43. 1 2
      htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
  44. 16 32
      htdocs/compta/index.php
  45. 2 3
      htdocs/compta/journal/purchasesjournal.php
  46. 2 3
      htdocs/compta/journal/sellsjournal.php
  47. 5 10
      htdocs/compta/localtax/card.php
  48. 15 30
      htdocs/compta/localtax/class/localtax.class.php
  49. 8 16
      htdocs/compta/localtax/clients.php
  50. 4 8
      htdocs/compta/localtax/index.php
  51. 1 2
      htdocs/compta/localtax/list.php
  52. 7 14
      htdocs/compta/localtax/quadri_detail.php
  53. 7 14
      htdocs/compta/paiement.php
  54. 8 16
      htdocs/compta/paiement/card.php
  55. 20 40
      htdocs/compta/paiement/cheque/card.php
  56. 25 50
      htdocs/compta/paiement/cheque/class/remisecheque.class.php
  57. 2 4
      htdocs/compta/paiement/cheque/index.php
  58. 2 4
      htdocs/compta/paiement/cheque/list.php
  59. 23 46
      htdocs/compta/paiement/class/paiement.class.php
  60. 3 5
      htdocs/compta/paiement/list.php
  61. 1 2
      htdocs/compta/paiement/rapport.php
  62. 1 2
      htdocs/compta/paiement/tovalidate.php
  63. 3 6
      htdocs/compta/paiement_charge.php
  64. 3 6
      htdocs/compta/payment_sc/card.php
  65. 3 6
      htdocs/compta/paymentbybanktransfer/index.php
  66. 1 2
      htdocs/compta/prelevement/bons.php
  67. 2 4
      htdocs/compta/prelevement/card.php
  68. 41 82
      htdocs/compta/prelevement/class/bonprelevement.class.php
  69. 2 4
      htdocs/compta/prelevement/class/ligneprelevement.class.php
  70. 9 18
      htdocs/compta/prelevement/class/rejetprelevement.class.php
  71. 6 12
      htdocs/compta/prelevement/create.php
  72. 2 4
      htdocs/compta/prelevement/demandes.php
  73. 2 4
      htdocs/compta/prelevement/factures.php
  74. 3 6
      htdocs/compta/prelevement/fiche-rejet.php
  75. 2 4
      htdocs/compta/prelevement/fiche-stat.php
  76. 3 6
      htdocs/compta/prelevement/index.php
  77. 8 16
      htdocs/compta/prelevement/line.php
  78. 1 2
      htdocs/compta/prelevement/list.php
  79. 1 2
      htdocs/compta/prelevement/rejets.php
  80. 2 4
      htdocs/compta/prelevement/stats.php
  81. 3 6
      htdocs/compta/recap-compta.php
  82. 18 35
      htdocs/compta/resultat/clientfourn.php
  83. 9 17
      htdocs/compta/resultat/index.php
  84. 2 2
      htdocs/compta/resultat/result.php
  85. 10 20
      htdocs/compta/sociales/card.php
  86. 9 18
      htdocs/compta/sociales/class/chargesociales.class.php
  87. 9 18
      htdocs/compta/sociales/class/paymentsocialcontribution.class.php
  88. 1 2
      htdocs/compta/sociales/document.php
  89. 4 8
      htdocs/compta/sociales/list.php
  90. 6 12
      htdocs/compta/sociales/payments.php
  91. 1 2
      htdocs/compta/stats/byratecountry.php
  92. 1 2
      htdocs/compta/stats/cabyprodserv.php
  93. 2 3
      htdocs/compta/stats/cabyuser.php
  94. 2 3
      htdocs/compta/stats/casoc.php
  95. 8 15
      htdocs/compta/stats/index.php
  96. 6 12
      htdocs/compta/stats/supplier_turnover.php
  97. 1 2
      htdocs/compta/stats/supplier_turnover_by_prodserv.php
  98. 1 2
      htdocs/compta/stats/supplier_turnover_by_thirdparty.php
  99. 6 12
      htdocs/compta/tva/card.php
  100. 17 34
      htdocs/compta/tva/class/tva.class.php

+ 4 - 8
htdocs/compta/accounting-files.php

@@ -335,8 +335,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
 
 		                    $filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile;
 		                }
-		                else
-		                {
+		                else {
 		                    foreach ($files as $key => $file)
 		                    {
 		                    	$file['id'] = $objd->id;
@@ -384,8 +383,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
 		            $i++;
 		        }
 		    }
-		    else
-		    {
+		    else {
 		        dol_print_error($db);
 		    }
 
@@ -492,8 +490,7 @@ if ($result && $action == "dl" && !$error)
 
         exit();
     }
-    else
-    {
+    else {
     	setEventMessages($langs->trans("FailedToOpenFile", $zipname), null, 'errors');
     }
 }
@@ -626,8 +623,7 @@ if (!empty($date_start) && !empty($date_stop))
         {
             print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td></tr>';
         }
-        else
-        {
+        else {
             // Sort array by date ASC to calculate balance
 
             $totalET_debit = 0;

+ 2 - 4
htdocs/compta/ajaxpayment.php

@@ -81,13 +81,11 @@ if ($currentInvId)																	// Here to breakdown
 			$remainAmount = $currentRemain - $currentAmount; // To keep value between curRemain and curAmount
 			$result += $remainAmount; // result must be deduced by
 			$currentAmount += $remainAmount; // curAmount put to curRemain
-		} else
-		{
+		} else {
 			$currentAmount = $currentRemain;
 			$result += $currentRemain;
 		}
-	} else
-	{
+	} else {
 		// Reset the substraction for this amount
 		$result += price2num($currentAmount);
 		$currentAmount = 0;

+ 9 - 18
htdocs/compta/bank/annuel.php

@@ -51,8 +51,7 @@ if (!$year_start)
 	$year_start = $year_current - 2;
 	$year_end = $year_current;
 }
-else
-{
+else {
 	$year_end = $year_start + 2;
 }
 
@@ -108,8 +107,7 @@ if ($resql)
 		$i++;
 	}
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 
@@ -136,8 +134,7 @@ if ($resql)
 		$i++;
 	}
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 
@@ -158,8 +155,7 @@ if (!empty($id))
     {
         dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
     }
-    else
-    {
+    else {
         $bankaccount = new Account($db);
         $listid = explode(',', $id);
         foreach ($listid as $key => $aId)
@@ -171,8 +167,7 @@ if (!empty($id))
         }
     }
 }
-else
-{
+else {
 	print $langs->trans("AllAccounts");
 }
 
@@ -281,8 +276,7 @@ if ($result < 0)
 	$error++;
 	setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors');
 }
-else
-{
+else {
 	// Calcul de $min et $max
 	$sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max";
 	$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@@ -299,8 +293,7 @@ else
 		$min = $db->jdate($obj->min);
 		$max = $db->jdate($obj->max);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 	$log = "graph.php: min=".$min." max=".$max;
@@ -339,8 +332,7 @@ else
 			}
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 	}
@@ -426,8 +418,7 @@ else
 			}
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 	}

+ 24 - 47
htdocs/compta/bank/bankentries_list.php

@@ -69,8 +69,7 @@ if ($fielvalue)
 	if ($user->socid) $socid = $user->socid;
 	$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype);
 }
-else
-{
+else {
 	if ($user->socid) $socid = $user->socid;
 	$result = restrictedArea($user, 'banque');
 }
@@ -242,15 +241,13 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
                 }
             }
         }
-        else
-        {
+        else {
             $error++;
             $langs->load("errors");
             setEventMessages($langs->trans("NoRecordSelected"), null, 'errors');
         }
     }
-    else
-    {
+    else {
         $error++;
         $langs->load("errors");
         setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors');
@@ -287,8 +284,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier)
     {
         $amount = price2num($_POST["addcredit"]);
     }
-    else
-    {
+    else {
         $amount = - price2num($_POST["adddebit"]);
     }
 
@@ -338,13 +334,11 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier)
             header("Location: ".$_SERVER['PHP_SELF'].($id ? "?id=".$id : ''));
             exit;
         }
-        else
-        {
+        else {
             setEventMessages($object->error, $object->errors, 'errors');
         }
     }
-    else
-    {
+    else {
         $action = 'addline';
     }
 }
@@ -469,8 +463,7 @@ if ($id > 0 || !empty($ref))
         }
     }
 }
-else
-{
+else {
 	llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
 }
 
@@ -675,8 +668,7 @@ if ($resql)
 	        print $liste;
 	        if ($numr <= 0) print '<b>'.$langs->trans("None").'</b>';
 	    }
-	    else
-	    {
+	    else {
 	        dol_print_error($db);
 	    }
 
@@ -793,13 +785,12 @@ if ($resql)
 			{
 			    $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier);
 			}
-			else												// If direct entries is not done using miscellaneous payments
+			else // If direct entries is not done using miscellaneous payments
 			{
                 $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', $user->rights->banque->modifier);
 			}
 		}
-		else
-		{
+		else {
             $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', -1);
 		}
 	}
@@ -1041,8 +1032,7 @@ if ($resql)
                 		$balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount);
                 	}
                 	// If sort is asc,asc,asc then total of previous date is balance of line before the next line to show
-                	else
-                	{
+                	else {
                 		$balance = $objforbalance->previoustotal;
                 	}
                 }
@@ -1129,8 +1119,7 @@ if ($resql)
         	$balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc)
         	$balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT');
         }
-		else
-		{
+		else {
 			$balancebefore = price2num($balance, 'MT'); // balancebefore = balance of previous line (sort is asc)
 			$balance = price2num($balance + ($sign * $objp->amount), 'MT');
 		}
@@ -1142,8 +1131,7 @@ if ($resql)
             $cachebankaccount[$objp->bankid] = $bankaccounttmp;
             $bankaccount = $bankaccounttmp;
         }
-        else
-        {
+        else {
             $bankaccount = $cachebankaccount[$objp->bankid];
         }
 
@@ -1279,8 +1267,7 @@ if ($resql)
     	                print $bankstatic->getNomUrl(1, '');
     	                print ')';
     	            }
-    	            else
-    	            {
+    	            else {
     	                $bankstatic->id = $objp->bankid;
     	                $bankstatic->label = $objp->bankref;
     	                print ' ('.$langs->trans("TransferFrom").' ';
@@ -1306,8 +1293,7 @@ if ($resql)
     	        elseif ($links[$key]['type'] == 'sc')
     	        {
     	        }
-    	        else
-    	        {
+    	        else {
     	            // Show link with label $links[$key]['label']
     	            if (!empty($objp->label) && !empty($links[$key]['label'])) print ' - ';
     	            print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
@@ -1317,8 +1303,7 @@ if ($resql)
     	                if ($reg[1] == 'paiement') $reg[1] = 'Payment';
     	                print ' '.$langs->trans($reg[1]);
     	            }
-    	            else
-    	            {
+    	            else {
     	                print ' '.$links[$key]['label'];
     	            }
     	            print '</a>';
@@ -1396,8 +1381,7 @@ if ($resql)
 				$companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
 				print $companystatic->getNomUrl(1);
 			}
-			else
-			{
+			else {
 				print '&nbsp;';
 			}
 			print '</td>';
@@ -1450,13 +1434,11 @@ if ($resql)
     			{
     				print '<td class="nowrap right">&nbsp;'.price($balancebefore).'</td>';
     			}
-    			else
-    			{
+    			else {
     				print '<td class="error nowrap right">&nbsp;'.price($balancebefore).'</td>';
     			}
     		}
-    		else
-    		{
+    		else {
     			print '<td class="right">-</td>';
     		}
     		if (!$i) $totalarray['nbfield']++;
@@ -1470,13 +1452,11 @@ if ($resql)
     			{
     				print '<td class="nowrap right">&nbsp;'.price($balance).'</td>';
     			}
-    			else
-    			{
+    			else {
     				print '<td class="error nowrap right">&nbsp;'.price($balance).'</td>';
     			}
     		}
-    		else
-    		{
+    		else {
     			print '<td class="right">-</td>';
     		}
     		if (!$i) $totalarray['nbfield']++;
@@ -1523,16 +1503,14 @@ if ($resql)
     	    print img_edit();
     	    print '</a>';
     	}
-    	else
-    	{
+    	else {
     	    if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
     	    {
     	        print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
     	        print img_edit();
     	        print '</a>';
     	    }
-    	    else
-    	    {
+    	    else {
     	        print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
     	        print img_view();
     	        print '</a>';
@@ -1610,8 +1588,7 @@ if ($resql)
     print '</form>';
 	$db->free($resql);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 1 - 2
htdocs/compta/bank/budget.php

@@ -90,8 +90,7 @@ if ($result)
 	print '<td class="liste_total right">'.price($total).'</td>';
 	print '<td colspan="2" class="liste_total right">'.price($totalnb ?price2num($total / $totalnb, 'MT') : 0).'</td></tr>';
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 print "</table>";

+ 10 - 20
htdocs/compta/bank/card.php

@@ -100,8 +100,7 @@ if ($action == 'add')
 	{
 		$object->account_number = '';
 	}
-	else
-	{
+	else {
 		$object->account_number = $account_number;
 	}
 	$fk_accountancy_journal  = GETPOST('fk_accountancy_journal', 'int');
@@ -168,8 +167,7 @@ if ($action == 'add')
 	{
 		$db->commit();
 	}
-	else
-	{
+	else {
 		$db->rollback();
 	}
 }
@@ -206,8 +204,7 @@ if ($action == 'update')
 	{
 		$object->account_number = '';
 	}
-	else
-	{
+	else {
 		$object->account_number = $account_number;
 	}
 	$fk_accountancy_journal  = GETPOST('fk_accountancy_journal', 'int');
@@ -260,8 +257,7 @@ if ($action == 'update')
 
 			$_GET["id"] = $_POST["id"]; // Force chargement page en mode visu
 		}
-		else
-		{
+		else {
 			$error++;
 			setEventMessages($object->error, $object->errors, 'errors');
 			$action = 'edit'; // Force chargement page edition
@@ -272,8 +268,7 @@ if ($action == 'update')
 	{
 		$db->commit();
 	}
-	else
-	{
+	else {
 		$db->rollback();
 	}
 }
@@ -291,8 +286,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->
 		header("Location: ".DOL_URL_ROOT."/compta/bank/list.php");
 		exit;
 	}
-	else
-	{
+	else {
 		setEventMessages($object->error, $object->errors, 'errors');
 		$action = '';
 	}
@@ -399,8 +393,7 @@ if ($action == 'create')
 	{
 		$formcompany->select_departement(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : '', $selectedcode, 'account_state_id');
 	}
-	else
-	{
+	else {
 		print $countrynotdefined;
 	}
 	print '</td></tr>';
@@ -545,8 +538,7 @@ if ($action == 'create')
 		print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
 		print '</td></tr>';
 	}
-	else
-	{
+	else {
 		print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
 		print '<td><input type="text" name="account_number" value="'.(GETPOST("account_number") ?GETPOST('account_number', 'alpha') : $object->account_number).'"></td></tr>';
 	}
@@ -577,8 +569,7 @@ if ($action == 'create')
 /* Visu et edition                                                            */
 /*                                                                            */
 /* ************************************************************************** */
-else
-{
+else {
 	if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
 	{
 		$object = new Account($db);
@@ -887,8 +878,7 @@ else
 		{
 			print $formcompany->select_state(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : $object->state_id, $selectedcode, 'account_state_id');
 		}
-		else
-		{
+		else {
 			print $countrynotdefined;
 		}
 		print '</td></tr>';

+ 1 - 2
htdocs/compta/bank/categ.php

@@ -133,8 +133,7 @@ if ($result)
 			print '<input type="submit" name="update" class="button" value="'.$langs->trans("Edit").'">';
 			print "</td>";
 		}
-		else
-		{
+		else {
 			print "<td >".$objp->label."</td>";
 			print '<td class="center">';
 			print '<a class="editfielda reposition marginleftonly marginrightonly" href="'.$_SERVER["PHP_SELF"].'?categid='.$objp->rowid.'&amp;action=edit">'.img_edit().'</a>';

+ 24 - 48
htdocs/compta/bank/class/account.class.php

@@ -404,8 +404,7 @@ class Account extends CommonObject
 			$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url");
 			return $rowid;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			return -1;
 		}
@@ -510,8 +509,7 @@ class Account extends CommonObject
 				$obj = $this->db->fetch_object($resql);
 				$oper = $obj->code;
 			}
-			else
-			{
+			else {
 				dol_print_error($this->db, 'Failed to get payment type code');
 				return -1;
 			}
@@ -721,13 +719,11 @@ class Account extends CommonObject
 					// End call triggers
 				}
 			}
-			else
-			{
+			else {
 				$error++;
 			}
 		}
-		else
-		{
+		else {
 			if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
 			{
 				$this->error = $langs->trans("ErrorBankLabelAlreadyExists");
@@ -744,8 +740,7 @@ class Account extends CommonObject
 			$this->db->commit();
 			return $this->id;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1 * $error;
 		}
@@ -837,8 +832,7 @@ class Account extends CommonObject
 				// End call triggers
 			}
 		}
-		else
-		{
+		else {
 			$error++;
 			$this->error = $this->db->lasterror();
 			dol_print_error($this->db);
@@ -849,8 +843,7 @@ class Account extends CommonObject
 			$this->db->commit();
 			return $this->id;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1 * $error;
 		}
@@ -908,8 +901,7 @@ class Account extends CommonObject
 		{
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			dol_print_error($this->db);
 			return -1;
@@ -1007,13 +999,11 @@ class Account extends CommonObject
 
 				return 1;
 			}
-			else
-			{
+			else {
 				return 0;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror;
 			$this->errors[] = $this->error;
 			return -1;
@@ -1114,8 +1104,7 @@ class Account extends CommonObject
 					}
 				}
 			}
-			else
-			{
+			else {
 				$error++;
 				$this->error = "Error ".$this->db->lasterror();
 			}
@@ -1126,8 +1115,7 @@ class Account extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -1292,8 +1280,7 @@ class Account extends CommonObject
 
 			return $response;
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			$this->error = $this->db->error();
 			return -1;
@@ -1331,8 +1318,7 @@ class Account extends CommonObject
 			}
 			$this->db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			$this->error = $this->db->error();
 			return -1;
@@ -1476,8 +1462,7 @@ class Account extends CommonObject
 		{
 			return 1;
 		}
-		else
-		{
+		else {
 			return 0;
 		}
 	}
@@ -1897,8 +1882,7 @@ class AccountLine extends CommonObject
 			$this->db->free($result);
 			return $ret;
 		}
-		else
-		{
+		else {
 			return -1;
 		}
 	}
@@ -2015,8 +1999,7 @@ class AccountLine extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -$nbko;
 		}
@@ -2054,8 +2037,7 @@ class AccountLine extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -$nbko;
 		}
@@ -2086,8 +2068,7 @@ class AccountLine extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			$this->error = $this->db->error();
 			return -1;
@@ -2152,8 +2133,7 @@ class AccountLine extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -2190,8 +2170,7 @@ class AccountLine extends CommonObject
 					return 1;
 				}
 			}
-			else
-			{
+			else {
 				dol_print_error($this->db);
 				return 0;
 			}
@@ -2257,8 +2236,7 @@ class AccountLine extends CommonObject
 					return 1;
 				}
 			}
-			else
-			{
+			else {
 				dol_print_error($this->db);
 				return 0;
 			}
@@ -2334,8 +2312,7 @@ class AccountLine extends CommonObject
 			}
 			$this->db->free($result);
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 		}
 	}
@@ -2477,8 +2454,7 @@ class AccountLine extends CommonObject
 				$alreadydispatched = $obj->nb;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			return -1;
 		}

+ 3 - 6
htdocs/compta/bank/class/api_bankaccounts.class.php

@@ -226,8 +226,7 @@ class BankAccounts extends DolibarrApi
         {
             $amount_to = $amount;
         }
-        else
-        {
+        else {
             if (!$amount_to || empty($amount_to))
             {
                 throw new RestException(422, 'You must provide amount_to value since bankaccount_from and bankaccount_to does not share the same currency.');
@@ -304,8 +303,7 @@ class BankAccounts extends DolibarrApi
                 )
             );
         }
-        else
-        {
+        else {
             $this->db->rollback();
             throw new RestException(500, $accountfrom->error.' '.$accountto->error);
         }
@@ -339,8 +337,7 @@ class BankAccounts extends DolibarrApi
         {
             return $this->get($id);
         }
-        else
-        {
+        else {
             throw new RestException(500, $account->error);
         }
     }

+ 8 - 16
htdocs/compta/bank/class/paymentvarious.class.php

@@ -170,8 +170,7 @@ class PaymentVarious extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -245,8 +244,7 @@ class PaymentVarious extends CommonObject
 
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = "Error ".$this->db->lasterror();
 			return -1;
 		}
@@ -431,8 +429,7 @@ class PaymentVarious extends CommonObject
 					{
 						$this->update_fk_bank($bank_line_id);
 					}
-					else
-					{
+					else {
 						$this->error = $acc->error;
 						$error++;
 					}
@@ -469,14 +466,12 @@ class PaymentVarious extends CommonObject
 				$this->db->commit();
 				return $this->id;
 			}
-			else
-			{
+			else {
 				$this->db->rollback();
 				return -2;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			$this->db->rollback();
 			return -1;
@@ -500,8 +495,7 @@ class PaymentVarious extends CommonObject
 		{
 			return 1;
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			return -1;
 		}
@@ -677,8 +671,7 @@ class PaymentVarious extends CommonObject
 			}
 			$this->db->free($result);
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 		}
 	}
@@ -706,8 +699,7 @@ class PaymentVarious extends CommonObject
 				$alreadydispatched = $obj->nb;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			return -1;
 		}

+ 18 - 36
htdocs/compta/bank/graph.php

@@ -85,8 +85,7 @@ if ($result < 0)
 	$error++;
 	setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors');
 }
-else
-{
+else {
 	// Calcul $min and $max
 	$sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max";
 	$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@@ -103,8 +102,7 @@ else
 		$min = $db->jdate($obj->min);
 		$max = $db->jdate($obj->max);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 	if (empty($min)) $min = dol_now() - 3600 * 24;
@@ -152,8 +150,7 @@ else
 			}
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -175,8 +172,7 @@ else
 			$solde = $row[0];
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -200,8 +196,7 @@ else
 			{
 				$datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph
 			}
-			else
-			{
+			else {
 				$datas[$i] = $solde + $subtotal;
 			}
 			$datamin[$i] = $object->min_desired;
@@ -295,8 +290,7 @@ else
 			}
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -318,8 +312,7 @@ else
 			$solde = $row[0];
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -344,8 +337,7 @@ else
 			{
 				$datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph
 			}
-			else
-			{
+			else {
 				$datas[$i] = $solde + $subtotal;
 			}
 			$datamin[$i] = $object->min_desired;
@@ -432,8 +424,7 @@ else
 				$i++;
 			}
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -460,8 +451,7 @@ else
 			{
 				$datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph
 			}
-			else
-			{
+			else {
 				$datas[$i] = 0 + $solde + $subtotal;
 			}
 			$datamin[$i] = $object->min_desired;
@@ -558,8 +548,7 @@ else
 			}
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -592,8 +581,7 @@ else
 			}
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -675,8 +663,7 @@ else
 			}
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 		$sql = "SELECT date_format(b.datev,'%m')";
@@ -700,8 +687,7 @@ else
 			}
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -771,15 +757,13 @@ if ($account)
 			$morehtml = '<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.'&option=all'.$moreparam.'">'.$langs->trans("ShowAllAccounts").'</a>';
     		dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1);
 		}
-		else
-		{
+		else {
 			$morehtml = '<a href="'.$_SERVER["PHP_SELF"].'?account='.$account.$moreparam.'">'.$langs->trans("BackToAccount").'</a>';
 			print $langs->trans("AllAccounts");
 			//print $morehtml;
 		}
 	}
-	else
-	{
+	else {
 	    $bankaccount = new Account($db);
 		$listid = explode(',', $account);
 		foreach ($listid as $key => $id)
@@ -791,8 +775,7 @@ if ($account)
 		}
 	}
 }
-else
-{
+else {
 	print $langs->trans("AllAccounts");
 }
 
@@ -809,8 +792,7 @@ if ($mode == 'showalltime')
 	print $langs->trans("GoBack");
 	print '</a>';
 }
-else
-{
+else {
 	print '<a href="'.$_SERVER["PHP_SELF"].'?mode=showalltime&account='.$account.'">';
 	print $langs->trans("ShowAllTimeBalance");
 	print '</a>';

+ 17 - 34
htdocs/compta/bank/line.php

@@ -100,8 +100,7 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban
         	dol_print_error($db);
     	}
 	}
-	else
-	{
+	else {
 		setEventMessages($langs->trans("MissingIds"), null, 'errors');
 	}
 }
@@ -121,8 +120,7 @@ if ($user->rights->banque->modifier && $action == "update")
 	{
 		$actarget->fetch(GETPOST('accountid', 'int'));
 	}
-	else
-	{
+	else {
 		$actarget->fetch($id);
 	}
 
@@ -192,8 +190,7 @@ if ($user->rights->banque->modifier && $action == "update")
 			setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
 			$db->commit();
 		}
-		else
-		{
+		else {
 			$db->rollback();
 			dol_print_error($db);
 		}
@@ -230,8 +227,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
 	        setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
             $db->commit();
         }
-        else
-        {
+        else {
             $db->rollback();
             dol_print_error($db);
         }
@@ -325,8 +321,7 @@ if ($result)
         {
         	$form->select_comptes($acct->id, 'accountid', 0, '', 0);
         }
-        else
-        {
+        else {
         	print $acct->getNomUrl(1, 'transactions', 'reflabel');
         }
         print '</td>';
@@ -464,8 +459,7 @@ if ($result)
             }
             print '</td>';
         }
-        else
-        {
+        else {
             print '<td>'.$objp->fk_type.' '.$objp->num_chq.'</td>';
         }
         print "</tr>";
@@ -480,8 +474,7 @@ if ($result)
             print '<input type="text" class="flat minwidth200" name="emetteur" value="'.(empty($objp->emetteur) ? '' : stripslashes($objp->emetteur)).'">';
             print '</td>';
         }
-        else
-        {
+        else {
             print '<td>'.$objp->emetteur.'</td>';
         }
         print "</tr>";
@@ -496,8 +489,7 @@ if ($result)
         	print '<input type="text" class="flat minwidth200" name="banque" value="'.(empty($objp->banque) ? '' : $objp->banque).'">';
         	print '</td>';
         }
-        else
-        {
+        else {
         	print '<td>'.$objp->banque.'</td>';
         }
         print "</tr>";
@@ -518,8 +510,7 @@ if ($result)
             }
             print '</td>';
         }
-        else
-        {
+        else {
             print '<td>';
             print dol_print_date($db->jdate($objp->do), "day");
             print '</td>';
@@ -542,8 +533,7 @@ if ($result)
             }
             print '</td>';
         }
-        else
-        {
+        else {
             print '<td>';
             print dol_print_date($db->jdate($objp->dv), "day");
             print '</td>';
@@ -561,23 +551,20 @@ if ($result)
                 // Label generique car entre parentheses. On l'affiche en le traduisant
                 print $langs->trans($reg[1]);
             }
-            else
-            {
+            else {
                 print $objp->label;
             }
             print '">';
             print '</td>';
         }
-        else
-        {
+        else {
             print '<td>';
             if (preg_match('/^\((.*)\)$/i', $objp->label, $reg))
             {
                 // Label generique car entre parentheses. On l'affiche en le traduisant
                 print $langs->trans($reg[1]);
             }
-            else
-            {
+            else {
                 print $objp->label;
             }
             print '</td>';
@@ -592,8 +579,7 @@ if ($result)
             print '<input name="amount" class="flat maxwidth100" '.($objp->rappro ? ' disabled' : '').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code);
             print '</td>';
         }
-        else
-        {
+        else {
             print '<td>';
             print price($objp->amount);
             print '</td>';
@@ -650,15 +636,13 @@ if ($result)
                     print $langs->trans("AccountStatement").' <input name="num_rel_bis" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
                     print '<input name="num_rel" type="hidden" value="'.$objp->num_releve.'">';
                 }
-                else
-                {
+                else {
                     print $langs->trans("AccountStatement").' <input name="num_rel" class="flat" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
                 }
                 if ($objp->num_releve) print ' &nbsp; (<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?num='.$objp->num_releve.'&account='.$acct->id.'">'.$langs->trans("AccountStatement").' '.$objp->num_releve.')</a>';
                 print '</td>';
             }
-            else
-            {
+            else {
                 print '<td>'.$objp->num_releve.'&nbsp;</td>';
             }
             print '</tr>';
@@ -670,8 +654,7 @@ if ($result)
                 print '<input type="checkbox" name="reconciled" class="flat" '.(isset($_POST["reconciled"]) ? ($_POST["reconciled"] ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
                 print '</td>';
             }
-            else
-            {
+            else {
                 print '<td>'.yn($objp->rappro).'</td>';
             }
             print '</tr>';

+ 2 - 4
htdocs/compta/bank/list.php

@@ -488,8 +488,7 @@ foreach ($accounts as $key=>$type)
     		$accountingaccount->fetch('', $objecttmp->account_number, 1);
     		print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
     	}
-    	else
-    	{
+    	else {
     		print $objecttmp->account_number;
     	}
     	print '</td>';
@@ -506,8 +505,7 @@ foreach ($accounts as $key=>$type)
     		$accountingjournal->fetch($objecttmp->fk_accountancy_journal);
     		print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
     	}
-    	else
-    	{
+    	else {
     		print '';
     	}
     	print '</td>';

+ 8 - 16
htdocs/compta/bank/releve.php

@@ -296,16 +296,14 @@ if (empty($numref))
 			{
 				//
 			}
-			else
-			{
+			else {
 				print '<tr class="oddeven">';
 				print '<td>';
 				if ($action != 'editbankreceipt' || $objp->numr != $brref)
 				{
 					print '<a href="releve.php?num='.$objp->numr.'&account='.$object->id.'">'.$objp->numr.'</a>';
 				}
-				else
-				{
+				else {
 					print '<input type="hidden" name="oldbankreceipt" value="'.$objp->numr.'">';
 					print '<input type="text" name="newbankreceipt" value="'.$objp->numr.'">';
 					print '<input type="submit" class="button" name="actionnewbankreceipt" value="'.$langs->trans("Rename").'">';
@@ -356,13 +354,11 @@ if (empty($numref))
 
 		print "\n</div>\n";
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
-else
-{
+else {
 	/**
 	 *   Show list of record into a bank statement
 	 */
@@ -554,8 +550,7 @@ else
 						print $bankstatic->getNomUrl(1, '');
 						print ')';
 					}
-					else
-					{
+					else {
 						$bankstatic->id = $objp->bankid;
 						$bankstatic->label = $objp->bankref;
 						print ' ('.$langs->trans("from").' ';
@@ -626,8 +621,7 @@ else
 						$ii++;
 					}
 				}
-				else
-				{
+				else {
 					dol_print_error($db);
 				}
 			}
@@ -639,8 +633,7 @@ else
 				$totald = $totald + abs($objp->amount);
 				print '<td class="nowrap right">'.price($objp->amount * -1)."</td><td>&nbsp;</td>\n";
 			}
-			else
-			{
+			else {
 				$totalc = $totalc + abs($objp->amount);
 				print '<td>&nbsp;</td><td class="nowrap right">'.price($objp->amount)."</td>\n";
 			}
@@ -653,8 +646,7 @@ else
 				print img_edit();
 				print "</a></td>";
 			}
-			else
-			{
+			else {
 				print "<td class=\"center\">&nbsp;</td>";
 			}
 			print "</tr>";

+ 3 - 6
htdocs/compta/bank/transfer.php

@@ -88,8 +88,7 @@ if ($action == 'add')
 		{
 			$amountto = $amount;
 		}
-		else
-		{
+		else {
 			if (!$amountto)
 			{
 				$error++;
@@ -131,14 +130,12 @@ if ($action == 'add')
 				setEventMessages($mesgs, null, 'mesgs');
 				$db->commit();
 			}
-			else
-			{
+			else {
 				setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors');
 				$db->rollback();
 			}
 		}
-		else
-		{
+		else {
 		    $error++;
 			setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers"), null, 'errors');
 		}

+ 3 - 6
htdocs/compta/bank/treso.php

@@ -73,8 +73,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
 	{
 		$viewline = $vline;
 	}
-	else
-	{
+	else {
 		$viewline = 20;
 	}
 
@@ -305,8 +304,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
 			$i++;
 		}
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 
@@ -327,8 +325,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
 	print "</table>";
     print "</div>";
 }
-else
-{
+else {
 	print $langs->trans("ErrorBankAccountNotFound");
 }
 

+ 7 - 14
htdocs/compta/bank/various_payment/card.php

@@ -164,8 +164,7 @@ if (empty($reshook))
 				header("Location: ".$urltogo);
 				exit;
 			}
-			else
-			{
+			else {
 				$db->rollback();
 				setEventMessages($object->error, $object->errors, 'errors');
 				$action = "create";
@@ -199,21 +198,18 @@ if (empty($reshook))
 					header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/list.php');
 					exit;
 				}
-				else
-				{
+				else {
 					$object->error = $accountline->error;
 					$db->rollback();
 					setEventMessages($object->error, $object->errors, 'errors');
 				}
 			}
-			else
-			{
+			else {
 				$db->rollback();
 				setEventMessages($object->error, $object->errors, 'errors');
 			}
 		}
-		else
-		{
+		else {
 			setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors');
 		}
 	}
@@ -392,8 +388,7 @@ if ($action == 'create')
         {
             print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, '');
         }
-        else
-        {
+        else {
             print '<input type="text" class="maxwidth200 maxwidthonsmartphone" name="subledger_account" value="'.$subledger_account.'">';
         }
         print '</td></tr>';
@@ -565,13 +560,11 @@ if ($id)
 				print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
 			}
 		}
-		else
-		{
+		else {
 			print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a></div>';
 		}
 	}
-	else
-	{
+	else {
 		print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a></div>';
 	}
 

+ 1 - 2
htdocs/compta/bank/various_payment/document.php

@@ -150,8 +150,7 @@ if ($object->id)
 	$param = '&id='.$object->id;
 	include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
 }
-else
-{
+else {
 	print $langs->trans("ErrorUnknown");
 }
 

+ 2 - 4
htdocs/compta/bank/various_payment/list.php

@@ -76,8 +76,7 @@ if (!GETPOST('typeid'))
 		if ($part[0] == 'v.fk_typepayment') $typeid = $part[1];
 	}
 }
-else
-{
+else {
 	$typeid = GETPOST('typeid');
 }
 
@@ -374,8 +373,7 @@ if ($result)
 
 	$db->free($result);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 8 - 16
htdocs/compta/cashcontrol/cashcontrol_card.php

@@ -178,8 +178,7 @@ elseif ($action == "add")
 			$db->commit();
 			$action = "view";
 		}
-		else
-		{
+		else {
 			$db->rollback;
 			$action = "view";
 		}
@@ -218,8 +217,7 @@ if ($action == "valid")	// validate = close
 		setEventMessages($object->error, $object->errors, 'errors');
 		$db->rollback();
 	}
-	else
-	{
+	else {
 		setEventMessages($langs->trans("CashFenceDone"), null);
 		$db->commit();
 	}
@@ -254,8 +252,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete))
         header("Location: ".$backurlforlist);
         exit;
     }
-    else
-    {
+    else {
         if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
         else setEventMessages($object->error, null, 'errors');
     }
@@ -330,8 +327,7 @@ if ($action == "create" || $action == "start" || $action == 'close')
     			}
     			else dol_print_error($db);
 			}
-			else
-			{
+			else {
 				setEventMessages($langs->trans("SetupOfTerminalNotComplete", $terminaltouse), null, 'errors');
 			    $error++;
 			}
@@ -350,8 +346,7 @@ if ($action == "create" || $action == "start" || $action == 'close')
 			if ($key == 'cash')       $sql .= " AND cp.code = 'LIQ'";
 			elseif ($key == 'cheque') $sql .= " AND cp.code = 'CHQ'";
 			elseif ($key == 'card')   $sql .= " AND cp.code = 'CB'";
-			else
-			{
+			else {
 				dol_print_error('Value for key = '.$key.' not supported');
 				exit;
 			}
@@ -394,8 +389,7 @@ if ($action == "create" || $action == "start" || $action == 'close')
 	    	print '<input type="hidden" name="action" value="valid">';
 			print '<input type="hidden" name="id" value="'.$id.'">';
 	    }
-		else
-	    {
+		else {
 	    	print '<input type="hidden" name="action" value="start">';
 	    }
 
@@ -470,8 +464,7 @@ if ($action == "create" || $action == "start" || $action == 'close')
 		{
 			print '';
 		}
-		else
-		{
+		else {
 			print '<input type="submit" name="add" class="button" value="'.$langs->trans("Start").'">';
 		}
 		print '</td>';
@@ -712,8 +705,7 @@ if (empty($action) || $action == "view" || $action == "close")
 	    		print '<input type="hidden" name="action" value="valid">';
 	    		print '<input type="hidden" name="id" value="'.$id.'">';
 	    	}
-	    	else
-	    	{
+	    	else {
 	    		print '<input type="hidden" name="action" value="start">';
 	    	}
 

+ 1 - 2
htdocs/compta/cashcontrol/cashcontrol_list.php

@@ -260,8 +260,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
 {
 	$num = $nbtotalofrecords;
 }
-else
-{
+else {
 	$sql .= $db->plimit($limit + 1, $offset);
 
 	$resql = $db->query($sql);

+ 2 - 4
htdocs/compta/cashcontrol/report.php

@@ -173,8 +173,7 @@ if ($resql)
             $cachebankaccount[$objp->bankid] = $bankaccounttmp;
             $bankaccount = $bankaccounttmp;
         }
-        else
-        {
+        else {
             $bankaccount = $cachebankaccount[$objp->bankid];
         }
 
@@ -312,8 +311,7 @@ if ($resql)
 
 	$db->free($resql);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 6 - 12
htdocs/compta/charges/index.php

@@ -104,8 +104,7 @@ if ($mode != 'sconly')
     $center = ($year ? '<a href="index.php?year='.($year - 1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="index.php?year='.($year + 1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>" : "");
     print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'object_payment', 0, '', '', $limit, 1);
 }
-else
-{
+else {
     print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'object_payment', 0, '', '', $limit, 0);
 }
 
@@ -241,8 +240,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
 	    print '<td class="liste_total right">'.price($totalpaye)."</td>";
 		print "</tr>";
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 	print '</table>';
@@ -357,8 +355,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
 		    print "</table>";
 		    $db->free($result);
 		}
-		else
-		{
+		else {
 		    dol_print_error($db);
 		}
 	}
@@ -380,8 +377,7 @@ elseif ($mysoc->localtax2_assuj == "1")
 	$j = 2;
 	$numlt = 3;
 }
-else
-{
+else {
 	$j = 0;
 	$numlt = 0;
 }
@@ -452,8 +448,7 @@ while ($j < $numlt)
 			print "</table>";
 			$db->free($result);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 	}
@@ -566,8 +561,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
 
             print "<br>";
         }
-        else
-        {
+        else {
             dol_print_error($db);
         }
     }

+ 1 - 2
htdocs/compta/clients.php

@@ -197,8 +197,7 @@ if ($resql)
 
 	$db->free($resql);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 15 - 30
htdocs/compta/deplacement/card.php

@@ -71,8 +71,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer)
             header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
             exit;
         }
-        else
-        {
+        else {
 	        setEventMessages($object->error, $object->errors, 'errors');
         }
     }
@@ -89,8 +88,7 @@ elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer)
             header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
             exit;
         }
-        else
-        {
+        else {
 	        setEventMessages($object->error, $object->errors, 'errors');
         }
     }
@@ -104,8 +102,7 @@ elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->depla
         header("Location: index.php");
         exit;
     }
-    else
-    {
+    else {
 	    setEventMessages($object->error, $object->errors, 'errors');
     }
 }
@@ -150,19 +147,16 @@ elseif ($action == 'add' && $user->rights->deplacement->creer)
                 header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
                 exit;
             }
-            else
-            {
+            else {
 	            setEventMessages($object->error, $object->errors, 'errors');
                 $action = 'create';
             }
         }
-        else
-        {
+        else {
             $action = 'create';
         }
     }
-    else
-    {
+    else {
         header("Location: index.php");
         exit;
     }
@@ -190,13 +184,11 @@ elseif ($action == 'update' && $user->rights->deplacement->creer)
             header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
             exit;
         }
-        else
-        {
+        else {
 	        setEventMessages($object->error, $object->errors, 'errors');
         }
     }
-    else
-    {
+    else {
         header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
         exit;
     }
@@ -413,8 +405,7 @@ elseif ($id)
 
             print '</div>';
         }
-        else
-        {
+        else {
             /*
              * Confirm delete trip
              */
@@ -493,8 +484,7 @@ elseif ($id)
                 {
                     $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1);
                 }
-                else
-                {
+                else {
                     $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0);
                 }
                 print '</td>';
@@ -529,8 +519,7 @@ elseif ($id)
 	            {
 	                print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
 	            }
-	            else
-	            {
+	            else {
 	                print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
 	            }
             }
@@ -541,8 +530,7 @@ elseif ($id)
                 {
                     print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=validate&id='.$id.'">'.$langs->trans('Validate').'</a>';
                 }
-                else
-                {
+                else {
                     print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Validate').'</a>';
                 }
             }
@@ -553,8 +541,7 @@ elseif ($id)
                 {
                     print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=classifyrefunded&id='.$id.'">'.$langs->trans('ClassifyRefunded').'</a>';
                 }
-                else
-                {
+                else {
                     print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
                 }
             }
@@ -563,16 +550,14 @@ elseif ($id)
             {
                 print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
             }
-            else
-            {
+            else {
                 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
             }
 
             print '</div>';
         }
     }
-    else
-    {
+    else {
         dol_print_error($db);
     }
 }

+ 7 - 14
htdocs/compta/deplacement/class/deplacement.class.php

@@ -200,15 +200,13 @@ class Deplacement extends CommonObject
 				$this->db->commit();
 				return $this->id;
 			}
-			else
-			{
+			else {
 				$this->error = $this->db->error();
 				$this->db->rollback();
 				return $result;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error()." sql=".$sql;
 			$this->db->rollback();
 			return -1;
@@ -268,8 +266,7 @@ class Deplacement extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			$this->db->rollback();
 			return -1;
@@ -313,8 +310,7 @@ class Deplacement extends CommonObject
 
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			return -1;
 		}
@@ -339,8 +335,7 @@ class Deplacement extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			$this->db->rollback();
 			return -1;
@@ -461,8 +456,7 @@ class Deplacement extends CommonObject
                 $i++;
             }
         }
-        else
-        {
+        else {
         	dol_print_error($this->db);
         }
 
@@ -508,8 +502,7 @@ class Deplacement extends CommonObject
 			}
 			$this->db->free($result);
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 		}
 	}

+ 1 - 2
htdocs/compta/deplacement/document.php

@@ -124,8 +124,7 @@ if ($object->id)
     $param = '&id='.$object->id;
     include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
 }
-else
-{
+else {
 	print $langs->trans("ErrorUnknown");
 }
 

+ 1 - 2
htdocs/compta/deplacement/index.php

@@ -193,8 +193,7 @@ if ($result)
             $i++;
         }
     }
-    else
-    {
+    else {
         print '<tr class="oddeven"><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
     }
     print '</table><br>';

+ 1 - 2
htdocs/compta/deplacement/list.php

@@ -197,8 +197,7 @@ if ($resql)
     print "</form>\n";
     $db->free($resql);
 }
-else
-{
+else {
     dol_print_error($db);
 }
 

+ 1 - 2
htdocs/compta/deplacement/stats/index.php

@@ -168,8 +168,7 @@ if (!$user->rights->societe->client->voir || $user->socid)
     if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
     if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png';
 }
-else
-{
+else {
     $filename_avg = $dir.'/ordersaverage-'.$year.'.png';
     if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png';
     if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png';

+ 33 - 66
htdocs/compta/facture/card-rec.php

@@ -239,8 +239,7 @@ if (empty($reshook))
 					$action = "create";
 				}
 			}
-			else
-			{
+			else {
 				$error++;
 				setEventMessages($object->error, $object->errors, 'errors');
 				$action = "create";
@@ -253,8 +252,7 @@ if (empty($reshook))
 				header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id);
 	   			exit;
 			}
-			else
-			{
+			else {
 				$db->rollback();
 
 				$error++;
@@ -357,8 +355,7 @@ if (empty($reshook))
 		{
 			$db->commit();
 		}
-		else
-		{
+		else {
 			$db->rollback();
 			setEventMessages($object->error, $object->errors, 'errors');
 		}
@@ -381,8 +378,7 @@ if (empty($reshook))
 		{
 			$db->commit();
 		}
-		else
-		{
+		else {
 			$db->rollback();
 			setEventMessages($object->error, $object->errors, 'errors');
 		}
@@ -419,14 +415,12 @@ if (empty($reshook))
 				$db->commit();
 				$object->fetch($object->id); // Reload lines
 			}
-			else
-			{
+			else {
 				$db->rollback();
 				setEventMessages($db->lasterror(), null, 'errors');
 			}
 		}
-		else
-		{
+		else {
 			$db->rollback();
 			setEventMessages($line->error, $line->errors, 'errors');
 		}
@@ -467,8 +461,7 @@ if (empty($reshook))
 			$idprod = 0;
 			$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
 		}
-		else
-		{
+		else {
 			$idprod = GETPOST('idprod', 'int');
 			$tva_tx = '';
 		}
@@ -579,8 +572,7 @@ if (empty($reshook))
 					{
 						$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
 					}
-					else
-					{
+					else {
 						$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
 					}
 				}
@@ -604,8 +596,7 @@ if (empty($reshook))
 
 					$desc = (!empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description;
 				}
-				else
-				{
+				else {
 					$desc = $prod->description;
 				}
 
@@ -641,8 +632,7 @@ if (empty($reshook))
 				$type = $prod->type;
 				$fk_unit = $prod->fk_unit;
 			}
-			else
-			{
+			else {
 				$pu_ht = price2num($price_ht, 'MU');
 				$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
 				$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
@@ -673,8 +663,7 @@ if (empty($reshook))
 				$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
 				setEventMessages($mesg, null, 'errors');
 			}
-			else
-			{
+			else {
 				// Insert line
 				$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice);
 
@@ -739,8 +728,7 @@ if (empty($reshook))
 					unset($_POST['situations']);
 					unset($_POST['progress']);
 				}
-				else
-				{
+				else {
 					setEventMessages($object->error, $object->errors, 'errors');
 				}
 
@@ -948,8 +936,7 @@ if (empty($reshook))
 				unset($_POST['situations']);
 				unset($_POST['progress']);
 			}
-			else
-			{
+			else {
 				setEventMessages($object->error, $object->errors, 'errors');
 			}
 		}
@@ -1145,8 +1132,7 @@ if ($action == 'create')
 			print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf'));
 			print "</td></tr>";
 		}
-		else
-		{
+		else {
 			print '<input type="hidden" name="generate_pdf" value="1">';
 		}
 
@@ -1199,13 +1185,11 @@ if ($action == 'create')
 		print '</div>';
 		print "</form>\n";
 	}
-	else
-	{
+	else {
 		dol_print_error('', "Error, no invoice ".$object->id);
 	}
 }
-else
-{
+else {
 	/*
 	 * View mode
 	 */
@@ -1329,8 +1313,7 @@ else
 			{
 				$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
 			}
-			else
-			{
+			else {
 				$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
 			}
 		} else {
@@ -1351,8 +1334,7 @@ else
 		{
 			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
 		}
-		else
-		{
+		else {
 			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none');
 		}
 		print '</td></tr>';
@@ -1460,8 +1442,7 @@ else
 		{
 			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
 		}
-		else
-		{
+		else {
 			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
 		}
 		print "</td>";
@@ -1487,8 +1468,7 @@ else
             $select = 'select;'.implode(',', $list);
             print $form->editfieldval($langs->trans("Model"), 'modelpdf', $object->modelpdf, $object, $user->rights->facture->creer, $select);
         }
-        else
-        {
+        else {
             print $object->modelpdf;
         }
         print "</td>";
@@ -1537,14 +1517,12 @@ else
 			print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
 			print '</tr></table></form>';
 		}
-		else
-		{
+		else {
 			if ($object->frequency > 0)
 			{
 				print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
 			}
-			else
-			{
+			else {
 				print $langs->trans("NotARecurringInvoiceTemplate");
 			}
 		}
@@ -1556,8 +1534,7 @@ else
 		{
 			print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day');
 		}
-		else
-		{
+		else {
 			print $langs->trans("NextDateToExecution");
 		}
 		print '</td><td>';
@@ -1570,8 +1547,7 @@ else
 		{
 			if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late"));
 		}
-		else
-		{
+		else {
 			print img_info($langs->trans("MaxNumberOfGenerationReached"));
 		}
 		print '</td>';
@@ -1583,8 +1559,7 @@ else
 		{
 			print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer);
 		}
-		else
-		{
+		else {
 			print $langs->trans("MaxPeriodNumber");
 		}
 		print '</td><td>';
@@ -1592,8 +1567,7 @@ else
 		{
 			  print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max ? $object->nb_gen_max : '', $object, $user->rights->facture->creer);
 		}
-		else
-		{
+		else {
 			print '';
 		}
 		print '</td>';
@@ -1603,8 +1577,7 @@ else
 		print '<tr><td>';
 		if ($action == 'auto_validate' || $object->frequency > 0)
 			print $form->editfieldkey($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer);
-		else
-			print $langs->trans("StatusOfGeneratedInvoices");
+		else print $langs->trans("StatusOfGeneratedInvoices");
 		print '</td><td>';
 		$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated');
 		if ($action == 'auto_validate' || $object->frequency > 0)
@@ -1619,8 +1592,7 @@ else
 			print '<td>';
 			if ($action == 'generate_pdf' || $object->frequency > 0)
 				print $form->editfieldkey($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $user->rights->facture->creer);
-			else
-				print $langs->trans("StatusOfGeneratedDocuments");
+			else print $langs->trans("StatusOfGeneratedDocuments");
 			print '</td>';
 			print '<td>';
 			$select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc');
@@ -1631,8 +1603,7 @@ else
 			print '</td>';
 			print '</tr>';
 		}
-		else
-		{
+		else {
 			print '<input type="hidden" name="generate_pdf" value="1">';
 		}
 
@@ -1734,20 +1705,17 @@ else
 				{
 					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
 				}
-				else
-				{
+				else {
 					if (empty($object->frequency) || $object->date_when <= $today)
 					{
 						print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
 					}
-					else
-					{
+					else {
 						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
 					}
 				}
 			}
-			else
-			{
+			else {
 				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>';
 			}
 		}
@@ -1758,8 +1726,7 @@ else
 			{
 				print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?action=disable&id='.$object->id.'">'.$langs->trans("Disable").'</a></div>';
 			}
-			else
-			{
+			else {
 				print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?action=enable&id='.$object->id.'">'.$langs->trans("Enable").'</a></div>';
 			}
 		}

+ 44 - 87
htdocs/compta/facture/card.php

@@ -619,8 +619,7 @@ if (empty($reshook))
 					}
 				}
 			}
-			else
-			{
+			else {
 				//var_dump($conf->global->SOCIETE_EMAIL_MANDATORY);
 				if ($key == 'EMAIL')
 				{
@@ -696,8 +695,7 @@ if (empty($reshook))
 					if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
 				}
 			}
-			else
-			{
+			else {
 				if (count($object->errors)) setEventMessages(null, $object->errors, 'errors');
 				else setEventMessages($object->error, $object->errors, 'errors');
 			}
@@ -972,8 +970,7 @@ if (empty($reshook))
 					{
 						$db->commit();
 					}
-					else
-					{
+					else {
 						setEventMessages($object->error, $object->errors, 'errors');
 						$db->rollback();
 					}
@@ -981,8 +978,7 @@ if (empty($reshook))
 					$db->commit();
 				}
 			}
-			else
-			{
+			else {
 				setEventMessages($discount->error, $discount->errors, 'errors');
 				$db->rollback();
 			}
@@ -1176,8 +1172,7 @@ if (empty($reshook))
 							                $searchPreviousInvoice = false; // find, exit;
 							                break;
 							            }
-							            else
-							            {
+							            else {
 							                $lineIndex--; // go to previous invoice in cycle
 							            }
 							        }
@@ -1470,8 +1465,7 @@ if (empty($reshook))
 									$amountdeposit[$tva] += $am / (1 + $tva / 100); // Convert into HT for the addline
 								}
 							}
-							else
-							{
+							else {
 								if ($typeamount == 'amount')
 								{
 									$amountdeposit[0] = $valuedeposit;
@@ -1725,8 +1719,7 @@ if (empty($reshook))
 						$error++;
 					}
 				}
-				else
-				{   // If some invoice's lines coming from page
+				else {   // If some invoice's lines coming from page
 					$id = $object->create($user);
 
 					for ($i = 1; $i <= $NBLINES; $i++) {
@@ -1853,8 +1846,7 @@ if (empty($reshook))
 				{
 					$mesg = $object->error;
 				}
-				else
-				{
+				else {
 					$nextSituationInvoice = new Facture($db);
 					$nextSituationInvoice->fetch($id);
 
@@ -1895,8 +1887,7 @@ if (empty($reshook))
 			header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
 			exit();
 		}
-		else
-		{
+		else {
 			$db->rollback();
 			$action = 'create';
 			$_GET["origin"] = $_POST["origin"];
@@ -1922,8 +1913,7 @@ if (empty($reshook))
 			$idprod = 0;
 			$tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0);
 		}
-		else
-		{
+		else {
 			$idprod = GETPOST('idprod', 'int');
 			$tva_tx = '';
 		}
@@ -1971,8 +1961,7 @@ if (empty($reshook))
 				}
 				$error++;
 			}
-			else
-			{
+			else {
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
 				$error++;
 			}
@@ -1999,8 +1988,7 @@ if (empty($reshook))
 				if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
 					$idprod = $res->fk_product_child;
 				}
-				else
-				{
+				else {
 					setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors');
 					$error++;
 				}
@@ -2065,8 +2053,7 @@ if (empty($reshook))
 					{
 						$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
 					}
-					else
-					{
+					else {
 						$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
 					}
 				}
@@ -2357,8 +2344,7 @@ if (empty($reshook))
 				}
 				$error++;
 			}
-			else
-			{
+			else {
 				setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
 				$error++;
 			}
@@ -2458,8 +2444,7 @@ if (empty($reshook))
                     $mesg = $langs->trans("Line").' '.$i.' : '.$langs->trans("CantBeLessThanMinPercent");
                     setEventMessages($mesg, null, 'warnings');
 					$result = -1;
-				} else
-					$object->update_percent($line, $_POST['all_progress']);
+				} else $object->update_percent($line, $_POST['all_progress']);
 			}
 		}
 	}
@@ -2540,8 +2525,7 @@ if (empty($reshook))
                                         $searchPreviousInvoice = false; // find, exit;
                                         break;
                                     }
-                                    else
-                                    {
+                                    else {
                                         $lineIndex--; // go to previous invoice in cycle
                                     }
                                 }
@@ -2569,18 +2553,15 @@ if (empty($reshook))
                         setEventMessages($langs->trans('Updated'), '', 'mesgs');
                         header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
                     }
-                    else
-                    {
+                    else {
                         setEventMessages($langs->trans('ErrorOutingSituationInvoiceCreditNote'), array(), 'errors');
                     }
 	            }
-	            else
-	            {
+	            else {
 	                setEventMessages($langs->trans('ErrorOutingSituationInvoiceOnUpdate'), array(), 'errors');
 	            }
 	        }
-	        else
-	        {
+	        else {
 	            setEventMessages($langs->trans('ErrorFindNextSituationInvoice'), array(), 'errors');
 	        }
 	    }
@@ -2875,8 +2856,7 @@ if ($action == 'create')
 				$expesrc->fetch_optionals();
 				$object->array_options = $expesrc->array_options;
 			}
-			else
-			{
+			else {
 				$cond_reglement_id 	= (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
 				$mode_reglement_id 	= (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
 				$fk_account         = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0));
@@ -2895,8 +2875,7 @@ if ($action == 'create')
 			}
 		}
 	}
-	else
-	{
+	else {
 		$cond_reglement_id 	= $soc->cond_reglement_id;
 		$mode_reglement_id 	= $soc->mode_reglement_id;
 		$fk_account        	= $soc->fk_account;
@@ -2979,8 +2958,7 @@ if ($action == 'create')
 		print '</td>';
 		print '</tr>'."\n";
 	}
-	else
-	{
+	else {
 		print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
 		print '<td colspan="2">';
 		print $form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
@@ -3204,8 +3182,7 @@ if ($action == 'create')
 			print '</div></div>';
 		}
 	}
-	else
-	{
+	else {
 	    if (!empty($conf->global->INVOICE_USE_SITUATION))
 	    {
     	    print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
@@ -3311,8 +3288,7 @@ if ($action == 'create')
     			print '</div></div>';
     		}
 		}
-		else
-		{
+		else {
 			print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
 			if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
 			else $tmp = '<input type="radio" name="type" id="radio_creditnote" value="2" > ';
@@ -3790,8 +3766,7 @@ elseif ($id > 0 || !empty($ref))
 				);
 				$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1);
 			}
-			else
-			{
+			else {
 				$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1);
 			}
 		} else {
@@ -4128,8 +4103,7 @@ elseif ($id > 0 || !empty($ref))
 		foreach ($facidavoir as $id) {
 			if ($i == 0)
 				print ' ';
-			else
-				print ',';
+			else print ',';
 			$facavoir = new Facture($db);
 			$facavoir->fetch($id);
 			print $facavoir->getNomUrl(1);
@@ -4274,8 +4248,7 @@ elseif ($id > 0 || !empty($ref))
 	{
 		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
 	}
-	else
-	{
+	else {
 		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT');
 	}
 	print '</td></tr>';
@@ -4339,8 +4312,7 @@ elseif ($id > 0 || !empty($ref))
 	{
 		$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
 	}
-	else
-	{
+	else {
 		$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
 	}
 	print "</td>";
@@ -4362,8 +4334,7 @@ elseif ($id > 0 || !empty($ref))
 		{
 			print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
 		}
-		else
-		{
+		else {
 			print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
 		}
 		print '</td></tr>';
@@ -4377,7 +4348,7 @@ elseif ($id > 0 || !empty($ref))
 			$displayWarranty = false;
 		}
 
-		if($displayWarranty) {
+		if ($displayWarranty) {
 			// Retained Warranty
 			print '<tr class="retained-warranty-lines"  ><td>';
 			print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
@@ -4398,8 +4369,7 @@ elseif ($id > 0 || !empty($ref))
 		        print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
 		        print '</form>';
 		    }
-		    else
-		    {
+		    else {
 		        print price($object->retained_warranty).'%';
 		    }
 		    print '</td></tr>';
@@ -4433,8 +4403,7 @@ elseif ($id > 0 || !empty($ref))
 		        print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
 		        print '</form>';
 		    }
-		    else
-		    {
+		    else {
 		        $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none');
 		        if (!$displayWarranty) {
 		            print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
@@ -4468,8 +4437,7 @@ elseif ($id > 0 || !empty($ref))
                 print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
                 print '</form>';
             }
-            else
-            {
+            else {
                 print dol_print_date($object->retained_warranty_date_limit, 'day');
             }
             print '</td></tr>';
@@ -4831,8 +4799,7 @@ elseif ($id > 0 || !empty($ref))
 		print '<tr><td colspan="'.$nbcols.'" class="right">';
 		if ($object->type != Facture::TYPE_DEPOSIT)
 			print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits');
-		else
-			print $langs->trans('AlreadyPaid');
+		else print $langs->trans('AlreadyPaid');
 		print ' :</td><td class="right'.(($totalpaye > 0) ? ' amountalreadypaid' : '').'">'.price($totalpaye).'</td><td>&nbsp;</td></tr>';
 
 		$resteapayeraffiche = $resteapayer;
@@ -4928,8 +4895,7 @@ elseif ($id > 0 || !empty($ref))
 		    {
 		        $retainedWarranty = $total_global_ttc * $object->retained_warranty / 100;
 		    }
-		    else
-		    {
+		    else {
 		        // Because one day retained warranty could be used on standard invoices
 		        $retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
 		    }
@@ -5119,8 +5085,7 @@ elseif ($id > 0 || !empty($ref))
 						}
 					}
 				}
-				else
-				{
+				else {
 					print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseDispatchedInBookkeeping").'">'.$langs->trans('Modify').'</span>';
 				}
 			}
@@ -5159,8 +5124,7 @@ elseif ($id > 0 || !empty($ref))
 					} else {
 						if ($usercansend) {
 							print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
-						} else
-							print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a>';
+						} else print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a>';
 					}
 				}
 			}
@@ -5179,13 +5143,11 @@ elseif ($id > 0 || !empty($ref))
 							print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('MakeWithdrawRequest').'</span>';
 						}
 					}
-					else
-					{
+					else {
 						//print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
 					}
 				}
-				else
-				{
+				else {
 					//print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
 				}
 			}
@@ -5220,8 +5182,7 @@ elseif ($id > 0 || !empty($ref))
 					{
 						print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPaymentBack').'</span>';
 					}
-					else
-					{
+					else {
 						print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&amp;action=create&amp;accountid='.$object->fk_account.'">'.$langs->trans('DoPaymentBack').'</a>';
 					}
 				}
@@ -5261,16 +5222,14 @@ elseif ($id > 0 || !empty($ref))
 					// If one payment or one credit note was linked to this invoice
 					print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=paid">'.$langs->trans('ClassifyPaidPartially').'</a>';
 				}
-				else
-				{
+				else {
 					if (empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED))
 					{
 						if ($objectidnext)
 						{
 							print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ClassifyCanceled').'</span>';
 						}
-						else
-						{
+						else {
 							print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=canceled">'.$langs->trans('ClassifyCanceled').'</a>';
 						}
 					}
@@ -5333,8 +5292,7 @@ elseif ($id > 0 || !empty($ref))
 			    {
 			        print '<a id="butSituationOut" class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=situationout">'.$langs->trans("RemoveSituationFromCycle").'</a>';
 			    }
-			    else
-			    {
+			    else {
 			        print '<a id="butSituationOutRefused" class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotEnouthCreditNote").'" >'.$langs->trans("RemoveSituationFromCycle").'</a>';
 			    }
 			}
@@ -5375,8 +5333,7 @@ elseif ($id > 0 || !empty($ref))
 				{
 					print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</a>';
 				}
-				else
-				{
+				else {
 					print '<a class="butActionDelete'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
 				}
 			} else {

+ 3 - 6
htdocs/compta/facture/class/api_invoices.class.php

@@ -549,8 +549,7 @@ class Invoices extends DolibarrApi
     	if ($updateRes > 0) {
     		return $this->get($id);
     	}
-    	else
-    	{
+    	else {
     		throw new RestException(405, $this->invoice->error);
     	}
     }
@@ -1125,8 +1124,7 @@ class Invoices extends DolibarrApi
                     {
                         $this->db->commit();
                     }
-                    else
-                    {
+                    else {
                         $this->db->rollback();
                         throw new RestException(500, 'Could not set paid');
                     }
@@ -1134,8 +1132,7 @@ class Invoices extends DolibarrApi
                     $this->db->commit();
                 }
             }
-            else
-            {
+            else {
                 $this->db->rollback();
                 throw new RestException(500, 'Discount creation error');
             }

+ 33 - 64
htdocs/compta/facture/class/facture-rec.class.php

@@ -378,7 +378,7 @@ class FactureRec extends CommonInvoice
 					            }
 					        }
 					    }
-					    else                                // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
+					    else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
 					    {
 					        $origin_id = $tmp_origin_id;
 	    					$ret = $this->add_object_linked($origin, $origin_id);
@@ -395,21 +395,18 @@ class FactureRec extends CommonInvoice
 				{
 					$this->db->rollback();
 				}
-				else
-				{
+				else {
 					$this->db->commit();
 					return $this->id;
 				}
 			}
-			else
-			{
+			else {
 			    $this->error = $this->db->lasterror();
 				$this->db->rollback();
 				return -2;
 			}
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -461,8 +458,7 @@ class FactureRec extends CommonInvoice
 	        $this->db->commit();
 	        return 1;
 	    }
-	    else
-	    {
+	    else {
 	        $this->error = $this->db->lasterror();
 	        $this->db->rollback();
 	        return -2;
@@ -585,15 +581,13 @@ class FactureRec extends CommonInvoice
 				}
 				return 1;
 			}
-			else
-			{
+			else {
 				$this->error = 'Bill with id '.$rowid.' or ref '.$ref.' not found sql='.$sql;
 				dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR);
 				return -2;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			return -1;
 		}
@@ -723,8 +717,7 @@ class FactureRec extends CommonInvoice
 			$this->db->free($result);
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			return -3;
 		}
@@ -767,14 +760,12 @@ class FactureRec extends CommonInvoice
                 $res = $this->deleteExtraFields();
                 if ($res < 0) $error = -4;
 			}
-			else
-			{
+			else {
 				$this->error = $this->db->lasterror();
 				$error = -1;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			$error = -2;
 		}
@@ -784,8 +775,7 @@ class FactureRec extends CommonInvoice
 		    $this->db->commit();
 		    return 1;
 		}
-		else
-		{
+		else {
 	        $this->db->rollback();
 	        return $error;
 		}
@@ -861,8 +851,7 @@ class FactureRec extends CommonInvoice
 			{
 				$pu = $pu_ht;
 			}
-			else
-			{
+			else {
 				$pu = $pu_ttc;
 			}
 
@@ -970,8 +959,7 @@ class FactureRec extends CommonInvoice
 				$this->update_price();
 				return $lineId;
 			}
-			else
-			{
+			else {
 				$this->error = $this->db->lasterror();
 				return -1;
 			}
@@ -1046,8 +1034,7 @@ class FactureRec extends CommonInvoice
 	        {
 	            $pu = $pu_ht;
 	        }
-	        else
-	        {
+	        else {
 	            $pu = $pu_ttc;
 	        }
 
@@ -1132,8 +1119,7 @@ class FactureRec extends CommonInvoice
 	            $this->update_price();
 	            return 1;
 	        }
-	        else
-	        {
+	        else {
 	            $this->error = $this->db->lasterror();
 	            return -1;
 	        }
@@ -1226,8 +1212,7 @@ class FactureRec extends CommonInvoice
 
 			if ($num)
 				$this->output .= $langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n";
-			else
-				$this->output .= $langs->trans("NoQualifiedRecurringInvoiceTemplateFound");
+			else $this->output .= $langs->trans("NoQualifiedRecurringInvoiceTemplateFound");
 
 			$saventity = $conf->entity;
 
@@ -1289,8 +1274,7 @@ class FactureRec extends CommonInvoice
 						}
 					}
 				}
-				else
-				{
+				else {
 					$error++;
 					$this->error = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity."\n";
 					$this->errors[] = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity;
@@ -1304,8 +1288,7 @@ class FactureRec extends CommonInvoice
 					$nb_create++;
 					$this->output .= $langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n";
 				}
-				else
-				{
+				else {
 					$db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref);
 				}
 
@@ -1435,8 +1418,7 @@ class FactureRec extends CommonInvoice
 					$labelStatus = $langs->trans('Active');
 				}
 			}
-			else
-			{
+			else {
 				if ($status == self::STATUS_SUSPENDED) {
 					$labelStatus = $langs->trans('Disabled');
 				}
@@ -1457,8 +1439,7 @@ class FactureRec extends CommonInvoice
 					$labelStatus = $langs->trans('Active');
 				}
 			}
-			else
-			{
+			else {
 				if ($status == self::STATUS_SUSPENDED) {
 					$labelStatus = $langs->trans('Disabled');
 				}
@@ -1480,8 +1461,7 @@ class FactureRec extends CommonInvoice
 					$labelStatus = $langs->trans('Active');
 				}
 			}
-			else
-			{
+			else {
 				if ($status == self::STATUS_SUSPENDED) {
 					$statusType = 'status6';
 					$labelStatus = $langs->trans('Disabled');
@@ -1506,8 +1486,7 @@ class FactureRec extends CommonInvoice
 					$labelStatus = $langs->trans('Active');
 				}
 			}
-			else
-			{
+			else {
 				if ($status == self::STATUS_SUSPENDED) {
 					$statusType = 'status6';
 					$labelStatus = $langs->trans('Disabled');
@@ -1532,8 +1511,7 @@ class FactureRec extends CommonInvoice
 					$labelStatus = $langs->trans('Active');
 				}
 			}
-			else
-			{
+			else {
 				if ($status == self::STATUS_SUSPENDED) {
 					$statusType = 'status6';
 					$labelStatus = $langs->trans('Disabled');
@@ -1559,8 +1537,7 @@ class FactureRec extends CommonInvoice
 					$labelStatus = $langs->trans('Active');
 				}
 			}
-			else
-			{
+			else {
 				if ($status == self::STATUS_SUSPENDED) {
 					$statusType = 'status6';
 					$labelStatus = $langs->trans('Disabled');
@@ -1672,7 +1649,7 @@ class FactureRec extends CommonInvoice
 					$line->total_tva = 9.8;
 					$line->remise_percent = 50;
 				}
-				else    // (product line)
+				else // (product line)
 				{
 					$prodid = mt_rand(1, $num_prods);
 					$line->fk_product = $prodids[$prodid];
@@ -1762,8 +1739,7 @@ class FactureRec extends CommonInvoice
             if (!empty($unit)) $this->unit_frequency = $unit;
             return 1;
         }
-        else
-        {
+        else {
             dol_print_error($this->db);
             return -1;
         }
@@ -1795,8 +1771,7 @@ class FactureRec extends CommonInvoice
             if ($increment_nb_gen_done > 0) $this->nb_gen_done++;
             return 1;
         }
-        else
-        {
+        else {
             dol_print_error($this->db);
             return -1;
         }
@@ -1828,8 +1803,7 @@ class FactureRec extends CommonInvoice
             $this->nb_gen_max = $nb;
             return 1;
         }
-        else
-        {
+        else {
             dol_print_error($this->db);
             return -1;
         }
@@ -1859,8 +1833,7 @@ class FactureRec extends CommonInvoice
             $this->auto_validate = $validate;
             return 1;
         }
-        else
-        {
+        else {
             dol_print_error($this->db);
             return -1;
         }
@@ -1890,8 +1863,7 @@ class FactureRec extends CommonInvoice
             $this->generate_pdf = $validate;
             return 1;
         }
-        else
-        {
+        else {
             dol_print_error($this->db);
             return -1;
         }
@@ -1921,8 +1893,7 @@ class FactureRec extends CommonInvoice
             $this->modelpdf = $model;
             return 1;
         }
-        else
-        {
+        else {
             dol_print_error($this->db);
             return -1;
         }
@@ -2068,8 +2039,7 @@ class FactureLigneRec extends CommonInvoiceLine
     		$this->db->free($result);
     		return 1;
     	}
-    	else
-    	{
+    	else {
     		$this->error = $this->db->lasterror();
     		return -3;
     	}
@@ -2150,8 +2120,7 @@ class FactureLigneRec extends CommonInvoiceLine
             $this->db->commit();
             return 1;
         }
-        else
-        {
+        else {
             $this->error = $this->db->lasterror();
             $this->db->rollback();
             return -2;

+ 72 - 142
htdocs/compta/facture/class/facture.class.php

@@ -679,7 +679,7 @@ class Facture extends CommonInvoice
 				            }
 				        }
 				    }
-				    else                                // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
+				    else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
 				    {
 				        $origin_id = $tmp_origin_id;
     					$ret = $this->add_object_linked($origin, $origin_id);
@@ -988,28 +988,24 @@ class Facture extends CommonInvoice
 						$this->db->commit();
 						return $this->id;
 					}
-					else
-					{
+					else {
 						$this->db->rollback();
 						return -4;
 					}
 				}
-				else
-				{
+				else {
 					$this->error = $langs->trans('FailedToUpdatePrice');
 					$this->db->rollback();
 					return -3;
 				}
 			}
-			else
-			{
+			else {
 				dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR);
 				$this->db->rollback();
 				return -2;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			$this->db->rollback();
 			return -1;
@@ -1241,8 +1237,7 @@ class Facture extends CommonInvoice
 			$this->db->commit();
 			return $object->id;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -1646,15 +1641,13 @@ class Facture extends CommonInvoice
 				}
 				return 1;
 			}
-			else
-			{
+			else {
 				$this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found';
 				dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
 				return 0;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			return -1;
 		}
@@ -1776,8 +1769,7 @@ class Facture extends CommonInvoice
 			$this->db->free($result);
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			return -3;
 		}
@@ -1816,8 +1808,7 @@ class Facture extends CommonInvoice
 					{
 					    $this->tab_previous_situation_invoice[] = $invoice;
 					}
-					else
-					{
+					else {
 					    $this->tab_next_situation_invoice[] = $invoice;
 					}
 				}
@@ -1934,8 +1925,7 @@ class Facture extends CommonInvoice
 			$this->db->rollback();
 			return -1 * $error;
 		}
-		else
-		{
+		else {
 			$this->db->commit();
 			return 1;
 		}
@@ -2022,22 +2012,19 @@ class Facture extends CommonInvoice
 					$this->db->commit();
 					return 1;
 				}
-				else
-				{
+				else {
 					$this->error = $facligne->error;
 					$this->db->rollback();
 					return -1;
 				}
 			}
-			else
-			{
+			else {
 				$this->error = $facligne->error;
 				$this->db->rollback();
 				return -2;
 			}
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -3;
 		}
@@ -2063,8 +2050,7 @@ class Facture extends CommonInvoice
 		$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
 		if (empty($ref_client))
 			$sql .= ' SET ref_client = NULL';
-		else
-			$sql .= ' SET ref_client = \''.$this->db->escape($ref_client).'\'';
+		else $sql .= ' SET ref_client = \''.$this->db->escape($ref_client).'\'';
 		$sql .= ' WHERE rowid = '.$this->id;
 
 		dol_syslog(__METHOD__.' this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG);
@@ -2095,8 +2081,7 @@ class Facture extends CommonInvoice
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			foreach ($this->errors as $errmsg)
 			{
 				dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
@@ -2261,22 +2246,19 @@ class Facture extends CommonInvoice
 					$this->db->commit();
 					return 1;
 				}
-				else
-				{
+				else {
 					$this->error = $this->db->lasterror()." sql=".$sql;
 					$this->db->rollback();
 					return -6;
 				}
 			}
-			else
-			{
+			else {
 				$this->error = $this->db->lasterror()." sql=".$sql;
 				$this->db->rollback();
 				return -4;
 			}
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -2;
 		}
@@ -2322,8 +2304,7 @@ class Facture extends CommonInvoice
 	            if ($result < 0) $error++;
 	            // End call triggers
 			}
-			else
-			{
+			else {
 				$error++;
 				$this->error = $this->db->lasterror();
 			}
@@ -2333,14 +2314,12 @@ class Facture extends CommonInvoice
 				$this->db->commit();
 				return 1;
 			}
-			else
-			{
+			else {
 				$this->db->rollback();
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			return 0;
 		}
 	}
@@ -2377,8 +2356,7 @@ class Facture extends CommonInvoice
             if ($result < 0) $error++;
             // End call triggers
 		}
-		else
-		{
+		else {
 			$error++;
 			$this->error = $this->db->error();
 			dol_print_error($this->db);
@@ -2389,8 +2367,7 @@ class Facture extends CommonInvoice
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -2446,15 +2423,13 @@ class Facture extends CommonInvoice
 				$this->db->commit();
 				return 1;
 			}
-			else
-			{
+			else {
 				$this->error = $this->db->error()." sql=".$sql;
 				$this->db->rollback();
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error()." sql=".$sql;
 			$this->db->rollback();
 			return -2;
@@ -2573,8 +2548,7 @@ class Facture extends CommonInvoice
 			}
 			$num = $this->getNextNumRef($this->thirdparty);
 		}
-		else
-		{
+		else {
 			$num = $this->ref;
 		}
 		$this->newref = dol_sanitizeFileName($num);
@@ -2804,8 +2778,7 @@ class Facture extends CommonInvoice
                 }
 			}
 		}
-		else
-		{
+		else {
 			$error++;
 		}
 
@@ -2814,8 +2787,7 @@ class Facture extends CommonInvoice
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -2943,14 +2915,12 @@ class Facture extends CommonInvoice
 				$this->db->commit();
 				return 1;
 			}
-			else
-			{
+			else {
 				$this->db->rollback();
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			$this->db->rollback();
 			return -1;
@@ -3070,8 +3040,7 @@ class Facture extends CommonInvoice
 			{
 				$pu = $pu_ht;
 			}
-			else
-			{
+			else {
 				$pu = $pu_ttc;
 			}
 
@@ -3213,22 +3182,19 @@ class Facture extends CommonInvoice
 					$this->db->commit();
 					return $this->line->id;
 				}
-				else
-				{
+				else {
 					$this->error = $this->db->lasterror();
 					$this->db->rollback();
 					return -1;
 				}
 			}
-			else
-			{
+			else {
 				$this->error = $this->line->error;
 				$this->db->rollback();
 				return -2;
 			}
 		}
-		else
-		{
+		else {
 			dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR);
 			return -3;
 		}
@@ -3444,15 +3410,13 @@ class Facture extends CommonInvoice
 				$this->db->commit();
 				return $result;
 			}
-			else
-			{
+			else {
 			    $this->error = $this->line->error;
 				$this->db->rollback();
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = "Invoice statut makes operation forbidden";
 			return -2;
 		}
@@ -3573,15 +3537,13 @@ class Facture extends CommonInvoice
 				$this->db->commit();
 				return 1;
 			}
-			else
-			{
+			else {
 				$this->db->rollback();
 				$this->error = $this->db->lasterror();
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			$this->error = $line->error;
 			return -1;
@@ -3640,8 +3602,7 @@ class Facture extends CommonInvoice
 				$this->db->commit();
 				return 1;
 			}
-			else
-			{
+			else {
 				foreach ($this->errors as $errmsg)
 				{
 					dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
@@ -3709,8 +3670,7 @@ class Facture extends CommonInvoice
 				$this->db->commit();
 				return 1;
 			}
-			else
-			{
+			else {
 				foreach ($this->errors as $errmsg)
 				{
 					dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
@@ -3869,8 +3829,7 @@ class Facture extends CommonInvoice
 			}
 			$this->db->free($result);
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 		}
 	}
@@ -3933,8 +3892,7 @@ class Facture extends CommonInvoice
 					{
 						$ga[$obj->fid] = $obj->ref.' ('.$obj->name.')';
 					}
-					else
-					{
+					else {
 						$ga[$i]['id'] = $obj->fid;
 						$ga[$i]['ref'] 	= $obj->ref;
 						$ga[$i]['name'] = $obj->name;
@@ -3944,8 +3902,7 @@ class Facture extends CommonInvoice
 			}
 			return $ga;
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			return -1;
 		}
@@ -3994,8 +3951,7 @@ class Facture extends CommonInvoice
 			//print_r($return);
 			return $return;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			return -1;
 		}
@@ -4042,8 +3998,7 @@ class Facture extends CommonInvoice
 		    $sqlSit .= " ORDER BY fs.situation_counter";
             $sql .= " AND ( f.type != ".self::TYPE_SITUATION." OR f.rowid IN (".$sqlSit.") )"; // Type non 5 si facture non avoir
 		}
-		else
-		{
+		else {
 		    $sql .= " AND f.type != ".self::TYPE_SITUATION; // Type non 5 si facture non avoir
 		}
 
@@ -4069,8 +4024,7 @@ class Facture extends CommonInvoice
 
 			return $return;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			return -1;
 		}
@@ -4147,8 +4101,7 @@ class Facture extends CommonInvoice
 						    $error++;
 						}
 					}
-					else
-					{
+					else {
 						$this->error = 'WithdrawRequestErrorNilAmount';
 	                    dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount');
 	                    $error++;
@@ -4167,22 +4120,19 @@ class Facture extends CommonInvoice
                     if ($error) return -1;
                     return 1;
                 }
-                else
-                {
+                else {
                     $this->error = "A request already exists";
                     dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours');
                     return 0;
                 }
             }
-            else
-            {
+            else {
                 $this->error = $this->db->error();
                 dol_syslog(get_class($this).'::demandeprelevement Erreur -2');
                 return -2;
             }
         }
-        else
-        {
+        else {
             $this->error = "Status of invoice does not allow this";
             dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id");
             return -3;
@@ -4207,8 +4157,7 @@ class Facture extends CommonInvoice
 		{
 			return 0;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error);
 			return -1;
@@ -4274,8 +4223,7 @@ class Facture extends CommonInvoice
 
 			return $response;
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			$this->error = $this->db->error();
 			return -1;
@@ -4419,7 +4367,7 @@ class Facture extends CommonInvoice
 					$line->multicurrency_total_tva = 19.6;
 					$line->remise_percent = 50;
 				}
-				else    // (product line)
+				else // (product line)
 				{
 					$prodid = mt_rand(1, $num_prods);
 					$line->fk_product = $prodids[$prodid];
@@ -4506,8 +4454,7 @@ class Facture extends CommonInvoice
             $this->db->free($resql);
 			return 1;
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			$this->error = $this->db->error();
 			return -1;
@@ -4669,8 +4616,7 @@ class Facture extends CommonInvoice
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			foreach ($this->errors as $errmsg)
 			{
 				dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
@@ -4760,8 +4706,7 @@ class Facture extends CommonInvoice
 		        {
 		            $hasDelay = 1;
 		        }
-		        else
-		        {
+		        else {
 		            $hasDelay = 0;
 		        }
 		    }
@@ -4852,8 +4797,7 @@ class Facture extends CommonInvoice
 	            return -1;
 	        }
 	    }
-	    else
-	    {
+	    else {
 	        // Because one day retained warranty could be used on standard invoices
 	        $retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100;
 	    }
@@ -4890,15 +4834,13 @@ class Facture extends CommonInvoice
 	            $this->retained_warranty = floatval($value);
 	            return 1;
 	        }
-	        else
-	        {
+	        else {
 	            dol_syslog(get_class($this).'::setRetainedWarranty Erreur '.$sql.' - '.$this->db->error());
 	            $this->error = $this->db->error();
 	            return -1;
 	        }
 	    }
-	    else
-	    {
+	    else {
 	        dol_syslog(get_class($this).'::setRetainedWarranty, status of the object is incompatible');
 	        $this->error = 'Status of the object is incompatible '.$this->statut;
 	        return -2;
@@ -4933,15 +4875,13 @@ class Facture extends CommonInvoice
 	            $this->retained_warranty_date_limit = $timestamp;
 	            return 1;
 	        }
-	        else
-	        {
+	        else {
 	            dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit Erreur '.$sql.' - '.$this->db->error());
 	            $this->error = $this->db->error();
 	            return -1;
 	        }
 	    }
-	    else
-	    {
+	    else {
 	        dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit, status of the object is incompatible');
 	        $this->error = 'Status of the object is incompatible '.$this->statut;
 	        return -2;
@@ -5123,8 +5063,7 @@ class FactureLigne extends CommonInvoiceLine
 
 			return 1;
 		}
-		else
-		{
+		else {
 		    $this->error = $this->db->lasterror();
 			return -1;
 		}
@@ -5178,8 +5117,7 @@ class FactureLigne extends CommonInvoiceLine
 			{
 				return $result;
 			}
-			else
-			{
+			else {
 				$this->pa_ht = $result;
 			}
 		}
@@ -5296,8 +5234,7 @@ class FactureLigne extends CommonInvoiceLine
     							return -3;
 						    }
 						}
-						else
-						{
+						else {
 							$result = $discount->link_to_invoice($this->rowid, 0);
 							if ($result < 0)
 							{
@@ -5308,16 +5245,14 @@ class FactureLigne extends CommonInvoiceLine
 							}
 						}
 					}
-					else
-					{
+					else {
 						$this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded");
 						dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
 						$this->db->rollback();
 						return -3;
 					}
 				}
-				else
-				{
+				else {
 					$this->error = $discount->error;
 					dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
 					$this->db->rollback();
@@ -5340,8 +5275,7 @@ class FactureLigne extends CommonInvoiceLine
 			$this->db->commit();
 			return $this->id;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			$this->db->rollback();
 			return -2;
@@ -5395,8 +5329,7 @@ class FactureLigne extends CommonInvoiceLine
 			{
 				return $result;
 			}
-			else
-			{
+			else {
 				$this->pa_ht = $result;
 			}
 		}
@@ -5475,8 +5408,7 @@ class FactureLigne extends CommonInvoiceLine
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			$this->db->rollback();
 			return -2;
@@ -5519,8 +5451,7 @@ class FactureLigne extends CommonInvoiceLine
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error()." sql=".$sql;
 			$this->db->rollback();
 			return -1;
@@ -5561,8 +5492,7 @@ class FactureLigne extends CommonInvoiceLine
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			$this->db->rollback();
 			return -2;

+ 6 - 12
htdocs/compta/facture/class/paymentterm.class.php

@@ -146,8 +146,7 @@ class PaymentTerm // extends CommonObject
 			$this->db->rollback();
 			return -1 * $error;
 		}
-		else
-		{
+		else {
 			$this->db->commit();
             return $this->id;
 		}
@@ -203,8 +202,7 @@ class PaymentTerm // extends CommonObject
 
             return 1;
         }
-        else
-        {
+        else {
       	    $this->error = "Error ".$this->db->lasterror();
             return -1;
         }
@@ -240,8 +238,7 @@ class PaymentTerm // extends CommonObject
 			$this->db->free($resql);
 			return $ret;
 		}
-		else
-		{
+		else {
 			$this->error = "Error ".$this->db->lasterror();
 			return -1;
 		}
@@ -306,8 +303,7 @@ class PaymentTerm // extends CommonObject
 			$this->db->rollback();
 			return -1 * $error;
 		}
-		else
-		{
+		else {
 			$this->db->commit();
 			return 1;
 		}
@@ -346,8 +342,7 @@ class PaymentTerm // extends CommonObject
 			$this->db->rollback();
 			return -1 * $error;
 		}
-		else
-		{
+		else {
 			$this->db->commit();
 			return 1;
 		}
@@ -397,8 +392,7 @@ class PaymentTerm // extends CommonObject
 			$this->db->commit();
 			return $object->id;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}

+ 4 - 8
htdocs/compta/facture/contact.php

@@ -70,15 +70,13 @@ if ($action == 'addcontact' && $user->rights->facture->creer)
 		header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
 		exit;
 	}
-	else
-	{
+	else {
 		if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
 		{
 			$langs->load("errors");
 			setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
 		}
-		else
-		{
+		else {
 			setEventMessages($object->error, $object->errors, 'errors');
 		}
 	}
@@ -91,8 +89,7 @@ elseif ($action == 'swapstatut' && $user->rights->facture->creer)
 	{
 	    $result = $object->swapContactStatus(GETPOST('ligne'));
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -208,8 +205,7 @@ if ($id > 0 || !empty($ref))
 		    if ($res) break;
 		}
 	}
-	else
-	{
+	else {
 		// Record not found
 		print "ErrorRecordNotFound";
 	}

+ 2 - 4
htdocs/compta/facture/document.php

@@ -182,13 +182,11 @@ if ($id > 0 || !empty($ref))
 		$param = '&id='.$object->id;
 		include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
-else
-{
+else {
 	print $langs->trans("ErrorUnknown");
 }
 

+ 5 - 10
htdocs/compta/facture/invoicetemplate_list.php

@@ -610,8 +610,7 @@ if ($resql)
 				{
 					if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late"));
 				}
-				else
-				{
+				else {
 					print img_info($langs->trans("MaxNumberOfGenerationReached"));
 				}
 				print '</div>';
@@ -660,13 +659,11 @@ if ($resql)
 					print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;socid='.$objp->socid.'&amp;fac_rec='.$objp->facid.'">';
 					print $langs->trans("CreateBill").'</a>';
 				}
-				else
-				{
+				else {
 					print $form->textwithpicto('', $langs->trans("DateIsNotEnough"));
 				}
 			}
-			else
-			{
+			else {
 				print "&nbsp;";
 			}
 			if (!$i) $totalarray['nbfield']++;
@@ -677,8 +674,7 @@ if ($resql)
 			$i++;
 		}
 	}
-	else
-	{
+	else {
 		$colspan = 1;
 		foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
 		print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
@@ -694,8 +690,7 @@ if ($resql)
 
 	$db->free($resql);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 7 - 14
htdocs/compta/facture/list.php

@@ -314,8 +314,7 @@ elseif ($massaction == 'withdrawrequest')
 		$error++;
 		setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors');
 	}
-	else
-	{
+	else {
 		//Checking error
 		$error = 0;
 
@@ -387,8 +386,7 @@ elseif ($massaction == 'withdrawrequest')
 					$db->commit();
 					$nbwithdrawrequestok++;
 				}
-				else
-				{
+				else {
 					$db->rollback();
 					setEventMessages($aBill->error, $aBill->errors, 'errors');
 				}
@@ -516,8 +514,7 @@ if ($search_status != '-1' && $search_status != '')
 		if ($search_status == '2') $sql .= " AND f.fk_statut = 2"; // payed     Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed)
 		if ($search_status == '3') $sql .= " AND f.fk_statut = 3"; // abandonned
 	}
-	else
-	{
+	else {
 		$sql .= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example
 	}
 }
@@ -564,8 +561,7 @@ if (!$sall)
 		foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
 	}
 }
-else
-{
+else {
 	$sql .= natural_search(array_keys($fieldstosearchall), $sall);
 }
 
@@ -1220,8 +1216,7 @@ if ($resql)
                 {
                     print $obj->ref;
                 }
-                else
-                {
+                else {
                     print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
                 }
 
@@ -1317,8 +1312,7 @@ if ($resql)
 				{
 				    print $thirdpartystatic->name;
 				}
-				else
-				{
+				else {
 				    print $thirdpartystatic->getNomUrl(1, 'customer');
 				}
 				print '</td>';
@@ -1620,8 +1614,7 @@ if ($resql)
 
 	print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 16 - 32
htdocs/compta/facture/prelevement.php

@@ -87,8 +87,7 @@ if (empty($reshook))
 
                 setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
             }
-            else
-            {
+            else {
                 $db->rollback();
                 setEventMessages($object->error, $object->errors, 'errors');
             }
@@ -293,13 +292,11 @@ if ($object->id > 0)
 		{
 			$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate');
 		}
-		else
-		{
+		else {
 			print dol_print_date($object->date, 'daytext');
 		}
 	}
-	else
-	{
+	else {
 		print dol_print_date($object->date, 'daytext');
 	}
 	print '</td>';
@@ -319,13 +316,11 @@ if ($object->id > 0)
 		{
 			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
 		}
-		else
-		{
+		else {
 			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
 		}
 	}
-	else
-	{
+	else {
 		print '&nbsp;';
 	}
 	print '</td></tr>';
@@ -344,16 +339,14 @@ if ($object->id > 0)
 		{
 			$form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date_lim_reglement, 'paymentterm');
 		}
-		else
-		{
+		else {
 			print dol_print_date($object->date_lim_reglement, 'daytext');
 			if ($object->hasDelay()) {
 				print img_warning($langs->trans('Late'));
 			}
 		}
 	}
-	else
-	{
+	else {
 		print '&nbsp;';
 	}
 	print '</td></tr>';
@@ -370,8 +363,7 @@ if ($object->id > 0)
 	{
 		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id');
 	}
-	else
-	{
+	else {
 		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
 	}
 	print '</td></tr>';
@@ -389,8 +381,7 @@ if ($object->id > 0)
 	{
 	    $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
 	}
-	else
-	{
+	else {
 	    $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
 	}
 	print "</td>";
@@ -503,8 +494,7 @@ if ($object->id > 0)
 		$num = $db->num_rows($result_sql);
 		$numopen = $num;
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 
@@ -521,8 +511,7 @@ if ($object->id > 0)
 		$obj = $db->fetch_object($result_sql);
 		if ($obj) $pending = $obj->amount;
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 
@@ -550,18 +539,15 @@ if ($object->id > 0)
     			print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
     			print '</form>';
     		}
-    		else
-    		{
+    		else {
     			print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
     		}
 	    }
-	    else
-        {
+	    else {
             print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
         }
 	}
-	else
-	{
+	else {
 		if ($num == 0)
 		{
 			if ($object->statut > Facture::STATUS_DRAFT) print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("AlreadyPaid")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
@@ -635,8 +621,7 @@ if ($object->id > 0)
 
 		$db->free($result_sql);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 
@@ -697,8 +682,7 @@ if ($object->id > 0)
 
 		$db->free($result);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 

+ 4 - 5
htdocs/compta/facture/stats/index.php

@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
-if(!empty($conf->category->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+if (!empty($conf->category->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
 
 $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
 $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
@@ -60,7 +60,7 @@ if ($user->socid > 0)
 
 $nowyear = strftime("%Y", dol_now());
 $year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear;
-if(!empty($conf->global->INVOICE_STATS_GRAPHS_SHOW_2_YEARS)) $startyear=$year-2;
+if (!empty($conf->global->INVOICE_STATS_GRAPHS_SHOW_2_YEARS)) $startyear=$year-2;
 else $startyear=$year-1;
 $endyear = $year;
 
@@ -68,7 +68,7 @@ $endyear = $year;
 /*
  * View
  */
-if(!empty($conf->category->enabled)) $langs->load('categories');
+if (!empty($conf->category->enabled)) $langs->load('categories');
 $form = new Form($db);
 $formcompany = new FormCompany($db);
 $formother = new FormOther($db);
@@ -181,8 +181,7 @@ if (!$user->rights->societe->client->voir || $user->socid)
     if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
     if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png';
 }
-else
-{
+else {
     $filename_avg = $dir.'/ordersaverage-'.$year.'.png';
     if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png';
     if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png';

+ 1 - 2
htdocs/compta/facture/tpl/linkedobjectblock.tpl.php

@@ -79,8 +79,7 @@ foreach ($linkedObjectBlock as $key => $objectlink)
     		$total = $total + $sign * $objectlink->total_ht;
     		echo price($objectlink->total_ht);
     	}
-    	else
-    	{
+    	else {
     		echo '<strike>'.price($objectlink->total_ht).'</strike>';
     	}
 	}

+ 16 - 32
htdocs/compta/index.php

@@ -215,15 +215,13 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
 			print '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
 			print '</tr>';
 		}
-		else
-		{
+		else {
 			print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
 		}
 		print "</table></div><br>";
 		$db->free($resql);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -303,15 +301,13 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
 			print '<td colspan="2" class="right">'.price($tot_ttc).'</td>';
 			print '</tr>';
 		}
-		else
-		{
+		else {
 			print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
 		}
 		print "</table></div><br>";
 		$db->free($resql);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -429,8 +425,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
 				$i++;
 			}
 		}
-		else
-		{
+		else {
 			$colspan = 5;
 			if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
 			print '<tr class="oddeven"><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
@@ -438,8 +433,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
 		print '</table></div><br>';
 		$db->free($resql);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -530,16 +524,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
 				$i++;
 			}
 		}
-		else
-		{
+		else {
 			$colspan = 5;
 			if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
 			print '<tr class="oddeven"><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
 		}
 		print '</table></div><br>';
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -609,8 +601,7 @@ if (!empty($conf->don->enabled) && $user->rights->don->lire)
 				$i++;
 			}
 		}
-		else
-		{
+		else {
 			print '<tr class="oddeven"><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
 		}
 		print '</table></div><br>';
@@ -687,15 +678,13 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
 				print '<td class="right">&nbsp;</td>';
 				print '</tr>';
 			}
-			else
-			{
+			else {
 				print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
 			}
 			print "</table></div><br>";
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 	}
@@ -816,8 +805,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user
 		}
 		$db->free($resql);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -940,8 +928,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
 			print '<td>&nbsp;</td>';
 			print '</tr>';
 		}
-		else
-		{
+		else {
 			$colspan = 6;
 			if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
 			print '<tr class="oddeven"><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
@@ -949,8 +936,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
 		print '</table></div><br>';
 		$db->free($resql);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -1050,16 +1036,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
 			print '<td>&nbsp;</td>';
 			print '</tr>';
 		}
-		else
-		{
+		else {
 			$colspan = 6;
 			if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
 			print '<tr class="oddeven"><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
 		}
 		print '</table></div><br>';
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }

+ 2 - 3
htdocs/compta/journal/purchasesjournal.php

@@ -91,7 +91,7 @@ $exportlink = '';
 $builddate = dol_now();
 $description = $langs->trans("DescPurchasesJournal").'<br>';
 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded");
-else  $description .= $langs->trans("DepositsAreIncluded");
+else $description .= $langs->trans("DepositsAreIncluded");
 $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
 
 report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink);
@@ -239,8 +239,7 @@ foreach ($tabfac as $key => $val)
 					print '<td class="right">'.($mt < 0 ?price(-$mt) : '')."</td>";
 	    			print '<td class="right">'.($mt >= 0 ?price($mt) : '')."</td>";
 				}
-				else
-				{
+				else {
 					print '<td class="right">'.($mt >= 0 ?price($mt) : '')."</td>";
 					print '<td class="right">'.($mt < 0 ?price(-$mt) : '')."</td>";
 				}

+ 2 - 3
htdocs/compta/journal/sellsjournal.php

@@ -93,7 +93,7 @@ $exportlink = '';
 $builddate = dol_now();
 $description = $langs->trans("DescSellsJournal").'<br>';
 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded");
-else  $description .= $langs->trans("DepositsAreIncluded");
+else $description .= $langs->trans("DepositsAreIncluded");
 $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
 report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink);
 
@@ -269,8 +269,7 @@ foreach ($tabfac as $key => $val)
 					print '<td class="right">'.($mt >= 0 ?price($mt) : '')."</td>";
 					print '<td class="right">'.($mt < 0 ?price(-$mt) : '')."</td>";
 				}
-				else
-				{
+				else {
 					print '<td class="right">'.($mt < 0 ?price(-$mt) : '')."</td>";
 	    			print '<td class="right">'.($mt >= 0 ?price($mt) : '')."</td>";
 				}

+ 5 - 10
htdocs/compta/localtax/card.php

@@ -81,8 +81,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
         header("Location: list.php?localTaxType=".$lttype);
         exit;
     }
-    else
-    {
+    else {
         $db->rollback();
         setEventMessages($object->error, $object->errors, 'errors');
         $_GET["action"] = "create";
@@ -114,21 +113,18 @@ if ($action == 'delete')
 				header("Location: ".DOL_URL_ROOT.'/compta/localtax/list.php?localTaxType='.$object->ltt);
 				exit;
 			}
-			else
-			{
+			else {
 				$object->error = $accountline->error;
 				$db->rollback();
 				setEventMessages($object->error, $object->errors, 'errors');
 			}
 	    }
-	    else
-	    {
+	    else {
 	        $db->rollback();
 	        setEventMessages($object->error, $object->errors, 'errors');
 	    }
 	}
-	else
-	{
+	else {
         $mesg = 'Error try do delete a line linked to a conciliated bank transaction';
         setEventMessages($mesg, null, 'errors');
 	}
@@ -290,8 +286,7 @@ if ($id)
 	{
 		print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
 	}
-	else
-	{
+	else {
 		print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConcialitedTransaction").'">'.$langs->trans("Delete").'</a>';
 	}
 	print "</div>";

+ 15 - 30
htdocs/compta/localtax/class/localtax.class.php

@@ -138,14 +138,12 @@ class Localtax extends CommonObject
             	$this->db->commit();
             	return $this->id;
             }
-            else
-			{
+            else {
 				$this->db->rollback();
 				return -1;
             }
         }
-        else
-		{
+        else {
             $this->error = "Error ".$this->db->lasterror();
             $this->db->rollback();
             return -1;
@@ -207,8 +205,7 @@ class Localtax extends CommonObject
     		$this->db->commit();
     		return 1;
     	}
-    	else
-    	{
+    	else {
     		$this->db->rollback();
     		return -1;
     	}
@@ -271,8 +268,7 @@ class Localtax extends CommonObject
 
             return 1;
         }
-        else
-        {
+        else {
       	    $this->error = "Error ".$this->db->lasterror();
             return -1;
         }
@@ -378,14 +374,12 @@ class Localtax extends CommonObject
                 $this->db->free($result);
                 return $ret;
             }
-            else
-			{
+            else {
             	$this->db->free($result);
 				return 0;
             }
         }
-        else
-		{
+        else {
             print $this->db->lasterror();
             return -1;
         }
@@ -419,14 +413,12 @@ class Localtax extends CommonObject
                 $this->db->free($result);
                 return $ret;
             }
-            else
-			{
+            else {
             	$this->db->free($result);
             	return 0;
             }
         }
-        else
-        {
+        else {
             print $this->db->lasterror();
             return -1;
         }
@@ -462,14 +454,12 @@ class Localtax extends CommonObject
             	$this->db->free($result);
                 return $ret;
             }
-            else
-			{
+            else {
             	$this->db->free($result);
 				return 0;
             }
         }
-        else
-        {
+        else {
             print $this->db->lasterror();
             return -1;
         }
@@ -548,8 +538,7 @@ class Localtax extends CommonObject
 					{
                         $this->update_fk_bank($bank_line_id);
                     }
-					else
-					{
+					else {
 						$this->error = $acc->error;
 						$ok = 0;
 					}
@@ -568,21 +557,18 @@ class Localtax extends CommonObject
 					$this->db->commit();
 					return $this->id;
 				}
-				else
-				{
+				else {
 					$this->db->rollback();
 					return -3;
 				}
             }
-            else
-            {
+            else {
                 $this->error = $this->db->lasterror();
                 $this->db->rollback();
                 return -2;
             }
         }
-        else
-        {
+        else {
             $this->error = $this->db->lasterror();
             $this->db->rollback();
             return -1;
@@ -605,8 +591,7 @@ class Localtax extends CommonObject
 		if ($result) {
 			return 1;
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			return -1;
 		}

+ 8 - 16
htdocs/compta/localtax/clients.php

@@ -54,16 +54,14 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
     if (empty($q))
 	{
 		if (GETPOST("month")) { $date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false); }
-		else
-		{
+		else {
 			$date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
 			if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1;
 			elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;
 			elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1;
 		}
 	}
-	else
-	{
+	else {
 		if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
 		if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
 		if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
@@ -202,8 +200,7 @@ if ($calc == 0 || $calc == 2)
 					{
 						$intra = $langs->trans('Unknown');
 					}
-					else
-					{
+					else {
 						$intra = '';
 					}
 				}
@@ -230,15 +227,13 @@ if ($calc == 0 || $calc == 2)
 		print '<td class="nowrap right">'.price($total).'</td>';
 		print '</tr>';
 	}
-	else
-	{
+	else {
 		$langs->load("errors");
 		if ($coll_list == -1)
 			print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
 		elseif ($coll_list == -2)
 			print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
-		else
-			print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
+		else print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
 	}
 }
 
@@ -275,8 +270,7 @@ if ($calc == 0 || $calc == 1) {
 					{
 						$intra = $langs->trans('Unknown');
 					}
-					else
-					{
+					else {
 						$intra = '';
 					}
 				}
@@ -305,15 +299,13 @@ if ($calc == 0 || $calc == 1) {
 
 		print '</table>';
 	}
-	else
-	{
+	else {
 		$langs->load("errors");
 		if ($coll_list == -1)
 			print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
 		elseif ($coll_list == -2)
 			print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
-		else
-			print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
+		else print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
 	}
 }
 

+ 4 - 8
htdocs/compta/localtax/index.php

@@ -53,14 +53,12 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 	if (empty($q))
 	{
 		if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); }
-		else
-		{
+		else {
 			$date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false);
 			$date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;
 		}
 	}
-	else
-	{
+	else {
 		if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
 		if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
 		if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
@@ -153,8 +151,7 @@ function pt($db, $sql, $date)
             	$previousmode = '';
             	$previousmonth = '';
             }
-            else
-            {
+            else {
             	$previousmode = $obj->mode;
             	$previousmonth = $obj->dm;
             }
@@ -389,8 +386,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000)	// $mc
 				//'link'				=>$expensereport->getNomUrl(1)
 				);
 			}
-			else
-			{
+			else {
 				//$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id];
 				//$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id];
 				//$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id];

+ 1 - 2
htdocs/compta/localtax/list.php

@@ -96,8 +96,7 @@ if ($result)
     print "</table>";
     $db->free($result);
 }
-else
-{
+else {
     dol_print_error($db);
 }
 

+ 7 - 14
htdocs/compta/localtax/quadri_detail.php

@@ -64,16 +64,14 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 	if (empty($q))
 	{
 		if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); }
-		else
-		{
+		else {
 			$date_start = dol_get_first_day($year_start, empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START, false);
 			if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1;
 			elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1;
 			elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1;
 		}
 	}
-	else
-	{
+	else {
 		if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
 		if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
 		if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
@@ -222,11 +220,9 @@ if (!is_array($x_coll) || !is_array($x_paye))
 		print '<tr><td colspan="'.$columns.'">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
 	elseif ($x_coll == -2)
 		print '<tr><td colspan="'.$columns.'">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
-	else
-		print '<tr><td colspan="'.$columns.'">'.$langs->trans("Error").'</td></tr>';
+	else print '<tr><td colspan="'.$columns.'">'.$langs->trans("Error").'</td></tr>';
 }
-else
-{
+else {
 	$x_both = array();
 
 	//now, from these two arrays, get another array with one rate per line
@@ -373,8 +369,7 @@ else
 						print $product_static->getNomUrl(1);
 						if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
 					}
-					else
-					{
+					else {
 						if ($type) $text = img_object($langs->trans('Service'), 'service');
 						else $text = img_object($langs->trans('Product'), 'product');
 			            if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg))
@@ -533,8 +528,7 @@ else
 						print $product_static->getNomUrl(1);
 						if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
 					}
-					else
-					{
+					else {
 						if ($type) $text = img_object($langs->trans('Service'), 'service');
 						else $text = img_object($langs->trans('Product'), 'product');
 						print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16);
@@ -573,8 +567,7 @@ else
 						{
 							print $langs->trans("NA");
 						}
-						else
-						{
+						else {
 							print price(price2num($fields['payment_amount'], 'MT'));
 							if (isset($fields['payment_amount'])) {
 								print ' ('.round($ratiopaymentinvoice * 100, 2).'%)';

+ 7 - 14
htdocs/compta/paiement.php

@@ -313,8 +313,7 @@ if (empty($reshook))
 	        header('Location: '.$loc);
 	        exit;
 	    }
-	    else
-	    {
+	    else {
 	        $db->rollback();
 	    }
 	}
@@ -504,8 +503,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
             $form->select_comptes($accountid, 'accountid', 0, '', 2);
             print '</td>';
         }
-        else
-        {
+        else {
             print '<td>&nbsp;</td>';
         }
         print "</tr>\n";
@@ -561,8 +559,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
         {
             $sql .= ' AND type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation
         }
-        else
-        {
+        else {
             $sql .= ' AND type = 2'; // If paying back a credit note, we show all credit notes
         }
         // Sort invoices by date and serial number: the older one comes first
@@ -666,8 +663,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
 
                         print '</td>';
                     }
-                    else
-                    {
+                    else {
                         print '<td align="center"></td>';
                     }
 
@@ -711,8 +707,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
    				    			print '<input type="text" class="maxwidth75 multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
    				    			print '<input type="hidden" class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
     				    	}
-    				    	else
-    				    	{
+    				    	else {
     				    		print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
     				    		print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
     				    	}
@@ -747,8 +742,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
                         print '<input type="text" class="maxwidth75 amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
                         print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
                     }
-                    else
-                    {
+                    else {
                         print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
                         print '<input type="hidden" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
                     }
@@ -804,8 +798,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
             }
             $db->free($resql);
         }
-        else
-		{
+        else {
             dol_print_error($db);
         }
 

+ 8 - 16
htdocs/compta/paiement/card.php

@@ -66,8 +66,7 @@ if ($action == 'setnote' && $user->rights->facture->paiement)
         $db->commit();
         $action = '';
     }
-    else
-    {
+    else {
 	    setEventMessages($object->error, $object->errors, 'errors');
         $db->rollback();
     }
@@ -88,14 +87,12 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->
         	header("Location: ".$backtopage);
         	exit;
         }
-        else
-        {
+        else {
         	header("Location: list.php");
         	exit;
         }
 	}
-	else
-	{
+	else {
 	    $langs->load("errors");
 		setEventMessages($object->error, $object->errors, 'errors');
         $db->rollback();
@@ -132,8 +129,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->
 		header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
 		exit;
 	}
-	else
-	{
+	else {
 	    $langs->load("errors");
 		setEventMessages($object->error, $object->errors, 'errors');
 		$db->rollback();
@@ -148,8 +144,7 @@ if ($action == 'setnum_paiement' && !empty($_POST['num_paiement']))
 	{
 		setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs');
 	}
-	else
-	{
+	else {
 		setEventMessages($langs->trans('PaymentNumberUpdateFailed'), null, 'errors');
 	}
 }
@@ -163,8 +158,7 @@ if ($action == 'setdatep' && !empty($_POST['datepday']))
 	{
 		setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs');
 	}
-	else
-	{
+	else {
 		setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors');
 	}
 }
@@ -414,8 +408,7 @@ if ($resql)
 
 	$db->free($resql);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 
@@ -446,8 +439,7 @@ if ($user->socid == 0 && $action == '')
 		{
 			print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
 		}
-		else
-		{
+		else {
 			print '<a class="butActionRefused classfortooltip" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>';
 		}
 	}

+ 20 - 40
htdocs/compta/paiement/cheque/card.php

@@ -80,8 +80,7 @@ if ($action == 'setdate' && $user->rights->banque->cheque)
 			setEventMessages($object->error, $object->errors, 'errors');
         }
     }
-    else
-    {
+    else {
         setEventMessages($object->error, $object->errors, 'errors');
     }
 }
@@ -99,8 +98,7 @@ if ($action == 'setrefext' && $user->rights->banque->cheque)
             setEventMessages($object->error, $object->errors, 'errors');
         }
     }
-    else
-    {
+    else {
         setEventMessages($object->error, $object->errors, 'errors');
     }
 }
@@ -118,8 +116,7 @@ if ($action == 'setref' && $user->rights->banque->cheque)
 			setEventMessages($object->error, $object->errors, 'errors');
 		}
 	}
-	else
-	{
+	else {
 		setEventMessages($object->error, $object->errors, 'errors');
 	}
 }
@@ -150,13 +147,11 @@ if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->che
        		header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
         	exit;
 		}
-		else
-		{
+		else {
 			setEventMessages($object->error, $object->errors, 'errors');
 		}
 	}
-	else
-	{
+	else {
 		setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'mesgs');
 	    $action = 'new';
 	}
@@ -171,8 +166,7 @@ if ($action == 'remove' && $id > 0 && $_GET["lineid"] > 0 && $user->rights->banq
 		header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
 		exit;
 	}
-	else
-	{
+	else {
 		setEventMessages($object->error, $object->errors, 'errors');
 	}
 }
@@ -186,8 +180,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->c
 		header("Location: index.php");
 		exit;
 	}
-	else
-	{
+	else {
 		setEventMessages($paiement->error, $paiement->errors, 'errors');
 	}
 }
@@ -213,8 +206,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->banque->c
         header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
 		exit;
 	}
-	else
-	{
+	else {
 		setEventMessages($object->error, $object->errors, 'errors');
 	}
 }
@@ -233,8 +225,7 @@ if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->rights->ban
 		//exit;
 		$action = '';
 	}
-	else
-	{
+	else {
 		setEventMessages($object->error, $object->errors, 'errors');
 		$action = '';
 	}
@@ -262,8 +253,7 @@ if ($action == 'builddoc' && $user->rights->banque->cheque)
 		dol_print_error($db, $object->error);
 		exit;
 	}
-	else
-	{
+	else {
 		header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
 		exit;
 	}
@@ -315,8 +305,7 @@ if ($action == 'new')
 
 	print load_fiche_titre($langs->trans("Cheques"), '', 'bank_account');
 }
-else
-{
+else {
 	$result = $object->fetch($id, $ref);
 	if ($result < 0)
 	{
@@ -510,8 +499,7 @@ if ($action == 'new')
 				{
 					print $paymentstatic->getNomUrl(1);
 				}
-				else
-				{
+				else {
 					print '&nbsp;';
 				}
 				print '</td>';
@@ -522,8 +510,7 @@ if ($action == 'new')
 				{
 					print $accountlinestatic->getNomUrl(1);
 				}
-				else
-				{
+				else {
 					print '&nbsp;';
 				}
 				print '</td>';
@@ -544,16 +531,14 @@ if ($action == 'new')
 		{
 			print '<input type="submit" class="button" value="'.$langs->trans('NewCheckDepositOn', $account_label).'">';
 		}
-		else
-		{
+		else {
 			print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('NewCheckDepositOn', $account_label).'</a>';
 		}
 		print '</div><br>';
 		print '</form>';
 	}
 }
-else
-{
+else {
 	$paymentstatic = new Paiement($db);
 	$accountlinestatic = new AccountLine($db);
 	$accountstatic = new Account($db);
@@ -588,8 +573,7 @@ else
         print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
         print '</form>';
     }
-    else
-    {
+    else {
         print $object->date_bordereau ? dol_print_date($object->date_bordereau, 'day') : '&nbsp;';
     }
 
@@ -700,8 +684,7 @@ else
     			{
     				print $paymentstatic->getNomUrl(1);
     			}
-    			else
-    			{
+    			else {
     				print '&nbsp;';
     			}
     			print '</td>';
@@ -712,8 +695,7 @@ else
     			{
     				print $accountlinestatic->getNomUrl(1);
     			}
-    			else
-    			{
+    			else {
     				print '&nbsp;';
     			}
     			print '</td>';
@@ -737,8 +719,7 @@ else
     			$i++;
     		}
         }
-        else
-        {
+        else {
             print '<td colspan="8" class="opacitymedium">';
             print $langs->trans("None");
             print '</td>';
@@ -756,8 +737,7 @@ else
 
 		print "</div>";
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 

+ 25 - 50
htdocs/compta/paiement/cheque/class/remisecheque.class.php

@@ -121,8 +121,7 @@ class RemiseCheque extends CommonObject
 				{
 					$this->ref = "(PROV".$this->id.")";
 				}
-				else
-				{
+				else {
 					$this->ref = $obj->ref;
 				}
 			}
@@ -130,8 +129,7 @@ class RemiseCheque extends CommonObject
 
 			return 1;
 		}
-		else
-		{
+		else {
 		    $this->error = $this->db->lasterror();
 			return -1;
 		}
@@ -228,8 +226,7 @@ class RemiseCheque extends CommonObject
 					}
 					$this->db->free($resql);
 				}
-				else
-				{
+				else {
 					$this->errno = -1026;
 					dol_syslog("RemiseCheque::Create Error ".$this->errno, LOG_ERR);
 				}
@@ -270,8 +267,7 @@ class RemiseCheque extends CommonObject
 				}
 			}
 		}
-		else
-		{
+		else {
 			$this->errno = -1;
 			$this->error = $this->db->lasterror();
 			$this->errno = $this->db->lasterrno();
@@ -289,8 +285,7 @@ class RemiseCheque extends CommonObject
             dol_syslog("RemiseCheque::Create end", LOG_DEBUG);
             return $this->id;
         }
-        else
-        {
+        else {
             $this->db->rollback();
             dol_syslog("RemiseCheque::Create end", LOG_DEBUG);
             return $this->errno;
@@ -342,8 +337,7 @@ class RemiseCheque extends CommonObject
 		{
 			$this->db->commit();
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			dol_syslog("RemiseCheque::Delete ROLLBACK ($this->errno)");
 		}
@@ -386,14 +380,12 @@ class RemiseCheque extends CommonObject
 				    $this->ref = $numref;
 					$this->statut = 1;
 				}
-				else
-				{
+				else {
 					$this->errno = -1029;
 					dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR);
 				}
 			}
-			else
-			{
+			else {
 				$this->errno = -1033;
 				dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR);
 			}
@@ -405,8 +397,7 @@ class RemiseCheque extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			dol_syslog("RemiseCheque::Validate ".$this->errno, LOG_ERR);
             return $this->errno;
@@ -489,8 +480,7 @@ class RemiseCheque extends CommonObject
 
 			return $numref;
 		}
-		else
-		{
+		else {
 			$langs->load("errors");
 			print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Bank"));
 			return "";
@@ -545,8 +535,7 @@ class RemiseCheque extends CommonObject
 
 			return $response;
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			$this->error = $this->db->error();
 			return -1;
@@ -585,8 +574,7 @@ class RemiseCheque extends CommonObject
 			$this->db->free($resql);
 			return 1;
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			$this->error = $this->db->error();
 			return -1;
@@ -665,16 +653,14 @@ class RemiseCheque extends CommonObject
 				//$outputlangs->charset_output=$sav_charset_output;
 				return 1;
 			}
-			else
-			{
+			else {
 				//$outputlangs->charset_output=$sav_charset_output;
 				dol_syslog("Error");
 				dol_print_error($this->db, $docmodel->error);
 				return 0;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $langs->trans("ErrorFileDoesNotExists", $dir.$file);
 			return -1;
 		}
@@ -721,8 +707,7 @@ class RemiseCheque extends CommonObject
 				dol_syslog("RemiseCheque::updateAmount ERREUR UPDATE ($this->errno)");
 			}
 		}
-		else
-		{
+		else {
 			$this->errno = -1031;
 			dol_syslog("RemiseCheque::updateAmount ERREUR SELECT ($this->errno)");
 		}
@@ -731,8 +716,7 @@ class RemiseCheque extends CommonObject
 		{
 			$this->db->commit();
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			dol_syslog("RemiseCheque::updateAmount ROLLBACK ($this->errno)");
 		}
@@ -762,8 +746,7 @@ class RemiseCheque extends CommonObject
 			{
 				$this->updateAmount();
 			}
-			else
-			{
+			else {
 				$this->errno = -1032;
 				dol_syslog("RemiseCheque::removeCheck ERREUR UPDATE ($this->errno)");
 			}
@@ -839,30 +822,26 @@ class RemiseCheque extends CommonObject
     					$this->db->commit();
     					return $rejectedPayment->id;
 					}
-					else
-					{
+					else {
                         $this->db->rollback();
 					    return -1;
 					}
 				}
-				else
-				{
+				else {
 				    $this->error = $rejectedPayment->error;
 				    $this->errors = $rejectedPayment->errors;
 				    $this->db->rollback();
 					return -1;
 				}
 			}
-			else
-			{
+			else {
 				$this->error = $rejectedPayment->error;
 				$this->errors = $rejectedPayment->errors;
 			    $this->db->rollback();
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			$this->db->rollback();
 			return -1;
@@ -936,14 +915,12 @@ class RemiseCheque extends CommonObject
                 $this->date_bordereau = $date;
                 return 1;
             }
-            else
-            {
+            else {
                 $this->error = $this->db->error();
                 return -1;
             }
         }
-        else
-        {
+        else {
             return -2;
         }
     }
@@ -971,14 +948,12 @@ class RemiseCheque extends CommonObject
 			{
 				return 1;
 			}
-			else
-			{
+			else {
 				$this->error = $this->db->error();
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			return -2;
 		}
 	}

+ 2 - 4
htdocs/compta/paiement/cheque/index.php

@@ -77,8 +77,7 @@ if ($resql) {
     print '</td></tr>';
     print "</table>\n";
 }
-else
-{
+else {
     dol_print_error($db);
 }
 
@@ -141,8 +140,7 @@ if ($resql)
 
 	$db->free($resql);
 }
-else
-{
+else {
     dol_print_error($db);
 }
 

+ 2 - 4
htdocs/compta/paiement/cheque/list.php

@@ -222,8 +222,7 @@ if ($resql)
     		$i++;
     	}
     }
-    else
-    {
+    else {
    		print '<tr class="oddeven">';
    		print '<td colspan="7" class="opacitymedium">'.$langs->trans("None")."</td>";
    		print '</tr>';
@@ -232,8 +231,7 @@ if ($resql)
 	print "</div>";
 	print "</form>\n";
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 23 - 46
htdocs/compta/paiement/class/paiement.class.php

@@ -201,14 +201,12 @@ class Paiement extends CommonObject
 				$this->db->free($resql);
 				return 1;
 			}
-			else
-			{
+			else {
 				$this->db->free($resql);
 				return 0;
 			}
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			return -1;
 		}
@@ -243,8 +241,7 @@ class Paiement extends CommonObject
 			$amounts = &$this->amounts;
 			$amounts_to_update = &$this->multicurrency_amounts;
 		}
-		else
-		{
+		else {
 			$amounts = &$this->multicurrency_amounts;
 			$amounts_to_update = &$this->amounts;
 		}
@@ -283,8 +280,7 @@ class Paiement extends CommonObject
 			$total = $totalamount;
 			$mtotal = $totalamount_converted; // Maybe use price2num with MT for the converted value
 		}
-		else
-		{
+		else {
 			$total = $totalamount_converted; // Maybe use price2num with MT for the converted value
 			$mtotal = $totalamount;
 		}
@@ -340,8 +336,7 @@ class Paiement extends CommonObject
                             if (!in_array($invoice->type, $affected_types)) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice, nor situation invoice. We do nothing more.");
                             elseif ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more.");
                             //else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more.");
-                            else
-                            {
+                            else {
                                 // If invoice is a down payment, we also convert down payment to discount
                                 if ($invoice->type == Facture::TYPE_DEPOSIT)
                                 {
@@ -430,14 +425,12 @@ class Paiement extends CommonObject
                             }
                         }
 					}
-					else
-					{
+					else {
 						$this->error = $this->db->lasterror();
 						$error++;
 					}
 				}
-				else
-				{
+				else {
 					dol_syslog(get_class($this).'::Create Amount line '.$key.' not a number. We discard it.');
 				}
 			}
@@ -450,8 +443,7 @@ class Paiement extends CommonObject
 				// Fin appel triggers
 			}
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			$error++;
 		}
@@ -464,8 +456,7 @@ class Paiement extends CommonObject
 			$this->db->commit();
 			return $this->id;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -502,8 +493,7 @@ class Paiement extends CommonObject
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -2;
 		}
@@ -568,8 +558,7 @@ class Paiement extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error;
 			$this->db->rollback();
 			return -5;
@@ -731,8 +720,7 @@ class Paiement extends CommonObject
 				    // Fin appel triggers
 				}
             }
-            else
-			{
+            else {
                 $this->error = $acc->error;
                 $error++;
             }
@@ -741,8 +729,7 @@ class Paiement extends CommonObject
             {
             	$this->db->commit();
             }
-            else
-			{
+            else {
             	$this->db->rollback();
             }
         }
@@ -751,8 +738,7 @@ class Paiement extends CommonObject
         {
             return $bank_line_id;
         }
-        else
-        {
+        else {
             return -1;
         }
     }
@@ -777,8 +763,7 @@ class Paiement extends CommonObject
 		{
 			return 1;
 		}
-		else
-		{
+		else {
             $this->error = $this->db->lasterror();
             dol_syslog(get_class($this).'::update_fk_bank '.$this->error);
 			return -1;
@@ -840,8 +825,7 @@ class Paiement extends CommonObject
                 $this->db->commit();
                 return 0;
             }
-            else
-            {
+            else {
                 $this->db->rollback();
                 return -2;
             }
@@ -871,8 +855,7 @@ class Paiement extends CommonObject
             	$this->num_payment = $this->db->escape($num);
                 return 0;
             }
-            else
-            {
+            else {
                 $this->error = 'Error -1 '.$this->db->error();
                 return -2;
             }
@@ -896,8 +879,7 @@ class Paiement extends CommonObject
 		{
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			dol_syslog(get_class($this).'::valide '.$this->error);
 			return -1;
@@ -920,8 +902,7 @@ class Paiement extends CommonObject
 		{
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->lasterror();
 			dol_syslog(get_class($this).'::reject '.$this->error);
 			return -1;
@@ -966,8 +947,7 @@ class Paiement extends CommonObject
 			}
 			$this->db->free($result);
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 		}
     }
@@ -1000,8 +980,7 @@ class Paiement extends CommonObject
 
 			return $billsarray;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			dol_syslog(get_class($this).'::getBillsArray Error '.$this->error.' -', LOG_DEBUG);
 			return -1;
@@ -1034,8 +1013,7 @@ class Paiement extends CommonObject
 
     		return $amounts;
     	}
-    	else
-    	{
+    	else {
     		$this->error = $this->db->error();
     		dol_syslog(get_class($this).'::getAmountsArray Error '.$this->error.' -', LOG_DEBUG);
     		return -1;
@@ -1119,8 +1097,7 @@ class Paiement extends CommonObject
 
 			return $numref;
 		}
-		else
-		{
+		else {
 			$langs->load("errors");
 			print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice"));
 			return "";

+ 3 - 5
htdocs/compta/paiement/list.php

@@ -130,8 +130,7 @@ if (GETPOST("orphelins", "alpha"))
 	$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
 	$sql .= $hookmanager->resPrint;
 }
-else
-{
+else {
     $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives
     $sql .= " p.statut, p.num_paiement as num_payment,";
     $sql .= " c.code as paiement_code,";
@@ -161,7 +160,7 @@ else
     if ($userid)
     {
         if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL";
-        else  $sql .= " AND f.fk_user_author = ".$userid;
+        else $sql .= " AND f.fk_user_author = ".$userid;
     }
     // Search criteria
     $sql .= dolSqlDateFilter("p.datep", $day, $month, $year);
@@ -379,8 +378,7 @@ if ($resql)
     print "</div>";
     print "</form>\n";
 }
-else
-{
+else {
     dol_print_error($db);
 }
 

+ 1 - 2
htdocs/compta/paiement/rapport.php

@@ -71,8 +71,7 @@ if ($action == 'builddoc')
     {
         $outputlangs->charset_output = $sav_charset_output;
     }
-    else
-    {
+    else {
         $outputlangs->charset_output = $sav_charset_output;
         dol_print_error($db, $obj->error);
     }

+ 1 - 2
htdocs/compta/paiement/tovalidate.php

@@ -127,8 +127,7 @@ if ($resql)
         {
             print '<a href="card.php?id='.$objp->rowid.'&amp;action=valide">'.$langs->trans("PaymentStatusToValidShort").'</a>';
         }
-        else
-        {
+        else {
             print "-";
         }
 

+ 3 - 6
htdocs/compta/paiement_charge.php

@@ -142,8 +142,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
                 header('Location: '.$loc);
                 exit;
             }
-            else
-            {
+            else {
                 $db->rollback();
             }
         }
@@ -284,8 +283,7 @@ if ($action == 'create')
 		{
 			print '<td class="left">'.dol_print_date($objp->date_ech, 'day').'</td>'."\n";
 		}
-		else
-		{
+		else {
 			print "<td align=\"center\"><b>!!!</b></td>\n";
 		}
 
@@ -306,8 +304,7 @@ if ($action == 'create')
 			print '<input type=hidden class="sum_remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
 			print '<input type="text" size="8" name="'.$namef.'" id="'.$namef.'">';
 		}
-		else
-		{
+		else {
 			print '-';
 		}
 		print "</td>";

+ 3 - 6
htdocs/compta/payment_sc/card.php

@@ -67,8 +67,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char
         header("Location: ".DOL_URL_ROOT."/compta/sociales/payments.php?mode=sconly");
         exit;
 	}
-	else
-	{
+	else {
 		setEventMessages($object->error, $object->errors, 'errors');
         $db->rollback();
 	}
@@ -284,8 +283,7 @@ if ($resql)
 	print "</table>\n";
 	$db->free($resql);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 
@@ -317,8 +315,7 @@ if ($action == '')
 		{
 			print '<a class="butActionDelete" href="card.php?id='.$_GET['id'].'&amp;action=delete">'.$langs->trans('Delete').'</a>';
 		}
-		else
-		{
+		else {
 			print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("CantRemovePaymentWithOneInvoicePaid")).'">'.$langs->trans('Delete').'</a>';
 		}
 	}

+ 3 - 6
htdocs/compta/paymentbybanktransfer/index.php

@@ -159,14 +159,12 @@ if ($resql)
             $i++;
         }
     }
-    else
-    {
+    else {
         print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("NoSupplierInvoiceToWithdraw", $langs->transnoentitiesnoconv("BankTransfer")).'</td></tr>';
     }
     print "</table></div><br>";
 }
-else
-{
+else {
     dol_print_error($db);
 }
 
@@ -221,8 +219,7 @@ if ($result)
     print "</table></div><br>";
     $db->free($result);
 }
-else
-{
+else {
     dol_print_error($db);
 }
 

+ 1 - 2
htdocs/compta/prelevement/bons.php

@@ -191,8 +191,7 @@ if ($result)
 
     $db->free($result);
 }
-else
-{
+else {
     dol_print_error($db);
 }
 

+ 2 - 4
htdocs/compta/prelevement/card.php

@@ -409,8 +409,7 @@ if ($id > 0 || $ref)
 			{
 		  		print '<b>'.$langs->trans("StatusRefused").'</b>';
 			}
-			else
-			{
+			else {
 		  		print "&nbsp;";
 			}
 
@@ -443,8 +442,7 @@ if ($id > 0 || $ref)
 
 		$db->free($result);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }

+ 41 - 82
htdocs/compta/prelevement/class/bonprelevement.class.php

@@ -152,20 +152,17 @@ class BonPrelevement extends CommonObject
 				{
 					$result = 0;
 				}
-				else
-				{
+				else {
 					$result = -1;
 					dol_syslog(get_class($this)."::AddFacture Erreur $result");
 				}
 			}
-			else
-			{
+			else {
 				$result = -2;
 				dol_syslog(get_class($this)."::AddFacture Erreur $result");
 			}
 		}
-		else
-		{
+		else {
 			$result = -3;
 			dol_syslog(get_class($this)."::AddFacture Erreur $result");
 		}
@@ -209,13 +206,11 @@ class BonPrelevement extends CommonObject
 			{
 				$num = $this->db->num_rows($resql);
 			}
-			else
-			{
+			else {
 				$result = -1;
 			}
 		}
-		else
-		{
+		else {
 			/*
 			 * No aggregate
 			 */
@@ -244,8 +239,7 @@ class BonPrelevement extends CommonObject
 				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
 				$result = 0;
 			}
-			else
-			{
+			else {
 				dol_syslog(get_class($this)."::addline Error -2");
 				$result = -2;
 			}
@@ -321,14 +315,12 @@ class BonPrelevement extends CommonObject
 
 				return 1;
 			}
-			else
-			{
+			else {
 				dol_syslog(get_class($this)."::Fetch Erreur aucune ligne retournee");
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			return -2;
 		}
 	}
@@ -397,16 +389,14 @@ class BonPrelevement extends CommonObject
 				$this->db->commit();
 				return 0;
 			}
-			else
-			{
+			else {
 				$this->db->rollback();
 				dol_syslog(get_class($this)."::set_credite ROLLBACK ");
 
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			dol_syslog(get_class($this)."::set_credite Ouverture transaction SQL impossible ");
 			return -2;
 		}
@@ -491,8 +481,7 @@ class BonPrelevement extends CommonObject
 								dol_syslog(get_class($this)."::set_infocredit AddPayment Error");
 								$error++;
 							}
-							else
-							{
+							else {
 								$result = $paiement->addPaymentToBank($user, 'payment', '(WithdrawalPayment)', $bankaccount, '', '');
 								if ($result < 0)
 								{
@@ -517,8 +506,7 @@ class BonPrelevement extends CommonObject
 							$error++;
 						}
 					}
-					else
-					{
+					else {
 						dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
 						$error++;
 					}
@@ -534,27 +522,23 @@ class BonPrelevement extends CommonObject
 						$this->db->commit();
 						return 0;
 					}
-					else
-					{
+					else {
 						$this->db->rollback();
 						dol_syslog("bon-prelevment::set_infocredit ROLLBACK ");
 						return -1;
 					}
 				}
-				else
-				{
+				else {
 					dol_syslog(get_class($this)."::set_infocredit 1025 Open SQL transaction impossible ");
 					return -1025;
 				}
 			}
-			else
-			{
+			else {
 				dol_syslog("bon-prelevment::set_infocredit 1027 Date de credit < Date de trans ");
 				return -1027;
 			}
 		}
-		else
-		{
+		else {
 			return -1026;
 		}
 	}
@@ -597,8 +581,7 @@ class BonPrelevement extends CommonObject
 
 				// TODO Call trigger to create a notification using notification module
 			}
-			else
-			{
+			else {
 				$error++;
 			}
 
@@ -610,16 +593,14 @@ class BonPrelevement extends CommonObject
 
 				return 0;
 			}
-			else
-			{
+			else {
 				$this->db->rollback();
 				dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR);
 
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
 			return -2;
 		}
@@ -664,8 +645,7 @@ class BonPrelevement extends CommonObject
 				{
 					$row = $this->db->fetch_row($resql);
 					if (!$amounts) $arr[$i] = $row[0];
-					else
-					{
+					else {
 						$arr[$i] = array(
 							$row[0],
 							$row[1]
@@ -676,8 +656,7 @@ class BonPrelevement extends CommonObject
 			}
 			$this->db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_syslog(get_class($this)."::getListInvoices Erreur");
 		}
 
@@ -715,8 +694,7 @@ class BonPrelevement extends CommonObject
 
 			return $obj->nb;
 		}
-		else
-		{
+		else {
 			$error = 1;
 			dol_syslog(get_class($this)."::SommeAPrelever Erreur -1");
 			dol_syslog($this->db->error());
@@ -760,8 +738,7 @@ class BonPrelevement extends CommonObject
 
 			return $obj->nb;
 		}
-		else
-		{
+		else {
 			$this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error();
 			return -1;
 		}
@@ -849,8 +826,7 @@ class BonPrelevement extends CommonObject
 				$this->db->free($resql);
 				dol_syslog(__METHOD__."::Read invoices, ".$i." invoices to withdraw", LOG_DEBUG);
 			}
-			else
-			{
+			else {
 				$error++;
 				dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR);
 			}
@@ -895,26 +871,22 @@ class BonPrelevement extends CommonObject
 								$i++;
 								//dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG);
 							}
-							else
-							{
+							else {
 								dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING);
 								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
 								$this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
 							}
 						}
-						else
-						{
+						else {
 							dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING);
 						}
 					}
-					else
-					{
+					else {
 						dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING);
 					}
 				}
 			}
-			else
-			{
+			else {
 				dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING);
 			}
 		}
@@ -941,8 +913,7 @@ class BonPrelevement extends CommonObject
 			{
 				$ok = 1;
 			}
-			else
-			{
+			else {
 				print $langs->trans("ModeWarning"); //"Option for real mode was not set, we stop after this simulation\n";
 			}
 		}
@@ -1000,14 +971,12 @@ class BonPrelevement extends CommonObject
 						$this->id = $prev_id;
 						$this->ref = $ref;
 					}
-					else
-					{
+					else {
 						$error++;
 						dol_syslog(__METHOD__."::Create withdraw receipt ".$this->db->lasterror(), LOG_ERR);
 					}
 				}
-				else
-				{
+				else {
 					$error++;
 					dol_syslog(__METHOD__."::Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR);
 				}
@@ -1129,15 +1098,13 @@ class BonPrelevement extends CommonObject
 			{
 				$this->db->commit();
 			}
-			else
-			{
+			else {
 				$this->db->rollback();
 			}
 
 			return count($factures_prev);
 		}
-		else
-		{
+		else {
 			return 0;
 		}
 	}
@@ -1198,8 +1165,7 @@ class BonPrelevement extends CommonObject
 			$this->db->commit();
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -1301,8 +1267,7 @@ class BonPrelevement extends CommonObject
 		{
 			return 0;
 		}
-		else
-		{
+		else {
 			return -1;
 		}
 	}
@@ -1327,8 +1292,7 @@ class BonPrelevement extends CommonObject
 		{
 			return 0;
 		}
-		else
-		{
+		else {
 			return -1;
 		}
 	}
@@ -1359,8 +1323,7 @@ class BonPrelevement extends CommonObject
 			{
 				$result = 0;
 			}
-			else
-			{
+			else {
 				$result = -1;
 				dol_syslog(get_class($this)."::AddNotification Error $result");
 			}
@@ -1464,8 +1427,7 @@ class BonPrelevement extends CommonObject
 				}
 				$nbtotalDrctDbtTxInf = $i;
 			}
-			else
-			{
+			else {
 				fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
 				$result = -2;
 			}
@@ -1475,8 +1437,7 @@ class BonPrelevement extends CommonObject
 			{
 				$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format);
 			}
-			else
-			{
+			else {
 				fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company
 			}
 
@@ -1543,8 +1504,7 @@ class BonPrelevement extends CommonObject
 					$i++;
 				}
 			}
-			else
-			{
+			else {
 				$result = -2;
 			}
 
@@ -1915,8 +1875,7 @@ class BonPrelevement extends CommonObject
 			$XML_SEPA_INFO .= '				</Id>'.$CrLf;
 			$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
 		}
-		else
-		{
+		else {
 			fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf);
 			$result = -2;
 		}

+ 2 - 4
htdocs/compta/prelevement/class/ligneprelevement.class.php

@@ -97,16 +97,14 @@ class LignePrelevement
 				$this->bon_ref         = $obj->ref;
 				$this->bon_rowid       = $obj->bon_rowid;
 			}
-			else
-			{
+			else {
 				$result++;
 				dol_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0");
 			}
 
 			$this->db->free($resql);
 		}
-		else
-		{
+		else {
 			$result++;
 			dol_syslog("LignePrelevement::Fetch rowid=$rowid");
 			dol_syslog($this->db->error());

+ 9 - 18
htdocs/compta/prelevement/class/rejetprelevement.class.php

@@ -161,8 +161,7 @@ class RejetPrelevement
 				$error++;
 				dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]);
 			}
-			else
-			{
+			else {
 				$result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', '');
 				if ($result < 0)
 				{
@@ -192,8 +191,7 @@ class RejetPrelevement
 			dol_syslog("RejetPrelevement::Create Commit");
 			$this->db->commit();
 		}
-		else
-		{
+		else {
 			dol_syslog("RejetPrelevement::Create Rollback");
 			$this->db->rollback();
 		}
@@ -228,8 +226,7 @@ class RejetPrelevement
 				$userid = $row[0];
 			}
 		}
-		else
-		{
+		else {
 			dol_syslog("RejetPrelevement::_send_email Erreur lecture user");
 		}
 
@@ -266,13 +263,11 @@ class RejetPrelevement
 			{
 				dol_syslog("RejetPrelevement::_send_email email envoye");
 			}
-			else
-			{
+			else {
 				dol_syslog("RejetPrelevement::_send_email Erreur envoi email");
 			}
 		}
-		else
-		{
+		else {
 			dol_syslog("RejetPrelevement::_send_email Userid invalide");
 		}
 	}
@@ -310,8 +305,7 @@ class RejetPrelevement
 				{
 					$row = $this->db->fetch_row($resql);
 					if (!$amounts) $arr[$i] = $row[0];
-					else
-					{
+					else {
 						$arr[$i] = array(
 							$row[0],
 							$row[1]
@@ -322,8 +316,7 @@ class RejetPrelevement
 			}
 			$this->db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_syslog("getListInvoices", LOG_ERR);
 		}
 
@@ -359,14 +352,12 @@ class RejetPrelevement
 
 				return 0;
 			}
-			else
-			{
+			else {
 				dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid numrows=0");
 				return -1;
 			}
 		}
-		else
-		{
+		else {
 			dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid");
 			return -2;
 		}

+ 6 - 12
htdocs/compta/prelevement/create.php

@@ -94,8 +94,7 @@ if (empty($reshook))
 				$mesg .= '<span class="warning">'.$val."</span><br>\n";
 			}
 		}
-		else
-		{
+		else {
 			setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
 		}
 	}
@@ -175,21 +174,18 @@ if ($nb) {
             print '<a class="butAction"  type="submit" href="create.php?action=create&format=ALL">'.$langs->trans("CreateAll")."</a>\n";
 		}
 	}
-	else
-	{
+	else {
 		if ($mysoc->isInEEC())
 		{
 			print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateForSepaFRST")."</a>\n";
 			print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateForSepaRCUR")."</a>\n";
 		}
-		else
-		{
+		else {
 			print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateAll")."</a>\n";
 		}
 	}
 }
-else
-{
+else {
     print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."</a>\n";
 }
 
@@ -308,16 +304,14 @@ if ($resql)
 			$i++;
 		}
 	}
-	else
-	{
+	else {
 		print '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
 	}
 	print "</table>";
 	print "</form>";
 	print "<br>\n";
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 2 - 4
htdocs/compta/prelevement/demandes.php

@@ -89,8 +89,7 @@ if (!$status)
 {
 	$title = $langs->trans("RequestStandingOrderToTreat");
 }
-else
-{
+else {
 	$title = $langs->trans("RequestStandingOrderTreated");
 }
 
@@ -143,8 +142,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
 {
 	$num = $nbtotalofrecords;
 }
-else
-{
+else {
 	$sql .= $db->plimit($limit + 1, $offset);
 
 	$resql = $db->query($sql);

+ 2 - 4
htdocs/compta/prelevement/factures.php

@@ -135,8 +135,7 @@ if ($prev_id > 0 || $ref)
 
 		dol_fiche_end();
     }
-  	else
-    {
+  	else {
       	dol_print_error($db);
     }
 }
@@ -290,8 +289,7 @@ if ($result)
 
   	$db->free($result);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 3 - 6
htdocs/compta/prelevement/fiche-rejet.php

@@ -136,8 +136,7 @@ if ($prev_id > 0 || $ref)
 
 		dol_fiche_end();
     }
-  	else
-    {
+  	else {
       	dol_print_error($db);
     }
 }
@@ -221,8 +220,7 @@ if ($resql)
     		$i++;
     	}
 	}
-	else
-	{
+	else {
 	    print '<tr><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
 	}
 
@@ -239,8 +237,7 @@ if ($resql)
 
 	$db->free($resql);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 2 - 4
htdocs/compta/prelevement/fiche-stat.php

@@ -133,8 +133,7 @@ if ($prev_id > 0 || $ref)
 
 		dol_fiche_end();
 	}
-	else
-	{
+	else {
 		$langs->load("errors");
 		print $langs->trans("Error");
 	}
@@ -186,8 +185,7 @@ if ($prev_id > 0 || $ref)
 		print "</table>";
 		$db->free($resql);
 	}
-	else
-	{
+	else {
 		print $db->error().' '.$sql;
 	}
 }

+ 3 - 6
htdocs/compta/prelevement/index.php

@@ -159,14 +159,12 @@ if ($resql)
             $i++;
         }
     }
-    else
-    {
+    else {
         print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders")).'</td></tr>';
     }
     print "</table></div><br>";
 }
-else
-{
+else {
     dol_print_error($db);
 }
 
@@ -221,8 +219,7 @@ if ($result)
     print "</table></div><br>";
     $db->free($result);
 }
-else
-{
+else {
     dol_print_error($db);
 }
 

+ 8 - 16
htdocs/compta/prelevement/line.php

@@ -103,13 +103,11 @@ if ($action == 'confirm_rejet')
 				exit;
 			}
 		}
-		else
-		{
+		else {
 			$action = "rejet";
 		}
 	}
-	else
-	{
+	else {
 		header("Location: line.php?id=".$id);
 		exit;
 	}
@@ -162,15 +160,13 @@ if ($id)
 					/* Historique pour certaines install */
 					print $langs->trans("Unknown");
 				}
-				else
-				{
+				else {
 					print dol_print_date($rej->date_rejet, 'day');
 				}
 				print '</td></tr>';
 				print '<tr><td width="20%">'.$langs->trans("RefusedInvoicing").'</td><td>'.$rej->invoicing.'</td></tr>';
 			}
-			else
-			{
+			else {
 				print '<tr><td width="20%">'.$resf.'</td></tr>';
 			}
 		}
@@ -178,8 +174,7 @@ if ($id)
 		print '</table>';
 		dol_fiche_end();
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 
@@ -246,13 +241,11 @@ if ($id)
 			{
 	  			print "<a class=\"butAction\" href=\"line.php?action=rejet&amp;id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>";
 			}
-			else
-			{
+			else {
 				print "<a class=\"butActionRefused classfortooltip\" href=\"#\" title=\"".$langs->trans("NotAllowed")."\">".$langs->trans("StandingOrderReject")."</a>";
 			}
 		}
-		else
-		{
+		else {
 			print "<a class=\"butActionRefused classfortooltip\" href=\"#\" title=\"".$langs->trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject")."</a>";
 		}
 	}
@@ -330,8 +323,7 @@ if ($id)
 
 		$db->free($result);
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }

+ 1 - 2
htdocs/compta/prelevement/list.php

@@ -236,8 +236,7 @@ if ($result)
 
     $db->free($result);
 }
-else
-{
+else {
     dol_print_error($db);
 }
 

+ 1 - 2
htdocs/compta/prelevement/rejets.php

@@ -118,8 +118,7 @@ if ($result)
 	print "</table>";
 	$db->free($result);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 2 - 4
htdocs/compta/prelevement/stats.php

@@ -126,8 +126,7 @@ if ($resql)
 	print "</tr></table>";
 	$db->free();
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 
@@ -220,8 +219,7 @@ if ($resql)
 	print "</tr></table>";
 	$db->free($resql);
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 3 - 6
htdocs/compta/recap-compta.php

@@ -212,14 +212,12 @@ if ($id > 0)
 
 					$db->free($resqlp);
 				}
-				else
-				{
+				else {
 					dol_print_error($db);
 				}
 			}
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -289,8 +287,7 @@ if ($id > 0)
 		print "</table>";
 	}
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 18 - 35
htdocs/compta/resultat/clientfourn.php

@@ -151,7 +151,7 @@ if ($modecompta == "CREANCES-DETTES")
 	$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
     $description = $langs->trans("RulesResultDue");
 	if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded");
-	else  $description .= $langs->trans("DepositsAreIncluded");
+	else $description .= $langs->trans("DepositsAreIncluded");
     $builddate = dol_now();
     //$exportlink=$langs->trans("NotYetAvailable");
 }
@@ -213,8 +213,7 @@ if ($modecompta == 'BOOKKEEPING')
 {
 	print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'amount', '', $param, 'class="right"', $sortfield, $sortorder);
 }
-else
-{
+else {
 	if ($modecompta == 'CREANCES-DETTES')
 	{
 		print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], 'amount_ht', '', $param, 'class="right"', $sortfield, $sortorder);
@@ -313,15 +312,13 @@ if ($modecompta == 'BOOKKEEPING')
 				$i++;
 			}
 		}
-		else
-		{
+		else {
 			print '<tr><td colspan="4" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
 		}
 	}
 	else dol_print_error($db);
 }
-else
-{
+else {
 	/*
 	 * Factures clients
 	 */
@@ -336,8 +333,7 @@ else
 	    $sql .= " AND f.fk_statut IN (1,2)";
 	    if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
 	    	$sql .= " AND f.type IN (0,1,2,5)";
-		else
-			$sql .= " AND f.type IN (0,1,2,3,5)";
+		else $sql .= " AND f.type IN (0,1,2,3,5)";
 	    if (!empty($date_start) && !empty($date_end))
 	    	$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
 	}
@@ -463,8 +459,7 @@ else
 	    $sql .= " AND f.fk_statut IN (1,2)";
 	    if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
 	    	$sql .= " AND f.type IN (0,1,2)";
-		else
-			$sql .= " AND f.type IN (0,1,2,3)";
+		else $sql .= " AND f.type IN (0,1,2,3)";
 	    if (!empty($date_start) && !empty($date_end))
 	    	$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
 	}
@@ -518,8 +513,7 @@ else
 	            $i++;
 	        }
 	    }
-	    else
-	    {
+	    else {
 	        print '<tr class="oddeven"><td>&nbsp;</td>';
 	        print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
 	        print '</tr>';
@@ -768,15 +762,13 @@ else
 		            $i++;
 		        }
 		    }
-		    else
-		    {
+		    else {
 		        print '<tr class="oddeven"><td>&nbsp;</td>';
 		        print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
 		        print '</tr>';
 		    }
 		}
-		else
-		{
+		else {
 		    dol_print_error($db);
 		}
 		print '<tr class="liste_total">';
@@ -854,15 +846,13 @@ else
 					print '</tr>';
 				}
 			}
-			else
-			{
+			else {
 				print '<tr class="oddeven"><td>&nbsp;</td>';
 				print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
 				print '</tr>';
 			}
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 		print '<tr class="liste_total">';
@@ -888,8 +878,7 @@ else
 		    	$sql .= " WHERE p.entity IN (".getEntity('donation').")";
 		    	$sql .= " AND fk_statut in (1,2)";
 			}
-			else
-			{
+			else {
 			    $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
 			    $sql .= " FROM ".MAIN_DB_PREFIX."don as p";
 			    $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
@@ -936,15 +925,13 @@ else
 					$i++;
 				}
 			}
-			else
-			{
+			else {
 				print '<tr class="oddeven"><td>&nbsp;</td>';
 				print '<td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td>';
 				print '</tr>';
 			}
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 		print '<tr class="liste_total">';
@@ -1083,8 +1070,7 @@ else
 		    $sql .= " WHERE f.fk_statut IN (1,2)";
 		    if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
 		    	$sql .= " AND f.type IN (0,1,2,5)";
-			else
-				$sql .= " AND f.type IN (0,1,2,3,5)";
+			else $sql .= " AND f.type IN (0,1,2,3,5)";
 		    if (!empty($date_start) && !empty($date_end))
 		    	$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
 		    $sql .= " AND f.entity IN (".getEntity('invoice').")";
@@ -1131,8 +1117,7 @@ else
 		    $sql .= " WHERE f.fk_statut IN (1,2)";
 		    if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
 		    	$sql .= " AND f.type IN (0,1,2)";
-			else
-				$sql .= " AND f.type IN (0,1,2,3)";
+			else $sql .= " AND f.type IN (0,1,2,3)";
 		    if (!empty($date_start) && !empty($date_end))
 		    	$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
 		    $sql .= " AND f.entity = ".$conf->entity;
@@ -1173,8 +1158,7 @@ else
 		    print '<td class="right">'.price($amount)."</td>\n";
 		    print "</tr>\n";
 		}
-		else
-		{
+		else {
 		    // VAT really already paid
 		    $amount = 0;
 		    $sql = "SELECT date_format(t.datev,'%Y-%m') as dm, sum(t.amount) as amount";
@@ -1254,8 +1238,7 @@ else
 		        }
 		        $db->free($result);
 		    }
-		    else
-		    {
+		    else {
 		        dol_print_error($db);
 		    }
 		    print '<tr class="oddeven"><td>&nbsp;</td>';

+ 9 - 17
htdocs/compta/resultat/index.php

@@ -131,7 +131,7 @@ if ($modecompta == 'CREANCES-DETTES')
 	$description = $langs->trans("RulesAmountWithTaxIncluded");
 	$description .= '<br>'.$langs->trans("RulesResultDue");
 	if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= "<br>".$langs->trans("DepositsAreNotIncluded");
-	else  $description .= "<br>".$langs->trans("DepositsAreIncluded");
+	else $description .= "<br>".$langs->trans("DepositsAreIncluded");
 	$builddate = dol_now();
 	//$exportlink=$langs->trans("NotYetAvailable");
 }
@@ -724,8 +724,7 @@ if (!empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' |
 			}
 		}
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -786,8 +785,7 @@ if (!empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
     		}
     	}
     }
-    else
-    {
+    else {
     	dol_print_error($db);
     }
 }
@@ -826,8 +824,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba
     		}
     	}
     }
-    else
-    {
+    else {
     	dol_print_error($db);
     }
 
@@ -856,8 +853,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba
     		}
     	}
     }
-    else
-    {
+    else {
     	dol_print_error($db);
     }
 }
@@ -894,8 +890,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan
     		}
     	}
     }
-    else
-    {
+    else {
     	dol_print_error($db);
     }
 }
@@ -961,8 +956,7 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
 			}
 		}
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -1042,8 +1036,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
 				$totsorties[$annee] += $decaiss[$case];
 			}
 		}
-		else
-		{
+		else {
 			if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0)
 			{
 				print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price(price2num($decaiss_ttc[$case], 'MT')).'</a>';
@@ -1063,8 +1056,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
 				$totentrees[$annee] += $encaiss[$case];
 			}
 		}
-		else
-		{
+		else {
 			if (isset($encaiss_ttc[$case]))
 			{
 				print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price(price2num($encaiss_ttc[$case], 'MT')).'</a>';

+ 2 - 2
htdocs/compta/resultat/result.php

@@ -178,7 +178,7 @@ if ($modecompta == "CREANCES-DETTES")
 	//$periodlink='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
 	$description = $langs->trans("RulesResultDue");
 	if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded");
-	else  $description .= $langs->trans("DepositsAreIncluded");
+	else $description .= $langs->trans("DepositsAreIncluded");
 	$builddate = dol_now();
 	//$exportlink=$langs->trans("NotYetAvailable");
 }
@@ -375,7 +375,7 @@ elseif ($modecompta == "BOOKKEEPING")
 				print "</tr>\n";
 
 				//var_dump($sommes);
-			} else            // normal category
+			} else // normal category
 			{
 				$code = $cat['code']; // Category code we process
 

+ 10 - 20
htdocs/compta/sociales/card.php

@@ -129,8 +129,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes')
 		header("Location: list.php");
 		exit;
 	}
-	else
-	{
+	else {
 		setEventMessages($object->error, $object->errors, 'errors');
 	}
 }
@@ -166,8 +165,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
 		setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
 		$action = 'create';
 	}
-	else
-	{
+	else {
 		$object->type = $actioncode;
 		$object->label = GETPOST('label', 'alpha');
 		$object->date_ech = $dateech;
@@ -211,8 +209,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre
 		setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors');
 		$action = 'create';
 	}
-	else
-	{
+	else {
 		$result = $object->fetch($id);
 
 		$object->date_ech = $dateech;
@@ -272,8 +269,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
 				header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
 				exit;
 			}
-			else
-			{
+			else {
 				$id = $originalId;
 				$db->rollback();
 
@@ -281,8 +277,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char
 			}
 		}
 	}
-	else
-	{
+	else {
 		$db->rollback();
 		dol_print_error($db, $object->error);
 	}
@@ -432,8 +427,7 @@ if ($id > 0)
 			{
 				$formquestion[] = array('type' => 'checkbox', 'name' => 'clone_for_next_month', 'label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1);
 			}
-			else
-			{
+			else {
 				$formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1);
 				$formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1);
 			}
@@ -536,8 +530,7 @@ if ($id > 0)
 		{
 			print $form->selectDate($object->periode, 'period', 0, 0, 0, 'charge', 1);
 		}
-		else
-		{
+		else {
 			print dol_print_date($object->periode, "day");
 		}
 		print "</td></tr>";
@@ -675,8 +668,7 @@ if ($id > 0)
 					$i++;
 				}
 			}
-			else
-			{
+			else {
 				print '<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
 				print '<td></td><td></td><td></td><td></td>';
 				print '</tr>';
@@ -696,8 +688,7 @@ if ($id > 0)
 
 			$db->free($resql);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 
@@ -768,8 +759,7 @@ if ($id > 0)
 			print "</div>";
 		}
 	}
-	else
-	{
+	else {
 		/* Social contribution not found */
 		dol_print_error('', $object->error);
 	}

+ 9 - 18
htdocs/compta/sociales/class/chargesociales.class.php

@@ -172,13 +172,11 @@ class ChargeSociales extends CommonObject
 
                 return 1;
             }
-            else
-            {
+            else {
                 return 0;
             }
         }
-        else
-        {
+        else {
             $this->error = $this->db->lasterror();
             return -1;
         }
@@ -258,8 +256,7 @@ class ChargeSociales extends CommonObject
 				return -1 * $error;
 			}
         }
-        else
-        {
+        else {
             $this->error = $this->db->error();
             $this->db->rollback();
             return -1;
@@ -329,8 +326,7 @@ class ChargeSociales extends CommonObject
             $this->db->commit();
             return 1;
         }
-        else
-        {
+        else {
             $this->db->rollback();
             return -1;
         }
@@ -387,8 +383,7 @@ class ChargeSociales extends CommonObject
             $this->db->rollback();
             return -1 * $error;
         }
-        else
-        {
+        else {
             $this->db->commit();
             return 1;
         }
@@ -422,13 +417,11 @@ class ChargeSociales extends CommonObject
                 $this->db->free($result);
                 return $obj->amount;
             }
-            else
-            {
+            else {
                 return 0;
             }
         }
-        else
-        {
+        else {
             print $this->db->error();
             return -1;
         }
@@ -613,8 +606,7 @@ class ChargeSociales extends CommonObject
             $this->db->free($resql);
             return $amount;
         }
-        else
-        {
+        else {
             return -1;
         }
     }
@@ -668,8 +660,7 @@ class ChargeSociales extends CommonObject
 
             $this->db->free($result);
         }
-        else
-        {
+        else {
             dol_print_error($this->db);
         }
     }

+ 9 - 18
htdocs/compta/sociales/class/paymentsocialcontribution.class.php

@@ -200,8 +200,7 @@ class PaymentSocialContribution extends CommonObject
 					}
 				}
 			}
-			else
-			{
+			else {
 				$error++;
 			}
 		}
@@ -216,8 +215,7 @@ class PaymentSocialContribution extends CommonObject
 		    $this->db->commit();
 			return $this->id;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			$this->db->rollback();
 			return -1;
@@ -287,8 +285,7 @@ class PaymentSocialContribution extends CommonObject
 
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = "Error ".$this->db->lasterror();
 			return -1;
 		}
@@ -359,8 +356,7 @@ class PaymentSocialContribution extends CommonObject
 			$this->db->rollback();
 			return -1 * $error;
 		}
-		else
-		{
+		else {
 			$this->db->commit();
 			return 1;
 		}
@@ -415,8 +411,7 @@ class PaymentSocialContribution extends CommonObject
 			$this->db->rollback();
 			return -1 * $error;
 		}
-		else
-		{
+		else {
 			$this->db->commit();
 			return 1;
 		}
@@ -466,8 +461,7 @@ class PaymentSocialContribution extends CommonObject
 			$this->db->commit();
 			return $object->id;
 		}
-		else
-		{
+		else {
 			$this->db->rollback();
 			return -1;
 		}
@@ -578,8 +572,7 @@ class PaymentSocialContribution extends CommonObject
                     }
                 }
             }
-            else
-            {
+            else {
                 $this->error = $acc->error;
                 $error++;
             }
@@ -589,8 +582,7 @@ class PaymentSocialContribution extends CommonObject
         {
             return 1;
         }
-        else
-        {
+        else {
             return -1;
         }
     }
@@ -614,8 +606,7 @@ class PaymentSocialContribution extends CommonObject
 		{
 			return 1;
 		}
-		else
-		{
+		else {
 			$this->error = $this->db->error();
 			return 0;
 		}

+ 1 - 2
htdocs/compta/sociales/document.php

@@ -164,8 +164,7 @@ if ($object->id)
     $param = '&id='.$object->id;
     include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
 }
-else
-{
+else {
     print $langs->trans("ErrorUnknown");
 }
 

+ 4 - 8
htdocs/compta/sociales/list.php

@@ -81,8 +81,7 @@ if (!GETPOSTISSET('search_typeid'))
 		if ($part[0] == 'cs.fk_type') $search_typeid = $part[1];
 	}
 }
-else
-{
+else {
 	$search_typeid = GETPOST('search_typeid', 'int');
 }
 
@@ -209,8 +208,7 @@ if ($resql)
 		print $countrynotdefined;
 		print '</div>';
 	}
-	else
-	{
+	else {
 	    print '<div class="div-table-responsive">';
 	    print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
 
@@ -314,8 +312,7 @@ if ($resql)
 			{
 				print '<a href="list.php?year='.strftime("%Y", $db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').'</a>';
 			}
-			else
-			{
+			else {
 				print '&nbsp;';
 			}
 			print "</td>\n";
@@ -346,8 +343,7 @@ if ($resql)
 	}
 	print '</form>';
 }
-else
-{
+else {
 	dol_print_error($db);
 }
 

+ 6 - 12
htdocs/compta/sociales/payments.php

@@ -93,8 +93,7 @@ if ($mode != 'sconly')
     $center = ($year ? '<a href="list.php?year='.($year - 1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="list.php?year='.($year + 1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>" : "");
     print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit, 1);
 }
-else
-{
+else {
     print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit);
 }
 
@@ -209,8 +208,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
 	    print '<td class="liste_total right">'.price($totalpaye)."</td>";
 		print "</tr>";
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 	print '</table>';
@@ -288,8 +286,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
 		    print "</table>";
 		    $db->free($result);
 		}
-		else
-		{
+		else {
 		    dol_print_error($db);
 		}
 	}
@@ -311,8 +308,7 @@ elseif ($mysoc->localtax2_assuj == "1")
 	$j = 2;
 	$numlt = 3;
 }
-else
-{
+else {
 	$j = 0;
 	$numlt = 0;
 }
@@ -389,8 +385,7 @@ while ($j < $numlt)
 			print "</table>";
 			$db->free($result);
 		}
-		else
-		{
+		else {
 			dol_print_error($db);
 		}
 	}
@@ -473,8 +468,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
 
             print "<br>";
         }
-        else
-        {
+        else {
             dol_print_error($db);
         }
     }

+ 1 - 2
htdocs/compta/stats/byratecountry.php

@@ -78,8 +78,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 		}
 		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
 	}
-	else
-	{
+	else {
 		if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
 		if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
 		if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }

+ 1 - 2
htdocs/compta/stats/cabyprodserv.php

@@ -104,8 +104,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 		}
 		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
 	}
-	else
-	{
+	else {
 		if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
 		if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
 		if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }

+ 2 - 3
htdocs/compta/stats/cabyuser.php

@@ -97,8 +97,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 	if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
 	if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); }
 }
-else
-{
+else {
 	// TODO We define q
 }
 // $date_start and $date_end are defined. We force $year_start and $nbofyear
@@ -154,7 +153,7 @@ if ($modecompta == "CREANCES-DETTES") {
     //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
     $description = $langs->trans("RulesCADue");
 	if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded");
-	else  $description .= $langs->trans("DepositsAreIncluded");
+	else $description .= $langs->trans("DepositsAreIncluded");
     $builddate = dol_now();
     //$exportlink=$langs->trans("NotYetAvailable");
 }

+ 2 - 3
htdocs/compta/stats/casoc.php

@@ -114,8 +114,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 	if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
 	if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); }
 }
-else
-{
+else {
 	// TODO We define q
 }
 
@@ -180,7 +179,7 @@ if ($modecompta == "CREANCES-DETTES")
 	//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
 	$description = $langs->trans("RulesCADue");
 	if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded");
-	else  $description .= $langs->trans("DepositsAreIncluded");
+	else $description .= $langs->trans("DepositsAreIncluded");
 	$builddate = dol_now();
 	//$exportlink=$langs->trans("NotYetAvailable");
 }

+ 8 - 15
htdocs/compta/stats/index.php

@@ -124,7 +124,7 @@ if ($modecompta == "CREANCES-DETTES")
 	$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
 	$description = $langs->trans("RulesCADue");
 	if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded");
-	else  $description .= $langs->trans("DepositsAreIncluded");
+	else $description .= $langs->trans("DepositsAreIncluded");
 	$builddate = dol_now();
 	//$exportlink=$langs->trans("NotYetAvailable");
 }
@@ -260,8 +260,7 @@ if ($modecompta == 'RECETTES-DEPENSES')
 			$i++;
 		}
 	}
-	else
-	{
+	else {
 		dol_print_error($db);
 	}
 }
@@ -340,8 +339,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
 					$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
 					print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price($cum_ht[$case], 1).'</a>';
 				}
-				else
-				{
+				else {
 					if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; }
 					else { print '&nbsp;'; }
 				}
@@ -357,8 +355,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
 				print price($cum[$case], 1);
 				if ($modecompta != 'BOOKKEEPING') print '</a>';
 			}
-			else
-			{
+			else {
 				if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; }
 				else { print '&nbsp;'; }
 			}
@@ -391,8 +388,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
 					print '<td class="borderrightlight right">-</td>';
 				}
 			}
-			else
-			{
+			else {
 				print '<td class="borderrightlight right">';
 				if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; }
 				else { print '&nbsp;'; }
@@ -484,8 +480,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++)
 		{
 			print '<td class="nowrap right">'.($total_ht[$annee] ?price($total_ht[$annee]) : "0")."</td>";
 		}
-		else
-		{
+		else {
 			print '<td>&nbsp;</td>';
 		}
 	}
@@ -495,8 +490,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++)
 	{
 		print '<td class="nowrap right">'.($total[$annee] ?price($total[$annee]) : "0")."</td>";
 	}
-	else
-	{
+	else {
 		print '<td>&nbsp;</td>';
 	}
 
@@ -520,8 +514,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++)
 			print '<td class="borderrightlight right">+0%</td>';
 		}
 	}
-	else
-	{
+	else {
 		print '<td class="borderrightlight right">';
 		if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; }
 		else { print '&nbsp;'; }

+ 6 - 12
htdocs/compta/stats/supplier_turnover.php

@@ -290,8 +290,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
 					$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
 					print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price($cum_ht[$case], 1).'</a>';
 				}
-				else
-				{
+				else {
 					if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; }
 					else { print '&nbsp;'; }
 				}
@@ -307,8 +306,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
 				print price($cum[$case], 1);
 				if ($modecompta != 'BOOKKEEPING') print '</a>';
 			}
-			else
-			{
+			else {
 				if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; }
 				else { print '&nbsp;'; }
 			}
@@ -341,8 +339,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++)
 					print '<td class="borderrightlight right">-</td>';
 				}
 			}
-			else
-			{
+			else {
 				print '<td class="borderrightlight right">';
 				if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; }
 				else { print '&nbsp;'; }
@@ -369,8 +366,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++)
 		{
 			print '<td class="nowrap right">'.($total_ht[$annee] ?price($total_ht[$annee]) : "0")."</td>";
 		}
-		else
-		{
+		else {
 			print '<td>&nbsp;</td>';
 		}
 	}
@@ -380,8 +376,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++)
 	{
 		print '<td class="nowrap right">'.($total[$annee] ?price($total[$annee]) : "0")."</td>";
 	}
-	else
-	{
+	else {
 		print '<td>&nbsp;</td>';
 	}
 
@@ -405,8 +400,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++)
 			print '<td class="borderrightlight right">+0%</td>';
 		}
 	}
-	else
-	{
+	else {
 		print '<td class="borderrightlight right">';
 		if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; }
 		else { print '&nbsp;'; }

+ 1 - 2
htdocs/compta/stats/supplier_turnover_by_prodserv.php

@@ -101,8 +101,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 		}
 		$date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false);
 	}
-	else
-	{
+	else {
 		if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); }
 		if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); }
 		if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }

+ 1 - 2
htdocs/compta/stats/supplier_turnover_by_thirdparty.php

@@ -108,8 +108,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
 	if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); }
 	if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); }
 }
-else
-{
+else {
 	// TODO We define q
 }
 

+ 6 - 12
htdocs/compta/tva/card.php

@@ -132,8 +132,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
 			header("Location: list.php");
 			exit;
 		}
-		else
-		{
+		else {
 			$db->rollback();
 			setEventMessages($object->error, $object->errors, 'errors');
 			$action = "create";
@@ -167,21 +166,18 @@ if ($action == 'delete')
 				header("Location: ".DOL_URL_ROOT.'/compta/tva/list.php');
 				exit;
 			}
-			else
-			{
+			else {
 				$object->error = $accountline->error;
 				$db->rollback();
 				setEventMessages($object->error, $object->errors, 'errors');
 			}
 	    }
-	    else
-	    {
+	    else {
 	        $db->rollback();
 	        setEventMessages($object->error, $object->errors, 'errors');
 	    }
 	}
-	else
-	{
+	else {
 		$mesg = 'Error try do delete a line linked to a conciliated bank transaction';
 		setEventMessages($mesg, null, 'errors');
 	}
@@ -389,13 +385,11 @@ if ($id)
 		{
 			print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
 		}
-		else
-		{
+		else {
 			print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("NotAllowed"))).'">'.$langs->trans("Delete").'</a></div>';
 		}
 	}
-	else
-	{
+	else {
 		print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("LinkedToAConciliatedTransaction").'">'.$langs->trans("Delete").'</a></div>';
 	}
 	print "</div>";

+ 17 - 34
htdocs/compta/tva/class/tva.class.php

@@ -151,14 +151,12 @@ class Tva extends CommonObject
             	$this->db->commit();
             	return $this->id;
             }
-            else
-			{
+            else {
 				$this->db->rollback();
 				return -1;
             }
         }
-        else
-		{
+        else {
 			$this->error = "Error ".$this->db->lasterror();
 			$this->db->rollback();
 			return -1;
@@ -225,8 +223,7 @@ class Tva extends CommonObject
     		$this->db->commit();
     		return 1;
     	}
-    	else
-    	{
+    	else {
     		$this->db->rollback();
     		return -1;
     	}
@@ -294,8 +291,7 @@ class Tva extends CommonObject
 
             return 1;
         }
-        else
-        {
+        else {
       	    $this->error = "Error ".$this->db->lasterror();
             return -1;
         }
@@ -405,14 +401,12 @@ class Tva extends CommonObject
                 $this->db->free($result);
                 return $ret;
             }
-            else
-			{
+            else {
                 $this->db->free($result);
 				return 0;
             }
         }
-        else
-        {
+        else {
             print $this->db->lasterror();
             return -1;
         }
@@ -446,14 +440,12 @@ class Tva extends CommonObject
             	$this->db->free($result);
                 return $ret;
             }
-            else
-			{
+            else {
             	$this->db->free($result);
 				return 0;
             }
         }
-        else
-        {
+        else {
             print $this->db->lasterror();
             return -1;
         }
@@ -489,14 +481,12 @@ class Tva extends CommonObject
             	$this->db->free($result);
                 return $ret;
             }
-            else
-			{
+            else {
             	$this->db->free($result);
 				return 0;
             }
         }
-        else
-        {
+        else {
             print $this->db->lasterror();
             return -1;
         }
@@ -613,8 +603,7 @@ class Tva extends CommonObject
 					{
                         $this->update_fk_bank($bank_line_id);
                     }
-					else
-					{
+					else {
 						$this->error = $acc->error;
 						$ok = 0;
 					}
@@ -633,20 +622,17 @@ class Tva extends CommonObject
 					$this->db->commit();
 					return $this->id;
 				}
-				else
-				{
+				else {
 					$this->db->rollback();
 					return -3;
 				}
             }
-            else
-            {
+            else {
                 $this->db->rollback();
                 return -2;
             }
         }
-        else
-        {
+        else {
             $this->error = $this->db->error();
             $this->db->rollback();
             return -1;
@@ -670,8 +656,7 @@ class Tva extends CommonObject
 		{
 			return 1;
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 			return -1;
 		}
@@ -753,8 +738,7 @@ class Tva extends CommonObject
             $this->db->free($resql);
             return $amount;
         }
-        else
-        {
+        else {
             return -1;
         }
     }
@@ -800,8 +784,7 @@ class Tva extends CommonObject
 
 			$this->db->free($result);
 		}
-		else
-		{
+		else {
 			dol_print_error($this->db);
 		}
 	}

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff