diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 7c53a8850436f2f97f2a3105772328e5363c331d..27cdedc4e1e3796c4af6ab6a8561ba0d2bcb6e91 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -841,7 +841,7 @@ class ActionComm extends CommonObject
         if (! empty($elementtype))
         {
             if ($elementtype == 'project') $sql.= ' AND a.fk_project = '.$fk_element;
-            else $sql.= " AND a.fk_element = ".$fk_element." AND a.elementtype = '".$elementtype."'";
+            else $sql.= " AND a.fk_element = ".(int) $fk_element." AND a.elementtype = '".$elementtype."'";
         }
         if (! empty($filter)) $sql.= $filter;
 		if ($sortorder && $sortfield) $sql.=$db->order($sortfield, $sortorder);
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 3afe428b9f86d792e4de699b6c222e2bdb48126d..3137cd9c7dca8b549bf895e1c06dcde28d584083 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -89,10 +89,39 @@ class Commande extends CommonOrder
     var $cond_reglement_id;
     var $cond_reglement_code;
     var $fk_account;
+    /**
+     * It holds the label of the payment mode. Use it in case translation cannot be found.
+     * @var string
+     */
+    var $mode_reglement;
+
+    /**
+     * Payment mode id
+     * @var int
+     */
     var $mode_reglement_id;
+
+    /**
+     * Payment mode code
+     * @var string
+     */
     var $mode_reglement_code;
+    /**
+     * Availability delivery time id
+     * @var int
+     */
     var $availability_id;
+    /**
+     * Availability delivery time code
+     * @var string
+     */
     var $availability_code;
+    /**
+     * Label of availability delivery time. Use it in case translation cannot be found.
+     * @var string
+     */
+    var $availability;
+
     var $demand_reason_id;
     var $demand_reason_code;
     var $fk_delivery_address;
@@ -1470,7 +1499,7 @@ class Commande extends CommonOrder
         $sql.= ", i.libelle as libelle_incoterms";
         $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
         $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc';
-        $sql.= ', ca.code as availability_code';
+        $sql.= ', ca.code as availability_code, ca.label as availability_label';
         $sql.= ', dr.code as demand_reason_code';
         $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
         $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON (c.fk_cond_reglement = cr.rowid)';
@@ -1527,6 +1556,7 @@ class Commande extends CommonOrder
                 $this->fk_account           = $obj->fk_account;
                 $this->availability_id		= $obj->fk_availability;
                 $this->availability_code	= $obj->availability_code;
+                $this->availability	    	= $obj->availability_label;
                 $this->demand_reason_id		= $obj->fk_input_reason;
                 $this->demand_reason_code	= $obj->demand_reason_code;
                 $this->date_livraison		= $this->db->jdate($obj->date_livraison);
@@ -2917,7 +2947,7 @@ class Commande extends CommonOrder
      */
     function LibStatut($statut,$billed,$mode)
     {
-        global $langs;
+        global $langs, $conf;
         //print 'x'.$statut.'-'.$billed;
         if ($mode == 0)
         {
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index a7e55afb3cbbda3c97d029fe9db50079fa19b2a4..774c284f730a0a18e87efc4d42a65e8cd430e644 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -1277,12 +1277,12 @@ class AccountLine extends CommonObject
             $nbko++;
         }
 
-        $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".$this->rowid;
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid=".(int) $this->rowid;
         dol_syslog(get_class($this)."::delete", LOG_DEBUG);
         $result = $this->db->query($sql);
         if (! $result) $nbko++;
 
-        $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$this->rowid;
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".(int) $this->rowid;
         dol_syslog(get_class($this)."::delete", LOG_DEBUG);
         $result = $this->db->query($sql);
         if (! $result) $nbko++;
@@ -1319,7 +1319,7 @@ class AccountLine extends CommonObject
 
         $this->db->begin();
 
-        $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$this->rowid;
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".(int) $this->rowid;
         dol_syslog(get_class($this)."::delete_urls", LOG_DEBUG);
         $result = $this->db->query($sql);
         if (! $result) $nbko++;
diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php
index 8468bfbd5fb72558aafe0b5535816890b8bbdc0f..a2db7be0a93e9da98ad89c0b6abf7b6319d3da7a 100644
--- a/htdocs/compta/bank/rappro.php
+++ b/htdocs/compta/bank/rappro.php
@@ -99,11 +99,14 @@ if ($action == 'rappro' && $user->rights->banque->consolidate)
 if ($action == 'del')
 {
 	$bankline=new AccountLine($db);
-	$bankline->fetch($_GET["rowid"]);
-	$result=$bankline->delete($user);
-    if ($result < 0)
-	{
-        dol_print_error($db,$bankline->error);
+
+    if ($bankline->fetch($_GET["rowid"]) > 0) {
+        $result = $bankline->delete($user);
+        if ($result < 0) {
+            dol_print_error($db, $bankline->error);
+        }
+    } else {
+        setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
     }
 }
 
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 7eb3144cc426e1e12fd1e03993a5e617f34d6222..628fd45f1ed1a170f1d3e3a94e1efff94d15535c 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1074,7 +1074,7 @@ class Facture extends CommonInvoice
 			}
 			else
 			{
-				$this->error='Bill with id '.$rowid.' or ref '.$ref.' not found sql='.$sql;
+				$this->error='Bill with id '.$rowid.' or ref '.$ref.' not found';
 				dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
 				return 0;
 			}
diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php
index fdd0fc2732cf01cc155ce683015a9636c55c9a8f..869b26e2f75078c2339e20a328aac49566d3cd9b 100644
--- a/htdocs/core/class/dolprintipp.class.php
+++ b/htdocs/core/class/dolprintipp.class.php
@@ -66,7 +66,7 @@ class dolprintIPP
      */
     function list_jobs($module)
     {
-        global $conf, $db, $bc;
+        global $conf, $db, $bc, $langs;
         include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php';
         $ipp = new CupsPrintIPP();
         $ipp->setLog(DOL_DATA_ROOT.'/printipp.log','file',3); // logging very verbose
@@ -96,7 +96,8 @@ class dolprintIPP
         }
         catch(Exception $e)
         {
-			print $e->getMessage();
+            setEventMessage('[printipp] '.$langs->trans('CoreErrorMessage'), 'errors');
+            dol_syslog($e->getMessage(), LOG_ERR);
         }
 
         print '<table width="100%" class="noborder">';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index d11bf26d7c43197170c4a0222e2c7da47112c0a4..7db437150cab2bc0a38ac6f37b9e9903ed0347ba 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1026,7 +1026,7 @@ class Form
         $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
         $sql.= " re.description, re.fk_facture_source";
         $sql.= " FROM ".MAIN_DB_PREFIX ."societe_remise_except as re";
-        $sql.= " WHERE fk_soc = ".$socid;
+        $sql.= " WHERE fk_soc = ".(int) $socid;
         if ($filter) $sql.= " AND ".$filter;
         $sql.= " ORDER BY re.description ASC";
 
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index b685a2c8ec4cec8a1ba3976a35f4bbd34d32d647..cb77607261be4083c36ada574a7215dc71d726f4 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -536,7 +536,7 @@ class Expedition extends CommonObject
 			else
 			{
 				dol_syslog(get_class($this).'::Fetch no expedition found', LOG_ERR);
-				$this->error='Delivery with id '.$id.' not found sql='.$sql;
+				$this->error='Delivery with id '.$id.' not found';
 				return 0;
 			}
 		}