Bug 20903

Summary: Print payment receipt on child patron could end with server error
Product: Koha Reporter: Josef Moravec <josef.moravec>
Component: PatronsAssignee: Josef Moravec <josef.moravec>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: fridolin.somers, gmcharlt, jonathan.druart, kyle.m.hall, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 19921    
Bug Blocks:    
Attachments: Bug 20903: Remove unnecessary category code parameters
Bug 20903: Remove unnecessary category code parameters
Bug 20903: Remove unnecessary category code parameters

Description Josef Moravec 2018-06-08 09:41:21 UTC
When you wan't to print a payment receipt for child patron and have only one adult patron category defined, it ends up with internal server error.
Comment 1 Josef Moravec 2018-06-08 09:52:33 UTC
Created attachment 75915 [details] [review]
Bug 20903: Remove unnecessary category code parameters

Test plan:
0) Do no apply the patch
1) Have only one adults patrons category defined
2) Add a fine to child patron and pay it
3) Try to print the payment receipt (file printfeercpt.pl)
4) You see only ISE
5) Apply the patch
6) Try the printing again
7) Now you should see right receipt
Comment 2 Josef Moravec 2018-06-11 06:27:44 UTC
Comment on attachment 75915 [details] [review]
Bug 20903: Remove unnecessary category code parameters

Review of attachment 75915 [details] [review]:
-----------------------------------------------------------------

::: members/printfeercpt.pl
@@ -60,5 @@
>  
> -if ( $patron->is_child ) {
> -    my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
> -    $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
> -    $template->param( 'catcode' => $patron_categories->next->categorycde )  if $patron_categories->count == 1;

This is the code which causes problem ('categorycde' instead of 'categorycode'). But as this code is not needed, I removed whole block of code.
Comment 3 Josef Moravec 2018-06-25 10:10:51 UTC
Raising severity as this generates ISE.
Comment 4 Katrin Fischer 2018-06-25 21:40:31 UTC
Created attachment 76424 [details] [review]
Bug 20903: Remove unnecessary category code parameters

Test plan:
0) Do no apply the patch
1) Have only one adults patrons category defined
2) Add a fine to child patron and pay it
3) Try to print the payment receipt (file printfeercpt.pl)
4) You see only ISE
5) Apply the patch
6) Try the printing again
7) Now you should see right receipt

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2018-06-26 15:22:26 UTC
Created attachment 76454 [details] [review]
Bug 20903: Remove unnecessary category code parameters

Test plan:
0) Do no apply the patch
1) Have only one adults patrons category defined
2) Add a fine to child patron and pay it
3) Try to print the payment receipt (file printfeercpt.pl)
4) You see only ISE
5) Apply the patch
6) Try the printing again
7) Now you should see right receipt

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2018-06-26 15:23:48 UTC
Caused by
  commit 585453fe20417779be84258b60d3d652d8e170e1
  Bug 19921: Fix update child when only one adult patron category exist
Comment 7 Nick Clemens 2018-06-29 21:01:29 UTC
Awesome work all!

Pushed to master for 18.11
Comment 8 Martin Renvoize 2018-07-02 07:21:09 UTC
Pushed to 18.05.x for 18.05.02
Comment 9 Fridolin Somers 2018-07-04 06:58:59 UTC
Pushed to 17.11.x for 17.11.08
Comment 10 Fridolin Somers 2018-09-24 13:21:22 UTC
Pushed to 17.05.x for 17.05.14