From e8b5639a148cba44e4ea89bb7960b5a41c6a233b 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 Signed-off-by: Liz Rea Signed-off-by: Lisette Scheer --- Koha/ItemType.pm | 14 ++++++ admin/itemtypes.pl | 2 +- .../prog/en/modules/admin/itemtypes.tt | 57 +++++++++++++++------- 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/Koha/ItemType.pm b/Koha/ItemType.pm index e33f0e66e4..76b776f588 100644 --- a/Koha/ItemType.pm +++ b/Koha/ItemType.pm @@ -139,6 +139,20 @@ sub _library_limits { }; } +=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 c24430a719..22aa5aac74 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -89,7 +89,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 eeffaf5d9c..9e9a97b9ef 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 %]