Bug 14659: (QA followup) switch to using Koha::Patron::Categories
Also, fix a nonsensically switched IF/ELSE. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
parent
cdbb63f856
commit
14efe709f5
2 changed files with 6 additions and 9 deletions
|
@ -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 {
|
||||
|
|
|
@ -128,10 +128,10 @@
|
|||
Library card number:
|
||||
</label>
|
||||
[% IF borrower %]
|
||||
[% borrower.cardnumber %]
|
||||
[% ELSE %]
|
||||
<input type="text" id="borrower_cardnumber" name="borrower_cardnumber" value="[% borrower.cardnumber %]" />
|
||||
[% IF mandatory.defined('cardnumber') %]<span class="required">Required</span>[% END %]
|
||||
[% ELSE %]
|
||||
[% borrower.cardnumber %]
|
||||
[% END %]
|
||||
</li>
|
||||
[% END %]
|
||||
|
@ -170,6 +170,8 @@
|
|||
Category:</label>
|
||||
|
||||
[% IF borrower %]
|
||||
[% Categories.GetName( borrower.categorycode ) %]
|
||||
[% ELSE %]
|
||||
<select id="borrower_categorycode" name="borrower_categorycode">
|
||||
[% FOREACH c IN Categories.all() %]
|
||||
[% IF c.categorycode == Koha.Preference('PatronSelfRegistrationDefaultCategory') %]
|
||||
|
@ -179,8 +181,6 @@
|
|||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
[% ELSE %]
|
||||
[% Categories.GetName( borrower.categorycode ) %]
|
||||
[% END %]
|
||||
</li>
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in a new issue