diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php
index 5ec1599c2cb92f9de6d98861b13743a7f1f64635..abe7eb2455562df03856693a610939bc3595720c 100755
--- a/htdocs/compta/paiement_charge.php
+++ b/htdocs/compta/paiement_charge.php
@@ -46,6 +46,8 @@ if ($user->societe_id > 0)
  */
 if ($_POST["action"] == 'add_paiement')
 {
+	$error=0;
+	
 	if ($_POST["cancel"])
 	{
 		$loc = DOL_URL_ROOT.'/compta/sociales/charges.php?id='.$chid;
@@ -76,6 +78,7 @@ if ($_POST["action"] == 'add_paiement')
 		$paymentid = 0;
 
 		// Read possible payments
+		// FIXME add error message if no payment is defined
 		foreach ($_POST as $key => $value)
 		{
 			if (substr($key,0,7) == 'amount_')
@@ -99,7 +102,7 @@ if ($_POST["action"] == 'add_paiement')
 		if (! $error)
 		{
 		    $paymentid = $paiement->create($user);
-            if (! $paymentid > 0)
+            if ($paymentid < 0)
             {
                 $errmsg=$paiement->error;
                 $error++;
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index 60caa013278593a1729bd38c699cc2394ed5736a..6b91c2bb69d7f4bddff83ffd68f863a956bfbdc9 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -71,6 +71,7 @@ class PaymentSocialContribution extends CommonObject
 	function create($user)
 	{
 		global $conf, $langs;
+		
 		$error=0;
 
 		// Validation parametres