diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 5b75bbadd00..9f051b902cc 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -834,7 +834,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 de32e30c5e6..3417419f892 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -76,9 +76,41 @@ class Commande extends CommonOrder var $brouillon; 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 $address; @@ -1435,7 +1467,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)'; @@ -1492,6 +1524,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); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 8c2b725f8d2..cf38669d554 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1281,12 +1281,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++; @@ -1323,7 +1323,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 82070a957e2..eaaf44b4e14 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 cc3d4200912..f8bb53cf9ed 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1040,7 +1040,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/compta/salaries/index.php b/htdocs/compta/salaries/index.php index f3312761141..52f1938a857 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -108,6 +108,12 @@ if ($typeid) { $sql .= " AND s.fk_typepayment=".$typeid; } //$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev, s.fk_typepayment, s.num_payment, pst.code"; +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index dec724c95d5..63c156609c8 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -119,6 +119,12 @@ if ($typeid) { $sql .= " AND cs.fk_type=".$typeid; } $sql.= " GROUP BY cs.rowid, cs.fk_type, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle"; +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index b603101ad29..91140bb97ca 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -115,6 +115,12 @@ if ($filtre) { if ($typeid) { $sql .= " AND t.fk_typepayment=".$typeid; } +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1,$offset); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 22b619c599c..e8c722dcab3 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -136,17 +136,21 @@ if ($search_contract) { if (!empty($search_ref_supplier)) { $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); } - if ($search_sale > 0) { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; } - if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; $sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid"; +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($conf->liste_limit + 1, $offset); diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index c59c67fe91c..b7b257ca07a 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -147,6 +147,12 @@ $filter_date1=dol_mktime(0,0,0,$op1month,$op1day,$op1year); $filter_date2=dol_mktime(0,0,0,$op2month,$op2day,$op2year); if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND date_ouverture_prevue ".$filter_op1." '".$db->idate($filter_date1)."'"; if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'"; +$totalnboflines=0; +$result=$db->query($sql); +if ($result) +{ + $totalnboflines = $db->num_rows($result); +} $sql .= $db->order($sortfield,$sortorder); $sql .= $db->plimit($limit + 1, $offset); diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index fdd0fc2732c..869b26e2f75 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 '