Bug 34829 - Cash register report reverts to "All libraries" after every search
Summary: Cash register report reverts to "All libraries" after every search
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Katrin Fischer
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-19 13:12 UTC by Laura Escamilla
Modified: 2023-10-03 11:32 UTC (History)
1 user (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 34829: Cash register report reverts to 'All libraries' after every search (4.02 KB, patch)
2023-09-19 21:09 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 34829: Cash register report reverts to 'All libraries' after every search (4.08 KB, patch)
2023-09-20 15:10 UTC, Laura Escamilla
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Laura Escamilla 2023-09-19 13:12:04 UTC
To recreate:
1. Have at least two libraries (Library A & Library B) and at least two patrons. One patron for Library A & one for Library B. 
2. Create a manual fee for both patrons and write them off. 
3. Go to the cash register statistics report and change the transaction type to "Write off" and your transaction library to Library A. 
4. Notice that when you submit the report the transaction library defaults back to "All" and shows both patrons instead of just the patron from Library A.
Comment 1 Katrin Fischer 2023-09-19 21:09:21 UTC
Created attachment 155915 [details] [review]
Bug 34829: Cash register report reverts to 'All libraries' after every search

To test:
1. Have at least two libraries (Library A & Library B) and
   at least two patrons. One patron for Library A & one for Library B.
2. Create a manual fee for both patrons and write them off.
3. Go to the cash register statistics report and change the
   transaction type to "Write off" and your transaction library to Library A.
4. Notice that when you submit the report the transaction library
   defaults back to "All" and shows both patrons instead of just the patron from Library A.
5. Apply patch
6. Verify that the library chosen now remains selected

Note: the export format is faulty, but this is unrelated to this patch.
Comment 2 Laura Escamilla 2023-09-20 15:10:19 UTC
Created attachment 155950 [details] [review]
Bug 34829: Cash register report reverts to 'All libraries' after every search

To test:
1. Have at least two libraries (Library A & Library B) and
   at least two patrons. One patron for Library A & one for Library B.
2. Create a manual fee for both patrons and write them off.
3. Go to the cash register statistics report and change the
   transaction type to "Write off" and your transaction library to Library A.
4. Notice that when you submit the report the transaction library
   defaults back to "All" and shows both patrons instead of just the patron from Library A.
5. Apply patch
6. Verify that the library chosen now remains selected

Note: the export format is faulty, but this is unrelated to this patch.
Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
Comment 3 Laura Escamilla 2023-09-20 15:10:58 UTC
Works as described! Thanks for the patch, Katrin!
Comment 4 Marcel de Rooy 2023-09-29 06:29:05 UTC
my $branch             = $input->param("branch");
my $manager_branchcode = $input->param("branch") || C4::Context->userenv->{'branch'};
This does not look good.


And this looks bad:
-                        <option value="ALL">All</option>
Script still has it:
    if ($manager_branchcode ne 'ALL') {
Comment 5 Katrin Fischer 2023-09-30 09:18:35 UTC
(In reply to Marcel de Rooy from comment #4)
> my $branch             = $input->param("branch");
> my $manager_branchcode = $input->param("branch") ||
> C4::Context->userenv->{'branch'};
> This does not look good.

I am sorry, but this is not constructive. Especially since I didn't change this line. It only appears in the patch because of the perltidy.

> 
> 
> And this looks bad:
> -                        <option value="ALL">All</option>
> Script still has it:
>     if ($manager_branchcode ne 'ALL') {

Still, no explanation.
Comment 6 Katrin Fischer 2023-09-30 09:19:06 UTC
I am not an expert programmer, I am happy to change things around, but I need a little bit more insight in why you think something is wrong.
Comment 7 Marcel de Rooy 2023-10-03 11:28:17 UTC
(In reply to Katrin Fischer from comment #6)
> I am not an expert programmer, I am happy to change things around, but I
> need a little bit more insight in why you think something is wrong.

I will try. Should not be very hard?
Comment 8 Marcel de Rooy 2023-10-03 11:32:05 UTC
(In reply to Marcel de Rooy from comment #4)
> my $branch             = $input->param("branch");
> my $manager_branchcode = $input->param("branch") ||
> C4::Context->userenv->{'branch'};
> This does not look good.

You added $branch here, but we already have $manager_branchcode using the same CGI parameter. We should not do that. It will create confusion. If you need to know the branch code passed, use the existing variable. Change that etc. Do not clone it.

> And this looks bad:
> -                        <option value="ALL">All</option>
> Script still has it:
>     if ($manager_branchcode ne 'ALL') {

In the template you remove the ALL value of a combo box. You replace it by:
+                        <option value="">All libraries</option>
But the script still contains reference to the old value ALL. You should also solve those references.

HTH