diff --git a/Koha/ItemType.pm b/Koha/ItemType.pm index f15c00e023..939c97704e 100644 --- a/Koha/ItemType.pm +++ b/Koha/ItemType.pm @@ -153,6 +153,17 @@ sub parent { } +=head3 children_with_localization + + Returns the ItemType objects of the children of this type or undef. + +=cut + +sub children_with_localization { + my ( $self ) = @_; + return Koha::ItemTypes->search_with_localization({ parent_type => $self->itemtype }); +} + =head3 type =cut diff --git a/Koha/Template/Plugin/ItemTypes.pm b/Koha/Template/Plugin/ItemTypes.pm index 20910562b0..5b3cf1edeb 100644 --- a/Koha/Template/Plugin/ItemTypes.pm +++ b/Koha/Template/Plugin/ItemTypes.pm @@ -25,9 +25,12 @@ use base qw( Template::Plugin ); use Koha::ItemTypes; sub GetDescription { - my ( $self, $itemtypecode ) = @_; + my ( $self, $itemtypecode, $want_parent ) = @_; my $itemtype = Koha::ItemTypes->find( $itemtypecode ); - return $itemtype ? $itemtype->translated_description : q{}; + return q{} unless $itemtype; + my $parent; + $parent = $itemtype->parent if $want_parent; + return $parent ? $parent->translated_description . "->" . $itemtype->translated_description : $itemtype->translated_description; } sub Get { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index 2b9f4513b2..a36daf5f4a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -57,6 +57,10 @@
  • default (all libraries), all patron categories, same item type
  • default (all libraries), all patron categories, all item types
  • + +

    Where an itemtype has a parent, the rule will display as "Parent->Child" and the number of + current checkouts allowed will be limited to either the maximum for the parent (counting sibling types) + or the specific rule's type, whichever is less.

    To modify a rule, create a new one with the same patron category and item type.

    @@ -86,7 +90,9 @@ + + @@ -162,6 +168,7 @@ [% IF show_rule %] [% SET row_count = row_count + 1 %] + + + + @@ -432,7 +451,9 @@ + + @@ -943,8 +964,20 @@ [% MACRO jsinclude BLOCK %] [% Asset.js("js/admin-menu.js") | $raw %] + [% INCLUDE 'datatables.inc' %] [% INCLUDE 'calendar.inc' %]
      Patron category  Item type Actions Note
    [% IF ( c == undef ) %]1[% ELSE %]0[% END %] [% IF c == undef %] All @@ -169,11 +176,12 @@ [% Categories.GetName(c) | html %] [% END %] [% IF ( i == undef ) %]1[% ELSE %]0[% END %] [% IF i == undef %] All [% ELSE %] - [% ItemTypes.GetDescription(i) | html %] + [% ItemTypes.GetDescription(i,1) | html %] [% END %] @@ -321,6 +329,7 @@ [% END %] [% END %]
    2 0
      Patron category  Item type   Note