Bug 23602: Display branch limitations in itemtype table

This patch adds a column in itemtype table to display branch limitations.

To test:
1) Open item types admin page.
CHECK => there is no column for branch limitations, even if you add a limitation in an item type.
2) Apply this patch
SUCCESS => A new column appears that displays branch limitations per item type
3) Sign off

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Agustin Moyano 2019-09-13 10:55:30 -03:00 committed by Martin Renvoize
parent 1001eb3384
commit ed2390f999
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 25 additions and 2 deletions

View File

@ -196,9 +196,15 @@ if ( $op eq 'add_form' ) {
}
if ( $op eq 'list' ) {
my $itemtypes = Koha::ItemTypes->search;
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;
}
$template->param(
itemtypes => $itemtypes,
itemtypes => \@itemtypes,
messages => \@messages,
);
}

View File

@ -359,6 +359,7 @@ Item types administration
<th>Default replacement cost</th>
<th>Processing fee (when lost)</th>
<th>Checkin message</th>
<th>Branches limitations</th>
<th>Actions</th>
</thead>
[% FOREACH itemtype IN itemtypes %]
@ -411,6 +412,22 @@ Item types administration
<td>[% itemtype.defaultreplacecost | $Price %]</td>
<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 %]
[% branches_str = branches_str _ " " _ branch.branchname _ "(" _ branch.branchcode _ ")" %]
[% END %]
<span href="#" title="[% branches_str | html %]">
[% IF itemtype.branches.size > 1 %]
[% itemtype.branches.size | html %] branches limitations
[% ELSE %]
[% itemtype.branches.size | html %] branch limitation
[% END %]
[% ELSE %]
No limitation
[% END %]
</td>
<td class="actions">
<a href="/cgi-bin/koha/admin/itemtypes.pl?op=add_form&amp;itemtype=[% itemtype.itemtype | uri %]" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
<a href="/cgi-bin/koha/admin/itemtypes.pl?op=delete_confirm&amp;itemtype=[% itemtype.itemtype | uri %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>