From da90b8736ee66bf2cde78cbf3ae52fa4cbd585f5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 11 Oct 2019 13:36:54 +0100 Subject: [PATCH] Bug 23772: Revert to passing itemtype objects to the template This patch restores the methodology prior to bug 23602 of passing the full Koha::ItemType objects to the template and thus giving us the ability to use all the methods present within them. Test plan: 1) Ensure you have at least one itemtype with an assigned icon and the images enabled. 2) View the itemtypes admin page and note the icons display again 3) Ensure you have at least one itemtype with library limitations defined. 4) View the itemtypes admin page and note the library limitations still display. 5) Signoff Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- admin/itemtypes.pl | 8 +------- .../prog/en/modules/admin/itemtypes.tt | 18 +++++++++--------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 05f394e053..8a341b6e11 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -196,13 +196,7 @@ if ( $op eq 'add_form' ) { } if ( $op eq 'list' ) { - my @itypes = Koha::ItemTypes->search->as_list; - my @itemtypes; - foreach my $itype (@itypes) { - my $itemtype = $itype->unblessed; - $itemtype->{branches} = $itype->library_limits ? $itype->library_limits->as_list : []; - push @itemtypes, $itemtype; - } + my @itemtypes = Koha::ItemTypes->search->as_list; $template->param( itemtypes => \@itemtypes, messages => \@messages, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt index 2330e84779..2f8c8986aa 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -414,20 +414,20 @@ Item types administration [% itemtype.processfee | $Price %] [% itemtype.checkinmsg | html_line_break | $raw %] - [% IF itemtype.branches.size > 0 %] - [% branches_str = "" %] - [% FOREACH branch IN itemtype.branches %] + [% IF itemtype.library_limits %] + [% libraries_str = "" %] + [% FOREACH library IN itemtype.library_limits %] [%- IF loop.first -%] - [% branches_str = branch.branchname _ " (" _ branch.branchcode _ ")" %] + [% libraries_str = library.branchname _ " (" _ library.branchcode _ ")" %] [% ELSE %] - [% branches_str = branches_str _ "\n" _ branch.branchname _ " (" _ branch.branchcode _ ")" %] + [% libraries_str = libraries_str _ "\n" _ library.branchname _ " (" _ library.branchcode _ ")" %] [% END %] [% END %] - - [% IF itemtype.branches.size > 1 %] - [% itemtype.branches.size | html %] library limitations + + [% IF itemtype.library_limits.count > 1 %] + [% itemtype.library_limits.count | html %] library limitations [% ELSE %] - [% itemtype.branches.size | html %] library limitation + [% itemtype.library_limits.count | html %] library limitation [% END %] [% ELSE %] No limitation -- 2.39.5