diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index f6b719515cc..39967304e4c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -791,7 +791,7 @@ if ($resql) { $nbmax = 12; // We show last 12 receipts (so we can have more than one year) $liste = ""; $sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank"; - $sql .= " WHERE fk_account=".$object->id." AND num_releve IS NOT NULL"; + $sql .= " WHERE fk_account = ".((int) $object->id)." AND num_releve IS NOT NULL"; $sql .= $db->order("num_releve", "DESC"); $sql .= $db->plimit($nbmax + 1); print '
'; @@ -967,7 +967,7 @@ if ($resql) { $moreforfilter = ''; $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('DateOperationShort').' :'; + $moreforfilter .= $langs->trans('DateOperationShort').' '; $moreforfilter .= ($conf->browser->layout == 'phone' ? '
' : ' '); $moreforfilter .= '
'; $moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'
'; @@ -976,7 +976,7 @@ if ($resql) { $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('DateValueShort').' : '; + $moreforfilter .= $langs->trans('DateValueShort').' '; $moreforfilter .= ($conf->browser->layout == 'phone' ? '
' : ' '); $moreforfilter .= '
'; $moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'
'; @@ -1329,21 +1329,22 @@ if ($resql) { // Description if (!empty($arrayfields['b.label']['checked'])) { - print ""; - - //print "rowid."&account=".$objp->fk_account."\">"; + $labeltoshow = ''; + $titletoshow = ''; $reg = array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) { - print $langs->trans($reg[1]); + $labeltoshow = $langs->trans($reg[1]); } else { if ($objp->label == '(payment_salary)') { - print dol_trunc($langs->trans("SalaryPayment", 40)); + $labeltoshow = dol_trunc($langs->trans("SalaryPayment", 40)); } else { - print dol_trunc($objp->label, 40); + $labeltoshow = dol_escape_htmltag($objp->label); + $titletoshow = $objp->label; } } - //print " "; + print ''; + print $labeltoshow; // Already escaped // Add links after description $cachebankaccount = array(); @@ -1498,7 +1499,7 @@ if ($resql) { // Num cheque if (!empty($arrayfields['b.num_chq']['checked'])) { - print ''.($objp->num_chq ? $objp->num_chq : "")."\n"; + print ''.($objp->num_chq ? dol_escape_htmltag($objp->num_chq) : "")."\n"; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 13c2bdba4ce..4e2e60908d8 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -509,9 +509,9 @@ class Account extends CommonObject } // Clean parameters - $label = $emetteur = trim($emetteur); $banque = trim($banque); + $label = trim($label); $now = dol_now(); diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 04ef9543867..0f13ed1e523 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -249,6 +249,10 @@ class BankAccounts extends DolibarrApi $typeto = 'LIQ'; } + // Clean data + $description = checkVal($description, 'alphanohtml'); + + /** * Creating bank line records */ @@ -295,7 +299,9 @@ class BankAccounts extends DolibarrApi return array( 'success' => array( 'code' => 201, - 'message' => 'Internal wire transfer created successfully.' + 'message' => 'Internal wire transfer created successfully.', + 'bank_id_from' => $bank_line_id_from, + 'bank_id_to' => $bank_line_id_to, ) ); } else { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7368510484f..cb48ac4d45d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -686,11 +686,11 @@ function GETPOSTINT($paramname, $method = 0, $filter = null, $options = null, $n /** * Return a value after checking on a rule. * - * @param string $out Value to get/check - * @param string $check Type of check + * @param string $out Value to check/clear. + * @param string $check Type of check/sanitizing * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) * @param mixed $options Options to pass to filter_var when $check is set to 'custom' - * @return string|array Value found (string or array), or '' if check fails + * @return string|array Value sanitized (string or array). It may be '' if format check fails. */ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = null) {