This is the fourth and last patch set to remove C4::Branch.
The real purpose of this patch is to standardise and refactor some code
which is related to the libraries selection/display.
Its unconfessed purpose is to remove the C4::Branch package.
Before this patch set, only 6 subroutines still existed in the C4::Branch
package:
- GetBranchName
- GetBranchesLoop
- mybranch
- onlymine
- GetBranches
- GetBranch
GetBranchName basically returns the branchname for a given branchcode.
The branchname is only used for a display purpose and we don't need to
retrieve it in package or pl scripts (unless for a few exceptions).
We have a `Branches` template plugin with a `GetName` method which does
exactly this job.
To achieve this removal, we will use this template plugin and delete the
GetBranchName from pl and pm files.
The `Branches.all()` will now select the library of the logged in user
if no `selected` parameter has been passed.
This new behavior could cause regressions, for instance there are some
places where we do not want an option preselected (batch item
modification for instance), keep that in mind when testing.
GetBranchesLoop took 3 parameters: $branch and $onlymine.
The first one was used to set a "selected" flag, for a display purpose:
select an option in the libraries dropdown lists.
The second one was useless: If not passed or set to 0, the
`C4::Branch::onlymine` subroutine was called.
This onlymine flag was use to know if the logged in user was able to see
other libraries infos.
A patron can see the infos from other libraries if IndependentBranches
is not set OR if he has the superlibrarian permission.
Prior to this patch set, the "onlymine test" was done on different
places (neworderempty.pl, additem.pl, holidays.pl, etc.), including the
Branches TT plugin. In this patch set, this test is only done on one
place (C4::Context::only_my_library, code moved from
C4::Branch::onlymine).
To accomplish the same job as this subroutine, we just need to call the
`Branches.all()` method from the `Branches` TT plugin. It already
accepts a `selected` parameter to set a flag on the option to select.
To avoid the repetitive
[% IF selected %]<option selected="selected">[% ELSE %]<option>[% END %]
pattern, a new `html_helpers` TT include file has been created, it
defines an `options_for_libraries` block, which takes a `selected`
parameter. We could imagine to use this include file for other
selects.
The 'mybranch` and `onlymine` subroutines of the C4::Branch package have
been moved to C4::Context. onlymine has been renamed with
only_my_library. There are only 4 occurrences of it, against 11 before
this patch set.
There 2 subroutines are Context-centric and it makes sense to put them
in `C4::Context` (at least it's the least worst place!)
GetBranches is the tricky part of this patch set: It retrieves all the
libraries, independently of the value of IndependentBranches.
To keep the same way as the existing calls of `Branches.all()`, I have
added a `unfiltered` parameter. If set, the `Branches.all()` will call
a usual Koha::Libraries->search method, otherwise
Koha::Libraries->search_filtered will be called. This new method will
check if the logged in user is allowed to see other libraries or only
its library.
Note that this `GetBranches` subroutine also created a `category` key:
it allowed to get the list of groups (of libraries) where this library
existed. Thanks to a previous patch set (bug 15295), this value was
not used anymore (I may have missed something!).
Note that the only use of `GetBranch` was buggy (see bug 15746).
Test plan (for the whole patch set):
The best way to test this whole patch set is to test with 2 instances: 1
with the patch set applied, 1 using master, to be sure there is no
regression.
It would be good to test the same with `IndependentBranches` and the
without `IndependentBranches`.
No difference should be found.
The tester must focus on the library dropdowns on as many forms as
possible.
You will notice changes in the order of the options: the libraries will
now be ordered by branchname (instead of branchcode in some places).
A special attention will be given to the following page:
- acqui/neworderempty.pl
- catalogue/search.pl
- members/members-home.pl (header?)
- opac/opac-topissues.pl
- tools/holidays.pl
- admin/branch_transfer_limits.pl
- admin/item_circulation_alerts.pl
- rotating_collections/transferCollection.pl
- suggestion/suggestion.pl
- tools/export.pl
Notes for QA:
- There are 2 FIXMEs in the patch set, I have kept the existing behavior,
but I am not sure it's the good one. Feel free to open a bug report and
I will fill a patch if you think it's not correct. Otherwise, remove the
FIXME lines in a follow-up patch.
- The whole patch set is huge and makes a lot of changes.
But it finally will tremendously reduce the number of lines:
716 insertions for 1910 deletions
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
notes => $order->{'order_vendornote'},
quantity => $order->{'quantity'},
rrp => $order->{'rrp'},
- deliveryplace => C4::Branch::GetBranchName( $basket->{'deliveryplace'} ),
- billingplace => C4::Branch::GetBranchName( $basket->{'billingplace'} ),
};
+ for my $place ( qw( deliveryplace billingplace ) ) {
+ if ( my $library = Koha::Libraries->find( $row->{deliveryplace} ) ) {
+ $row->{$place} = $library->branchname
+ }
+ }
foreach(qw(
contractname author title publishercode collectiontitle notes
deliveryplace billingplace
booksellerpostal => $bookseller->{postal},
contractnumber => $contract->{contractnumber},
contractname => $contract->{contractname},
- basketgroupdeliveryplace => C4::Branch::GetBranchName( $basketgroup->{deliveryplace} ),
- basketgroupbillingplace => C4::Branch::GetBranchName( $basketgroup->{billingplace} ),
- basketdeliveryplace => C4::Branch::GetBranchName( $basket->{deliveryplace} ),
- basketbillingplace => C4::Branch::GetBranchName( $basket->{billingplace} ),
+ basketgroupdeliveryplace => $basketgroup->{deliveryplace},
+ basketgroupbillingplace => $basketgroup->{billingplace},
+ basketdeliveryplace => $basket->{deliveryplace},
+ basketbillingplace => $basket->{billingplace},
};
+ for my $place (qw( basketgroupdeliveryplace basketgroupbillingplace basketdeliveryplace basketbillingplace )) {
+ if ( my $library = Koha::Libraries->find( $row->{deliveryplace} ) ) {
+ $row->{$place} = $library->branchname;
+ }
+ }
foreach(qw(
basketname author title publishercode collectiontitle notes
booksellername bookselleraddress booksellerpostal contractname
use Koha;
use Koha::Caches;
use Koha::AuthUtils qw(get_script_name hash_password);
+use Koha::Libraries;
use Koha::LibraryCategories;
use Koha::Libraries;
use POSIX qw/strftime/;
# if they specify at login, use that
if ( $query->param('branch') ) {
$branchcode = $query->param('branch');
- $branchname = GetBranchName($branchcode);
+ $branchname = Koha::Libraries->find($branchcode)->branchname;
}
my $branches = GetBranches();
if ( C4::Context->boolean_preference('IndependentBranches') && C4::Context->boolean_preference('Autolocation') ) {
# if they specify at login, use that
if ( $query->param('branch') ) {
$branchcode = $query->param('branch');
- $branchname = GetBranchName($branchcode);
+ $branchname = Koha::Libraries->find($branchcode)->branchname;
}
my $branches = GetBranches();
my @branchesloop;
use Koha::Authority::Types;
use Koha::Acquisition::Currencies;
use Koha::SearchEngine;
+use Koha::Libraries;
use vars qw(@ISA @EXPORT);
use vars qw($debug $cgi_debug);
#---- branch
if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
- return C4::Branch::GetBranchName($value);
+ return Koha::Libraries->find($value)->branchname;
}
#---- itemtypes
BEGIN {
@ISA = qw(Exporter);
@EXPORT = qw(
- &GetBranchName
&GetBranch
&GetBranches
&GetBranchesLoop
return \@loop;
}
-=head2 GetBranchName
-
-=cut
-
-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;
- return ($branchname);
-}
-
=head2 GetBranch
$branch = GetBranch( $query, $branches );
$issuingimpossible{ITEMNOTSAMEBRANCH} = 1;
$issuingimpossible{'itemhomebranch'} = $item->{C4::Context->preference("HomeOrHoldingBranch")};
}
- $needsconfirmation{BORRNOTSAMEBRANCH} = GetBranchName( $borrower->{'branchcode'} )
+ $needsconfirmation{BORRNOTSAMEBRANCH} = $borrower->{'branchcode'}
if ( $borrower->{'branchcode'} ne $userenv->{branch} );
}
}
my $resbor = $res->{'borrowernumber'};
if ( $resbor ne $borrower->{'borrowernumber'} ) {
my ( $resborrower ) = C4::Members::GetMember( borrowernumber => $resbor );
- my $branchname = GetBranchName( $res->{'branchcode'} );
if ( $restype eq "Waiting" )
{
# The item is on reserve and waiting, but has been
$needsconfirmation{'ressurname'} = $resborrower->{'surname'};
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
- $needsconfirmation{'resbranchname'} = $branchname;
+ $needsconfirmation{'resbranchcode'} = $res->{branchcode};
$needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'};
}
elsif ( $restype eq "Reserved" ) {
$needsconfirmation{'ressurname'} = $resborrower->{'surname'};
$needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'};
$needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'};
- $needsconfirmation{'resbranchname'} = $branchname;
+ $needsconfirmation{'resbranchcode'} = $res->{branchcode};
$needsconfirmation{'resreservedate'} = $res->{'reservedate'};
}
}
use C4::Auth;
use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Libraries;
+
=head1 NAME
C4::ILS-DI::Services - ILS-DI Services
delete $item->{'more_subfields_xml'};
# Display branch names instead of branch codes
- $item->{'homebranchname'} = GetBranchName( $item->{'homebranch'} );
- $item->{'holdingbranchname'} = GetBranchName( $item->{'holdingbranch'} );
+ my $home_library = Koha::Libraries->find( $item->{homebranch} );
+ my $holding_library = Koha::Libraries->find( $item->{holdingbranch} );
+ $item->{'homebranchname'} = $home_library ? $home_library->branchname : '';
+ $item->{'holdingbranchname'} = $holding_library ? $holding_library->branchname : '';
}
# Hashref building...
# Cleaning the borrower hashref
$borrower->{'charges'} = $borrower->{'flags'}->{'CHARGES'}->{'amount'};
- $borrower->{'branchname'} = GetBranchName( $borrower->{'branchcode'} );
+ my $library = Koha::Libraries->find( $borrower->{branchcode} );
+ $borrower->{'branchname'} = $library ? $library->branchname : '';
delete $borrower->{'flags'};
delete $borrower->{'userid'};
delete $borrower->{'password'};
# Get additional informations
my $item = GetBiblioFromItemNumber( $reserve->{'itemnumber'}, undef );
- my $branchname = GetBranchName( $reserve->{'branchcode'} );
+ my $library = Koha::Libraries->find( $reserve->{branchcode} );
+ my $branchname = $library ? $library->branchname : '';
# Remove unwanted fields
delete $item->{'marc'};
# Hashref building
my $out;
$out->{'title'} = $title;
- $out->{'pickup_location'} = GetBranchName($branch);
+ my $library = Koha::Libraries->find( $branch );
+ $out->{'pickup_location'} = $library ? $library->branchname : '';
# TODO $out->{'date_available'} = '';
# Hashref building
my $out;
- $out->{'pickup_location'} = GetBranchName($branch);
+ my $library = Koha::Libraries->find( $branch );
+ $out->{'pickup_location'} = $library ? $library->branchname : '';
# TODO $out->{'date_available'} = '';
}
my $biblionumber = $item->{'biblioitemnumber'};
- my $location = GetBranchName( $item->{'holdingbranch'} );
+ my $library = Koha::Libraries->find( $item->{holdingbranch} );
+ my $location = $library ? $library->branchname : '';
if ( $item->{'notforloan'} ) {
return ( $biblionumber, 'not available', 'Not for loan', $location );
use Koha::Items;
use Koha::SearchEngine;
use Koha::SearchEngine::Search;
+use Koha::Libraries;
use vars qw(@ISA @EXPORT);
# check for valid home branch
if (exists $item_ref->{'homebranch'} and defined $item_ref->{'homebranch'}) {
- my $branch_name = C4::Branch::GetBranchName($item_ref->{'homebranch'});
- unless (defined $branch_name) {
- # relies on fact that branches.branchname is a non-NULL column,
- # so GetBranchName returns undef only if branch does not exist
+ my $home_library = Koha::Libraries->find( $item_ref->{homebranch} );
+ unless (defined $home_library) {
$errors{'invalid_homebranch'} = $item_ref->{'homebranch'};
}
}
# check for valid holding branch
if (exists $item_ref->{'holdingbranch'} and defined $item_ref->{'holdingbranch'}) {
- my $branch_name = C4::Branch::GetBranchName($item_ref->{'holdingbranch'});
- unless (defined $branch_name) {
- # relies on fact that branches.branchname is a non-NULL column,
- # so GetBranchName returns undef only if branch does not exist
+ my $holding_library = Koha::Libraries->find( $item_ref->{holdingbranch} );
+ unless (defined $holding_library) {
$errors{'invalid_holdingbranch'} = $item_ref->{'holdingbranch'};
}
}
$data->{'itype'} = $data1->{'description'};
# add *_description fields
if ($data->{'homebranch'} || $data->{'holdingbranch'}){
- require C4::Branch;
- $data->{'homebranch_description'} = C4::Branch::GetBranchName($data->{'homebranch'}) if $data->{'homebranch'};
- $data->{'holdingbranch_description'} = C4::Branch::GetBranchName($data->{'holdingbranch'}) if $data->{'holdingbranch'};
+ require Koha::Libraries;
+ # FIXME Is this used??
+ $data->{'homebranch_description'} = Koha::Libraries->find($data->{'homebranch'})->branchname if $data->{'homebranch'};
+ $data->{'holdingbranch_description'} = Koha::Libraries->find($data->{'holdingbranch'})->branchname if $data->{'holdingbranch'};
}
$data->{'ccode_description'} = C4::Biblio::GetAuthorisedValueDesc('','', $data->{'ccode'} ,'','','CCODE', 1) if $data->{'ccode'};
$data->{'location_description'} = C4::Biblio::GetAuthorisedValueDesc('','', $data->{'location'} ,'','','LOC', 1) if $data->{'location'};
use C4::Koha;
use C4::Members;
use C4::Reserves;
-use C4::Branch qw(GetBranchName);
use C4::Items qw( GetBarcodeFromItemnumber GetItemnumbersForBiblio);
use C4::Auth qw(checkpw);
+use Koha::Libraries;
our $kp; # koha patron
sub library_name {
my $self = shift;
unless ($self->{library_name}) {
- $self->{library_name} = GetBranchName($self->{branchcode});
+ my $library = Koha::Libraries->find( $self->{branchcode} );
+ $self->{library_name} = $library ? $library->branchname : '';
}
return $self->{library_name};
}
use C4::Biblio; # GetMarcFromKohaField, GetBiblioData
use C4::Koha; # getFacets
use Koha::DateUtils;
+use Koha::Libraries;
use Lingua::Stem;
use C4::Search::PazPar2;
use XML::Simple;
$limit_cgi .= "&limit=" . uri_escape_utf8($this_limit);
if ($this_limit =~ /^branch:(.+)/) {
my $branchcode = $1;
- my $branchname = GetBranchName($branchcode);
- if (defined $branchname) {
- $limit_desc .= " branch:$branchname";
+ my $library = Koha::Libraries->find( $branchcode );
+ if (defined $library) {
+ $limit_desc .= " branch:" . $library->branchname;
} else {
$limit_desc .= " $this_limit";
}
}
);
-my $user = GetMember( 'borrowernumber' => $loggedinuser );
-my $branchname = GetBranchName($user->{branchcode});
-
my $status = $query->param('status') || "ASKED";
my $suggestions_count = CountSuggestion($status);
foreach my $budget ( @{$budget_arr} ) {
next unless (CanUserUseBudget($loggedinuser, $budget, $userflags));
- $budget->{'budget_branchname'} =
- GetBranchName( $budget->{'budget_branchcode'} );
-
my $member = GetMember( borrowernumber => $budget->{budget_owner_id} );
if ($member) {
$budget->{budget_owner_firstname} = $member->{'firstname'};
$template->param(
type => 'intranet',
loop_budget => \@budget_loop,
- branchname => $branchname,
total => $total,
totspent => $totspent,
totordered => $totordered,
if ($basket->{basketgroupid}){
$basketgroup = GetBasketgroup($basket->{basketgroupid});
- $basketgroup->{deliveryplacename} = C4::Branch::GetBranchName( $basketgroup->{deliveryplace} );
- $basketgroup->{billingplacename} = C4::Branch::GetBranchName( $basketgroup->{billingplace} );
}
my $borrower= GetMember('borrowernumber' => $loggedinuser);
my $budgets = GetBudgetHierarchy;
basketno => $basketno,
basket => $basket,
basketname => $basket->{'basketname'},
- basketbranchname => C4::Branch::GetBranchName($basket->{branch}),
+ basketbranchcode => $basket->{branch},
basketnote => $basket->{note},
basketbooksellernote => $basket->{booksellernote},
basketcontractno => $basket->{contractnumber},
closedate => $basket->{closedate},
estimateddeliverydate=> $estimateddeliverydate,
is_standing => $basket->{is_standing},
- deliveryplace => C4::Branch::GetBranchName( $basket->{deliveryplace} ),
- billingplace => C4::Branch::GetBranchName( $basket->{billingplace} ),
+ deliveryplace => $basket->{deliveryplace},
+ billingplace => $basket->{billingplace},
active => $bookseller->{'active'},
booksellerid => $bookseller->{'id'},
name => $bookseller->{'name'},
my @items;
foreach (@itemnumbers) {
my $item = GetItem($_);
- if($item->{homebranch}) {
- $item->{homebranchname} = GetBranchName($item->{homebranch});
- }
- if($item->{holdingbranch}) {
- $item->{holdingbranchname} = GetBranchName($item->{holdingbranch});
- }
if(my $code = GetAuthValCode("items.notforloan", $fw)) {
$item->{notforloan} = GetKohaAuthorisedValueLib($code, $item->{notforloan});
}
use warnings;
use utf8;
-use C4::Branch qw(GetBranchName);
-
use Koha::Number::Price;
use Koha::DateUtils;
use Koha::Libraries;
my $number = 3;
for my $basket (@$baskets){
my $page = $pdf->page();
-
+ my $billing_library = Koha::Libraries->find( $basket->{billingplace} );
+ my $delivery_library = Koha::Libraries->find( $basket->{deliveryplace} );
+
# print basket header (box)
my $box = $page->gfx;
$box->rectxy(($width - 10)/mm, ($height - 5)/mm, 10/mm, ($height - 25)/mm);
$text->text("Order no. ".$basketgroup->{'id'}.". Basket no. ".$basket->{basketno}.". ".$basket->{booksellernote});
$text->translate(20/mm, ($height-20)/mm);
$text->font( $pdf->corefont("Times", -encoding => "utf8"), 4/mm );
- $text->text( ( $basket->{billingplace} ? "Billing at " . C4::Branch::GetBranchName( $basket->{billingplace} ) : "" )
- . ( $basket->{billingplace} and $basket->{deliveryplace} ? " and " : "" )
- . ( $basket->{deliveryplace} ? "delivery at " . C4::Branch::GetBranchName( $basket->{deliveryplace}) : "" )
+ $text->text( ( $billing_library ? "Billing at " . $billing_library->branchname : "" )
+ . ( $billing_library and $delivery_library ? " and " : "" )
+ . ( $delivery_library ? "delivery at " . $delivery_library->branchname : "" )
);
my $pdftable = new PDF::Table();
use warnings;
use utf8;
-use C4::Branch qw(GetBranchName);
-
use Koha::Number::Price;
use Koha::DateUtils;
use Koha::Libraries;
my $number = 3;
for my $basket (@$baskets){
my $page = $pdf->page();
+ my $billing_library = Koha::Libraries->find( $basket->{billingplace} );
+ my $delivery_library = Koha::Libraries->find( $basket->{deliveryplace} );
# print basket header (box)
my $box = $page->gfx;
$text->text("Commande N°".$basketgroup->{'id'}.". Panier N° ".$basket->{basketno}.". ".$basket->{booksellernote});
$text->translate(20/mm, ($height-20)/mm);
$text->font( $pdf->corefont("Times", -encoding => "utf8"), 4/mm );
- $text->text( ( $basket->{billingplace} ? "Facturation à " . C4::Branch::GetBranchName( $basket->{billingplace} ) : "" )
- . ( $basket->{billingplace} and $basket->{deliveryplace} ? " et " : "" )
- . ( $basket->{deliveryplace} ? "livraison à " . C4::Branch::GetBranchName( $basket->{deliveryplace}) : "" )
+ $text->text( ( $billing_library ? "Facturation à " . $billing_library->branchname : "" )
+ . ( $billing_library and $delivery_library ? " et " : "" )
+ . ( $delivery_library ? "livraison à " . $delivery_library->branchname : "" )
);
my $pdftable = new PDF::Table();
$branchcode = $input->param('branchcode');
}
-my $branchname = GetBranchName($branchcode);
-
# Getting the branches for user selection
my $branches = GetBranches();
my @branch_loop;
$row_data{ code } = $code;
$row_data{ toBranch } = $toBranch;
$row_data{ isChecked } = $isChecked;
- $row_data{ toBranchname } = GetBranchName($toBranch);
push( @to_branch_loop, \%row_data );
}
branch_loop => \@branch_loop,
branchcode_loop => \@branchcode_loop,
branchcode => $branchcode,
- branchname => $branchname,
limitType => $limitType,
);
use C4::Auth;
use C4::Koha;
use C4::Debug;
-use C4::Branch; # GetBranches
+use C4::Branch; # GetBranchesLoop
my $input = new CGI;
my $dbh = C4::Context->dbh;
my $branchloop = GetBranchesLoop;
$template->param(frombranch => $frombranch) if ($frombranch);
-$template->param(frombranchname => GetBranchName($frombranch)) if ($frombranch);
$template->param(tobranch => $tobranch) if ($tobranch);
-$template->param(tobranchname => GetBranchName($tobranch)) if ($tobranch);
$template->param(branchloop => $branchloop);
$cell{missinglist} = $subscription->{missinglist};
$cell{librariannote} = $subscription->{librariannote};
$cell{branchcode} = $subscription->{branchcode};
- $cell{branchname} = GetBranchName($subscription->{branchcode});
$cell{hasalert} = $subscription->{hasalert};
$cell{callnumber} = $subscription->{callnumber};
$cell{closed} = $subscription->{closed};
use C4::Auth;
use C4::Biblio;
-use C4::Branch;
use C4::Items;
use C4::Koha;
use C4::Output;
+use Koha::Libraries;
my $cgi = new CGI;
$item = GetItem($itemnumber);
if($item->{homebranch}) {
- $item->{homebranchname} = GetBranchName($item->{homebranch});
+ $item->{homebranchname} = Koha::Libraries->find($item->{homebranch})->branchname;
}
if($item->{holdingbranch}) {
- $item->{holdingbranchname} = GetBranchName($item->{holdingbranch});
+ $item->{holdingbranchname} = Koha::Libraries->find($item->{holdingbranch})->branchname;
}
if(my $code = GetAuthValCode("items.notforloan", $fw)) {
$item->{'nomod'}=1;
}
}
- $item->{'homebranchname'} = GetBranchName($item->{'homebranch'});
- $item->{'holdingbranchname'} = GetBranchName($item->{'holdingbranch'});
if ($item->{'datedue'}) {
$item->{'issue'}= 1;
} else {
$overdueforbranch{'borrowerfirstname'} = $num->{'firstname'};
$overdueforbranch{'borrowerphone'} = $num->{'phone'};
$overdueforbranch{'borroweremail'} = $num->{'email'};
- $overdueforbranch{'homebranch'} = GetBranchName($num->{'homebranch'});
+ $overdueforbranch{'homebranch'} = $num->{'homebranch'};
$overdueforbranch{'itemcallnumber'} = $num->{'itemcallnumber'};
$overdueforbranch{'borrowernumber'} = $num->{'borrowernumber'};
$overdueforbranch{'itemnumber'} = $num->{'itemnumber'};
borrowernumber => $borrowernumber,
categoryname => $borrower->{'description'},
branch => $branch,
- branchname => GetBranchName($borrower->{'branchcode'}),
was_renewed => scalar $query->param('was_renewed') ? 1 : 0,
expiry => $borrower->{'dateexpiry'},
roadtype => $roadtype,
use C4::Items;
use C4::Members;
use C4::Members::Messaging;
-use C4::Branch; # GetBranches GetBranchName
+use C4::Branch; # GetBranches
use C4::Koha; # FIXME : is it still useful ?
use C4::RotatingCollections;
use Koha::DateUtils;
itemnumber => $iteminfo->{'itemnumber'},
itembiblionumber => $iteminfo->{'biblionumber'},
iteminfo => $iteminfo->{'author'},
- tobranchname => GetBranchName($messages->{'transfert'}),
name => $name,
borrowernumber => $borrowernumber,
borcnum => $borr->{'cardnumber'},
if ( ! ( $holdingBranch eq $collectionBranch ) ) {
$template->param(
collectionItemNeedsTransferred => 1,
- collectionBranchName => GetBranchName($collectionBranch),
collectionBranch => $collectionBranch,
itemnumber => $itemnumber,
);
use C4::Koha;
use C4::Branch; # GetBranches GetBranchesLoop
+use Koha::Libraries;
+
# this will be the script that chooses branch and printer settings....
my $query = CGI->new();
# $session lddines here are doing the updating
if ($branch and $branches->{$branch}) {
if (! $userenv_branch or $userenv_branch ne $branch ) {
- my $branchname = GetBranchName($branch);
+ my $branchname = Koha::Libraries->find($branch)->branchname;
$template->param(LoginBranchname => $branchname); # update template for new branch
$template->param(LoginBranchcode => $branch); # update template for new branch
$session->param('branchname', $branchname); # update sesssion in DB
use CGI qw ( -utf8 );
use C4::Context;
use C4::Output;
-use C4::Branch; # GetBranchName
use C4::Auth;
use C4::Circulation;
use C4::Members;
$getreserv{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($gettitle->{'biblionumber'}), GetFrameworkCode($gettitle->{'biblionumber'}));
$getreserv{'biblionumber'} = $gettitle->{'biblionumber'};
$getreserv{'barcode'} = $gettitle->{'barcode'};
- $getreserv{'branchname'} = GetBranchName($gettitle->{'homebranch'});
$getreserv{'homebranch'} = $gettitle->{'homebranch'};
$getreserv{'holdingbranch'} = $gettitle->{'holdingbranch'};
$getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
my $iteminfo = GetBiblioFromItemNumber($item);
if ( $messages->{'transfert'} ) {
$res{messagetransfert} = $messages->{'transfert'};
- $res{branchname} = GetBranchName($messages->{'transfert'});
+ $res{branchcode} = $messages->{'transfert'};
}
$res{message} = 1;
[% END %]
[% END %][% END %]
<li class="patroncategory">Category: [% categoryname %] ([% categorycode %])</li>
- <li class="patronlibrary">Home library: [% IF ( branchname ) %][% branchname %][% ELSE %][% branch %][% END %]</li>
+ <li class="patronlibrary">Home library: [% Branches.GetName( branchcode ) %]</li>
</ul></div>
<div id="menu">
<ul>
[% USE Price %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions</title>
[% INCLUDE 'doc-head-close.inc' %]
[% IF ( loop_budget ) %]
- <h3>All available funds[% IF ( branchname ) %] for [% branchname %][% END %]</h3>
+ <h3>All available funds[% IF LoginBranchname %] for [% LoginBranchname %][% END %]</h3>
<div id="BudgetsAndFunds">
<table id="accounts">
[% END %]
</td>
- <td>[% loop_budge.budget_branchname %]</td>
+ <td>[% Branches.GetName( loop_budge.budget_branchcode ) %]</td>
<td class="data">
[% IF loop_budge.budget_parent_id %]
[% loop_budge.budget_amount | $Price %]
[% USE KohaDates %]
+[% USE Branches %]
[% USE Price %]
[% USE AuthorisedValues %]
[% IF ( basketcontractno ) %]
<li><span class="label">Contract name:</span> <a href="../admin/aqcontract.pl?op=add_form&contractnumber=[% basketcontractno %]&booksellerid=[% booksellerid %]">[% basketcontractname %]</a></li>
[% END %]
- [% IF ( deliveryplace ) %]<li><span class="label">Delivery place:</span> [% deliveryplace %]</li>[% END %]
- [% IF ( billingplace ) %]<li><span class="label">Billing place:</span> [% billingplace %]</li>[% END %]
+ [% IF deliveryplace %]<li><span class="label">Delivery place:</span> [% Branches.GetName( deliveryplace ) %]</li>[% END %]
+ [% IF billingplace %]<li><span class="label">Billing place:</span> [% Branches.GetName( billingplace ) %]</li>[% END %]
[% IF ( authorisedbyname ) %]<li><span class="label">Created by:</span> [% authorisedbyname %]</li>[% END %]
<li id="managedby">
<form action="" method="post">
</li>
<li id="branch">
<span class="label">Library:</span>
- [% IF basketbranchname %]
- [% basketbranchname %]
+ [% IF basketbranchcode %]
+ [% Branches.GetName( basketbranchcode ) %]
[% ELSE %]
No library
[% END %]
<input type="submit" value="Change basket group" />
[% END %]
</li>
- [% IF ( basketgroup.deliveryplacename ) %]<li><span class="label">Basket group delivery placename:</span> [% basketgroup.deliveryplacename %]</li>[% END %]
- [% IF ( basketgroup.billingplacename ) %]<li><span class="label">Basket group billing place:</span> [% basketgroup.billingplacename %]</li>[% END %]
+ [% IF basketgroup.deliveryplace %]<li><span class="label">Basket group delivery placename:</span> [% Branches.GetName( basketgroup.deliveryplace ) %]</li>[% END %]
+ [% IF basketgroup.billingplace %]<li><span class="label">Basket group billing place:</span> [% Branches.GetName( basketgroup.billingplace ) %]</li>[% END %]
</ol>
[% IF ( CAN_user_acquisition_group_manage ) %]
</form>
[% USE KohaDates %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions › Receipt summary for : [% name %] [% IF ( invoice ) %]invoice, [% invoice %][% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<td style="text-align:center"><input type="checkbox" name="items_to_receive" value="[% item.itemnumber %]" /></td>
<td><a style="cursor:pointer" onclick="PopupEditPage([% item.biblionumber %],[% item.itemnumber %]);">Edit</a></td>
<td>[% item.barcode %]</td>
- <td>[% item.homebranchname %]</td>
- <td>[% item.holdingbranchname %]</td>
+ <td>[% Branches.GetName( item.homebranch )%]</td>
+ <td>[% Branches.GetName( item.holdingbranch ) %]</td>
<td>[% item.notforloan %]</td>
<td>[% item.restricted %]</td>
<td>[% item.location %]</td>
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Library checkin and transfer policy</title>
[% INCLUDE 'doc-head-close.inc' %]
<div id="yui-main">
<div class="yui-b">
-<h1>Library [% branchcode %] - [% branchname %] Checkin and transfer policy</h1>
+<h1>Library [% branchcode %] - [% Branches.GetName( branchcode ) %] Checkin and transfer policy</h1>
<form method="get" action="/cgi-bin/koha/admin/branch_transfer_limits.pl" id="selectlibrary">
<label for="branchselect">Select a library :</label>
<select name="branchcode" id="branchselect">
<tbody>
[% FOREACH to_branch_loo IN codes_loo.to_branch_loop %]
<tr>
- <td><label style="min-width:400px;" for="[% to_branch_loo.code %][% to_branch_loo.toBranch %]row">[% to_branch_loo.toBranch %] - [% to_branch_loo.toBranchname %]</label></td>
+ <td><label style="min-width:400px;" for="[% to_branch_loo.code %][% to_branch_loo.toBranch %]row">[% to_branch_loo.toBranch %] - [% Branches.GetName( to_branch_loo.toBranch ) %]</label></td>
<td>
[% IF ( to_branch_loo.isChecked ) %]
<input type="checkbox" id="[% to_branch_loo.code %][% to_branch_loo.toBranch %]row" name="[% to_branch_loo.code %]_[% to_branch_loo.toBranch %]" checked="checked" />
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Circulation and fine rules › Clone circulation and fine rules</title>
[% INCLUDE 'doc-head-close.inc' %]
<div id="yui-main">
<div class="yui-b">
<h2>Cloning circulation and fine rules
- [% IF ( frombranchname || tobranchname ) %]
- [% IF ( frombranchname ) %] from "[% frombranchname %]"[% END %]
- [% IF ( tobranchname ) %] to "[% tobranchname %]"[% END %]
- [% END %]
+ [% IF frombranch %] from "[% Branches.GetName( frombranch ) %]"[% END %]
+ [% IF tobranch %] to "[% Branches.GetName( tobranch ) %]"[% END %]
</h2>
[% IF ( result ) %]
[% item.translated_description %]
</td>
[% END %]
- <td class="location">[% UNLESS ( singlebranchmode ) %][% item.branchname %] [% END %]</td>
+ <td class="location">[% UNLESS ( singlebranchmode ) %][% Branches.GetName( item.branchcode ) %] [% END %]</td>
<td class="homebranch">[% Branches.GetName(item.homebranch) %]<span class="shelvingloc">[% item.location %]</span> </td>
[% IF ( itemdata_ccode ) %]<td>[% item.ccode %]</td>[% END %]
<td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber %][% END %]</td>
<h2>This is a serial subscription</h2>
<p> (There are [% subscriptionsnumber %] subscriptions associated with this title).</p>
[% FOREACH subscription IN subscriptions %]
- [% IF ( subscription.branchname ) %]<h3>At library: [% subscription.branchname %]</h3>[% ELSE %]
- [% IF ( subscription.branchcode ) %]<h3>At library: [% subscription.branchcode %]</h3>[% END %][% END %]
+ [% IF subscription.branchcode %]
+ <h3>At library: [% Branches.GetName(subscription.branchcode) || subscription.branchcode %]</h3>
+ [% END %]
[% IF ( subscription.closed ) %]<p>This subscription is closed.</p>[% END %]
[% IF ( subscription.callnumber ) %]<p>Callnumber: [% subscription.callnumber %] </p>[% END %]
[% IF ( subscription.subscriptionnotes ) %]<p>[% subscription.subscriptionnotes FILTER html_line_break %] </p>[% END %]
[% USE Koha %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Catalog › Item details for [% title %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% END %]
[% END %][% END %]</h4>
<ol class="bibliodetails">
- <li><span class="label">Home library:</span> [% ITEM_DAT.homebranchname %] </li>
+ <li><span class="label">Home library:</span> [% Branches.GetName( ITEM_DAT.homebranch ) %] </li>
[% IF ( item_level_itypes ) %]
<li><span class="label">Item type:</span> [% ITEM_DAT.itype %] </li>
[% END %]
)[% END %]</h4>
<ol class="bibliodetails">
- <li><span class="label">Current location:</span> [% ITEM_DAT.holdingbranchname %] </li>
+ <li><span class="label">Current location:</span> [% Branches.GetName( ITEM_DAT.holdingbranch ) %] </li>
<li><span class="label">Checkout status:</span>
[% IF ( ITEM_DAT.issue ) %]Checked out to
[% IF ( hidepatronname ) %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Circulation › Overdues at [% LoginBranchname %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% IF ( overduesloo.borroweremail ) %]<a href="mailto:[% overduesloo.borroweremail %]?subject=Overdue: [% overduesloo.title |html %]">
[% overduesloo.borroweremail %]</a>[% END %]
</td>
- <td>[% overduesloo.homebranch %] [% overduesloo.itemcallnumber %]
+ <td>[% Branches.GetName( overduesloo.homebranch ) %] [% overduesloo.itemcallnumber %]
</td>
<td align="center">
<b>
[% todayoverduesloo.borroweremail %]</a>[% END %]
</p>
</td>
- <td><p>[% todayoverduesloo.homebranch %] [% todayoverduesloo.itemcallnumber %]</p>
+ <td><p>[% Branches.GetName( todayoverduesloo.homebranch ) %] [% todayoverduesloo.itemcallnumber %]</p>
</td>
<td align="center">
<b>
[% END %]
[% IF ( RESERVE_WAITING ) %]
- <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been waiting for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% resbranchname %] since [% reswaitingdate | $KohaDates %]</li>
+ <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been waiting for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% Branches.GetName( resbranchcode ) %] since [% reswaitingdate | $KohaDates %]</li>
[% END %]
[% IF ( RESERVED ) %]
- <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been on hold for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% resbranchname %] since [% resreservedate | $KohaDates %]</li>
+ <li>Item <i>[% getTitleMessageIteminfo %]</i> ([% getBarcodeMessageIteminfo %]) has been on hold for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% resborrowernumber %]">[% resfirstname %] [% ressurname %]</a> ([% rescardnumber %]) at [% Branches.GetName( resbranchcode ) %] since [% resreservedate | $KohaDates %]</li>
[% END %]
[% IF ( ISSUED_TO_ANOTHER ) %]
[% END %]
[% IF ( BORRNOTSAMEBRANCH ) %]
- <li>This patron is from a different library ([% BORRNOTSAMEBRANCH %])</li>
+ <li>This patron is from a different library ([% Branches.GetName( BORRNOTSAMEBRANCH ) %])</li>
[% END %]
[% IF ( PATRON_CANT ) %]
<li><i class="fa fa-li fa-warning"></i>Too many checked out.</li>
[% END %]
[% IF checkout_info.BORRNOTSAMEBRANCH %]
- <li><i class="fa fa-li fa-warning"></i>This patron is from a different library ([% checkout_info.BORRNOTSAMEBRANCH %]).</li>
+ <li><i class="fa fa-li fa-warning"></i>This patron is from a different library ([% Branches.GetName( checkout_info.BORRNOTSAMEBRANCH ) %]).</li>
[% END %]
[% IF checkout_ino.PATRON_CANT %]
<li><i class="fa fa-li fa-warning"></i>This patron can't check out this item per library circulation policy.</li>
[% IF ( collectionItemNeedsTransferred ) %]
<div id="rotating-collection" class="dialog message">
- <h3>Please transfer item to: [% collectionBranchName %]</h3>
+ <h3>Please transfer item to: [% Branches.GetName( collectionBranch ) %]</h3>
<p><a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&biblionumber=[% itembiblionumber %]">[% itembarcode |html %]: [% title |html %]</a></p>
<p>This item is part of a rotating collection.</p>
<p><button type="button" class="openWin" data-url="transfer-slip.pl?transferitem=[% itemnumber %]&branchcode=[% collectionBranch %]&op=slip"><i class="fa fa-print"></i> Print slip</button></p>
[% FOREACH cancel_result %]
[% IF ( messagetransfert ) %]
<div class="dialog message">
- <h2>This item is on hold for pick-up at [% branchname %]</h2>
+ <h2>This item is on hold for pick-up at [% Branches.GetName( branchname ) %]</h2>
<p><strong>[% nextreservtitle %]</strong> is on hold for <strong> [% nextreservsurname %], [% nextreservfirstname %]</strong>.
Please retain this item and check it in to process the hold.
</p>
<input type="hidden" name="tbr" value="[% reserveloo.homebranch %]" />
<input type="hidden" name="tab" value="holdswaiting">
[% IF ( reserveloo.dotransfer ) %]
- <input type="submit" value="Cancel hold and return to : [% reserveloo.branchname %]" />
+ <input type="submit" value="Cancel hold and return to : [% Branches.GetName( reserveloo.homebranch ) %]" />
[% ELSE %]
<input type="submit" value="Cancel hold" />
[% END %]
<input type="hidden" name="tbr" value="[% overloo.homebranch %]" />
<input type="hidden" name="tab" value="holdsover">
[% IF ( overloo.dotransfer ) %]
- <input type="submit" value="Cancel hold and return to : [% overloo.branchname %]" />
+ <input type="submit" value="Cancel hold and return to : [% Branches.GetName( overloo.homebranch ) %]" />
[% ELSE %]
<input type="submit" value="Cancel hold" />
[% END %]
[% USE KohaDates %]
[% USE AuthorisedValues %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons › [% IF (unknowuser) %]Patron does not exist[% ELSE %]Discharge for [% firstname %] [% surname %] ([% cardnumber %])[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons › Pending discharge requests</title>
[% INCLUDE 'doc-head-close.inc' %]
+[% USE Branches %]
[% PROCESS 'permissions.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons › Set permissions for [% surname %], [% firstname %]</title>
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons › [% IF ( newpassword ) %]Password updated [% ELSE %]Update password for [% surname %], [% firstname %][% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% USE Koha %]
+[% USE Branches %]
[% USE KohaDates %]
[% USE AuthorisedValues %]
[% USE ColumnsSettings %]
[% USE Koha %]
[% USE AuthorisedValues %]
+[% USE Branches %]
[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Sent notices for [% INCLUDE 'patron-title.inc' %]</title>
[% USE Koha %]
[% USE AuthorisedValues %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons › Pay Fines for [% borrower.firstname %] [% borrower.surname %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% USE Koha %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons › Collect fine payment for [% borrower.firstname %] [% borrower.surname %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% USE Koha %]
[% USE AuthorisedValues %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons › Purchase suggestions for [% INCLUDE 'patron-title.inc' %]</title>
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
[% USE Koha %]
[% USE AuthorisedValues %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Subscription Routing Lists for [% INCLUDE 'patron-title.inc' %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% USE Koha %]
[% USE AuthorisedValues %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons ›
[% IF ( unknowuser ) %]
+[% USE Branches %]
[% USE ItemTypes %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Reports › Catalog by item types</title>
[% IF ( do_it ) %]
[% FOREACH mainloo IN mainloop %]
- <h1>Reports on item types [% IF ( mainloo.branchname ) %] held at [% mainloo.branchname %][% END %]</h1>
+ <h1>Reports on item types [% IF branch %] held at [% Branches.GetName( branch ) %][% END %]</h1>
<table id="itemtypest">
<thead>
<tr>
<fieldset class="rows"> <legend>Acquisition information</legend>
<ol>
<li>
- <span class="label">Library:</span> [% branchname %]
+ <span class="label">Library:</span> [% Branches.GetName( branchcode ) %]
</li>
<li>
<span class="label">Fund:</span> [% budgetname %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Tools › [% branchname %] calendar</title>
+<title>Koha › Tools › [% Branches.GetName( branch ) %] calendar</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% branchname %] calendar</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% Branches.GetName( branch ) %] calendar</div>
<div id="doc3" class="yui-t1">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
- <h2>[% branchname %] calendar</h2>
+ <h2>[% Branches.GetName( branch ) %] calendar</h2>
<div class="yui-g">
<div class="yui-u first">
<label for="branch">Define the holidays for:</label>
[% USE Koha %]
[% USE KohaDates %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc'%]
<title>Koha › Tools › Batch patron modification</title>
[% INCLUDE 'doc-head-close.inc' %]
<td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]">[% borrower.cardnumber %]</a></td>
<td>[% borrower.surname %]</td>
<td>[% borrower.firstname %]</td>
- <td>[% borrower.branchname %]</td>
+ <td>[% Branches.GetName( borrower.branchcode ) %]</td>
<td>[% borrower.categorycode %]</td>
<td>[% borrower.city %]</td>
<td>[% borrower.state %]</td>
[% USE Koha %]
[% USE AuthorisedValues %]
+[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>
Koha › Tools ›
<h2>This is a serial</h2>
<p>There are [% subscriptionsnumber %] subscription(s) associated with this title.</p>
[% FOREACH subscription IN subscriptions %]
- [% IF ( subscription.branchname ) %]
- <h3>At library: [% subscription.branchname %]</h3>
+ [% IF ( subscription.branchcode ) %]
+ <h3>At library: [% Branches.GetName( subscription.branchname ) %]</h3>
[% ELSE %]
[% IF ( subscription.branchcode ) %]
<h3>At library: [% subscription.branchcode %]</h3>
$template->param(
finesview => 1,
borrowernumber => $borrowernumber,
- branchname => GetBranchName($data->{'branchcode'}),
total => sprintf("%.2f",$total),
totalcredit => $totalcredit,
is_child => ($data->{'category_type'} eq 'C'),
phone => $bor->{'phone'},
email => $bor->{'email'},
branchcode => $bor->{'branchcode'},
- branchname => GetBranchName($bor->{'branchcode'}),
activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
RoutingSerials => C4::Context->preference('RoutingSerials'),
);
$template->param(
categoryname => $data->{'description'},
- branchname => GetBranchName($data->{'branchcode'}),
RoutingSerials => C4::Context->preference('RoutingSerials'),
);
finesview => 1,
borrowernumber => $borrowernumber,
categoryname => $data->{'description'},
- branchname => GetBranchName($data->{'branchcode'}),
is_child => ($data->{'category_type'} eq 'C'),
activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
RoutingSerials => C4::Context->preference('RoutingSerials'),
finesview => 1,
borrowernumber => $borrowernumber,
categoryname => $data->{'description'},
- branchname => GetBranchName($data->{'branchcode'}),
is_child => ($data->{'category_type'} eq 'C'),
activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
RoutingSerials => C4::Context->preference('RoutingSerials'),
email => $bor->{'email'},
emailpro => $bor->{'emailpro'},
branchcode => $bor->{'branchcode'},
- branchname => GetBranchName($bor->{'branchcode'}),
loop => \@loop,
is_child => ($bor->{'category_type'} eq 'C'),
activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
email => $bor->{'email'},
emailpro => $bor->{'emailpro'},
branchcode => $bor->{'branchcode'},
- branchname => GetBranchName( $bor->{'branchcode'} ),
userid => $bor->{'userid'},
destination => $destination,
is_child => ( $bor->{'category_type'} eq 'C' ),
use C4::Koha;
use C4::Letters;
use C4::Biblio;
-use C4::Branch; # GetBranchName
use C4::Form::MessagingPreferences;
use List::MoreUtils qw/uniq/;
use C4::Members::Attributes qw(GetBorrowerAttributes);
categoryname => $data->{'description'},
was_renewed => scalar $input->param('was_renewed') ? 1 : 0,
branch => $branch,
+ branchcode => $branch,
todaysdate => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
totalprice => sprintf("%.2f", $totalprice),
totaldue => sprintf("%.2f", $total),
use C4::Output;
use CGI qw ( -utf8 );
use C4::Members;
-use C4::Branch;
use C4::Letters;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::Patron::Images;
QUEUED_MESSAGES => $queued_messages,
borrowernumber => $borrowernumber,
sentnotices => 1,
- branchname => GetBranchName($borrower->{'branchcode'}),
categoryname => $borrower->{'description'},
activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
RoutingSerials => C4::Context->preference('RoutingSerials'),
);
}
- $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} );
return;
}
$b_ref->{extendedattributes} = GetBorrowerAttributes($b_ref->{borrowernumber});
}
- $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} );
return;
}
phone => $data->{'phone'},
email => $data->{'email'},
branchcode => $data->{'branchcode'},
- branchname => GetBranchName($data->{'branchcode'}),
total => sprintf("%.2f",$total),
totalcredit => $totalcredit,
is_child => ($data->{'category_type'} eq 'C'),
phone => $data->{'phone'},
email => $data->{'email'},
branchcode => $data->{'branchcode'},
- branchname => GetBranchName( $data->{'branchcode'} ),
total => sprintf( "%.2f", $total ),
totalcredit => $totalcredit,
is_child => ( $data->{'category_type'} eq 'C' ),
$template->param(
suggestionsview => 1,
categoryname => $borrower->{'description'},
- branchname => GetBranchName( $borrower->{'branchcode'} ),
RoutingSerials => C4::Context->preference('RoutingSerials'),
);
borrower => $borrower,
borrowernumber => $borrowernumber,
branch => $branch,
- branchname => GetBranchName($borrower->{'branchcode'}),
categoryname => $borrower->{description},
RoutingSerials => C4::Context->preference('RoutingSerials'),
);
}
$template->param(
categoryname => $borrower->{'description'},
- branchname => GetBranchName($borrower->{'branchcode'}),
);
# Construct column names
my $fields = C4::Members::Statistics::get_fields();
$cell{histstartdate} = $subscription->{histstartdate};
$cell{histenddate} = $subscription->{histenddate};
$cell{branchcode} = $subscription->{branchcode};
- $cell{branchname} = GetBranchName($subscription->{branchcode});
$cell{hasalert} = $subscription->{hasalert};
$cell{callnumber} = $subscription->{callnumber};
$cell{closed} = $subscription->{closed};
$globalline{loopitemtype} = \@results;
$globalline{total} = $grantotal;
$globalline{branch} = $branch;
- $globalline{branchname} = GetBranchName($branch);
push @mainloop,\%globalline;
return \@mainloop;
}
use C4::Reports;
use C4::Members;
use Koha::DateUtils;
+use Koha::Libraries;
use Koha::Patron::Categories;
use List::MoreUtils qw/any/;
use YAML;
( $crit =~ /ccode/ ) ? $ccodes->{$value}
: ( $crit =~ /location/ ) ? $locations->{$value}
: ( $crit =~ /itemtype/ ) ? $itemtypes->{$value}->{description}
- : ( $crit =~ /branch/ ) ? GetBranchName($value)
+ : ( $crit =~ /branch/ ) ? Koha::Libraries->find($value)->branchname
: ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
: $value; # default fallback
if ($crit =~ /sort1/) {
use C4::Serials;
use URI::Escape;
use C4::Branch;
+use Koha::Libraries;
my $query = new CGI;
my $subscriptionid = $query->param('subscriptionid');
my ($count2,@bibitems) = GetBiblioItemByBiblioNumber($biblio);
my @itemresults = GetItemsInfo( $subs->{biblionumber} );
my $branch = $itemresults[0]->{'holdingbranch'};
- my $branchname = GetBranchName($branch);
+ my $branchname = Koha::Libraries->find($branch)->branchname;
if (C4::Context->preference('RoutingListAddReserves')){
# get existing reserves .....
use Koha::DateUtils qw( dt_from_string );
use Koha::Acquisition::Currencies;
+use Koha::Libraries;
use URI::Escape;
}
return ($criteriumvalue eq 'ASKED'?"Pending":ucfirst(lc( $criteriumvalue))) if ($displayby =~/status/i);
}
- return (GetBranchName($criteriumvalue)) if ($displayby =~/branchcode/);
+ return Koha::Libraries->find($criteriumvalue)->branchname;
+ if $displayby =~ /branchcode/;
return GetAuthorisedValueByCode('SUGGEST_FORMAT', $criteriumvalue) || "Unknown" if ($displayby =~/itemtype/);
if ($displayby =~/suggestedby/||$displayby =~/managedby/||$displayby =~/acceptedby/){
my $borr=C4::Members::GetMember(borrowernumber=>$criteriumvalue);
}
elsif ( $op eq 'show' ) {
$suggestion_ref=&GetSuggestion($$suggestion_ref{'suggestionid'});
- $$suggestion_ref{branchname} = GetBranchName $$suggestion_ref{branchcode};
my $budget = GetBudget $$suggestion_ref{budgetid};
$$suggestion_ref{budgetname} = $$budget{budget_name};
Init($suggestion_ref);
use C4::Auth qw(check_cookie_auth);
use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
-use C4::Branch qw(GetBranchName);
use C4::Charset;
use C4::Circulation qw(GetTransfers);
use C4::Context;
$hold->{color} = 'transferred';
$hold->{transferred} = 1;
$hold->{date_sent} = output_pref( dt_from_string($transferred_when) );
- $hold->{from_branch} = GetBranchName($transferred_from);
+ $hold->{from_branch} = Koha::Libraries->find($transferred_from)->branchname;
}
elsif ( $item->holding_branch() && $item->holding_branch()->branchcode() ne
$h->branch()->branchcode() )
use C4::Context;
use Data::Dumper;
-use Test::More tests => 17;
+use Test::More tests => 16;
use C4::Branch;
use Koha::Database;
}
can_ok(
'C4::Branch', qw(
- GetBranchName
GetBranch
GetBranches
GetBranchesLoop
is( Koha::Libraries->find( $b2->{branchcode} )->delete, 1, "One row affected" );
is( Koha::Libraries->search->count, $count + 1, "branch BRB deleted" );
-#Test GetBranchName
-is( GetBranchName( $b1->{branchcode} ),
- $b1->{branchname}, "GetBranchName returns the right name" );
-
#Test Getbranches
my $branches = GetBranches();
is( scalar( keys %$branches ),
#!/usr/bin/perl
use Modern::Perl;
-use C4::Branch qw(GetBranchName);
use Koha::DateUtils;
+use Koha::Libraries;
use Test::More tests => 14;
# Add LIB1, if it doesn't exist.
my $addbra = 'LIB1';
-if ( !GetBranchName($addbra) ) {
+unless ( Koha::Libraries->find($addbra) ) {
$dbh->do( q{ INSERT INTO branches (branchcode,branchname) VALUES (?,?) },
undef, ( $addbra, "$addbra branch" ) );
}
use t::lib::Mocks;
use Koha::DateUtils;
+use Koha::Libraries;
use Koha::Patron::Categories;
use Data::Dumper;
# Add branches if not existing
foreach my $addbra ('CPL', 'FPL', 'RPL') {
- $dbh->do("INSERT INTO branches (branchcode,branchname) VALUES (?,?)", undef, ($addbra,"$addbra branch")) unless GetBranchName($addbra);
+ $dbh->do("INSERT INTO branches (branchcode,branchname) VALUES (?,?)", undef, ($addbra,"$addbra branch")) unless Koha::Libraries->find($addbra);
}
# Add categories if not existing
if ( $onlymine ) {
$branch = C4::Context->userenv->{'branch'};
}
-my $branchname = GetBranchName($branch);
my $branches = GetBranches($onlymine);
my @branchloop;
for my $thisbranch (
keydate => $keydate,
branchcodes => $branchcodes,
branch => $branch,
- branchname => $branchname,
- branch => $branch,
);
# Shows the template with the real values replaced
use C4::Auth;
use C4::Output;
use C4::Context;
-use C4::Branch qw/GetBranchesLoop GetBranchName/;
+use C4::Branch qw/GetBranchesLoop/;
use C4::Members;
use C4::Members::Attributes qw(:all);
use C4::Members::AttributeTypes;
use Koha::Patrons;
use Koha::DateUtils;
use Koha::Token;
+use Koha::Libraries;
use Koha::Patron::Categories;
use Text::CSV;
}
if ($borrower{branchcode}) {
push @missing_criticals, {key=>'branchcode', line=>$. , lineraw=>$borrowerline, value=>$borrower{branchcode}, branch_map=>1}
- unless GetBranchName($borrower{branchcode});
+ unless Koha::Libraries->find($borrower{branchcode});
} else {
push @missing_criticals, {key=>'branchcode', line=>$. , lineraw=>$borrowerline};
}
my ( %info ) = @_;
my $borrower = GetMember( %info );
if ( $borrower ) {
- $borrower->{branchname} = GetBranchName( $borrower->{branchcode} );
for ( qw(dateenrolled dateexpiry) ) {
my $userdate = $borrower->{$_};
unless ($userdate && $userdate ne "0000-00-00" and $userdate ne "9999-12-31") {
menu => 1,
borrowernumber => $borrowernumber,
categoryname => $data->{'description'},
- branchname => GetBranchName( $data->{'branchcode'} ),
RoutingSerials => C4::Context->preference('RoutingSerials'),
);
}