Lines 30-37
use Koha::Libraries;
Link Here
|
30 |
sub GetName { |
30 |
sub GetName { |
31 |
my ( $self, $branchcode ) = @_; |
31 |
my ( $self, $branchcode ) = @_; |
32 |
|
32 |
|
33 |
my $l = Koha::Libraries->find($branchcode); |
33 |
unless (exists $self->{branches}->{$branchcode} ){ |
34 |
return $l ? $l->branchname : q{}; |
34 |
my $l = Koha::Libraries->find($branchcode); |
|
|
35 |
$self->{branches}->{$branchcode} = $l if $l; |
36 |
} |
37 |
return $self->{branches}->{$branchcode}->branchname ? $self->{branchname}->{$branchcode} : q{}; |
35 |
} |
38 |
} |
36 |
|
39 |
|
37 |
sub GetLoggedInBranchcode { |
40 |
sub GetLoggedInBranchcode { |
Lines 49-59
sub GetLoggedInBranchname {
Link Here
|
49 |
sub GetURL { |
52 |
sub GetURL { |
50 |
my ( $self, $branchcode ) = @_; |
53 |
my ( $self, $branchcode ) = @_; |
51 |
|
54 |
|
52 |
my $query = "SELECT branchurl FROM branches WHERE branchcode = ?"; |
55 |
unless (exists $self->{branches}->{$branchcode} ){ |
53 |
my $sth = C4::Context->dbh->prepare($query); |
56 |
my $l = Koha::Libraries->find($branchcode); |
54 |
$sth->execute($branchcode); |
57 |
$self->{branches}->{$branchcode} = $l if $l; |
55 |
my $b = $sth->fetchrow_hashref(); |
58 |
} |
56 |
return $b->{branchurl}; |
59 |
return $self->{branches}->{$branchcode}->branchurl ? $self->{branchname}->{$branchcode} : q{}; |
57 |
} |
60 |
} |
58 |
|
61 |
|
59 |
sub all { |
62 |
sub all { |
60 |
- |
|
|