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

(-)a/Koha/Template/Plugin/Branches.pm (-2 / +1 lines)
Lines 43-50 sub GetLoggedInBranchcode { Link Here
43
sub GetLoggedInBranchname {
43
sub GetLoggedInBranchname {
44
    my ($self) = @_;
44
    my ($self) = @_;
45
45
46
    my $code = $self->GetLoggedInBranchcode;
46
    return C4::Context->userenv ? C4::Context->userenv->{'branchname'} : q{};
47
    return $code ? $self->GetName($code) : q{};
48
}
47
}
49
48
50
sub GetURL {
49
sub GetURL {
(-)a/t/db_dependent/Template/Plugin/Branches.t (-2 / +1 lines)
Lines 71-77 subtest 'all() tests' => sub { Link Here
71
    is($plugin->GetLoggedInBranchcode(), '', 'no active library code if there is no active user session');
71
    is($plugin->GetLoggedInBranchcode(), '', 'no active library code if there is no active user session');
72
    is($plugin->GetLoggedInBranchname(), '', 'no active library name if there is no active user session');
72
    is($plugin->GetLoggedInBranchname(), '', 'no active library name if there is no active user session');
73
73
74
    t::lib::Mocks::mock_userenv({ branchcode => 'MYLIBRARY' });
74
    t::lib::Mocks::mock_userenv({ branchcode => 'MYLIBRARY', branchname => 'My sweet library' });
75
    is($plugin->GetLoggedInBranchcode(), 'MYLIBRARY', 'GetLoggedInBranchcode() returns active library code');
75
    is($plugin->GetLoggedInBranchcode(), 'MYLIBRARY', 'GetLoggedInBranchcode() returns active library code');
76
    is($plugin->GetLoggedInBranchname(), 'My sweet library', 'GetLoggedInBranchname() returns active library name');
76
    is($plugin->GetLoggedInBranchname(), 'My sweet library', 'GetLoggedInBranchname() returns active library name');
77
77
78
- 

Return to bug 25765