@@ -, +, @@ - GetBranchName - GetBranchesLoop - mybranch - onlymine - GetBranches - GetBranch [% IF selected %][% ELSE %][% END %] - 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 - There are 2 FIXMEs in the patch set, I have kept the existing behavior, - The whole patch set is huge and makes a lot of changes. --- C4/Acquisition.pm | 20 +++++++++++++------ C4/Auth.pm | 5 +++-- C4/Biblio.pm | 3 ++- C4/Branch.pm | 15 -------------- C4/Circulation.pm | 7 +++---- C4/ILSDI/Services.pm | 23 +++++++++++++++------- C4/Items.pm | 13 +++++------- C4/Labels/Label.pm | 7 ++++--- C4/SIP/ILS/Patron.pm | 5 +++-- C4/Search.pm | 7 ++++--- acqui/acqui-home.pl | 7 ------- acqui/basket.pl | 8 +++----- acqui/orderreceive.pl | 6 ------ acqui/pdfformat/layout3pages.pm | 12 +++++------ acqui/pdfformat/layout3pagesfr.pm | 10 +++++----- admin/branch_transfer_limits.pl | 4 ---- admin/clone-rules.pl | 4 +--- catalogue/detail.pl | 1 - catalogue/getitem-ajax.pl | 6 +++--- catalogue/moredetail.pl | 2 -- circ/branchoverdues.pl | 2 +- circ/circulation.pl | 1 - circ/returns.pl | 4 +--- circ/selectbranchprinter.pl | 4 +++- circ/waitingreserves.pl | 4 +--- .../intranet-tmpl/prog/en/includes/circ-menu.inc | 2 +- .../prog/en/modules/acqui/acqui-home.tt | 5 +++-- .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 13 ++++++------ .../prog/en/modules/acqui/orderreceive.tt | 5 +++-- .../en/modules/admin/branch_transfer_limits.tt | 5 +++-- .../prog/en/modules/admin/clone-rules.tt | 7 +++---- .../prog/en/modules/catalogue/detail.tt | 7 ++++--- .../prog/en/modules/catalogue/moredetail.tt | 5 +++-- .../prog/en/modules/circ/branchoverdues.tt | 5 +++-- .../prog/en/modules/circ/circulation.tt | 6 +++--- .../en/modules/circ/circulation_batch_checkouts.tt | 2 +- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 2 +- .../prog/en/modules/circ/waitingreserves.tt | 6 +++--- .../prog/en/modules/members/discharge.tt | 1 + .../prog/en/modules/members/discharges.tt | 1 + .../prog/en/modules/members/notices.tt | 1 + .../intranet-tmpl/prog/en/modules/members/pay.tt | 1 + .../en/modules/members/purchase-suggestions.tt | 1 + .../prog/en/modules/members/routing-lists.tt | 1 + .../prog/en/modules/members/statistics.tt | 1 + .../prog/en/modules/reports/itemtypes.tt | 3 ++- .../prog/en/modules/suggestion/suggestion.tt | 2 +- .../prog/en/modules/tools/holidays.tt | 7 ++++--- .../prog/en/modules/tools/modborrowers.tt | 3 ++- .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 1 + .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 4 ++-- members/boraccount.pl | 1 - members/deletemem.pl | 1 - members/files.pl | 1 - members/mancredit.pl | 1 - members/maninvoice.pl | 1 - members/member-flags.pl | 1 - members/member-password.pl | 1 - members/moremember.pl | 2 +- members/notices.pl | 2 -- members/pay.pl | 1 - members/paycollect.pl | 1 - members/printfeercpt.pl | 1 - members/printinvoice.pl | 1 - members/purchase-suggestions.pl | 1 - members/routing-lists.pl | 1 - members/statistics.pl | 1 - opac/opac-detail.pl | 1 - reports/itemtypes.plugin | 1 - reports/reserves_stats.pl | 3 ++- serials/routing-preview.pl | 3 ++- suggestion/suggestion.pl | 5 +++-- svc/holds | 3 +-- t/db_dependent/Branch.t | 7 +------ t/db_dependent/NewsChannels.t | 4 ++-- t/db_dependent/Reserves.t | 3 ++- tools/holidays.pl | 3 --- tools/import_borrowers.pl | 5 +++-- tools/modborrowers.pl | 1 - tools/viewlog.pl | 1 - 80 files changed, 152 insertions(+), 183 deletions(-) --- a/C4/Acquisition.pm +++ a/C4/Acquisition.pm @@ -302,9 +302,12 @@ sub GetBasketAsCSV { 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 @@ -375,11 +378,16 @@ sub GetBasketGroupAsCSV { 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 --- a/C4/Auth.pm +++ a/C4/Auth.pm @@ -33,6 +33,7 @@ use C4::Branch; # GetBranches use C4::Search::History; use Koha; use Koha::AuthUtils qw(hash_password); +use Koha::Libraries; use Koha::LibraryCategories; use Koha::Libraries; use POSIX qw/strftime/; @@ -1076,7 +1077,7 @@ sub checkauth { # 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') ) { @@ -1528,7 +1529,7 @@ sub check_api_auth { # 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; --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -43,6 +43,7 @@ use Koha::Cache; 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); @@ -1679,7 +1680,7 @@ sub GetAuthorisedValueDesc { #---- branch if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - return C4::Branch::GetBranchName($value); + return Koha::Libraries->find($value)->branchname; } #---- itemtypes --- a/C4/Branch.pm +++ a/C4/Branch.pm @@ -27,7 +27,6 @@ use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); BEGIN { @ISA = qw(Exporter); @EXPORT = qw( - &GetBranchName &GetBranch &GetBranches &GetBranchesLoop @@ -152,20 +151,6 @@ sub GetBranchesLoop { # since this is what most pages want anyway 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 ); --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -1001,7 +1001,7 @@ sub CanBookBeIssued { $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} ); } } @@ -1068,7 +1068,6 @@ sub CanBookBeIssued { 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 @@ -1078,7 +1077,7 @@ sub CanBookBeIssued { $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" ) { @@ -1088,7 +1087,7 @@ sub CanBookBeIssued { $needsconfirmation{'ressurname'} = $resborrower->{'surname'}; $needsconfirmation{'rescardnumber'} = $resborrower->{'cardnumber'}; $needsconfirmation{'resborrowernumber'} = $resborrower->{'borrowernumber'}; - $needsconfirmation{'resbranchname'} = $branchname; + $needsconfirmation{'resbranchcode'} = $res->{branchcode}; $needsconfirmation{'resreservedate'} = $res->{'reservedate'}; } } --- a/C4/ILSDI/Services.pm +++ a/C4/ILSDI/Services.pm @@ -36,6 +36,8 @@ use DateTime; use C4::Auth; use C4::Members::Attributes qw(GetBorrowerAttributes); +use Koha::Libraries; + =head1 NAME C4::ILS-DI::Services - ILS-DI Services @@ -220,8 +222,10 @@ sub GetRecords { 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... @@ -364,7 +368,8 @@ sub GetPatronInfo { # 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'}; @@ -404,7 +409,8 @@ sub GetPatronInfo { # 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'}; @@ -638,7 +644,8 @@ sub HoldTitle { # 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'} = ''; @@ -714,7 +721,8 @@ sub HoldItem { # 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'} = ''; @@ -770,7 +778,8 @@ sub _availability { } 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 ); --- a/C4/Items.pm +++ a/C4/Items.pm @@ -40,6 +40,7 @@ use Koha::Database; use Koha::Database; use Koha::SearchEngine; use Koha::SearchEngine::Search; +use Koha::Libraries; use vars qw(@ISA @EXPORT); @@ -753,20 +754,16 @@ sub CheckItemPreSave { # 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'}; } } --- a/C4/Labels/Label.pm +++ a/C4/Labels/Label.pm @@ -97,9 +97,10 @@ sub _get_label_item { $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'}; --- a/C4/SIP/ILS/Patron.pm +++ a/C4/SIP/ILS/Patron.pm @@ -20,10 +20,10 @@ use C4::Context; 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 @@ -392,7 +392,8 @@ sub holds_blocked_by_excessive_fees { 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}; } --- a/C4/Search.pm +++ a/C4/Search.pm @@ -22,6 +22,7 @@ use C4::Context; 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; @@ -1709,9 +1710,9 @@ sub buildQuery { $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"; } --- a/acqui/acqui-home.pl +++ a/acqui/acqui-home.pl @@ -51,9 +51,6 @@ my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( } ); -my $user = GetMember( 'borrowernumber' => $loggedinuser ); -my $branchname = GetBranchName($user->{branchcode}); - my $status = $query->param('status') || "ASKED"; my $suggestions_count = CountSuggestion($status); @@ -74,9 +71,6 @@ my @budget_loop; 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'}; @@ -117,7 +111,6 @@ foreach my $budget ( @{$budget_arr} ) { $template->param( type => 'intranet', loop_budget => \@budget_loop, - branchname => $branchname, total => $total, totspent => $totspent, totordered => $totordered, --- a/acqui/basket.pl +++ a/acqui/basket.pl @@ -348,8 +348,6 @@ elsif ( $op eq 'ediorder' ) { 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; @@ -368,7 +366,7 @@ elsif ( $op eq 'ediorder' ) { 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}, @@ -382,8 +380,8 @@ elsif ( $op eq 'ediorder' ) { 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'}, --- a/acqui/orderreceive.pl +++ a/acqui/orderreceive.pl @@ -129,12 +129,6 @@ if ($AcqCreateItem eq 'receiving') { 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}); } --- a/acqui/pdfformat/layout3pages.pm +++ a/acqui/pdfformat/layout3pages.pm @@ -29,8 +29,6 @@ use strict; use warnings; use utf8; -use C4::Branch qw(GetBranchName); - use Koha::Number::Price; use Koha::DateUtils; use Koha::Libraries; @@ -63,7 +61,9 @@ sub printorders { 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); @@ -78,9 +78,9 @@ sub printorders { $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(); --- a/acqui/pdfformat/layout3pagesfr.pm +++ a/acqui/pdfformat/layout3pagesfr.pm @@ -28,8 +28,6 @@ use strict; use warnings; use utf8; -use C4::Branch qw(GetBranchName); - use Koha::Number::Price; use Koha::DateUtils; use Koha::Libraries; @@ -62,6 +60,8 @@ sub printorders { 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; @@ -77,9 +77,9 @@ sub printorders { $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(); --- a/admin/branch_transfer_limits.pl +++ a/admin/branch_transfer_limits.pl @@ -50,8 +50,6 @@ else $branchcode = $input->param('branchcode'); } -my $branchname = GetBranchName($branchcode); - # Getting the branches for user selection my $branches = GetBranches(); my @branch_loop; @@ -124,7 +122,6 @@ foreach my $code ( @codes ) { $row_data{ code } = $code; $row_data{ toBranch } = $toBranch; $row_data{ isChecked } = $isChecked; - $row_data{ toBranchname } = GetBranchName($toBranch); push( @to_branch_loop, \%row_data ); } @@ -138,7 +135,6 @@ $template->param( branch_loop => \@branch_loop, branchcode_loop => \@branchcode_loop, branchcode => $branchcode, - branchname => $branchname, limitType => $limitType, ); --- a/admin/clone-rules.pl +++ a/admin/clone-rules.pl @@ -33,7 +33,7 @@ use C4::Output; 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; @@ -52,9 +52,7 @@ my $tobranch = $input->param("tobranch"); 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); --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -159,7 +159,6 @@ foreach my $subscription (@subscriptions) { $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}; --- a/catalogue/getitem-ajax.pl +++ a/catalogue/getitem-ajax.pl @@ -23,10 +23,10 @@ use JSON; 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; @@ -46,11 +46,11 @@ if($itemnumber) { $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)) { --- a/catalogue/moredetail.pl +++ a/catalogue/moredetail.pl @@ -176,8 +176,6 @@ foreach my $item (@items){ $item->{'nomod'}=1; } } - $item->{'homebranchname'} = GetBranchName($item->{'homebranch'}); - $item->{'holdingbranchname'} = GetBranchName($item->{'holdingbranch'}); if ($item->{'datedue'}) { $item->{'issue'}= 1; } else { --- a/circ/branchoverdues.pl +++ a/circ/branchoverdues.pl @@ -125,7 +125,7 @@ foreach my $num (@getoverdues) { $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'}; --- a/circ/circulation.pl +++ a/circ/circulation.pl @@ -628,7 +628,6 @@ $template->param( 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, --- a/circ/returns.pl +++ a/circ/returns.pl @@ -45,7 +45,7 @@ use C4::Biblio; 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; @@ -172,7 +172,6 @@ if ( $query->param('resbarcode') ) { itemnumber => $iteminfo->{'itemnumber'}, itembiblionumber => $iteminfo->{'biblionumber'}, iteminfo => $iteminfo->{'author'}, - tobranchname => GetBranchName($messages->{'transfert'}), name => $name, borrowernumber => $borrowernumber, borcnum => $borr->{'cardnumber'}, @@ -649,7 +648,6 @@ if ( $itemnumber ) { if ( ! ( $holdingBranch eq $collectionBranch ) ) { $template->param( collectionItemNeedsTransferred => 1, - collectionBranchName => GetBranchName($collectionBranch), collectionBranch => $collectionBranch, itemnumber => $itemnumber, ); --- a/circ/selectbranchprinter.pl +++ a/circ/selectbranchprinter.pl @@ -28,6 +28,8 @@ use C4::Print; # GetPrinters 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(); @@ -58,7 +60,7 @@ my @updated; # $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 --- a/circ/waitingreserves.pl +++ a/circ/waitingreserves.pl @@ -23,7 +23,6 @@ use warnings; use CGI qw ( -utf8 ); use C4::Context; use C4::Output; -use C4::Branch; # GetBranchName use C4::Auth; use C4::Circulation; use C4::Members; @@ -119,7 +118,6 @@ foreach my $num (@getreserves) { $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'}; @@ -194,7 +192,7 @@ sub cancel { my $iteminfo = GetBiblioFromItemNumber($item); if ( $messages->{'transfert'} ) { $res{messagetransfert} = $messages->{'transfert'}; - $res{branchname} = GetBranchName($messages->{'transfert'}); + $res{branchcode} = $messages->{'transfert'}; } $res{message} = 1; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -59,7 +59,7 @@ [% END %] [% END %][% END %] Category: [% categoryname %] ([% categorycode %]) - Home library: [% IF ( branchname ) %][% branchname %][% ELSE %][% branch %][% END %] + Home library: [% Branches.GetName( branchcode ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt @@ -1,4 +1,5 @@ [% USE Price %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions [% INCLUDE 'doc-head-close.inc' %] @@ -136,7 +137,7 @@ $(document).ready(function() { [% IF ( loop_budget ) %] - All available funds[% IF ( branchname ) %] for [% branchname %][% END %] + All available funds[% IF LoginBranchname %] for [% LoginBranchname %][% END %] @@ -196,7 +197,7 @@ $(document).ready(function() { [% END %] - [% loop_budge.budget_branchname %] + [% Branches.GetName( loop_budge.budget_branchcode ) %] [% IF loop_budge.budget_parent_id %] [% loop_budge.budget_amount | $Price %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE Branches %] [% USE Price %] [% USE AuthorisedValues %] @@ -301,8 +302,8 @@ [% IF ( basketcontractno ) %] Contract name: [% basketcontractname %] [% END %] - [% IF ( deliveryplace ) %]Delivery place: [% deliveryplace %][% END %] - [% IF ( billingplace ) %]Billing place: [% billingplace %][% END %] + [% IF deliveryplace %]Delivery place: [% Branches.GetName( deliveryplace ) %][% END %] + [% IF billingplace %]Billing place: [% Branches.GetName( billingplace ) %][% END %] [% IF ( authorisedbyname ) %]Created by: [% authorisedbyname %][% END %] @@ -326,8 +327,8 @@ Library: - [% IF basketbranchname %] - [% basketbranchname %] + [% IF basketbranchcode %] + [% Branches.GetName( basketbranchcode ) %] [% ELSE %] No library [% END %] @@ -403,8 +404,8 @@ [% END %] - [% IF ( basketgroup.deliveryplacename ) %]Basket group delivery placename: [% basketgroup.deliveryplacename %][% END %] - [% IF ( basketgroup.billingplacename ) %]Basket group billing place: [% basketgroup.billingplacename %][% END %] + [% IF basketgroup.deliveryplace %]Basket group delivery placename: [% Branches.GetName( basketgroup.deliveryplace ) %][% END %] + [% IF basketgroup.billingplace %]Basket group billing place: [% Branches.GetName( basketgroup.billingplace ) %][% END %] [% IF ( CAN_user_acquisition_group_manage ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Acquisitions › Receipt summary for : [% name %] [% IF ( invoice ) %]invoice, [% invoice %][% END %] [% INCLUDE 'doc-head-close.inc' %] @@ -238,8 +239,8 @@ Edit [% item.barcode %] - [% item.homebranchname %] - [% item.holdingbranchname %] + [% Branches.GetName( item.homebranch )%] + [% Branches.GetName( item.holdingbranch ) %] [% item.notforloan %] [% item.restricted %] [% item.location %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branch_transfer_limits.tt @@ -1,3 +1,4 @@ +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › Library checkin and transfer policy [% INCLUDE 'doc-head-close.inc' %] @@ -54,7 +55,7 @@ -Library [% branchcode %] - [% branchname %] Checkin and transfer policy +Library [% branchcode %] - [% Branches.GetName( branchcode ) %] Checkin and transfer policy Select a library : @@ -95,7 +96,7 @@ [% FOREACH to_branch_loo IN codes_loo.to_branch_loop %] - [% to_branch_loo.toBranch %] - [% to_branch_loo.toBranchname %] + [% to_branch_loo.toBranch %] - [% Branches.GetName( to_branch_loo.toBranch ) %] [% IF ( to_branch_loo.isChecked ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/clone-rules.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/clone-rules.tt @@ -1,3 +1,4 @@ +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › Circulation and fine rules › Clone circulation and fine rules [% INCLUDE 'doc-head-close.inc' %] @@ -14,10 +15,8 @@ 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 %] [% IF ( result ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -623,7 +623,7 @@ function verify_images() { [% item.translated_description %] [% END %] - [% UNLESS ( singlebranchmode ) %][% item.branchname %] [% END %] + [% UNLESS ( singlebranchmode ) %][% Branches.GetName( item.branchcode ) %] [% END %] [% Branches.GetName(item.homebranch) %][% item.location %] [% IF ( itemdata_ccode ) %][% item.ccode %][% END %] [% IF ( item.itemcallnumber ) %] [% item.itemcallnumber %][% END %] @@ -891,8 +891,9 @@ function verify_images() { This is a serial subscription (There are [% subscriptionsnumber %] subscriptions associated with this title). [% FOREACH subscription IN subscriptions %] - [% IF ( subscription.branchname ) %]At library: [% subscription.branchname %][% ELSE %] - [% IF ( subscription.branchcode ) %]At library: [% subscription.branchcode %][% END %][% END %] + [% IF subscription.branchcode %] + At library: [% Branches.GetName(subscription.branchcode) || subscription.branchcode %] + [% END %] [% IF ( subscription.closed ) %]This subscription is closed.[% END %] [% IF ( subscription.callnumber ) %]Callnumber: [% subscription.callnumber %] [% END %] [% IF ( subscription.subscriptionnotes ) %][% subscription.subscriptionnotes FILTER html_line_break %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Catalog › Item details for [% title %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %] [% INCLUDE 'doc-head-close.inc' %] @@ -62,7 +63,7 @@ [% END %] [% END %][% END %] - Home library: [% ITEM_DAT.homebranchname %] + Home library: [% Branches.GetName( ITEM_DAT.homebranch ) %] [% IF ( item_level_itypes ) %] Item type: [% ITEM_DAT.itype %] [% END %] @@ -80,7 +81,7 @@ )[% END %] - Current location: [% ITEM_DAT.holdingbranchname %] + Current location: [% Branches.GetName( ITEM_DAT.holdingbranch ) %] Checkout status: [% IF ( ITEM_DAT.issue ) %]Checked out to [% IF ( hidepatronname ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchoverdues.tt @@ -1,3 +1,4 @@ +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Circulation › Overdues at [% LoginBranchname %] [% INCLUDE 'doc-head-close.inc' %] @@ -54,7 +55,7 @@ [% IF ( overduesloo.borroweremail ) %] [% overduesloo.borroweremail %][% END %] - [% overduesloo.homebranch %] [% overduesloo.itemcallnumber %] + [% Branches.GetName( overduesloo.homebranch ) %] [% overduesloo.itemcallnumber %] @@ -132,7 +133,7 @@ [% todayoverduesloo.borroweremail %][% END %] - [% todayoverduesloo.homebranch %] [% todayoverduesloo.itemcallnumber %] + [% Branches.GetName( todayoverduesloo.homebranch ) %] [% todayoverduesloo.itemcallnumber %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -199,11 +199,11 @@ $(document).ready(function() { [% END %] [% IF ( RESERVE_WAITING ) %] - Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been waiting for [% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% reswaitingdate | $KohaDates %] + Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been waiting for [% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% Branches.GetName( resbranchcode ) %] since [% reswaitingdate | $KohaDates %] [% END %] [% IF ( RESERVED ) %] - Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been on hold for [% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% resbranchname %] since [% resreservedate | $KohaDates %] + Item [% getTitleMessageIteminfo %] ([% getBarcodeMessageIteminfo %]) has been on hold for [% resfirstname %] [% ressurname %] ([% rescardnumber %]) at [% Branches.GetName( resbranchcode ) %] since [% resreservedate | $KohaDates %] [% END %] [% IF ( ISSUED_TO_ANOTHER ) %] @@ -223,7 +223,7 @@ $(document).ready(function() { [% END %] [% IF ( BORRNOTSAMEBRANCH ) %] - This patron is from a different library ([% BORRNOTSAMEBRANCH %]) + This patron is from a different library ([% Branches.GetName( BORRNOTSAMEBRANCH ) %]) [% END %] [% IF ( PATRON_CANT ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -164,7 +164,7 @@ $(document).ready(function() { Too many checked out. [% END %] [% IF checkout_info.BORRNOTSAMEBRANCH %] - This patron is from a different library ([% checkout_info.BORRNOTSAMEBRANCH %]). + This patron is from a different library ([% Branches.GetName( checkout_info.BORRNOTSAMEBRANCH ) %]). [% END %] [% IF checkout_ino.PATRON_CANT %] This patron can't check out this item per library circulation policy. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -161,7 +161,7 @@ $(document).ready(function () { [% IF ( collectionItemNeedsTransferred ) %] - Please transfer item to: [% collectionBranchName %] + Please transfer item to: [% Branches.GetName( collectionBranch ) %] [% itembarcode |html %]: [% title |html %] This item is part of a rotating collection. Print slip --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt @@ -47,7 +47,7 @@ [% FOREACH cancel_result %] [% IF ( messagetransfert ) %] - This item is on hold for pick-up at [% branchname %] + This item is on hold for pick-up at [% Branches.GetName( branchname ) %] [% nextreservtitle %] is on hold for [% nextreservsurname %], [% nextreservfirstname %]. Please retain this item and check it in to process the hold. @@ -115,7 +115,7 @@ [% IF ( reserveloo.dotransfer ) %] - + [% ELSE %] [% END %] @@ -175,7 +175,7 @@ [% IF ( overloo.dotransfer ) %] - + [% ELSE %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt @@ -1,5 +1,6 @@ [% USE KohaDates %] [% USE AuthorisedValues %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › [% IF (unknowuser) %]Patron does not exist[% ELSE %]Discharge for [% firstname %] [% surname %] ([% cardnumber %])[% END %] [% INCLUDE 'doc-head-close.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt @@ -1,3 +1,4 @@ +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Pending discharge requests [% INCLUDE 'doc-head-close.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE AuthorisedValues %] +[% USE Branches %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %] Sent notices for [% INCLUDE 'patron-title.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE AuthorisedValues %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Pay Fines for [% borrower.firstname %] [% borrower.surname %] [% INCLUDE 'doc-head-close.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE AuthorisedValues %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › Purchase suggestions for [% INCLUDE 'patron-title.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE AuthorisedValues %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Subscription Routing Lists for [% INCLUDE 'patron-title.inc' %] [% INCLUDE 'doc-head-close.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE AuthorisedValues %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Patrons › [% IF ( unknowuser ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemtypes.tt @@ -1,3 +1,4 @@ +[% USE Branches %] [% USE ItemTypes %] [% INCLUDE 'doc-head-open.inc' %] Koha › Reports › Catalog by item types @@ -31,7 +32,7 @@ $(document).ready(function(){ [% IF ( do_it ) %] [% FOREACH mainloo IN mainloop %] - Reports on item types [% IF ( mainloo.branchname ) %] held at [% mainloo.branchname %][% END %] + Reports on item types [% IF branch %] held at [% Branches.GetName( branch ) %][% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -278,7 +278,7 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Acquisition information - Library: [% branchname %] + Library: [% Branches.GetName( branchcode ) %] Fund: [% budgetname %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt @@ -1,5 +1,6 @@ +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] -Koha › Tools › [% branchname %] calendar +Koha › Tools › [% Branches.GetName( branch ) %] calendar [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] @@ -226,14 +227,14 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] -Home › Tools › [% branchname %] calendar +Home › Tools › [% Branches.GetName( branchname ) %] calendar - [% branchname %] calendar + [% Branches.GetName( branchname ) %] calendar Define the holidays for: --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc'%] Koha › Tools › Batch patron modification [% INCLUDE 'doc-head-close.inc' %] @@ -253,7 +254,7 @@ [% borrower.cardnumber %] [% borrower.surname %] [% borrower.firstname %] - [% borrower.branchname %] + [% Branches.GetName( borrower.branchcode ) %] [% borrower.categorycode %] [% borrower.city %] [% borrower.state %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE AuthorisedValues %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -794,8 +794,8 @@ This is a serial There are [% subscriptionsnumber %] subscription(s) associated with this title. [% FOREACH subscription IN subscriptions %] - [% IF ( subscription.branchname ) %] - At library: [% subscription.branchname %] + [% IF ( subscription.branchcode ) %] + At library: [% Branches.GetName( subscription.branchname ) %] [% ELSE %] [% IF ( subscription.branchcode ) %] At library: [% subscription.branchcode %] --- a/members/boraccount.pl +++ a/members/boraccount.pl @@ -111,7 +111,6 @@ $template->param(%$data); $template->param( finesview => 1, borrowernumber => $borrowernumber, - branchname => GetBranchName($data->{'branchcode'}), total => sprintf("%.2f",$total), totalcredit => $totalcredit, is_child => ($data->{'category_type'} eq 'C'), --- a/members/deletemem.pl +++ a/members/deletemem.pl @@ -127,7 +127,6 @@ if ($countissues > 0 or $flags->{'CHARGES'} or $data->{'borrowernumber'} or $de phone => $bor->{'phone'}, email => $bor->{'email'}, branchcode => $bor->{'branchcode'}, - branchname => GetBranchName($bor->{'branchcode'}), activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), RoutingSerials => C4::Context->preference('RoutingSerials'), ); --- a/members/files.pl +++ a/members/files.pl @@ -104,7 +104,6 @@ else { $template->param( categoryname => $data->{'description'}, - branchname => GetBranchName($data->{'branchcode'}), RoutingSerials => C4::Context->preference('RoutingSerials'), ); --- a/members/mancredit.pl +++ a/members/mancredit.pl @@ -99,7 +99,6 @@ if ($add){ 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'), --- a/members/maninvoice.pl +++ a/members/maninvoice.pl @@ -124,7 +124,6 @@ if ($add){ 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'), --- a/members/member-flags.pl +++ a/members/member-flags.pl @@ -192,7 +192,6 @@ $template->param( 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 ''), --- a/members/member-password.pl +++ a/members/member-password.pl @@ -135,7 +135,6 @@ $template->param( 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' ), --- a/members/moremember.pl +++ a/members/moremember.pl @@ -47,7 +47,6 @@ use C4::Circulation; 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); @@ -325,6 +324,7 @@ $template->param( 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), --- a/members/notices.pl +++ a/members/notices.pl @@ -25,7 +25,6 @@ use C4::Auth; 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; @@ -79,7 +78,6 @@ $template->param( 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'), --- a/members/pay.pl +++ a/members/pay.pl @@ -231,7 +231,6 @@ sub borrower_add_additional_fields { ); } - $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} ); return; } --- a/members/paycollect.pl +++ a/members/paycollect.pl @@ -180,6 +180,5 @@ sub borrower_add_additional_fields { $b_ref->{extendedattributes} = GetBorrowerAttributes($b_ref->{borrowernumber}); } - $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} ); return; } --- a/members/printfeercpt.pl +++ a/members/printfeercpt.pl @@ -135,7 +135,6 @@ $template->param( 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'), --- a/members/printinvoice.pl +++ a/members/printinvoice.pl @@ -134,7 +134,6 @@ $template->param( 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' ), --- a/members/purchase-suggestions.pl +++ a/members/purchase-suggestions.pl @@ -51,7 +51,6 @@ foreach my $key ( keys %$borrower ) { $template->param( suggestionsview => 1, categoryname => $borrower->{'description'}, - branchname => GetBranchName( $borrower->{'branchcode'} ), RoutingSerials => C4::Context->preference('RoutingSerials'), ); --- a/members/routing-lists.pl +++ a/members/routing-lists.pl @@ -95,7 +95,6 @@ $template->param( borrower => $borrower, borrowernumber => $borrowernumber, branch => $branch, - branchname => GetBranchName($borrower->{'branchcode'}), categoryname => $borrower->{description}, RoutingSerials => C4::Context->preference('RoutingSerials'), ); --- a/members/statistics.pl +++ a/members/statistics.pl @@ -61,7 +61,6 @@ foreach my $key ( keys %$borrower ) { } $template->param( categoryname => $borrower->{'description'}, - branchname => GetBranchName($borrower->{'branchcode'}), ); # Construct column names my $fields = C4::Members::Statistics::get_fields(); --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -552,7 +552,6 @@ foreach my $subscription (@subscriptions) { $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}; --- a/reports/itemtypes.plugin +++ a/reports/itemtypes.plugin @@ -108,7 +108,6 @@ sub calculate { $globalline{loopitemtype} = \@results; $globalline{total} = $grantotal; $globalline{branch} = $branch; - $globalline{branchname} = GetBranchName($branch); push @mainloop,\%globalline; return \@mainloop; } --- a/reports/reserves_stats.pl +++ a/reports/reserves_stats.pl @@ -32,6 +32,7 @@ use C4::Output; use C4::Reports; use C4::Members; use Koha::DateUtils; +use Koha::Libraries; use Koha::Patron::Categories; use List::MoreUtils qw/any/; use YAML; @@ -338,7 +339,7 @@ sub display_value { ( $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/) { --- a/serials/routing-preview.pl +++ a/serials/routing-preview.pl @@ -34,6 +34,7 @@ use C4::Items; use C4::Serials; use URI::Escape; use C4::Branch; +use Koha::Libraries; my $query = new CGI; my $subscriptionid = $query->param('subscriptionid'); @@ -66,7 +67,7 @@ if($ok){ 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 ..... --- a/suggestion/suggestion.pl +++ a/suggestion/suggestion.pl @@ -33,6 +33,7 @@ use C4::Debug; use Koha::DateUtils qw( dt_from_string ); use Koha::Acquisition::Currencies; +use Koha::Libraries; use URI::Escape; @@ -60,7 +61,8 @@ sub GetCriteriumDesc{ } 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); @@ -213,7 +215,6 @@ elsif ($op eq "change" ) { } 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); --- a/svc/holds +++ a/svc/holds @@ -24,7 +24,6 @@ use JSON qw(to_json); 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; @@ -134,7 +133,7 @@ while ( my $h = $holds_rs->next() ) { $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() ) --- a/t/db_dependent/Branch.t +++ a/t/db_dependent/Branch.t @@ -21,7 +21,7 @@ use Modern::Perl; use C4::Context; use Data::Dumper; -use Test::More tests => 17; +use Test::More tests => 16; use C4::Branch; use Koha::Database; @@ -36,7 +36,6 @@ BEGIN { } can_ok( 'C4::Branch', qw( - GetBranchName GetBranch GetBranches GetBranchesLoop @@ -110,10 +109,6 @@ is( Koha::Libraries->search->count, $count + 2, "two branches added" ); 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 ), --- a/t/db_dependent/NewsChannels.t +++ a/t/db_dependent/NewsChannels.t @@ -1,8 +1,8 @@ #!/usr/bin/perl use Modern::Perl; -use C4::Branch qw(GetBranchName); use Koha::DateUtils; +use Koha::Libraries; use Test::More tests => 14; @@ -18,7 +18,7 @@ $dbh->{RaiseError} = 1; # 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" ) ); } --- a/t/db_dependent/Reserves.t +++ a/t/db_dependent/Reserves.t @@ -32,6 +32,7 @@ use Koha::Holds; use t::lib::Mocks; use Koha::DateUtils; +use Koha::Libraries; use Koha::Patron::Categories; use Data::Dumper; @@ -57,7 +58,7 @@ $dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestricti # 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 --- a/tools/holidays.pl +++ a/tools/holidays.pl @@ -60,7 +60,6 @@ my $onlymine = if ( $onlymine ) { $branch = C4::Context->userenv->{'branch'}; } -my $branchname = GetBranchName($branch); my $branches = GetBranches($onlymine); my @branchloop; for my $thisbranch ( @@ -154,8 +153,6 @@ $template->param( keydate => $keydate, branchcodes => $branchcodes, branch => $branch, - branchname => $branchname, - branch => $branch, ); # Shows the template with the real values replaced --- a/tools/import_borrowers.pl +++ a/tools/import_borrowers.pl @@ -40,7 +40,7 @@ use warnings; 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; @@ -49,6 +49,7 @@ use C4::Reports::Guided; use C4::Templates; use Koha::Patron::Debarments; use Koha::DateUtils; +use Koha::Libraries; use Koha::Patron::Categories; use Text::CSV; @@ -185,7 +186,7 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { } 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}; } --- a/tools/modborrowers.pl +++ a/tools/modborrowers.pl @@ -362,7 +362,6 @@ sub GetBorrowerInfos { 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") { --- a/tools/viewlog.pl +++ a/tools/viewlog.pl @@ -91,7 +91,6 @@ if ( $src eq 'circ' ) { menu => 1, borrowernumber => $borrowernumber, categoryname => $data->{'description'}, - branchname => GetBranchName( $data->{'branchcode'} ), RoutingSerials => C4::Context->preference('RoutingSerials'), ); } --
(There are [% subscriptionsnumber %] subscriptions associated with this title).
This subscription is closed.
Callnumber: [% subscription.callnumber %]
[% subscription.subscriptionnotes FILTER html_line_break %]
[% todayoverduesloo.homebranch %] [% todayoverduesloo.itemcallnumber %]
[% Branches.GetName( todayoverduesloo.homebranch ) %] [% todayoverduesloo.itemcallnumber %]
[% itembarcode |html %]: [% title |html %]
This item is part of a rotating collection.
Print slip
[% nextreservtitle %] is on hold for [% nextreservsurname %], [% nextreservfirstname %]. Please retain this item and check it in to process the hold.
There are [% subscriptionsnumber %] subscription(s) associated with this title.