From 67cd7efeed45cddbfe43120f273a21ba8a555dcd 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 3868a0cbb7..ef87136f56 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 0f9a5bd495..a1f7a0da64 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt @@ -119,6 +119,7 @@ Item types administration [% IF !is_a_parent && parent_types %]