Fix #34931 strip surrounding & from action=reconcile in bank delete link (#38708)

The delete-icon link on bankentries_list.php stripped 'action=reconcile'
from $param but left a stray trailing '&' (and the same string can be
re-emitted by other includes), so the final URL ended up with two
action= query params (action=delete and action=reconcile). PHP picks
the last one, the page silently switches to the reconcile path and the
delete confirm dialog never opens.

Widen the preg_replace to consume the surrounding & as well, and also
clean up the confirm_deleteonreconcile form.

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
This commit is contained in:
w3houde 2026-06-12 00:07:07 +02:00 committed by GitHub
parent 4ee7657dca
commit a04db9bd0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1913,7 +1913,9 @@ if ($resql) {
}
}
if ($user->hasRight('banque', 'modifier')) {
$parambis = preg_replace('/action=reconcile/', '', $param);
// Strip the surrounding & so the leading action= we put first stays the only action= in the URL.
// Without this the URL ends up with two action= params; PHP picks the last one and the page silently switches to 'reconcile' instead of 'delete'.
$parambis = preg_replace('/&?action=(reconcile|confirm_deleteonreconcile)(&|$)/', '\2', $param);
print '<a href="'.$_SERVER["PHP_SELF"].'?action='.($action == 'reconcile' ? 'confirm_deleteonreconcile&confirm=yes' : 'delete').'&token='.newToken().'&rowid='.$objp->rowid.'&page='.$page.$parambis.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">';
print img_delete('', 'class="marginleftonly"');
print '</a>';