Bug 9943 - Pay fines page "Pay selected" button give invalid amount when nothing is selected
Summary: Pay fines page "Pay selected" button give invalid amount when nothing is sele...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Owen Leonard
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-28 07:09 UTC by Pongtawat
Modified: 2014-05-26 21:05 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 9943 - Pay fines page "Pay selected" button give invalid amount when nothing is selected (3.54 KB, patch)
2013-08-09 17:47 UTC, Owen Leonard
Details | Diff | Splinter Review
[Signed off] Bug 9943 - Pay fines page "Pay selected" button give invalid amount when nothing is selected (3.57 KB, application/mbox)
2013-08-09 23:42 UTC, Melia Meggs
Details
Bug 9943 - Pay fines page "Pay selected" button give invalid amount when nothing is selected (3.55 KB, patch)
2013-08-16 16:28 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
[PASSED QA] Bug 9943 - Pay fines page "Pay selected" button give invalid amount when nothing is selected (3.68 KB, patch)
2013-08-25 19:22 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pongtawat 2013-03-28 07:09:30 UTC
In Patrons > Pay Fines page, if there is a payable fine but all of them are not selected and "Pay selected" button is pressed. The next page shown is "Pay an amount toward all fines" with the "Total amount outstanding" being the total fines. The page shown should be "Pay an amount toward selected fines" like when some item is selected, with "Total amount outstanding" = 0.

Step to reproduce:

1. Select a patron with some outstanding fines item.
2. Go to Pay fines page at /cgi-bin/koha/members/pay.pl?borrowernumber=xxx
3. Deselect every item.
4. Press "Pay selected"

Current Result:
- Next page shown is "Pay an amount toward all fines"

Expected Result:
- Next page shown is "Pay an amount toward selected fines"
Comment 1 Pongtawat 2013-03-28 07:15:42 UTC
The problem is that when nothing is selected, &selected= parameter is passed with empty string. The condition in paycollect.pl will miss it. It might be simply fixed by update that condition to use "defined" function.

--- paycollect.pl	2013-03-28 14:10:16.518906138 +0700
+++ new/paycollect.pl	2013-03-28 14:11:12.994905576 +0700
@@ -86,7 +86,7 @@
         notify_id         => $notify_id,
         notify_level      => $notify_level,
     );
-} elsif ($select_lines) {
+} elsif (defined $select_lines) {
     $total_due = $input->param('amt');
     $template->param(
         selected_accts => $select_lines
Comment 2 Pongtawat 2013-03-28 07:26:49 UTC
Maybe it's better if "Pay selected" is not clickable if nothing is selected.
Comment 3 Owen Leonard 2013-08-09 17:47:56 UTC Comment hidden (obsolete)
Comment 4 Melia Meggs 2013-08-09 23:42:26 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall (khall) 2013-08-16 16:28:42 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2013-08-25 19:22:29 UTC
Created attachment 20603 [details] [review]
[PASSED QA] Bug 9943 - Pay fines page "Pay selected" button give invalid amount when nothing is selected

If you select no fines but click the "pay selected" button the resulting
screen offers to let you pay against all fines, which is confusing. To
simplify things this patch disables the "pay selected" button if no
lines are selected.

To test, apply the patch and find a patron with outstanding fines. From
the "pay fines" page (members/pay.pl) try selecting and deselecting
checkboxes and using the "select all" and "clear all" links. When no
item is selected the "Pay selected" button should become disabled.
Confirm that the form submits correctly when one or more fines is
selected.

Signed-off-by: Melia Meggs <melia@bywatersolutions.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works nicely in my tests.
Comment 7 Galen Charlton 2013-09-08 07:12:15 UTC
Pushed to master.  Thanks, Owen!
Comment 8 Tomás Cohen Arazi (tcohen) 2013-11-01 17:48:45 UTC
This patch has been pushed to 3.12.x, will be in 3.12.7.

Thanks Owen!