use Koha::Acquisition::Order;
use Koha::Acquisition::Bookseller;
use Koha::Number::Price;
+use Koha::Libraries;
use C4::Koha qw( subfield_is_koha_internal_p );
my $order = GetOrder( $ordernumber );
for my $borrowernumber (@borrowernumbers) {
my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber );
- my $branch = C4::Branch::GetBranchDetail( $borrower->{branchcode} );
+ my $library = Koha::Libraries->find( $borrower->{branchcode} )->unblessed;
my $biblio = C4::Biblio::GetBiblio( $order->{biblionumber} );
my $letter = C4::Letters::GetPreparedLetter(
module => 'acquisition',
letter_code => 'ACQ_NOTIF_ON_RECEIV',
- branchcode => $branch->{branchcode},
+ branchcode => $library->branchcode,
tables => {
- 'branches' => $branch,
+ 'branches' => $library,
'borrowers' => $borrower,
'biblio' => $biblio,
'aqorders' => $order,
&GetBranch
&GetBranches
&GetBranchesLoop
- &GetBranchDetail
&ModBranch
&GetBranchInfo
&mybranch
return $branch;
}
-=head2 GetBranchDetail
-
- $branch = &GetBranchDetail($branchcode);
-
-Given the branch code, the function returns a
-hashref for the corresponding row in the branches table.
-
-=cut
-
-sub GetBranchDetail {
- my ($branchcode) = shift or return;
- my $sth = C4::Context->dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
- $sth->execute($branchcode);
- return $sth->fetchrow_hashref();
-}
-
=head2 GetBranchInfo
$results = GetBranchInfo($branchcode);
use Koha::Borrowers;
use Koha::Borrower::Debarments;
use Koha::Database;
+use Koha::Libraries;
use Carp;
use List::MoreUtils qw( uniq );
use Date::Calc qw(
sub AddReturn {
my ( $barcode, $branch, $exemptfine, $dropbox, $return_date, $dropboxdate ) = @_;
- if ($branch and not GetBranchDetail($branch)) {
+ if ($branch and not Koha::Libraries->find($branch)) {
warn "AddReturn error: branch '$branch' not found. Reverting to " . C4::Context->userenv->{'branch'};
undef $branch;
}
# warn "sending issues...";
my $userenv = C4::Context->userenv;
- my $branchdetails = GetBranchDetail($_->{'branchcode'});
+ my $library = Koha::Libraries->find( $_->{branchcode} );
my $letter = GetPreparedLetter (
module => 'serial',
letter_code => $letter_code,
my %mail = $message->create_message_headers(
{
to => $email,
- from => $branchdetails->{'branchemail'},
- replyto => $branchdetails->{'branchreplyto'},
- sender => $branchdetails->{'branchreturnpath'},
+ from => $library->branchemail,
+ replyto => $library->branchreplyto,
+ sender => $library->branchreturnpath,
subject => Encode::encode( "UTF-8", "" . $letter->{title} ),
message => $letter->{'is_html'}
? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ),
}
# send an "account details" notice to a newly created user
elsif ( $type eq 'members' ) {
- my $branchdetails = GetBranchDetail($externalid->{'branchcode'});
+ my $library = Koha::Libraries->find( $externalid->{branchcode} )->unblessed;
my $letter = GetPreparedLetter (
module => 'members',
letter_code => $letter_code,
branchcode => $externalid->{'branchcode'},
tables => {
- 'branches' => $branchdetails,
+ 'branches' => $library,
'borrowers' => $externalid->{'borrowernumber'},
},
substitute => { 'borrowers.password' => $externalid->{'password'} },
my %mail = $email->create_message_headers(
{
to => $externalid->{'emailaddr'},
- from => $branchdetails->{'branchemail'},
- replyto => $branchdetails->{'branchreplyto'},
- sender => $branchdetails->{'branchreturnpath'},
+ from => $library->{branchemail},
+ replyto => $library->{branchreplyto},
+ sender => $library->{branchreturnpath},
subject => Encode::encode( "UTF-8", "" . $letter->{'title'} ),
message => $letter->{'is_html'}
? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ),
my $branch_email = undef;
my $branch_replyto = undef;
my $branch_returnpath = undef;
- if ($member){
- my $branchdetail = GetBranchDetail( $member->{'branchcode'} );
- $branch_email = $branchdetail->{'branchemail'};
- $branch_replyto = $branchdetail->{'branchreplyto'};
- $branch_returnpath = $branchdetail->{'branchreturnpath'};
+ if ($member) {
+ my $library = Koha::Libraries->find( $member->{branchcode} );
+ $branch_email = $library->branchemail;
+ $branch_replyto = $library->branchreplyto;
+ $branch_returnpath = $library->branchreturnpath;
}
my $email = Koha::Email->new();
my %sendmail_params = $email->create_message_headers(
use C4::Members::Messaging;
use C4::Members qw();
use C4::Letters;
-use C4::Branch qw( GetBranchDetail );
use Koha::DateUtils;
use Koha::Calendar;
use Koha::Database;
use Koha::Hold;
use Koha::Holds;
+use Koha::Libraries;
use List::MoreUtils qw( firstidx any );
use Carp;
# Send e-mail to librarian if syspref is active
if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){
my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
- my $branch_details = C4::Branch::GetBranchDetail($borrower->{branchcode});
+ my $library = Koha::Libraries->find($borrower->{branchcode})->unblessed;
if ( my $letter = C4::Letters::GetPreparedLetter (
module => 'reserves',
letter_code => 'HOLDPLACED',
branchcode => $branch,
tables => {
- 'branches' => $branch_details,
+ 'branches' => $library,
'borrowers' => $borrower,
'biblio' => $biblionumber,
'biblioitems' => $biblionumber,
},
) ) {
- my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
+ my $admin_email_address = $library->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
C4::Letters::EnqueueLetter(
{ letter => $letter,
");
$sth->execute( $borrowernumber, $biblionumber );
my $reserve = $sth->fetchrow_hashref;
- my $branch_details = GetBranchDetail( $reserve->{'branchcode'} );
+ my $library = Koha::Libraries->find( $reserve->{branchcode} )->unblessed;
- my $admin_email_address = $branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
+ my $admin_email_address = $library->{branchemail} || C4::Context->preference('KohaAdminEmailAddress');
my %letter_params = (
module => 'reserves',
branchcode => $reserve->{branchcode},
tables => {
- 'branches' => $branch_details,
+ 'branches' => $library,
'borrowers' => $borrower,
'biblio' => $biblionumber,
'biblioitems' => $biblionumber,
}
# 3rd add order
my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser );
- my $branch = C4::Branch->GetBranchDetail( $patron->{branchcode} );
# get quantity in the MARC record (1 if none)
my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
my %orderinfo = (
use warnings;
use utf8;
-use C4::Branch qw(GetBranchDetail);
-
use Koha::Number::Price;
use Koha::DateUtils;
+use Koha::Libraries;
BEGIN {
use Exporter ();
# get library name
my $libraryname = C4::Context->preference("LibraryName");
- # get branch details
- my $billingdetails = GetBranchDetail( $basketgroup->{billingplace} );
- my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} );
+ my $billing_library = Koha::Libraries->find( $basketgroup->{billingplace} );
+ my $delivery_library = Koha::Libraries->find( $basketgroup->{deliveryplace} );
my $freedeliveryplace = $basketgroup->{freedeliveryplace};
# get the subject
my $subject;
$text->translate(100/mm, ($height-86)/mm);
$text->text($libraryname);
$text->translate(100/mm, ($height-97)/mm);
- $text->text($billingdetails->{branchname});
+ $text->text($billing_library->branchname);
$text->translate(100/mm, ($height-108.5)/mm);
- $text->text($billingdetails->{branchphone});
+ $text->text($billing_library->branchphone);
$text->translate(100/mm, ($height-115.5)/mm);
- $text->text($billingdetails->{branchfax});
+ $text->text($billing_library->branchfax);
$text->translate(100/mm, ($height-122.5)/mm);
- $text->text($billingdetails->{branchaddress1});
+ $text->text($billing_library->branchaddress1);
$text->translate(100/mm, ($height-127.5)/mm);
- $text->text($billingdetails->{branchaddress2});
+ $text->text($billing_library->branchaddress2);
$text->translate(100/mm, ($height-132.5)/mm);
- $text->text($billingdetails->{branchaddress3});
+ $text->text($billing_library->branchaddress3);
$text->translate(100/mm, ($height-137.5)/mm);
- $text->text(join(' ', $billingdetails->{branchzip}, $billingdetails->{branchcity}, $billingdetails->{branchcountry}));
+ $text->text(join(' ', $billing_library->branchzip, $billing_library->branchcity, $billing_library->branchcountry));
$text->translate(100/mm, ($height-147.5)/mm);
- $text->text($billingdetails->{branchemail});
+ $text->text($billing_library->branchemail);
# print subject
$text->translate(100/mm, ($height-145.5)/mm);
$start += 5;
}
} else {
- $text->text( $deliverydetails->{branchaddress1} );
+ $text->text( $delivery_library->branchaddress1 );
$text->translate( 50 / mm, ( $height - 242 ) / mm );
- $text->text( $deliverydetails->{branchaddress2} );
+ $text->text( $delivery_library->branchaddress2 );
$text->translate( 50 / mm, ( $height - 247 ) / mm );
- $text->text( $deliverydetails->{branchaddress3} );
+ $text->text( $delivery_library->branchaddress3 );
$text->translate( 50 / mm, ( $height - 252 ) / mm );
- $text->text( join( ' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry} ) );
+ $text->text( join( ' ', $delivery_library->branchzip, $delivery_library->branchcity, $delivery_library->branchcountry ) );
}
$text->translate(50/mm, ($height-262)/mm);
$text->text($basketgroup->{deliverycomment});
use warnings;
use utf8;
-use C4::Branch qw(GetBranchDetail);
-
use Koha::Number::Price;
use Koha::DateUtils;
+use Koha::Libraries;
BEGIN {
use Exporter ();
# get library name
my $libraryname = C4::Context->preference("LibraryName");
- # get branch details
- my $billingdetails = GetBranchDetail( $basketgroup->{billingplace} );
- my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} );
+ my $billing_library = Koha::Libraries->find( $basketgroup->{billingplace} );
+ my $delivery_library = Koha::Libraries->find( $basketgroup->{deliveryplace} );
my $freedeliveryplace = $basketgroup->{freedeliveryplace};
# get the subject
my $subject;
$text->translate(100/mm, ($height-86)/mm);
$text->text($libraryname);
$text->translate(100/mm, ($height-97)/mm);
- $text->text($billingdetails->{branchname});
+ $text->text($billing_library->branchname);
$text->translate(100/mm, ($height-108.5)/mm);
- $text->text($billingdetails->{branchphone});
+ $text->text($billing_library->branchphone);
$text->translate(100/mm, ($height-115.5)/mm);
- $text->text($billingdetails->{branchfax});
+ $text->text($billing_library->branchfax);
$text->translate(100/mm, ($height-122.5)/mm);
- $text->text($billingdetails->{branchaddress1});
+ $text->text($billing_library->branchaddress1);
$text->translate(100/mm, ($height-127.5)/mm);
- $text->text($billingdetails->{branchaddress2});
+ $text->text($billing_library->branchaddress2);
$text->translate(100/mm, ($height-132.5)/mm);
- $text->text($billingdetails->{branchaddress3});
+ $text->text($billing_library->branchaddress3);
$text->translate(100/mm, ($height-137.5)/mm);
- $text->text(join(' ', $billingdetails->{branchzip}, $billingdetails->{branchcity}, $billingdetails->{branchcountry}));
+ $text->text(join(' ', $billing_library->branchzip, $billing_library->branchcity, $billing_library->branchcountry));
$text->translate(100/mm, ($height-147.5)/mm);
- $text->text($billingdetails->{branchemail});
+ $text->text($billing_library->branchemail);
# print subject
$text->translate(100/mm, ($height-145.5)/mm);
$start += 5;
}
} else {
- $text->text( $deliverydetails->{branchaddress1} );
+ $text->text( $delivery_library->branchaddress1 );
$text->translate( 50 / mm, ( $height - 242 ) / mm );
- $text->text( $deliverydetails->{branchaddress2} );
+ $text->text( $delivery_library->branchaddress2 );
$text->translate( 50 / mm, ( $height - 247 ) / mm );
- $text->text( $deliverydetails->{branchaddress3} );
+ $text->text( $delivery_library->branchaddress3 );
$text->translate( 50 / mm, ( $height - 252 ) / mm );
- $text->text( join( ' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry} ) );
+ $text->text( join( ' ', $delivery_library->branchzip, $delivery_library->branchcity, $delivery_library->branchcountry ) );
}
$text->translate(50/mm, ($height-262)/mm);
$text->text($basketgroup->{deliverycomment});
use warnings;
use utf8;
-use C4::Branch qw(GetBranchDetail GetBranchName);
+use C4::Branch qw(GetBranchName);
use Koha::Number::Price;
use Koha::DateUtils;
+use Koha::Libraries;
BEGIN {
use Exporter ();
# get library name
my $libraryname = C4::Context->preference("LibraryName");
- # get branch details
- my $billingdetails = GetBranchDetail( $basketgroup->{billingplace} );
- my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} );
+ my $billing_library = Koha::Libraries->find( $basketgroup->{billingplace} );
+ my $delivery_library = Koha::Libraries->find( $basketgroup->{deliveryplace} );
my $freedeliveryplace = $basketgroup->{freedeliveryplace};
# get the subject
my $subject;
$text->translate(100/mm, ($height-86)/mm);
$text->text($libraryname);
$text->translate(100/mm, ($height-97)/mm);
- $text->text($billingdetails->{branchname});
+ $text->text($billing_library->branchname);
$text->translate(100/mm, ($height-108.5)/mm);
- $text->text($billingdetails->{branchphone});
+ $text->text($billing_library->branchphone);
$text->translate(100/mm, ($height-115.5)/mm);
- $text->text($billingdetails->{branchfax});
+ $text->text($billing_library->branchfax);
$text->translate(100/mm, ($height-122.5)/mm);
- $text->text($billingdetails->{branchaddress1});
+ $text->text($billing_library->branchaddress1);
$text->translate(100/mm, ($height-127.5)/mm);
- $text->text($billingdetails->{branchaddress2});
+ $text->text($billing_library->branchaddress2);
$text->translate(100/mm, ($height-132.5)/mm);
- $text->text($billingdetails->{branchaddress3});
+ $text->text($billing_library->branchaddress3);
$text->translate(100/mm, ($height-137.5)/mm);
- $text->text(join(' ', $billingdetails->{branchzip}, $billingdetails->{branchcity}, $billingdetails->{branchcountry}));
+ $text->text(join(' ', $billing_library->branchzip, $billing_library->branchcity, $billing_library->branchcountry));
$text->translate(100/mm, ($height-147.5)/mm);
- $text->text($billingdetails->{branchemail});
+ $text->text($billing_library->branchemail);
# print subject
$text->translate(100/mm, ($height-145.5)/mm);
$start += 5;
}
} else {
- $text->text($deliverydetails->{branchaddress1});
+ $text->text($delivery_library->branchaddress1);
$text->translate(50/mm, ($height-242)/mm);
- $text->text($deliverydetails->{branchaddress2});
+ $text->text($delivery_library->branchaddress2);
$text->translate(50/mm, ($height-247)/mm);
- $text->text($deliverydetails->{branchaddress3});
+ $text->text($delivery_library->branchaddress3);
$text->translate(50/mm, ($height-252)/mm);
- $text->text(join(' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry}));
+ $text->text(join(' ', $delivery_library->branchzip, $delivery_library->branchcity, $delivery_library->branchcountry));
}
$text->translate(50/mm, ($height-262)/mm);
$text->text($basketgroup->{deliverycomment});
use warnings;
use utf8;
-use C4::Branch qw(GetBranchDetail GetBranchName);
+use C4::Branch qw(GetBranchName);
use Koha::Number::Price;
use Koha::DateUtils;
+use Koha::Libraries;
BEGIN {
use Exporter ();
# get library name
my $libraryname = C4::Context->preference("LibraryName");
- # get branch details
- my $billingdetails = GetBranchDetail( $basketgroup->{billingplace} );
- my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} );
+ my $billing_library = Koha::Libraries->find( $basketgroup->{billingplace} );
+ my $delivery_library = Koha::Libraries->find( $basketgroup->{deliveryplace} );
my $freedeliveryplace = $basketgroup->{freedeliveryplace};
# get the subject
my $subject;
$text->translate(100/mm, ($height-86)/mm);
$text->text($libraryname);
$text->translate(100/mm, ($height-97)/mm);
- $text->text($billingdetails->{branchname});
+ $text->text($billing_library->branchname);
$text->translate(100/mm, ($height-108.5)/mm);
- $text->text($billingdetails->{branchphone});
+ $text->text($billing_library->branchphone);
$text->translate(100/mm, ($height-115.5)/mm);
- $text->text($billingdetails->{branchfax});
+ $text->text($billing_library->branchfax);
$text->translate(100/mm, ($height-122.5)/mm);
- $text->text($billingdetails->{branchaddress1});
+ $text->text($billing_library->branchaddress1);
$text->translate(100/mm, ($height-127.5)/mm);
- $text->text($billingdetails->{branchaddress2});
+ $text->text($billing_library->branchaddress2);
$text->translate(100/mm, ($height-132.5)/mm);
- $text->text($billingdetails->{branchaddress3});
+ $text->text($billing_library->branchaddress3);
$text->translate(100/mm, ($height-137.5)/mm);
- $text->text(join(' ', $billingdetails->{branchzip}, $billingdetails->{branchcity}, $billingdetails->{branchcountry}));
+ $text->text(join(' ', $billing_library->branchzip, $billing_library->branchcity, $billing_library->branchcountry));
$text->translate(100/mm, ($height-147.5)/mm);
- $text->text($billingdetails->{branchemail});
+ $text->text($billing_library->branchemail);
# print subject
$text->translate(100/mm, ($height-145.5)/mm);
$start += 5;
}
} else {
- $text->text($deliverydetails->{branchaddress1});
+ $text->text($delivery_library->branchaddress1);
$text->translate(50/mm, ($height-242)/mm);
- $text->text($deliverydetails->{branchaddress2});
+ $text->text($delivery_library->branchaddress2);
$text->translate(50/mm, ($height-247)/mm);
- $text->text($deliverydetails->{branchaddress3});
+ $text->text($delivery_library->branchaddress3);
$text->translate(50/mm, ($height-252)/mm);
- $text->text(join(' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry}));
+ $text->text(join(' ', $delivery_library->branchzip, $delivery_library->branchcity, $delivery_library->branchcountry));
}
$text->translate(50/mm, ($height-262)/mm);
$text->text($basketgroup->{deliverycomment});
use C4::Biblio;
use C4::Items;
use C4::Members; # to use GetMember
-use C4::Branch; # GetBranchDetail
use C4::Serials; # CountSubscriptionFromBiblionumber
use C4::Search; # enabled_staff_search_views
use C4::Acquisition qw(GetOrdersByBiblionumber);
use C4::Branch;
use C4::Category;
use Koha::Borrower::Modifications;
+use Koha::Libraries;
use Koha::List::Patron;
my $query = new CGI;
my @branchloop;
if ( C4::Branch::onlymine ) {
my $userenv = C4::Context->userenv;
- my $branch = C4::Branch::GetBranchDetail( $userenv->{'branch'} );
+ my $library = Koha::Libraries->find( $userenv->{'branch'} );
push @branchloop, {
- value => $branch->{branchcode},
- branchcode => $branch->{branchcode},
- branchname => $branch->{branchname},
+ value => $library->branchcode,
+ branchcode => $library->branchcode,
+ branchname => $library->branchname,
selected => 1
}
} else {
use List::MoreUtils qw/uniq/;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::Borrower::Debarments qw(GetDebarments IsDebarred);
+use Koha::Libraries;
use Module::Load;
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
else {
$samebranch = 1;
}
-my $branchdetail = GetBranchDetail( $data->{'branchcode'});
-@{$data}{keys %$branchdetail} = values %$branchdetail; # merge in all branch columns
+my $library = Koha::Libraries->find( $data->{branchcode})->unblessed;
+@{$data}{keys %$library} = values %$library; # merge in all branch columns
my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
my $lib1 = &GetSortDetails( "Bsort1", $data->{'sort1'} );
use C4::Overdues;
use Koha::DateUtils;
use C4::Log;
+use Koha::Libraries;
=head1 NAME
## Get branch info for borrowers home library.
my $borrower_details = C4::Members::GetMember( borrowernumber => $borrowernumber );
my $borrower_branchcode = $borrower_details->{'branchcode'};
- my $branch = C4::Branch::GetBranchDetail( $borrower_branchcode );
+ my $branch = Koha::Libraries->find( $borrower_branchcode )->unblessed;
my %branch_info;
foreach my $key( keys %$branch ) {
$branch_info{"branches.$key"} = $branch->{$key};
use C4::Budgets qw( GetBudget );
use C4::Members qw( GetMember );
use C4::Suggestions qw( GetUnprocessedSuggestions );
+use Koha::Libraries;
my ( $help, $verbose, $confirm, @days );
GetOptions(
my $patron = C4::Members::GetMember( borrowernumber => $budget->{budget_owner_id} );
my $email_address =
C4::Members::GetNoticeEmailAddress( $budget->{budget_owner_id} );
- my $library = C4::Branch::GetBranchDetail( $patron->{branchcode} );
- my $admin_email_address = $library->{branchemail}
+ my $library = Koha::Libraries->find( $patron->{branchcode} );
+ my $admin_email_address = $library->branchemail
|| C4::Context->preference('KohaAdminEmailAddress');
if ($email_address) {
use Koha::Borrower::Debarments qw(AddUniqueDebarment);
use Koha::DateUtils;
use Koha::Calendar;
+use Koha::Libraries;
=head1 NAME
}
}
- my $branch_details = C4::Branch::GetBranchDetail($branchcode);
- my $admin_email_address = $branch_details->{'branchemail'}
+ my $library = Koha::Libraries->find($branchcode);
+ my $admin_email_address = $library->branchemail
|| C4::Context->preference('KohaAdminEmailAddress');
my @output_chunks; # may be sent to mail or stdout or csv file.
branchcode => $branchcode,
items => \@items,
substitute => { # this appears to be a hack to overcome incomplete features in this code.
- bib => $branch_details->{'branchname'}, # maybe 'bib' is a typo for 'lib<rary>'?
+ bib => $library->branchname, # maybe 'bib' is a typo for 'lib<rary>'?
'items.content' => $titles,
'count' => $itemcount,
},
city => $data->{'city'},
phone => $data->{'phone'},
cardnumber => $data->{'cardnumber'},
- branchname => $branch_details->{'branchname'},
+ branchname => $library->branchname,
letternumber => $i,
postcode => $data->{'zipcode'},
country => $data->{'country'},
use Koha::DateUtils;
use Koha::Borrower::Debarments qw(IsDebarred);
use Koha::Holds;
+use Koha::Libraries;
my $dbh = C4::Context->dbh;
my $input = new CGI;
$reserve{'reserve_id'} = $res->reserve_id();
if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
- $reserve{'branchloop'} = [ GetBranchDetail( $res->branchcode() ) ];
+ $reserve{'branchloop'} = [ Koha::Libraries->find( $res->branchcode() ) ];
}
else {
$reserve{'branchloop'} = GetBranchesLoop( $res->branchcode() );
use C4::Context;
use Data::Dumper;
-use Test::More tests => 21;
+use Test::More tests => 19;
use C4::Branch;
use Koha::Libraries;
GetBranch
GetBranches
GetBranchesLoop
- GetBranchDetail
ModBranch
GetBranchInfo
mybranch
branchip => 'ipA',
branchprinter => undef,
branchnotes => 'noteA',
- opac_info => 'opacA'
+ opac_info => 'opacA',
+ issuing => undef,
};
my $b2 = {
branchcode => 'BRB',
branchprinter => undef,
branchnotes => 'noteB',
opac_info => 'opacB',
+ issuing => undef,
};
ModBranch($b1);
is( ModBranch($b2), undef, 'the field add is missing' );
is( GetBranchName( $b1->{branchcode} ),
$b1->{branchname}, "GetBranchName returns the right name" );
-#Test GetBranchDetail
-my $branchdetail = GetBranchDetail( $b1->{branchcode} );
-$branchdetail->{add} = 1;
-$b1->{issuing} = undef; # Not used in DB
-is_deeply( $branchdetail, $b1, 'branchdetail is right' );
-
#Test Getbranches
my $branches = GetBranches();
is( scalar( keys %$branches ),
branchip => 'ipA modified',
branchprinter => undef,
branchnotes => 'notesA modified',
- opac_info => 'opacA modified'
+ opac_info => 'opacA modified',
+ issuing => undef,
};
ModBranch($b1);
is( Koha::Libraries->search->count, $count + 1,
"A branch has been modified, no new branch added" );
-$branchdetail = GetBranchDetail( $b1->{branchcode} );
-$b1->{issuing} = undef;
-is_deeply( $branchdetail, $b1 , "GetBranchDetail gives the details of BRA");
#Test categories
my $count_cat = Koha::LibraryCategories->search->count;
branchprinter => undef,
branchnotes => 'noteB',
opac_info => 'opacB',
+ issuing => undef,
CAT1 => 1,
CAT2 => 1
};
push( @cat, $cat2->{categorycode} );
delete $b2->{CAT1};
delete $b2->{CAT2};
-$b2->{issuing} = undef;
$b2->{categories} = \@cat;
is_deeply( @$b2info[0], $b2, 'BRB has the category CAT1 and CAT2' );
use Modern::Perl;
use C4::Members qw/AddMember GetMember GetBorrowercategory/;
-use C4::Branch;
+use Koha::Libraries;
use CGI qw ( -utf8 );
use Test::More tests => 15;
('UT','Unit tester',99,99,0.000000,1,0.000000,'C','default');");
}
-# Create branch
-unless ( GetBranchDetail('UT') ) {
+# Create library
+unless ( Koha::Libraries->find('UT') ) {
$dbh->do("INSERT INTO branches (branchcode,branchname) VALUES ('UT','Unit test library');");
}
holdingbranch => $library2->{branchcode},
}, $biblionumber );
- my $branch = GetBranchDetail( $library1->{branchcode} );
- $branch->{ opac_info } = "homebranch OPAC info";
- ModBranch($branch);
+ my $library = Koha::Libraries->find( $library1->{branchcode} )->unblessed;
+ $library->{ opac_info }= "homebranch OPAC info";
+ ModBranch($library);
- $branch = GetBranchDetail( $library2->{branchcode} );
- $branch->{ opac_info } = "holdingbranch OPAC info";
- ModBranch($branch);
+ $library = Koha::Libraries->find( $library2->{branchcode} )->unblessed;
+ $library->{ opac_info } = "holdingbranch OPAC info";
+ ModBranch($library);
my @results = GetItemsInfo( $biblionumber );
ok( @results, 'GetItemsInfo returns results');
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
-use Test::More tests => 69;
+use Test::More tests => 68;
use Test::MockModule;
use Test::Warn;
use_ok('C4::Context');
use_ok('C4::Members');
-use_ok('C4::Branch');
use_ok('C4::Acquisition');
use_ok('C4::Biblio');
use_ok('C4::Bookseller');
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Acquisition::Order;
use Koha::Acquisition::Bookseller;
+use Koha::Libraries;
my $schema = Koha::Database->schema;
$schema->storage->txn_begin();
substitute => $substitute,
repeat => $repeat,
));
-my $branch = GetBranchDetail($library->{branchcode});
-my $my_title_letter = qq|$branch->{branchname} - $substitute->{status}|;
+my $retrieved_library = Koha::Libraries->find($library->{branchcode});
+my $my_title_letter = $retrieved_library->branchname . qq| - $substitute->{status}|;
my $my_content_letter = qq|Dear Jane Smith,
According to our current records, you have items that are overdue.Your library does not charge late fines, but please return or renew them at the branch below as soon as possible.
-$branch->{branchname}
-$branch->{branchaddress1}
+|.$retrieved_library->branchname.qq|
+|.$retrieved_library->branchaddress1.qq|
URL: http://thisisatest.com
The following item(s) is/are currently $substitute->{status}:
use C4::Budgets qw( AddBudgetPeriod AddBudget );
use Koha::DateUtils qw( dt_from_string );
+use Koha::Libraries;
use DateTime::Duration;
use Test::More tests => 105;
$dbh->do(q|INSERT INTO letter(module, code, content) VALUES ('suggestions', 'CHECKED', 'my content')|);
# Add CPL if missing.
-if (not defined GetBranchDetail('CPL')) {
+if (not defined Koha::Libraries->find('CPL')) {
ModBranch({add => 1, branchcode => 'CPL', branchname => 'Centerville'});
}