From 58b4de8bc33c79869d4d4f96586a1858fc4e0cb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Dec 2020 19:27:42 +0100 Subject: [PATCH] More complete fix for #15712 --- htdocs/compta/bank/bankentries_list.php | 43 ++++++++++++++----------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 902a96ec16c..d57e2cf5591 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -496,7 +496,7 @@ if (dol_strlen($search_dv_end) > 0) $sql .= " AND b.datev <= '".$db->idate($sear if ($search_ref) $sql .= natural_search("b.rowid", $search_ref, 1); if ($search_req_nb) $sql .= natural_search("b.num_chq", $search_req_nb); if ($search_num_releve) $sql .= natural_search("b.num_releve", $search_num_releve); -if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".$search_conciliated; +if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".urlencode($search_conciliated); if ($search_thirdparty) $sql .= natural_search("s.nom", $search_thirdparty); if ($search_description) { @@ -861,6 +861,10 @@ if ($resql) $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + // When action is 'reconcile', we force to have the column num_releve always enabled (otherwise we can't make reconciliation). + if ($action == 'reconcile') { + $arrayfields['b.num_releve']['checked'] = 1; + } print '
'; print ''."\n"; @@ -993,9 +997,8 @@ if ($resql) while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); - // If we are in a situation where we need/can show balance, we calculate the start of balance - if (!$balancecalculated && (!empty($arrayfields['balancebefore']['checked']) || !empty($arrayfields['balance']['checked'])) && $mode_balance_ok) + if (!$balancecalculated && (!empty($arrayfields['balancebefore']['checked']) || !empty($arrayfields['balance']['checked'])) && ($mode_balance_ok || $search_conciliated === '0')) { if (!$search_account) { @@ -1016,11 +1019,9 @@ if ($resql) $sqlforbalance .= " AND (b.datev < '".$db->idate($db->jdate($objp->dv))."' OR (b.datev = '".$db->idate($db->jdate($objp->dv))."' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))"; $resqlforbalance = $db->query($sqlforbalance); //print $sqlforbalance; - if ($resqlforbalance) - { + if ($resqlforbalance) { $objforbalance = $db->fetch_object($resqlforbalance); - if ($objforbalance) - { + if ($objforbalance) { // If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') { @@ -1081,24 +1082,30 @@ if ($resql) if (!empty($arrayfields['balancebefore']['checked'])) { print ''; } if (!empty($arrayfields['balance']['checked'])) { print ''; + } + if (!empty($arrayfields['b.num_releve']['checked'])) + { + print ''; } - - print ''; print '';
'; - print price(price2num($balance, 'MT'), 1, $langs); + if ($search_conciliated !== '0') { + print price(price2num($balance, 'MT'), 1, $langs); + } print ''; - print price(price2num($balance, 'MT'), 1, $langs); + if ($search_conciliated !== '0') { + print price(price2num($balance, 'MT'), 1, $langs); + } + print ''; + print ''; + print ' '; print ''; - print ''; - print ' '; - print ''; print ' '; print '