diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php
index 234b70d84b92b4c7d2b072aeec09bdd28668a191..5e728b0cc64092facb2607bd795f944ad6c6bda2 100644
--- a/htdocs/compta/salaries/class/paymentsalary.class.php
+++ b/htdocs/compta/salaries/class/paymentsalary.class.php
@@ -1,19 +1,20 @@
 <?php
 /* Copyright (C) 2011-2014 Alexandre Spangaro   <alexandre.spangaro@gmail.com>
+ * Copyright (C) 2014	   Juanjo Menent		<jmenent@2byte.es>
  *
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
 
 /**
  *      \file       htdocs/compta/salaries/class/paymentsalary.class.php
@@ -278,6 +279,8 @@ class PaymentSalary extends CommonObject
 	function create($user)
 	{
 		global $conf,$langs;
+		
+		$error=0;
 
 		// Clean parameters
 		$this->amount=price2num(trim($this->amount));
@@ -351,7 +354,6 @@ class PaymentSalary extends CommonObject
 		$result = $this->db->query($sql);
 		if ($result)
 		{
-			$ok=1;
 
 			$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
 
@@ -387,10 +389,10 @@ class PaymentSalary extends CommonObject
 					else
 					{
 						$this->error=$acc->error;
-						$ok=0;
+						$error++;
 					}
 
-					if ($ok)
+					if (! $error)
 					{
 						// Add link 'payment_salary' in bank_url between payment and bank transaction
 						$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
@@ -399,7 +401,7 @@ class PaymentSalary extends CommonObject
 						if ($result <= 0)
 						{
 							$this->error=$acc->error;
-							$ok=0;
+							$error++;
 						}
 					}
 
@@ -419,19 +421,19 @@ class PaymentSalary extends CommonObject
 					if ($result <= 0)
 					{
 						$this->error=$acc->error;
-						$ok=0;
+						$error++;
 					}
 				}
 
 	            // Call trigger
 	            $result=$this->call_trigger('PAYMENT_SALARY_CREATE',$user);
-	            if ($result < 0) $ok=0;            
+	            if ($result < 0) $error++;            
 	            // End call triggers
 	
 			}
-			else $ok=0;
+			else $error++;
 
-			if ($ok)
+			if (! $error)
 			{
 				$this->db->commit();
 				return $this->id;