From 14efe709f57d317d4b5fc5151b3e41af1f525b00 Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Thu, 25 Feb 2016 14:36:04 -0700 Subject: [PATCH] Bug 14659: (QA followup) switch to using Koha::Patron::Categories Also, fix a nonsensically switched IF/ELSE. Signed-off-by: Jonathan Druart Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com --- Koha/Template/Plugin/Categories.pm | 7 ++----- .../opac-tmpl/bootstrap/en/modules/opac-memberentry.tt | 8 ++++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Koha/Template/Plugin/Categories.pm b/Koha/Template/Plugin/Categories.pm index fe8b0d74d9..acd94fb299 100644 --- a/Koha/Template/Plugin/Categories.pm +++ b/Koha/Template/Plugin/Categories.pm @@ -21,15 +21,12 @@ use Template::Plugin; use base qw( Template::Plugin ); use C4::Category; -use Koha::Database; +use Koha::Patron::Categories; sub GetName { my ( $self, $categorycode ) = @_; - my $schema = Koha::Database->new->schema; - return $schema->resultset( 'Category' )->search( { - categorycode => $categorycode, - } )->get_column( 'description' )->next // ''; + return Koha::Patron::Categories->find( $categorycode )->description; } sub all { diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt index a3d152be49..a2d03156a3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -128,10 +128,10 @@ Library card number: [% IF borrower %] + [% borrower.cardnumber %] + [% ELSE %] [% IF mandatory.defined('cardnumber') %]Required[% END %] - [% ELSE %] - [% borrower.cardnumber %] [% END %] [% END %] @@ -170,6 +170,8 @@ Category: [% IF borrower %] + [% Categories.GetName( borrower.categorycode ) %] + [% ELSE %] - [% ELSE %] - [% Categories.GetName( borrower.categorycode ) %] [% END %] [% END %] -- 2.39.5