diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index f7c173a401d2c23fea027dc37d2b27dfc39a4d40..010fcf191ccf1f69dbfb3b87cd08083a7445847b 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -214,7 +214,7 @@ class DoliDBPgsql extends DoliDB
 
     			// nuke unsigned
     			$line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line);
-    			$line=preg_replace('/as signed/i','as integer',$line);
+    			$line=preg_replace('/as signed/i','as integer',$line);
     			 
     			// blob -> text
     			$line=preg_replace('/\w*blob/i','text',$line);
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 3e6beaa9eebe281679d014a077cbe46fc4919218..2bd3c757e4720ceaa4f2fc6753efd28d2ed11d2e 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -802,7 +802,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
         if ($counter >= pow(10, dol_strlen($maskcounter)))
         {
         	$counter='ErrorMaxNumberReachForThisMask';
-        }
+        }
 
         if (! empty($maskrefclient_maskcounter))
         {
diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php
index 78b0a829fa9d245814a0fd43f2758a4623700e0a..cd21c5164ac2521658c0c65473d9b65e78d3b0ae 100644
--- a/htdocs/core/modules/contract/mod_contract_serpis.php
+++ b/htdocs/core/modules/contract/mod_contract_serpis.php
@@ -123,8 +123,8 @@ class mod_contract_serpis extends ModelNumRefContracts
 		$date=$contract->date_contrat;
 		$yymm = strftime("%y%m",$date);
 
-		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
-		else $num = sprintf("%04s",$max+1);
+		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
+		else $num = sprintf("%04s",$max+1);
 
 		dol_syslog("mod_contract_serpis::getNextValue return ".$this->prefix.$yymm."-".$num);
 		return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php
index e575f5c93af963cd14d67125d156357ae6956e37..ceec6107e58b34c20b7371e82598d386303c051b 100644
--- a/htdocs/core/modules/expedition/mod_expedition_safor.php
+++ b/htdocs/core/modules/expedition/mod_expedition_safor.php
@@ -123,8 +123,8 @@ class mod_expedition_safor extends ModelNumRefExpedition
 		$date=time();
 		$yymm = strftime("%y%m",$date);
 
-		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
-		else $num = sprintf("%04s",$max+1);
+		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
+		else $num = sprintf("%04s",$max+1);
 
 		dol_syslog("mod_expedition_safor::getNextValue return ".$this->prefix.$yymm."-".$num);
 		return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php
index 3305636457464f7dfa7888123a10f89949c092d1..e1b749bbf2f0c2c507d9875560c32cf07e03ab04 100644
--- a/htdocs/core/modules/livraison/mod_livraison_jade.php
+++ b/htdocs/core/modules/livraison/mod_livraison_jade.php
@@ -135,8 +135,8 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder
         if (empty($date)) $date=dol_now();
         $yymm = strftime("%y%m",$date);
         
-        if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
-        else $num = sprintf("%04s",$max+1);
+        if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
+        else $num = sprintf("%04s",$max+1);
 
         dol_syslog("mod_livraison_jade::getNextValue return ".$this->prefix.$yymm."-".$num);
         return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php
index 4f13c40c970bf84fe6bc24ff41aff13d477243b1..686fa74dc431b1870fa2ace981963089dcbe08a2 100644
--- a/htdocs/core/modules/project/mod_project_simple.php
+++ b/htdocs/core/modules/project/mod_project_simple.php
@@ -131,8 +131,8 @@ class mod_project_simple extends ModeleNumRefProjects
 		//$yymm = strftime("%y%m",time());
 		$yymm = strftime("%y%m",$date);
 		
-		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
-		else $num = sprintf("%04s",$max+1);
+		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
+		else $num = sprintf("%04s",$max+1);
 
 		dol_syslog("mod_project_simple::getNextValue return ".$this->prefix.$yymm."-".$num);
 		return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php
index e0a18711ca6fc2af74b5e90eab9738d1ceff8ef8..8d6ea55351923010b8d601379a2e60f062415c81 100644
--- a/htdocs/core/modules/project/task/mod_task_simple.php
+++ b/htdocs/core/modules/project/task/mod_task_simple.php
@@ -131,8 +131,8 @@ class mod_task_simple extends ModeleNumRefTask
 		//$yymm = strftime("%y%m",time());
 		$yymm = strftime("%y%m",$date);
 		
-		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
-		else $num = sprintf("%04s",$max+1);
+		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
+		else $num = sprintf("%04s",$max+1);
 
 		dol_syslog("mod_task_simple::getNextValue return ".$this->prefix.$yymm."-".$num);
 		return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php
index 15e06d995d14665b3ab17b0227f5036c97f96123..5d8b8e169df51e22a79ff8b79a82c4ad20eb7043 100644
--- a/htdocs/core/modules/propale/mod_propale_marbre.php
+++ b/htdocs/core/modules/propale/mod_propale_marbre.php
@@ -131,8 +131,8 @@ class mod_propale_marbre extends ModeleNumRefPropales
 		$date = time();
 		$yymm = strftime("%y%m",$date);
 		
-		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
-		else $num = sprintf("%04s",$max+1);
+		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
+		else $num = sprintf("%04s",$max+1);
 
 		dol_syslog("mod_propale_marbre::getNextValue return ".$this->prefix.$yymm."-".$num);
 		return $this->prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php
index 95f3fa27b2c562dedc36d016923b2d1889d68296..4c24f5691a5ee0b137b6b0e64c17cc819d4b1175 100644
--- a/htdocs/core/modules/societe/mod_codeclient_monkey.php
+++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php
@@ -140,8 +140,8 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
 		$date	= dol_now();
 		$yymm	= strftime("%y%m",$date);
 		
-		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
-		else $num = sprintf("%04s",$max+1);
+		if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
+		else $num = sprintf("%04s",$max+1);
 
 		dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num);
 		return $prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
index 19eb47e6a089bb66fc78336da033dbafbf6a5cf6..e35226b20fd4b22bb6d9e0bcf138e71f6cb7d118 100644
--- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
+++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
@@ -158,8 +158,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
         	$date=$object->date;	// This is invoice date (not creation date)
         	$yymm = strftime("%y%m",$date);
         	
-        	if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
-        	else $num = sprintf("%04s",$max+1);
+        	if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
+        	else $num = sprintf("%04s",$max+1);
 
         	dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num);
         	return $prefix.$yymm."-".$num;
diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php
index c321b408d2494119a26f393506bd4ae3fe422179..fea7c4f21e0cee5dbb6d7cfc1462a26480881666 100644
--- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php
+++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php
@@ -126,8 +126,8 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
         if (empty($date)) $date=$object->date;  // Creation date is order date for suppliers orders
         $yymm = strftime("%y%m",$date);
         
-        if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
-        else $num = sprintf("%04s",$max+1);
+        if ($max >= (pow(10, 4) - 1)) $num=$max+1;	// If counter > 9999, we do not format on 4 chars, we take number as it is
+        else $num = sprintf("%04s",$max+1);
 
         return $this->prefix.$yymm."-".$num;
     }