@@ -, +, @@ DBIx::Class equivalent * REMOVE GetBranchName by replacing all the calls by Koha::BusinessLogic::Branch->read({'branchcode' => $branchcode})->first->branchname; * overload the sub and make it die later --- C4/Branch.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/C4/Branch.pm +++ a/C4/Branch.pm @@ -21,6 +21,8 @@ use strict; require Exporter; use C4::Context; +use Koha::BusinessLogic::Branch; + use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); BEGIN { @@ -177,13 +179,8 @@ sub GetBranchesLoop { # since this is what most pages want anyway sub GetBranchName { my ($branchcode) = @_; - my $dbh = C4::Context->dbh; - my $sth; - $sth = $dbh->prepare("Select branchname from branches where branchcode=?"); - $sth->execute($branchcode); - my $branchname = $sth->fetchrow_array; - $sth->finish; - return ($branchname); + return "" unless $branchcode; #FIXME ? sometimes GetBranchName is called without branchcode, we must return immediatly to avoid an arror in ->first->branchname + return Koha::BusinessLogic::Branch->read({'branchcode' => $branchcode})->first->branchname; } =head2 ModBranch --