To reproduce 1) Go to Tools -> Patron Clubs 2) Create a club template 3) Create a club using that template 4) Notice page breaks and you can't get back on to patron clubs This error is triggered: Template process failed: undef error - Cannot use "->find" in list context at /home/vagrant/kohaclone/Koha/Club.pm line 51.
Created attachment 64694 [details] [review] Bug 18870: Using a prefetch to get relationship data rather than a method Using the DBIx Resultset prefetch to get club_template data about clubs rather than a built-in method. To test: 1) Confirm that creating a club works. 2) Confirm that viewing the clubs.pl page works and all data is displayed Sponsored-by: Catalyst IT
This patch cannot be tested yet as something is broken in the DBIx relationships. See Bug 18862
Aleisha, This needs a scalar: return Koha::Club::Templates->find( $self->club_template_id() ); So: return scalar Koha::Club::Templates->find( $self->club_template_id() ); See also bug 18179 (incl. comment43)
Created attachment 64834 [details] [review] Bug 18870: Force scalar context for Koha::Club methods These 2 methods are called from the template in list context. However since bug 18539 Koha::Objects->find can no longer be called in list context. Forcing the context to scalar fixes the problem and should not introduced side-effects. Test plan: - Create a club template - Create a club using this template => Without this patch you should no longer get the following error: Template process failed: undef error - Cannot use "->find" in list context at /home/vagrant/kohaclone/Koha/Club.pm line 51.
Created attachment 64836 [details] [review] [SIGNED-OFF] Bug 18870: Force scalar context for Koha::Club methods These 2 methods are called from the template in list context. However since bug 18539 Koha::Objects->find can no longer be called in list context. Forcing the context to scalar fixes the problem and should not introduced side-effects. Test plan: - Create a club template - Create a club using this template => Without this patch you should no longer get the following error: Template process failed: undef error - Cannot use "->find" in list context at /home/vagrant/kohaclone/Koha/Club.pm line 51. Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Created attachment 64837 [details] [review] Bug 18870: Force scalar context for Koha::Club methods These 2 methods are called from the template in list context. However since bug 18539 Koha::Objects->find can no longer be called in list context. Forcing the context to scalar fixes the problem and should not introduced side-effects. Test plan: - Create a club template - Create a club using this template => Without this patch you should no longer get the following error: Template process failed: undef error - Cannot use "->find" in list context at /home/vagrant/kohaclone/Koha/Club.pm line 51. Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Pushed to master for 17.11, thanks to everybody involved!
Pushed to 17.05.x, will be in 17.05.02
Patron clubs is a 17.05 feature, so this patch is not relevant for 16.11.x.