From a5c9909d98911b896839fb4d5361e5b9af78be17 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 5 Apr 2019 13:40:30 +0000 Subject: [PATCH] Bug 21946: Fix display of parent types --- Koha/ItemType.pm | 13 +++++ admin/itemtypes.pl | 2 +- .../prog/en/modules/admin/itemtypes.tt | 57 +++++++++++++++------- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/Koha/ItemType.pm b/Koha/ItemType.pm index 63c113c83d..cfdd6d03fb 100644 --- a/Koha/ItemType.pm +++ b/Koha/ItemType.pm @@ -125,6 +125,19 @@ sub may_article_request { return ( $guess->{ $itemtype // q{} } || $guess->{ '*' } ) ? 1 : q{}; } +=head3 parent + + Returns the ItemType object of the parent_type or undef. + +=cut + +sub parent { + my ( $self ) = @_; + my $parent_rs = $self->_result->parent_type; + return unless $parent_rs; + return Koha::ItemType->_new_from_dbic( $parent_rs ); + +} =head3 type =cut diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 79ee3f1a9d..546e54288b 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -75,7 +75,7 @@ if ( $op eq 'add_form' ) { } elsif ( $op eq 'add_validate' ) { my $is_a_modif = $input->param('is_a_modif'); my $itemtype = Koha::ItemTypes->find($itemtype_code); - my $parent_type = $input->param('parent_type'); + my $parent_type = $input->param('parent_type') || undef; my $description = $input->param('description'); my $rentalcharge = $input->param('rentalcharge'); my $rentalcharge_daily = $input->param('rentalcharge_daily'); 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 2e8a06a3f2..cd380a87b8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -118,6 +118,7 @@ Item types administration [% IF !is_a_parent && parent_types %]