Bug 19921 - Error when updating child to adult patron on system with only one adult patron category
Summary: Error when updating child to adult patron on system with only one adult patro...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Marcel de Rooy
URL:
Whiteboard:
Keywords:
Depends on: 15407
Blocks: 19641 20903
  Show dependency treegraph
 
Reported: 2018-01-05 18:01 UTC by Owen Leonard
Modified: 2018-06-26 15:23 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 19921: Fix update child when only one adult patron category exist (11.25 KB, patch)
2018-01-05 19:39 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 19921: Fix update child when only one adult patron category exist (11.22 KB, patch)
2018-01-09 12:51 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 19921: Fix update child when only one adult patron category exist (11.32 KB, patch)
2018-01-12 08:47 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2018-01-05 18:01:09 UTC
To reproduce this bug you must test in a system which has only one patron category of the "adult" type. View the details of a patron with a child-type patron category and choose More -> Update child to adult patron.

This results in an error:

Can't call method "category_type" on an undefined value at /home/vagrant/kohaclone/members/update-child.pl line 84.

The URL of the error page shows a problem with the parameters being passed:

members/update-child.pl?op=update&borrowernumber=12345&catcode=Koha::Patron::Category=HASH(0xa168a18)&catcode_multi=
Comment 1 Jonathan Druart 2018-01-05 19:36:10 UTC
Caused by commit cae4b980607be083e5e0fb163c4949c73d6347db
Bug 15407: Koha::Patron::Categories - replace GetborCatFromCatType
Comment 2 Jonathan Druart 2018-01-05 19:39:13 UTC
Created attachment 70313 [details] [review]
Bug 19921: Fix update child when only one adult patron category exist

We are passing the Koha::Patron::Category object to the template instead
of the categorycode.

To reproduce this bug you must test in a system which has only one
patron category of the "adult" type. View the details of a patron with a
child-type patron category and choose More -> Update child to adult
patron.

This results in an error:

Can't call method "category_type" on an undefined value at
/home/vagrant/kohaclone/members/update-child.pl line 84.

The URL of the error page shows a problem with the parameters being
passed:

members/update-child.pl?op=update&borrowernumber=12345&catcode=Koha::Patron::Category=HASH(0xa168a18)&catcode_multi=

Test plan:
Make sure you have only 1 adult patron category
Update a child to adult
=> With this patch applied the error is gone and the patron has been
correctly updated
Comment 3 Owen Leonard 2018-01-09 12:51:32 UTC
Created attachment 70340 [details] [review]
Bug 19921: Fix update child when only one adult patron category exist

We are passing the Koha::Patron::Category object to the template instead
of the categorycode.

To reproduce this bug you must test in a system which has only one
patron category of the "adult" type. View the details of a patron with a
child-type patron category and choose More -> Update child to adult
patron.

This results in an error:

Can't call method "category_type" on an undefined value at
/home/vagrant/kohaclone/members/update-child.pl line 84.

The URL of the error page shows a problem with the parameters being
passed:

members/update-child.pl?op=update&borrowernumber=12345&catcode=Koha::Patron::Category=HASH(0xa168a18)&catcode_multi=

Test plan:
Make sure you have only 1 adult patron category
Update a child to adult
=> With this patch applied the error is gone and the patron has been
correctly updated

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Marcel de Rooy 2018-01-12 08:47:08 UTC
Created attachment 70448 [details] [review]
Bug 19921: Fix update child when only one adult patron category exist

We are passing the Koha::Patron::Category object to the template instead
of the categorycode.

To reproduce this bug you must test in a system which has only one
patron category of the "adult" type. View the details of a patron with a
child-type patron category and choose More -> Update child to adult
patron.

This results in an error:

Can't call method "category_type" on an undefined value at
/home/vagrant/kohaclone/members/update-child.pl line 84.

The URL of the error page shows a problem with the parameters being
passed:

members/update-child.pl?op=update&borrowernumber=12345&catcode=Koha::Patron::Category=HASH(0xa168a18)&catcode_multi=

Test plan:
Make sure you have only 1 adult patron category
Update a child to adult
=> With this patch applied the error is gone and the patron has been
correctly updated

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Jonathan Druart 2018-01-15 15:25:48 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 6 Nick Clemens 2018-01-23 04:07:45 UTC
Awesome work all!

Pushed to Stable for 17.11.02
Comment 7 Fridolin SOMERS 2018-01-30 08:10:24 UTC
Pushed to 17.05.x for v17.05.09