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 <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2019-10-11 13:36:54 +01:00
parent 82abbb29f9
commit da90b8736e
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 10 additions and 16 deletions

View File

@ -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,

View File

@ -414,20 +414,20 @@ Item types administration
<td>[% itemtype.processfee | $Price %]</td>
<td>[% itemtype.checkinmsg | html_line_break | $raw %]</td>
<td>
[% 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 %]
<span class="library_limitation" title="[% branches_str | html %]">
[% IF itemtype.branches.size > 1 %]
[% itemtype.branches.size | html %] library limitations
<span class="library_limitation" title="[% libraries_str | html %]">
[% 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