diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index ede475a3cd..f9c12d797d 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -301,9 +301,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 @@ -374,11 +377,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 diff --git a/C4/Auth.pm b/C4/Auth.pm index 29d06fb70d..f0822a61a6 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -34,6 +34,7 @@ use C4::Search::History; 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/; @@ -1077,7 +1078,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') ) { @@ -1529,7 +1530,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; diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 78314b34cb..fd8f58cac2 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -42,6 +42,7 @@ use Koha::Caches; 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); @@ -1698,7 +1699,7 @@ sub GetAuthorisedValueDesc { #---- branch if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - return C4::Branch::GetBranchName($value); + return Koha::Libraries->find($value)->branchname; } #---- itemtypes diff --git a/C4/Branch.pm b/C4/Branch.pm index 5925d08997..7b9b85d7f1 100644 --- a/C4/Branch.pm +++ b/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 ); diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 0964050a44..ad715f5abd 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -903,7 +903,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} ); } } @@ -970,7 +970,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 @@ -980,7 +979,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" ) { @@ -990,7 +989,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'}; } } diff --git a/C4/ILSDI/Services.pm b/C4/ILSDI/Services.pm index 2820fef878..72d2ab8385 100644 --- a/C4/ILSDI/Services.pm +++ b/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... @@ -366,7 +370,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'}; @@ -406,7 +411,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'}; @@ -640,7 +646,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'} = ''; @@ -716,7 +723,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'} = ''; @@ -772,7 +780,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 ); diff --git a/C4/Items.pm b/C4/Items.pm index dd7614cf9d..8e69eba650 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -41,6 +41,7 @@ use Koha::Biblioitems; use Koha::Items; use Koha::SearchEngine; use Koha::SearchEngine::Search; +use Koha::Libraries; use vars qw(@ISA @EXPORT); @@ -755,20 +756,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'}; } } diff --git a/C4/Labels/Label.pm b/C4/Labels/Label.pm index 491146e7dc..c7c5371549 100644 --- a/C4/Labels/Label.pm +++ b/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'}; diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 93b6c546c4..26ad963645 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/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}; } diff --git a/C4/Search.pm b/C4/Search.pm index d9a193c641..29e606239f 100644 --- a/C4/Search.pm +++ b/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; @@ -1712,9 +1713,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"; } diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index 804e3ce062..b58c8f4d2b 100755 --- a/acqui/acqui-home.pl +++ b/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, diff --git a/acqui/basket.pl b/acqui/basket.pl index d1f37e6c34..afc0ec0e51 100755 --- a/acqui/basket.pl +++ b/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'}, diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index a75a624560..b07ee0f70c 100755 --- a/acqui/orderreceive.pl +++ b/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}); } diff --git a/acqui/pdfformat/layout3pages.pm b/acqui/pdfformat/layout3pages.pm index cedd9b9693..230865ce3c 100644 --- a/acqui/pdfformat/layout3pages.pm +++ b/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(); diff --git a/acqui/pdfformat/layout3pagesfr.pm b/acqui/pdfformat/layout3pagesfr.pm index 694f0cb86b..93f1cf1d6c 100644 --- a/acqui/pdfformat/layout3pagesfr.pm +++ b/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(); diff --git a/admin/branch_transfer_limits.pl b/admin/branch_transfer_limits.pl index 0adc9583c1..d1e59c77fc 100755 --- a/admin/branch_transfer_limits.pl +++ b/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, ); diff --git a/admin/clone-rules.pl b/admin/clone-rules.pl index 41f4ad62ea..d2412ae15d 100755 --- a/admin/clone-rules.pl +++ b/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); diff --git a/catalogue/detail.pl b/catalogue/detail.pl index ebc138de93..3fc8c29426 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -161,7 +161,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}; diff --git a/catalogue/getitem-ajax.pl b/catalogue/getitem-ajax.pl index fd69a74322..fa0aa611c6 100755 --- a/catalogue/getitem-ajax.pl +++ b/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)) { diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 7ba2fbe429..efa445772f 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -178,8 +178,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 { diff --git a/circ/branchoverdues.pl b/circ/branchoverdues.pl index d04f5e416e..22c46f0212 100755 --- a/circ/branchoverdues.pl +++ b/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'}; diff --git a/circ/circulation.pl b/circ/circulation.pl index a83ca11eb8..4e3e1be45c 100755 --- a/circ/circulation.pl +++ b/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, diff --git a/circ/returns.pl b/circ/returns.pl index 3dd0bda864..d1b0d54ff4 100755 --- a/circ/returns.pl +++ b/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('reserve_id') ) { itemnumber => $iteminfo->{'itemnumber'}, itembiblionumber => $iteminfo->{'biblionumber'}, iteminfo => $iteminfo->{'author'}, - tobranchname => GetBranchName($messages->{'transfert'}), name => $name, borrowernumber => $borrowernumber, borcnum => $borr->{'cardnumber'}, @@ -650,7 +649,6 @@ if ( $itemnumber ) { if ( ! ( $holdingBranch eq $collectionBranch ) ) { $template->param( collectionItemNeedsTransferred => 1, - collectionBranchName => GetBranchName($collectionBranch), collectionBranch => $collectionBranch, itemnumber => $itemnumber, ); diff --git a/circ/selectbranchprinter.pl b/circ/selectbranchprinter.pl index 36fd9a5868..42e8b05993 100755 --- a/circ/selectbranchprinter.pl +++ b/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 diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index 0050ce3ac5..d6a24f7236 100755 --- a/circ/waitingreserves.pl +++ b/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; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index a42384489a..56d3ae60ff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -59,7 +59,7 @@ [% END %] [% END %][% END %]