|
Lines 24-36
use base qw( Template::Plugin );
Link Here
|
| 24 |
|
24 |
|
| 25 |
use Koha::ItemTypes; |
25 |
use Koha::ItemTypes; |
| 26 |
|
26 |
|
|
|
27 |
our %itemtypes; |
| 28 |
|
| 29 |
sub new { |
| 30 |
my ($class, $context, @params) = @_; |
| 31 |
bless { |
| 32 |
map { $_->{itemtype} => $_ } @{Koha::ItemTypes->search_with_localization()->unblessed} |
| 33 |
}, $class; |
| 34 |
} |
| 35 |
|
| 27 |
sub GetDescription { |
36 |
sub GetDescription { |
| 28 |
my ( $self, $itemtypecode, $want_parent ) = @_; |
37 |
my ( $self, $itemtypecode, $want_parent ) = @_; |
| 29 |
my $itemtype = Koha::ItemTypes->find( $itemtypecode ); |
38 |
my $itemtype = $self->{$itemtypecode}; |
| 30 |
return q{} unless $itemtype; |
39 |
return q{} unless $itemtype; |
| 31 |
my $parent; |
40 |
my $parent; |
| 32 |
$parent = $itemtype->parent if $want_parent; |
41 |
$parent = $self->{$itemtype->{parent_type}} if $want_parent; |
| 33 |
return $parent ? $parent->translated_description . "->" . $itemtype->translated_description : $itemtype->translated_description; |
42 |
return $parent ? $parent->{translated_description} . "->" . $itemtype->{translated_description} : $itemtype->{translated_description}; |
| 34 |
} |
43 |
} |
| 35 |
|
44 |
|
| 36 |
sub Get { |
45 |
sub Get { |
| 37 |
- |
|
|