Fix #yogosha5877

This commit is contained in:
Laurent Destailleur 2021-04-24 20:52:48 +02:00
parent 24a4c09613
commit 9f03054fc4
4 changed files with 23 additions and 16 deletions

View File

@ -791,7 +791,7 @@ if ($resql) {
$nbmax = 12; // We show last 12 receipts (so we can have more than one year) $nbmax = 12; // We show last 12 receipts (so we can have more than one year)
$liste = ""; $liste = "";
$sql = "SELECT DISTINCT num_releve FROM ".MAIN_DB_PREFIX."bank"; $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->order("num_releve", "DESC");
$sql .= $db->plimit($nbmax + 1); $sql .= $db->plimit($nbmax + 1);
print '<br>'; print '<br>';
@ -967,7 +967,7 @@ if ($resql) {
$moreforfilter = ''; $moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateOperationShort').' :'; $moreforfilter .= $langs->trans('DateOperationShort').' ';
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' '); $moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">'; $moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>'; $moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>';
@ -976,7 +976,7 @@ if ($resql) {
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateValueShort').' : '; $moreforfilter .= $langs->trans('DateValueShort').' ';
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' '); $moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">'; $moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>'; $moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>';
@ -1329,21 +1329,22 @@ if ($resql) {
// Description // Description
if (!empty($arrayfields['b.label']['checked'])) { if (!empty($arrayfields['b.label']['checked'])) {
print "<td>"; $labeltoshow = '';
$titletoshow = '';
//print "<a href=\"line.php?rowid=".$objp->rowid."&amp;account=".$objp->fk_account."\">";
$reg = array(); $reg = array();
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction 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]) { if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) {
print $langs->trans($reg[1]); $labeltoshow = $langs->trans($reg[1]);
} else { } else {
if ($objp->label == '(payment_salary)') { if ($objp->label == '(payment_salary)') {
print dol_trunc($langs->trans("SalaryPayment", 40)); $labeltoshow = dol_trunc($langs->trans("SalaryPayment", 40));
} else { } else {
print dol_trunc($objp->label, 40); $labeltoshow = dol_escape_htmltag($objp->label);
$titletoshow = $objp->label;
} }
} }
//print "</a>&nbsp;"; print '<td class="tdoverflowmax300"'.($titletoshow ? ' title="'.dol_escape_htmltag($titletoshow).'"' : '').'>';
print $labeltoshow; // Already escaped
// Add links after description // Add links after description
$cachebankaccount = array(); $cachebankaccount = array();
@ -1498,7 +1499,7 @@ if ($resql) {
// Num cheque // Num cheque
if (!empty($arrayfields['b.num_chq']['checked'])) { if (!empty($arrayfields['b.num_chq']['checked'])) {
print '<td class="nowrap" align="center">'.($objp->num_chq ? $objp->num_chq : "")."</td>\n"; print '<td class="nowrap" align="center">'.($objp->num_chq ? dol_escape_htmltag($objp->num_chq) : "")."</td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }

View File

@ -509,9 +509,9 @@ class Account extends CommonObject
} }
// Clean parameters // Clean parameters
$label =
$emetteur = trim($emetteur); $emetteur = trim($emetteur);
$banque = trim($banque); $banque = trim($banque);
$label = trim($label);
$now = dol_now(); $now = dol_now();

View File

@ -249,6 +249,10 @@ class BankAccounts extends DolibarrApi
$typeto = 'LIQ'; $typeto = 'LIQ';
} }
// Clean data
$description = checkVal($description, 'alphanohtml');
/** /**
* Creating bank line records * Creating bank line records
*/ */
@ -295,7 +299,9 @@ class BankAccounts extends DolibarrApi
return array( return array(
'success' => array( 'success' => array(
'code' => 201, '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 { } else {

View File

@ -686,11 +686,11 @@ function GETPOSTINT($paramname, $method = 0, $filter = null, $options = null, $n
/** /**
* Return a value after checking on a rule. * Return a value after checking on a rule.
* *
* @param string $out Value to get/check * @param string $out Value to check/clear.
* @param string $check Type of check * @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 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' * @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) function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = null)
{ {