diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
index f2cce5bee913fe692a1a51ea1ad5b4cd5f01a0f8..e80634ad7f616eb81dfd96fa9200ac9a06d30a13 100644
--- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
+++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php
@@ -85,13 +85,13 @@ if ($action == 'lettering') {
 
 if ($action == 'autolettrage') {
 
-	$result = $BookKeeping->LettrageTiers($socid);
+	$result = $BookKeeping->lettrageTiers($socid);
 
-	if( $result < 0 ){
-							setEventMessages('', $BookKeeping->errors, 'errors' );
-							$error++;
-
-						}
+	if( $result < 0 )
+	{
+		setEventMessages('', $BookKeeping->errors, 'errors' );
+		$error++;
+	}
 
 }
 
diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
index f98cb74a456ec94c4848193d64c58374be6c94f7..99374a97118d639f5615582731d628529520db74 100644
--- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
+++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php
@@ -86,13 +86,13 @@ if ($action == 'lettering') {
 
 if ($action == 'autolettrage') {
 
-	$result = $BookKeeping->LettrageTiers($socid);
+	$result = $BookKeeping->lettrageTiers($socid);
 
-	if( $result < 0 ){
-							setEventMessages('', $BookKeeping->errors, 'errors' );
-							$error++;
-
-						}
+	if ( $result < 0 )
+	{
+		setEventMessages('', $BookKeeping->errors, 'errors' );
+		$error++;
+	}
 
 }
 
diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php
index 97721669f912a487b38799ffc2e7670b29c761b5..f3d9359b19d2362a24075eeea7addadf708eb36a 100644
--- a/htdocs/accountancy/class/lettering.class.php
+++ b/htdocs/accountancy/class/lettering.class.php
@@ -36,8 +36,8 @@ class lettering extends BookKeeping
     /**
      * lettrageTiers
      *
-     * @param   int   $socid      Thirdparty id
-     * @return  void
+     * @param   int   $socid	Thirdparty id
+     * @return  int				<0 if KO, >0 if OK
      */
 	public function lettrageTiers($socid) {
 
@@ -229,13 +229,15 @@ class lettering extends BookKeeping
 			}
 		}
 
-
+		return 1;
 	}
 
 
 	public function updatelettrage($ids, $notrigger=false){
 		$error = 0;
 
+		$lettre='';
+
 		$sql = "SELECT lettering_code FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
 		$sql .= " lettering_code != '' GROUP BY lettering_code ORDER BY lettering_code DESC limit 1;  ";
 // 		echo $sql;
@@ -252,39 +254,42 @@ class lettering extends BookKeeping
 		}
 // 			var_dump(__line__, $error);
 
-		$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred   FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
-		$sql .= " rowid IN (".implode(',', $ids).") ";
-		$result = $this->db->query ( $sql );
-		if ($result) {
-			$obj = $this->db->fetch_object ( $result );
-// 			print_r($obj);
-			if( !(round(abs($obj->deb),2) === round(abs($obj->cred),2)) ){
-// 				echo $sql;
-// 				print_r($obj);
-				$this->errors[] = 'Total not exacts '.round(abs($obj->deb),2).' vs '. round(abs($obj->cred),2);
+		if (! $error)
+		{
+			$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred   FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
+			$sql .= " rowid IN (".implode(',', $ids).") ";
+			$result = $this->db->query ( $sql );
+			if ($result) {
+				$obj = $this->db->fetch_object ( $result );
+	// 			print_r($obj);
+				if( !(round(abs($obj->deb),2) === round(abs($obj->cred),2)) ){
+	// 				echo $sql;
+	// 				print_r($obj);
+					$this->errors[] = 'Total not exacts '.round(abs($obj->deb),2).' vs '. round(abs($obj->cred),2);
+					$error++;
+				}
+			}
+			else{
+				$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
 				$error++;
 			}
 		}
-		else{
-			$this->errors[] = 'Erreur sql'.$this->db->lasterror();;
-			$error++;
-		}
-
-
-		// Update request
 
 		$now = dol_now();
 
-		$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
-		$sql.= " lettering_code='".$lettre."'";
-		$sql.= " , date_lettering = " .$now ;  // todo correct date it's false
-		$sql.= "  WHERE rowid IN (".implode(',', $ids).") ";
-// 		echo $sql ;
-//
-// 		var_dump(__line__, $error);
-// 		print_r($this->errors);
-// 		exit;
-		$this->db->begin();
+		// Update request
+		if (! $error)
+		{
+			$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
+			$sql.= " lettering_code='".$lettre."'";
+			$sql.= " , date_lettering = " .$now ;  // todo correct date it's false
+			$sql.= "  WHERE rowid IN (".implode(',', $ids).") ";
+	// 		echo $sql ;
+	//
+	// 		var_dump(__line__, $error);
+	// 		print_r($this->errors);
+	// 		exit;
+			$this->db->begin();
 
 			dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
 			$resql = $this->db->query($sql);
@@ -306,6 +311,7 @@ class lettering extends BookKeeping
 				}
 			}
 // 				var_dump(__line__, $error);
+
 			// Commit or rollback
 			if ($error)
 			{
@@ -324,6 +330,8 @@ class lettering extends BookKeeping
 				$this->db->commit();
 				return 1;
 			}
+		}
+		return -1;
 	}
 
 }
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index f5f6a161ec5a72d741791e111be0f75b31ef7de5..99c343a1ff02fd4b8c719415a0ee6d397c94eb1e 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -230,6 +230,8 @@ class AdherentType extends CommonObject
 	{
 		global $user;
 
+		$error = 0;
+
 		$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type";
 		$sql.= " WHERE rowid = ".$this->id;
 
diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php
index f437dc66975d1e23fb402ad3386f93b833a0b0ed..84ec9457532690aafdfcd8a04fdb8789084b9674 100644
--- a/htdocs/admin/dolistore/class/dolistore.class.php
+++ b/htdocs/admin/dolistore/class/dolistore.class.php
@@ -26,17 +26,19 @@ include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class
 class Dolistore
 {
     // params
-    public $start       // beginning of pagination
-        , $end          // end of pagination
-        , $per_page     // pagination: display per page
-        , $categorie    // the current categorie
-        , $search       // the search keywords
-        // setups
-        , $url          // the url of this page
-        , $shop_url     // the url of the shop
-        , $vat_rate     // the vat rate used in the shop (prices are provided without vat)
-        , $lang         // the integer representing the lang in the store
-        , $debug_api;   // usefull if no dialog
+    public $start;       // beginning of pagination
+    public $end;         // end of pagination
+    public $per_page;    // pagination: display per page
+    public $categorie;   // the current categorie
+    public $search;      // the search keywords
+
+    // setups
+    public $url;         // the url of this page
+    public $shop_url;    // the url of the shop
+    public $vat_rate;    // the vat rate used in the shop (prices are provided without vat)
+    public $lang;        // the integer representing the lang in the store
+    public $debug_api;   // usefull if no dialog
+
 
     /**
      * Constructor
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 972f67095e3e643741ed4cafa9bf2f2a1eb6d17b..4ba38dd17f623be8a1734397f3c00ccdab5e91ef 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -1581,7 +1581,7 @@ class BonPrelevement extends CommonObject
 		$XML_DEBITOR .='					<PstlAdr>'.$CrLf;
 		$XML_DEBITOR .='						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
 		$addressline1 = dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => "")));
-		$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town)?' ':''.$row_town)), array(CHR(13) => ", ", CHR(10) => ""));
+		$addressline2 = dol_string_unaccent(strtr($row_zip.(($row_zip && $row_town)?' ':''.$row_town), array(CHR(13) => ", ", CHR(10) => "")));
 		if (trim($addressline1)) 	$XML_DEBITOR .='						<AdrLine>'.dolEscapeXML(dol_trunc($addressline1,70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
 		if (trim($addressline2))	$XML_DEBITOR .='						<AdrLine>'.dolEscapeXML(dol_trunc($addressline2,70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
 		$XML_DEBITOR .='					</PstlAdr>'.$CrLf;
diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php
index 04bb7a86a12104a9d6220a88631631b28efb148a..c93d6517a22eddf3eb00aaf62b96f26698bd49f8 100644
--- a/htdocs/core/class/emailsenderprofile.class.php
+++ b/htdocs/core/class/emailsenderprofile.class.php
@@ -223,11 +223,9 @@ class EmailSenderProfile extends CommonObject
 	/**
 	 * Load object lines in memory from the database
 	 *
-	 * @param int    $id   Id object
-	 * @param string $ref  Ref
 	 * @return int         <0 if KO, 0 if not found, >0 if OK
 	 */
-	public function fetchLines($id, $ref = null)
+	public function fetchLines()
 	{
 		$this->lines=array();
 
@@ -257,7 +255,7 @@ class EmailSenderProfile extends CommonObject
 	 */
 	public function delete(User $user, $notrigger = false)
 	{
-		return $this->deleteCommon($user, $trigger);
+		return $this->deleteCommon($user, $notrigger);
 	}
 
 	/**
@@ -272,8 +270,6 @@ class EmailSenderProfile extends CommonObject
         global $dolibarr_main_authentication, $dolibarr_main_demo;
         global $menumanager;
 
-        if (! empty($conf->dol_no_mouse_hover)) $notooltip=1;   // Force disable tooltips
-
         $result = '';
         $companylink = '';
 
@@ -285,7 +281,7 @@ class EmailSenderProfile extends CommonObject
 
         if ($withpicto)
         {
-            $result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
+            $result.=($linkstart.img_object($label, 'label', 'class="classfortooltip"').$linkend);
             if ($withpicto != 2) $result.=' ';
 		}
 		$result.= $linkstart . $this->label . $linkend;
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 93d2244a6ec52ec861e2a60d00104875cf461806..fcec7cce16567067be0b03bae9ec7e6847a47a90 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -480,7 +480,7 @@ class FormMail extends Form
                         		$i++;
                         	}
                         }
-                        else dol_print_error($db);
+                        else dol_print_error($this->db);
 
                         foreach($listaliases as $typealias => $listalias)
                         {
diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php
index f1c5dc7136d21994a45c4d75f0f56ba57e1794ba..ba060e62a77e4c3de98cac515081020244cbed9b 100644
--- a/htdocs/expensereport/class/expensereport_rule.class.php
+++ b/htdocs/expensereport/class/expensereport_rule.class.php
@@ -21,7 +21,7 @@
  *	\ingroup    expenseik
  *	\brief      File of class to manage expense ik
  */
- 
+
 require_once DOL_DOCUMENT_ROOT.'/core/class/coreobject.class.php';
 
 /**
@@ -32,69 +32,69 @@ class ExpenseReportRule extends CoreObject
 	public $element='expenserule';
 	public $table_element='expensereport_rules';
 	public $fk_element='fk_expense_rule';
-	
+
 	/**
 	 * date start
-	 * @var date
+	 * @var int|string
 	 */
 	public $dates;
-	
+
 	/**
 	 * date end
-	 * @var date
+	 * @var int|string
 	 */
 	public $datee;
-	
+
 	/**
 	 * amount
 	 * @var double
 	 */
 	public $amount;
-	
+
 	/**
 	 * restrective
 	 * @var int
 	 */
 	public $restrictive;
-	
+
 	/**
 	 * rule for user
 	 * @var int
 	 */
 	public $fk_user;
-	
+
 	/**
 	 * rule for group
 	 * @var int
 	 */
 	public $fk_usergroup;
-	
+
 	/**
 	 * c_type_fees id
 	 * @var int
 	 */
 	public $fk_c_type_fees;
-	
+
 	/**
 	 * code type of expense report
 	 * @var string
 	 */
 	public $code_expense_rules_type;
-	
-	
+
+
 	/**
 	 * rule for all
 	 * @var int
 	 */
 	public $is_for_all;
-	
+
 	/**
 	 * entity
 	 * @var int
 	 */
 	public $entity;
-	
-	
+
+
 
     /**
      * Attribute object linked with database
@@ -119,19 +119,19 @@ class ExpenseReportRule extends CoreObject
      *
      *  @param      DoliDB		$db      Database handler
      */
-	public function __construct(DoliDB &$db) 
+	public function __construct(DoliDB &$db)
 	{
 		global $conf;
 
         parent::__construct($db);
 		parent::init();
-		
+
 		$this->errors = array();
 	}
-	
+
 	/**
 	 * Return all rules or filtered by something
-	 * 
+	 *
 	 * @param int	$fk_c_type_fees	type of expense
 	 * @param date	$date			date of expense
 	 * @param type	$fk_user		user of expense
@@ -140,7 +140,7 @@ class ExpenseReportRule extends CoreObject
 	public static function getAllRule($fk_c_type_fees='', $date='', $fk_user='')
 	{
 		global $db;
-		
+
 		$rules = array();
 		$sql = 'SELECT er.rowid';
 		$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_rules er';
@@ -162,9 +162,9 @@ class ExpenseReportRule extends CoreObject
 			$sql.= ' OR er.fk_usergroup IN (SELECT ugu.fk_usergroup FROM '.MAIN_DB_PREFIX.'usergroup_user ugu WHERE ugu.fk_user = '.$fk_user.') )';
 		}
 		$sql.= ' ORDER BY er.is_for_all, er.fk_usergroup, er.fk_user';
-		
+
 		dol_syslog("ExpenseReportRule::getAllRule sql=".$sql);
-		
+
 		$resql = $db->query($sql);
 		if ($resql)
 		{
@@ -179,19 +179,19 @@ class ExpenseReportRule extends CoreObject
 		{
 			dol_print_error($db);
 		}
-		
+
 		return $rules;
 	}
-	
+
 	/**
 	 * Return the label of group for the current object
-	 * 
+	 *
 	 * @return string
 	 */
 	public function getGroupLabel()
 	{
 		include_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
-		
+
 		if ($this->fk_usergroup > 0)
 		{
 			$group = new UserGroup($this->db);
@@ -205,19 +205,19 @@ class ExpenseReportRule extends CoreObject
 				$this->errors[] = $this->error;
 			}
 		}
-		
+
 		return '';
 	}
-	
+
 	/**
 	 * Return the name of user for the current object
-	 * 
+	 *
 	 * @return string
 	 */
 	public function getUserName()
 	{
 		include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
-		
+
 		if ($this->fk_user > 0)
 		{
 			$u = new User($this->db);
@@ -231,7 +231,7 @@ class ExpenseReportRule extends CoreObject
 				$this->errors[] = $this->error;
 			}
 		}
-		
+
 		return '';
 	}
 }
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 14250fe424d2c19e82216cfdf3c8101108be104f..e0a827f8c8cca3d2d7d4e942f6b0ca942fad77e2 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -228,11 +228,9 @@ class MyObject extends CommonObject
 	/**
 	 * Load object lines in memory from the database
 	 *
-	 * @param int    $id   Id object
-	 * @param string $ref  Ref
 	 * @return int         <0 if KO, 0 if not found, >0 if OK
 	 */
-	public function fetchLines($id, $ref = null)
+	public function fetchLines()
 	{
 		$this->lines=array();
 
@@ -262,7 +260,7 @@ class MyObject extends CommonObject
 	 */
 	public function delete(User $user, $notrigger = false)
 	{
-		return $this->deleteCommon($user, $trigger);
+		return $this->deleteCommon($user, $notrigger);
 	}
 
 	/**