View | Details | Raw Unified | Return to bug 29454
Collapse All | Expand All

(-)a/Koha/Template/Plugin/Branches.pm (-3 / +10 lines)
Lines 27-37 use C4::Koha; Link Here
27
use C4::Context;
27
use C4::Context;
28
use Koha::Libraries;
28
use Koha::Libraries;
29
29
30
our %branches;
31
32
sub new {
33
    my ($class, $context, @params) = @_;
34
    bless {
35
        map { $_->{branchcode} => $_ } @{Koha::Libraries->search()->unblessed}
36
    }, $class;
37
}
38
30
sub GetName {
39
sub GetName {
31
    my ( $self, $branchcode ) = @_;
40
    my ( $self, $branchcode ) = @_;
32
41
    return $self->{$branchcode}->{branchname} // $branchcode;
33
    my $l = Koha::Libraries->find($branchcode);
34
    return $l ? $l->branchname : q{};
35
}
42
}
36
43
37
sub GetLoggedInBranchcode {
44
sub GetLoggedInBranchcode {
(-)a/Koha/Template/Plugin/ItemTypes.pm (-4 / +12 lines)
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
- 

Return to bug 29454