View | Details | Raw Unified | Return to bug 15629
Collapse All | Expand All

(-)a/C4/Acquisition.pm (-3 / +4 lines)
Lines 31-36 use Koha::DateUtils qw( dt_from_string output_pref ); Link Here
31
use Koha::Acquisition::Order;
31
use Koha::Acquisition::Order;
32
use Koha::Acquisition::Bookseller;
32
use Koha::Acquisition::Bookseller;
33
use Koha::Number::Price;
33
use Koha::Number::Price;
34
use Koha::Libraries;
34
35
35
use C4::Koha qw( subfield_is_koha_internal_p );
36
use C4::Koha qw( subfield_is_koha_internal_p );
36
37
Lines 2949-2962 sub NotifyOrderUsers { Link Here
2949
    my $order = GetOrder( $ordernumber );
2950
    my $order = GetOrder( $ordernumber );
2950
    for my $borrowernumber (@borrowernumbers) {
2951
    for my $borrowernumber (@borrowernumbers) {
2951
        my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber );
2952
        my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber );
2952
        my $branch = C4::Branch::GetBranchDetail( $borrower->{branchcode} );
2953
        my $library = Koha::Libraries->find( $borrower->{branchcode} )->unblessed;
2953
        my $biblio = C4::Biblio::GetBiblio( $order->{biblionumber} );
2954
        my $biblio = C4::Biblio::GetBiblio( $order->{biblionumber} );
2954
        my $letter = C4::Letters::GetPreparedLetter(
2955
        my $letter = C4::Letters::GetPreparedLetter(
2955
            module      => 'acquisition',
2956
            module      => 'acquisition',
2956
            letter_code => 'ACQ_NOTIF_ON_RECEIV',
2957
            letter_code => 'ACQ_NOTIF_ON_RECEIV',
2957
            branchcode  => $branch->{branchcode},
2958
            branchcode  => $library->branchcode,
2958
            tables      => {
2959
            tables      => {
2959
                'branches'    => $branch,
2960
                'branches'    => $library,
2960
                'borrowers'   => $borrower,
2961
                'borrowers'   => $borrower,
2961
                'biblio'      => $biblio,
2962
                'biblio'      => $biblio,
2962
                'aqorders'    => $order,
2963
                'aqorders'    => $order,
(-)a/C4/Branch.pm (-17 lines)
Lines 33-39 BEGIN { Link Here
33
		&GetBranch
33
		&GetBranch
34
		&GetBranches
34
		&GetBranches
35
		&GetBranchesLoop
35
		&GetBranchesLoop
36
		&GetBranchDetail
37
		&ModBranch
36
		&ModBranch
38
		&GetBranchInfo
37
		&GetBranchInfo
39
		&mybranch
38
		&mybranch
Lines 293-314 sub GetBranch { Link Here
293
    return $branch;
292
    return $branch;
294
}
293
}
295
294
296
=head2 GetBranchDetail
297
298
    $branch = &GetBranchDetail($branchcode);
299
300
Given the branch code, the function returns a
301
hashref for the corresponding row in the branches table.
302
303
=cut
304
305
sub GetBranchDetail {
306
    my ($branchcode) = shift or return;
307
    my $sth = C4::Context->dbh->prepare("SELECT * FROM branches WHERE branchcode = ?");
308
    $sth->execute($branchcode);
309
    return $sth->fetchrow_hashref();
310
}
311
312
=head2 GetBranchInfo
295
=head2 GetBranchInfo
313
296
314
$results = GetBranchInfo($branchcode);
297
$results = GetBranchInfo($branchcode);
(-)a/C4/Circulation.pm (-1 / +2 lines)
Lines 51-56 use Koha::Items; Link Here
51
use Koha::Borrowers;
51
use Koha::Borrowers;
52
use Koha::Borrower::Debarments;
52
use Koha::Borrower::Debarments;
53
use Koha::Database;
53
use Koha::Database;
54
use Koha::Libraries;
54
use Carp;
55
use Carp;
55
use List::MoreUtils qw( uniq );
56
use List::MoreUtils qw( uniq );
56
use Date::Calc qw(
57
use Date::Calc qw(
Lines 1796-1802 patron who last borrowed the book. Link Here
1796
sub AddReturn {
1797
sub AddReturn {
1797
    my ( $barcode, $branch, $exemptfine, $dropbox, $return_date, $dropboxdate ) = @_;
1798
    my ( $barcode, $branch, $exemptfine, $dropbox, $return_date, $dropboxdate ) = @_;
1798
1799
1799
    if ($branch and not GetBranchDetail($branch)) {
1800
    if ($branch and not Koha::Libraries->find($branch)) {
1800
        warn "AddReturn error: branch '$branch' not found.  Reverting to " . C4::Context->userenv->{'branch'};
1801
        warn "AddReturn error: branch '$branch' not found.  Reverting to " . C4::Context->userenv->{'branch'};
1801
        undef $branch;
1802
        undef $branch;
1802
    }
1803
    }
(-)a/C4/Letters.pm (-14 / +14 lines)
Lines 418-424 sub SendAlerts { Link Here
418
418
419
#                    warn "sending issues...";
419
#                    warn "sending issues...";
420
            my $userenv = C4::Context->userenv;
420
            my $userenv = C4::Context->userenv;
421
            my $branchdetails = GetBranchDetail($_->{'branchcode'});
421
            my $library = Koha::Libraries->find( $_->{branchcode} );
422
            my $letter = GetPreparedLetter (
422
            my $letter = GetPreparedLetter (
423
                module => 'serial',
423
                module => 'serial',
424
                letter_code => $letter_code,
424
                letter_code => $letter_code,
Lines 439-447 sub SendAlerts { Link Here
439
            my %mail = $message->create_message_headers(
439
            my %mail = $message->create_message_headers(
440
                {
440
                {
441
                    to      => $email,
441
                    to      => $email,
442
                    from    => $branchdetails->{'branchemail'},
442
                    from    => $library->branchemail,
443
                    replyto => $branchdetails->{'branchreplyto'},
443
                    replyto => $library->branchreplyto,
444
                    sender  => $branchdetails->{'branchreturnpath'},
444
                    sender  => $library->branchreturnpath,
445
                    subject => Encode::encode( "UTF-8", "" . $letter->{title} ),
445
                    subject => Encode::encode( "UTF-8", "" . $letter->{title} ),
446
                    message => $letter->{'is_html'}
446
                    message => $letter->{'is_html'}
447
                                ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ),
447
                                ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ),
Lines 569-581 sub SendAlerts { Link Here
569
    }
569
    }
570
   # send an "account details" notice to a newly created user
570
   # send an "account details" notice to a newly created user
571
    elsif ( $type eq 'members' ) {
571
    elsif ( $type eq 'members' ) {
572
        my $branchdetails = GetBranchDetail($externalid->{'branchcode'});
572
        my $library = Koha::Libraries->find( $externalid->{branchcode} )->unblessed;
573
        my $letter = GetPreparedLetter (
573
        my $letter = GetPreparedLetter (
574
            module => 'members',
574
            module => 'members',
575
            letter_code => $letter_code,
575
            letter_code => $letter_code,
576
            branchcode => $externalid->{'branchcode'},
576
            branchcode => $externalid->{'branchcode'},
577
            tables => {
577
            tables => {
578
                'branches'    => $branchdetails,
578
                'branches'    => $library,
579
                'borrowers' => $externalid->{'borrowernumber'},
579
                'borrowers' => $externalid->{'borrowernumber'},
580
            },
580
            },
581
            substitute => { 'borrowers.password' => $externalid->{'password'} },
581
            substitute => { 'borrowers.password' => $externalid->{'password'} },
Lines 586-594 sub SendAlerts { Link Here
586
        my %mail  = $email->create_message_headers(
586
        my %mail  = $email->create_message_headers(
587
            {
587
            {
588
                to      => $externalid->{'emailaddr'},
588
                to      => $externalid->{'emailaddr'},
589
                from    => $branchdetails->{'branchemail'},
589
                from    => $library->{branchemail},
590
                replyto => $branchdetails->{'branchreplyto'},
590
                replyto => $library->{branchreplyto},
591
                sender  => $branchdetails->{'branchreturnpath'},
591
                sender  => $library->{branchreturnpath},
592
                subject => Encode::encode( "UTF-8", "" . $letter->{'title'} ),
592
                subject => Encode::encode( "UTF-8", "" . $letter->{'title'} ),
593
                message => $letter->{'is_html'}
593
                message => $letter->{'is_html'}
594
                            ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ),
594
                            ? _wrap_html( Encode::encode( "UTF-8", $letter->{'content'} ),
Lines 1197-1207 sub _send_message_by_email { Link Here
1197
    my $branch_email = undef;
1197
    my $branch_email = undef;
1198
    my $branch_replyto = undef;
1198
    my $branch_replyto = undef;
1199
    my $branch_returnpath = undef;
1199
    my $branch_returnpath = undef;
1200
    if ($member){
1200
    if ($member) {
1201
        my $branchdetail = GetBranchDetail( $member->{'branchcode'} );
1201
        my $library = Koha::Libraries->find( $member->{branchcode} );
1202
        $branch_email = $branchdetail->{'branchemail'};
1202
        $branch_email      = $library->branchemail;
1203
        $branch_replyto = $branchdetail->{'branchreplyto'};
1203
        $branch_replyto    = $library->branchreplyto;
1204
        $branch_returnpath = $branchdetail->{'branchreturnpath'};
1204
        $branch_returnpath = $library->branchreturnpath;
1205
    }
1205
    }
1206
    my $email = Koha::Email->new();
1206
    my $email = Koha::Email->new();
1207
    my %sendmail_params = $email->create_message_headers(
1207
    my %sendmail_params = $email->create_message_headers(
(-)a/C4/Reserves.pm (-7 / +7 lines)
Lines 34-46 use C4::Accounts; Link Here
34
use C4::Members::Messaging;
34
use C4::Members::Messaging;
35
use C4::Members qw();
35
use C4::Members qw();
36
use C4::Letters;
36
use C4::Letters;
37
use C4::Branch qw( GetBranchDetail );
38
37
39
use Koha::DateUtils;
38
use Koha::DateUtils;
40
use Koha::Calendar;
39
use Koha::Calendar;
41
use Koha::Database;
40
use Koha::Database;
42
use Koha::Hold;
41
use Koha::Hold;
43
use Koha::Holds;
42
use Koha::Holds;
43
use Koha::Libraries;
44
44
45
use List::MoreUtils qw( firstidx any );
45
use List::MoreUtils qw( firstidx any );
46
use Carp;
46
use Carp;
Lines 219-231 sub AddReserve { Link Here
219
    # Send e-mail to librarian if syspref is active
219
    # Send e-mail to librarian if syspref is active
220
    if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){
220
    if(C4::Context->preference("emailLibrarianWhenHoldIsPlaced")){
221
        my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
221
        my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
222
        my $branch_details = C4::Branch::GetBranchDetail($borrower->{branchcode});
222
        my $library = Koha::Libraries->find($borrower->{branchcode})->unblessed;
223
        if ( my $letter =  C4::Letters::GetPreparedLetter (
223
        if ( my $letter =  C4::Letters::GetPreparedLetter (
224
            module => 'reserves',
224
            module => 'reserves',
225
            letter_code => 'HOLDPLACED',
225
            letter_code => 'HOLDPLACED',
226
            branchcode => $branch,
226
            branchcode => $branch,
227
            tables => {
227
            tables => {
228
                'branches'    => $branch_details,
228
                'branches'    => $library,
229
                'borrowers'   => $borrower,
229
                'borrowers'   => $borrower,
230
                'biblio'      => $biblionumber,
230
                'biblio'      => $biblionumber,
231
                'biblioitems' => $biblionumber,
231
                'biblioitems' => $biblionumber,
Lines 233-239 sub AddReserve { Link Here
233
            },
233
            },
234
        ) ) {
234
        ) ) {
235
235
236
            my $admin_email_address =$branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
236
            my $admin_email_address = $library->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
237
237
238
            C4::Letters::EnqueueLetter(
238
            C4::Letters::EnqueueLetter(
239
                {   letter                 => $letter,
239
                {   letter                 => $letter,
Lines 1990-2004 sub _koha_notify_reserve { Link Here
1990
    ");
1990
    ");
1991
    $sth->execute( $borrowernumber, $biblionumber );
1991
    $sth->execute( $borrowernumber, $biblionumber );
1992
    my $reserve = $sth->fetchrow_hashref;
1992
    my $reserve = $sth->fetchrow_hashref;
1993
    my $branch_details = GetBranchDetail( $reserve->{'branchcode'} );
1993
    my $library = Koha::Libraries->find( $reserve->{branchcode} )->unblessed;
1994
1994
1995
    my $admin_email_address = $branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress');
1995
    my $admin_email_address = $library->{branchemail} || C4::Context->preference('KohaAdminEmailAddress');
1996
1996
1997
    my %letter_params = (
1997
    my %letter_params = (
1998
        module => 'reserves',
1998
        module => 'reserves',
1999
        branchcode => $reserve->{branchcode},
1999
        branchcode => $reserve->{branchcode},
2000
        tables => {
2000
        tables => {
2001
            'branches'       => $branch_details,
2001
            'branches'       => $library,
2002
            'borrowers'      => $borrower,
2002
            'borrowers'      => $borrower,
2003
            'biblio'         => $biblionumber,
2003
            'biblio'         => $biblionumber,
2004
            'biblioitems'    => $biblionumber,
2004
            'biblioitems'    => $biblionumber,
(-)a/acqui/addorderiso2709.pl (-1 lines)
Lines 210-216 if ($op eq ""){ Link Here
210
        }
210
        }
211
        # 3rd add order
211
        # 3rd add order
212
        my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser );
212
        my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser );
213
        my $branch = C4::Branch->GetBranchDetail( $patron->{branchcode} );
214
        # get quantity in the MARC record (1 if none)
213
        # get quantity in the MARC record (1 if none)
215
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
214
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
216
        my %orderinfo = (
215
        my %orderinfo = (
(-)a/acqui/pdfformat/layout2pages.pm (-17 / +15 lines)
Lines 28-37 use strict; Link Here
28
use warnings;
28
use warnings;
29
use utf8;
29
use utf8;
30
30
31
use C4::Branch qw(GetBranchDetail);
32
33
use Koha::Number::Price;
31
use Koha::Number::Price;
34
use Koha::DateUtils;
32
use Koha::DateUtils;
33
use Koha::Libraries;
35
34
36
BEGIN {
35
BEGIN {
37
         use Exporter   ();
36
         use Exporter   ();
Lines 147-155 sub printhead { Link Here
147
146
148
    # get library name
147
    # get library name
149
    my $libraryname = C4::Context->preference("LibraryName");
148
    my $libraryname = C4::Context->preference("LibraryName");
150
    # get branch details
149
    my $billing_library  = Koha::Libraries->find( $basketgroup->{billingplace} );
151
    my $billingdetails  = GetBranchDetail( $basketgroup->{billingplace} );
150
    my $delivery_library = Koha::Libraries->find( $basketgroup->{deliveryplace} );
152
    my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} );
153
    my $freedeliveryplace = $basketgroup->{freedeliveryplace};
151
    my $freedeliveryplace = $basketgroup->{freedeliveryplace};
154
    # get the subject
152
    # get the subject
155
    my $subject;
153
    my $subject;
Lines 181-201 sub printhead { Link Here
181
    $text->translate(100/mm, ($height-86)/mm);
179
    $text->translate(100/mm, ($height-86)/mm);
182
    $text->text($libraryname);
180
    $text->text($libraryname);
183
    $text->translate(100/mm, ($height-97)/mm);
181
    $text->translate(100/mm, ($height-97)/mm);
184
    $text->text($billingdetails->{branchname});
182
    $text->text($billing_library->branchname);
185
    $text->translate(100/mm, ($height-108.5)/mm);
183
    $text->translate(100/mm, ($height-108.5)/mm);
186
    $text->text($billingdetails->{branchphone});
184
    $text->text($billing_library->branchphone);
187
    $text->translate(100/mm, ($height-115.5)/mm);
185
    $text->translate(100/mm, ($height-115.5)/mm);
188
    $text->text($billingdetails->{branchfax});
186
    $text->text($billing_library->branchfax);
189
    $text->translate(100/mm, ($height-122.5)/mm);
187
    $text->translate(100/mm, ($height-122.5)/mm);
190
    $text->text($billingdetails->{branchaddress1});
188
    $text->text($billing_library->branchaddress1);
191
    $text->translate(100/mm, ($height-127.5)/mm);
189
    $text->translate(100/mm, ($height-127.5)/mm);
192
    $text->text($billingdetails->{branchaddress2});
190
    $text->text($billing_library->branchaddress2);
193
    $text->translate(100/mm, ($height-132.5)/mm);
191
    $text->translate(100/mm, ($height-132.5)/mm);
194
    $text->text($billingdetails->{branchaddress3});
192
    $text->text($billing_library->branchaddress3);
195
    $text->translate(100/mm, ($height-137.5)/mm);
193
    $text->translate(100/mm, ($height-137.5)/mm);
196
    $text->text(join(' ', $billingdetails->{branchzip}, $billingdetails->{branchcity}, $billingdetails->{branchcountry}));
194
    $text->text(join(' ', $billing_library->branchzip, $billing_library->branchcity, $billing_library->branchcountry));
197
    $text->translate(100/mm, ($height-147.5)/mm);
195
    $text->translate(100/mm, ($height-147.5)/mm);
198
    $text->text($billingdetails->{branchemail});
196
    $text->text($billing_library->branchemail);
199
    
197
    
200
    # print subject
198
    # print subject
201
    $text->translate(100/mm, ($height-145.5)/mm);
199
    $text->translate(100/mm, ($height-145.5)/mm);
Lines 227-239 sub printhead { Link Here
227
            $start += 5;
225
            $start += 5;
228
        }
226
        }
229
    } else {
227
    } else {
230
        $text->text( $deliverydetails->{branchaddress1} );
228
        $text->text( $delivery_library->branchaddress1 );
231
        $text->translate( 50 / mm, ( $height - 242 ) / mm );
229
        $text->translate( 50 / mm, ( $height - 242 ) / mm );
232
        $text->text( $deliverydetails->{branchaddress2} );
230
        $text->text( $delivery_library->branchaddress2 );
233
        $text->translate( 50 / mm, ( $height - 247 ) / mm );
231
        $text->translate( 50 / mm, ( $height - 247 ) / mm );
234
        $text->text( $deliverydetails->{branchaddress3} );
232
        $text->text( $delivery_library->branchaddress3 );
235
        $text->translate( 50 / mm, ( $height - 252 ) / mm );
233
        $text->translate( 50 / mm, ( $height - 252 ) / mm );
236
        $text->text( join( ' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry} ) );
234
        $text->text( join( ' ', $delivery_library->branchzip, $delivery_library->branchcity, $delivery_library->branchcountry ) );
237
    }
235
    }
238
    $text->translate(50/mm, ($height-262)/mm);
236
    $text->translate(50/mm, ($height-262)/mm);
239
    $text->text($basketgroup->{deliverycomment});
237
    $text->text($basketgroup->{deliverycomment});
(-)a/acqui/pdfformat/layout2pagesde.pm (-17 / +15 lines)
Lines 28-37 use strict; Link Here
28
use warnings;
28
use warnings;
29
use utf8;
29
use utf8;
30
30
31
use C4::Branch qw(GetBranchDetail);
32
33
use Koha::Number::Price;
31
use Koha::Number::Price;
34
use Koha::DateUtils;
32
use Koha::DateUtils;
33
use Koha::Libraries;
35
34
36
BEGIN {
35
BEGIN {
37
         use Exporter   ();
36
         use Exporter   ();
Lines 147-155 sub printhead { Link Here
147
146
148
    # get library name
147
    # get library name
149
    my $libraryname = C4::Context->preference("LibraryName");
148
    my $libraryname = C4::Context->preference("LibraryName");
150
    # get branch details
149
    my $billing_library  = Koha::Libraries->find( $basketgroup->{billingplace} );
151
    my $billingdetails  = GetBranchDetail( $basketgroup->{billingplace} );
150
    my $delivery_library = Koha::Libraries->find( $basketgroup->{deliveryplace} );
152
    my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} );
153
    my $freedeliveryplace = $basketgroup->{freedeliveryplace};
151
    my $freedeliveryplace = $basketgroup->{freedeliveryplace};
154
    # get the subject
152
    # get the subject
155
    my $subject;
153
    my $subject;
Lines 181-201 sub printhead { Link Here
181
    $text->translate(100/mm, ($height-86)/mm);
179
    $text->translate(100/mm, ($height-86)/mm);
182
    $text->text($libraryname);
180
    $text->text($libraryname);
183
    $text->translate(100/mm, ($height-97)/mm);
181
    $text->translate(100/mm, ($height-97)/mm);
184
    $text->text($billingdetails->{branchname});
182
    $text->text($billing_library->branchname);
185
    $text->translate(100/mm, ($height-108.5)/mm);
183
    $text->translate(100/mm, ($height-108.5)/mm);
186
    $text->text($billingdetails->{branchphone});
184
    $text->text($billing_library->branchphone);
187
    $text->translate(100/mm, ($height-115.5)/mm);
185
    $text->translate(100/mm, ($height-115.5)/mm);
188
    $text->text($billingdetails->{branchfax});
186
    $text->text($billing_library->branchfax);
189
    $text->translate(100/mm, ($height-122.5)/mm);
187
    $text->translate(100/mm, ($height-122.5)/mm);
190
    $text->text($billingdetails->{branchaddress1});
188
    $text->text($billing_library->branchaddress1);
191
    $text->translate(100/mm, ($height-127.5)/mm);
189
    $text->translate(100/mm, ($height-127.5)/mm);
192
    $text->text($billingdetails->{branchaddress2});
190
    $text->text($billing_library->branchaddress2);
193
    $text->translate(100/mm, ($height-132.5)/mm);
191
    $text->translate(100/mm, ($height-132.5)/mm);
194
    $text->text($billingdetails->{branchaddress3});
192
    $text->text($billing_library->branchaddress3);
195
    $text->translate(100/mm, ($height-137.5)/mm);
193
    $text->translate(100/mm, ($height-137.5)/mm);
196
    $text->text(join(' ', $billingdetails->{branchzip}, $billingdetails->{branchcity}, $billingdetails->{branchcountry}));
194
    $text->text(join(' ', $billing_library->branchzip, $billing_library->branchcity, $billing_library->branchcountry));
197
    $text->translate(100/mm, ($height-147.5)/mm);
195
    $text->translate(100/mm, ($height-147.5)/mm);
198
    $text->text($billingdetails->{branchemail});
196
    $text->text($billing_library->branchemail);
199
    
197
    
200
    # print subject
198
    # print subject
201
    $text->translate(100/mm, ($height-145.5)/mm);
199
    $text->translate(100/mm, ($height-145.5)/mm);
Lines 227-239 sub printhead { Link Here
227
            $start += 5;
225
            $start += 5;
228
        }
226
        }
229
    } else {
227
    } else {
230
        $text->text( $deliverydetails->{branchaddress1} );
228
        $text->text( $delivery_library->branchaddress1 );
231
        $text->translate( 50 / mm, ( $height - 242 ) / mm );
229
        $text->translate( 50 / mm, ( $height - 242 ) / mm );
232
        $text->text( $deliverydetails->{branchaddress2} );
230
        $text->text( $delivery_library->branchaddress2 );
233
        $text->translate( 50 / mm, ( $height - 247 ) / mm );
231
        $text->translate( 50 / mm, ( $height - 247 ) / mm );
234
        $text->text( $deliverydetails->{branchaddress3} );
232
        $text->text( $delivery_library->branchaddress3 );
235
        $text->translate( 50 / mm, ( $height - 252 ) / mm );
233
        $text->translate( 50 / mm, ( $height - 252 ) / mm );
236
        $text->text( join( ' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry} ) );
234
        $text->text( join( ' ', $delivery_library->branchzip, $delivery_library->branchcity, $delivery_library->branchcountry ) );
237
    }
235
    }
238
    $text->translate(50/mm, ($height-262)/mm);
236
    $text->translate(50/mm, ($height-262)/mm);
239
    $text->text($basketgroup->{deliverycomment});
237
    $text->text($basketgroup->{deliverycomment});
(-)a/acqui/pdfformat/layout3pages.pm (-16 / +16 lines)
Lines 29-38 use strict; Link Here
29
use warnings;
29
use warnings;
30
use utf8;
30
use utf8;
31
31
32
use C4::Branch qw(GetBranchDetail GetBranchName);
32
use C4::Branch qw(GetBranchName);
33
33
34
use Koha::Number::Price;
34
use Koha::Number::Price;
35
use Koha::DateUtils;
35
use Koha::DateUtils;
36
use Koha::Libraries;
36
37
37
BEGIN {
38
BEGIN {
38
         use Exporter   ();
39
         use Exporter   ();
Lines 311-319 sub printhead { Link Here
311
312
312
    # get library name
313
    # get library name
313
    my $libraryname = C4::Context->preference("LibraryName");
314
    my $libraryname = C4::Context->preference("LibraryName");
314
    # get branch details
315
    my $billing_library  = Koha::Libraries->find( $basketgroup->{billingplace} );
315
    my $billingdetails  = GetBranchDetail( $basketgroup->{billingplace} );
316
    my $delivery_library = Koha::Libraries->find( $basketgroup->{deliveryplace} );
316
    my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} );
317
    my $freedeliveryplace = $basketgroup->{freedeliveryplace};
317
    my $freedeliveryplace = $basketgroup->{freedeliveryplace};
318
    # get the subject
318
    # get the subject
319
    my $subject;
319
    my $subject;
Lines 345-365 sub printhead { Link Here
345
    $text->translate(100/mm,  ($height-86)/mm);
345
    $text->translate(100/mm,  ($height-86)/mm);
346
    $text->text($libraryname);
346
    $text->text($libraryname);
347
    $text->translate(100/mm,  ($height-97)/mm);
347
    $text->translate(100/mm,  ($height-97)/mm);
348
    $text->text($billingdetails->{branchname});
348
    $text->text($billing_library->branchname);
349
    $text->translate(100/mm,  ($height-108.5)/mm);
349
    $text->translate(100/mm,  ($height-108.5)/mm);
350
    $text->text($billingdetails->{branchphone});
350
    $text->text($billing_library->branchphone);
351
    $text->translate(100/mm,  ($height-115.5)/mm);
351
    $text->translate(100/mm,  ($height-115.5)/mm);
352
    $text->text($billingdetails->{branchfax});
352
    $text->text($billing_library->branchfax);
353
    $text->translate(100/mm,  ($height-122.5)/mm);
353
    $text->translate(100/mm,  ($height-122.5)/mm);
354
    $text->text($billingdetails->{branchaddress1});
354
    $text->text($billing_library->branchaddress1);
355
    $text->translate(100/mm,  ($height-127.5)/mm);
355
    $text->translate(100/mm,  ($height-127.5)/mm);
356
    $text->text($billingdetails->{branchaddress2});
356
    $text->text($billing_library->branchaddress2);
357
    $text->translate(100/mm,  ($height-132.5)/mm);
357
    $text->translate(100/mm,  ($height-132.5)/mm);
358
    $text->text($billingdetails->{branchaddress3});
358
    $text->text($billing_library->branchaddress3);
359
    $text->translate(100/mm,  ($height-137.5)/mm);
359
    $text->translate(100/mm,  ($height-137.5)/mm);
360
    $text->text(join(' ', $billingdetails->{branchzip}, $billingdetails->{branchcity}, $billingdetails->{branchcountry}));
360
    $text->text(join(' ', $billing_library->branchzip, $billing_library->branchcity, $billing_library->branchcountry));
361
    $text->translate(100/mm,  ($height-147.5)/mm);
361
    $text->translate(100/mm,  ($height-147.5)/mm);
362
    $text->text($billingdetails->{branchemail});
362
    $text->text($billing_library->branchemail);
363
    
363
    
364
    # print subject
364
    # print subject
365
    $text->translate(100/mm,  ($height-145.5)/mm);
365
    $text->translate(100/mm,  ($height-145.5)/mm);
Lines 391-403 sub printhead { Link Here
391
            $start += 5;
391
            $start += 5;
392
        }
392
        }
393
    } else {
393
    } else {
394
        $text->text($deliverydetails->{branchaddress1});
394
        $text->text($delivery_library->branchaddress1);
395
        $text->translate(50/mm,  ($height-242)/mm);
395
        $text->translate(50/mm,  ($height-242)/mm);
396
        $text->text($deliverydetails->{branchaddress2});
396
        $text->text($delivery_library->branchaddress2);
397
        $text->translate(50/mm,  ($height-247)/mm);
397
        $text->translate(50/mm,  ($height-247)/mm);
398
        $text->text($deliverydetails->{branchaddress3});
398
        $text->text($delivery_library->branchaddress3);
399
        $text->translate(50/mm,  ($height-252)/mm);
399
        $text->translate(50/mm,  ($height-252)/mm);
400
        $text->text(join(' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry}));
400
        $text->text(join(' ', $delivery_library->branchzip, $delivery_library->branchcity, $delivery_library->branchcountry));
401
    }
401
    }
402
    $text->translate(50/mm,  ($height-262)/mm);
402
    $text->translate(50/mm,  ($height-262)/mm);
403
    $text->text($basketgroup->{deliverycomment});
403
    $text->text($basketgroup->{deliverycomment});
(-)a/acqui/pdfformat/layout3pagesfr.pm (-16 / +16 lines)
Lines 28-37 use strict; Link Here
28
use warnings;
28
use warnings;
29
use utf8;
29
use utf8;
30
30
31
use C4::Branch qw(GetBranchDetail GetBranchName);
31
use C4::Branch qw(GetBranchName);
32
32
33
use Koha::Number::Price;
33
use Koha::Number::Price;
34
use Koha::DateUtils;
34
use Koha::DateUtils;
35
use Koha::Libraries;
35
36
36
BEGIN {
37
BEGIN {
37
         use Exporter   ();
38
         use Exporter   ();
Lines 311-319 sub printhead { Link Here
311
312
312
    # get library name
313
    # get library name
313
    my $libraryname = C4::Context->preference("LibraryName");
314
    my $libraryname = C4::Context->preference("LibraryName");
314
    # get branch details
315
    my $billing_library  = Koha::Libraries->find( $basketgroup->{billingplace} );
315
    my $billingdetails  = GetBranchDetail( $basketgroup->{billingplace} );
316
    my $delivery_library = Koha::Libraries->find( $basketgroup->{deliveryplace} );
316
    my $deliverydetails = GetBranchDetail( $basketgroup->{deliveryplace} );
317
    my $freedeliveryplace = $basketgroup->{freedeliveryplace};
317
    my $freedeliveryplace = $basketgroup->{freedeliveryplace};
318
    # get the subject
318
    # get the subject
319
    my $subject;
319
    my $subject;
Lines 345-365 sub printhead { Link Here
345
    $text->translate(100/mm,  ($height-86)/mm);
345
    $text->translate(100/mm,  ($height-86)/mm);
346
    $text->text($libraryname);
346
    $text->text($libraryname);
347
    $text->translate(100/mm,  ($height-97)/mm);
347
    $text->translate(100/mm,  ($height-97)/mm);
348
    $text->text($billingdetails->{branchname});
348
    $text->text($billing_library->branchname);
349
    $text->translate(100/mm,  ($height-108.5)/mm);
349
    $text->translate(100/mm,  ($height-108.5)/mm);
350
    $text->text($billingdetails->{branchphone});
350
    $text->text($billing_library->branchphone);
351
    $text->translate(100/mm,  ($height-115.5)/mm);
351
    $text->translate(100/mm,  ($height-115.5)/mm);
352
    $text->text($billingdetails->{branchfax});
352
    $text->text($billing_library->branchfax);
353
    $text->translate(100/mm,  ($height-122.5)/mm);
353
    $text->translate(100/mm,  ($height-122.5)/mm);
354
    $text->text($billingdetails->{branchaddress1});
354
    $text->text($billing_library->branchaddress1);
355
    $text->translate(100/mm,  ($height-127.5)/mm);
355
    $text->translate(100/mm,  ($height-127.5)/mm);
356
    $text->text($billingdetails->{branchaddress2});
356
    $text->text($billing_library->branchaddress2);
357
    $text->translate(100/mm,  ($height-132.5)/mm);
357
    $text->translate(100/mm,  ($height-132.5)/mm);
358
    $text->text($billingdetails->{branchaddress3});
358
    $text->text($billing_library->branchaddress3);
359
    $text->translate(100/mm,  ($height-137.5)/mm);
359
    $text->translate(100/mm,  ($height-137.5)/mm);
360
    $text->text(join(' ', $billingdetails->{branchzip}, $billingdetails->{branchcity}, $billingdetails->{branchcountry}));
360
    $text->text(join(' ', $billing_library->branchzip, $billing_library->branchcity, $billing_library->branchcountry));
361
    $text->translate(100/mm,  ($height-147.5)/mm);
361
    $text->translate(100/mm,  ($height-147.5)/mm);
362
    $text->text($billingdetails->{branchemail});
362
    $text->text($billing_library->branchemail);
363
363
364
    # print subject
364
    # print subject
365
    $text->translate(100/mm,  ($height-145.5)/mm);
365
    $text->translate(100/mm,  ($height-145.5)/mm);
Lines 391-403 sub printhead { Link Here
391
            $start += 5;
391
            $start += 5;
392
        }
392
        }
393
    } else {
393
    } else {
394
        $text->text($deliverydetails->{branchaddress1});
394
        $text->text($delivery_library->branchaddress1);
395
        $text->translate(50/mm,  ($height-242)/mm);
395
        $text->translate(50/mm,  ($height-242)/mm);
396
        $text->text($deliverydetails->{branchaddress2});
396
        $text->text($delivery_library->branchaddress2);
397
        $text->translate(50/mm,  ($height-247)/mm);
397
        $text->translate(50/mm,  ($height-247)/mm);
398
        $text->text($deliverydetails->{branchaddress3});
398
        $text->text($delivery_library->branchaddress3);
399
        $text->translate(50/mm,  ($height-252)/mm);
399
        $text->translate(50/mm,  ($height-252)/mm);
400
        $text->text(join(' ', $deliverydetails->{branchzip}, $deliverydetails->{branchcity}, $deliverydetails->{branchcountry}));
400
        $text->text(join(' ', $delivery_library->branchzip, $delivery_library->branchcity, $delivery_library->branchcountry));
401
    }
401
    }
402
    $text->translate(50/mm,  ($height-262)/mm);
402
    $text->translate(50/mm,  ($height-262)/mm);
403
    $text->text($basketgroup->{deliverycomment});
403
    $text->text($basketgroup->{deliverycomment});
(-)a/catalogue/ISBDdetail.pl (-1 lines)
Lines 44-50 use C4::Koha; Link Here
44
use C4::Biblio;
44
use C4::Biblio;
45
use C4::Items;
45
use C4::Items;
46
use C4::Members; # to use GetMember
46
use C4::Members; # to use GetMember
47
use C4::Branch;     # GetBranchDetail
48
use C4::Serials;    # CountSubscriptionFromBiblionumber
47
use C4::Serials;    # CountSubscriptionFromBiblionumber
49
use C4::Search;		# enabled_staff_search_views
48
use C4::Search;		# enabled_staff_search_views
50
use C4::Acquisition qw(GetOrdersByBiblionumber);
49
use C4::Acquisition qw(GetOrdersByBiblionumber);
(-)a/members/members-home.pl (-4 / +5 lines)
Lines 27-32 use C4::Members; Link Here
27
use C4::Branch;
27
use C4::Branch;
28
use C4::Category;
28
use C4::Category;
29
use Koha::Borrower::Modifications;
29
use Koha::Borrower::Modifications;
30
use Koha::Libraries;
30
use Koha::List::Patron;
31
use Koha::List::Patron;
31
32
32
my $query = new CGI;
33
my $query = new CGI;
Lines 47-57 my $branches = GetBranches; Link Here
47
my @branchloop;
48
my @branchloop;
48
if ( C4::Branch::onlymine ) {
49
if ( C4::Branch::onlymine ) {
49
    my $userenv = C4::Context->userenv;
50
    my $userenv = C4::Context->userenv;
50
    my $branch = C4::Branch::GetBranchDetail( $userenv->{'branch'} );
51
    my $library = Koha::Libraries->find( $userenv->{'branch'} );
51
    push @branchloop, {
52
    push @branchloop, {
52
        value => $branch->{branchcode},
53
        value => $library->branchcode,
53
        branchcode => $branch->{branchcode},
54
        branchcode => $library->branchcode,
54
        branchname => $branch->{branchname},
55
        branchname => $library->branchname,
55
        selected => 1
56
        selected => 1
56
    }
57
    }
57
} else {
58
} else {
(-)a/members/moremember.pl (-2 / +3 lines)
Lines 52-57 use C4::Form::MessagingPreferences; Link Here
52
use List::MoreUtils qw/uniq/;
52
use List::MoreUtils qw/uniq/;
53
use C4::Members::Attributes qw(GetBorrowerAttributes);
53
use C4::Members::Attributes qw(GetBorrowerAttributes);
54
use Koha::Borrower::Debarments qw(GetDebarments IsDebarred);
54
use Koha::Borrower::Debarments qw(GetDebarments IsDebarred);
55
use Koha::Libraries;
55
use Module::Load;
56
use Module::Load;
56
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
57
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
57
    load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
58
    load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
Lines 215-222 if ( C4::Context->preference("IndependentBranches") ) { Link Here
215
else {
216
else {
216
    $samebranch = 1;
217
    $samebranch = 1;
217
}
218
}
218
my $branchdetail = GetBranchDetail( $data->{'branchcode'});
219
my $library = Koha::Libraries->find( $data->{branchcode})->unblessed;
219
@{$data}{keys %$branchdetail} = values %$branchdetail; # merge in all branch columns
220
@{$data}{keys %$library} = values %$library; # merge in all branch columns
220
221
221
my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
222
my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
222
my $lib1 = &GetSortDetails( "Bsort1", $data->{'sort1'} );
223
my $lib1 = &GetSortDetails( "Bsort1", $data->{'sort1'} );
(-)a/misc/cronjobs/advance_notices.pl (-1 / +2 lines)
Lines 57-62 use C4::Members::Messaging; Link Here
57
use C4::Overdues;
57
use C4::Overdues;
58
use Koha::DateUtils;
58
use Koha::DateUtils;
59
use C4::Log;
59
use C4::Log;
60
use Koha::Libraries;
60
61
61
=head1 NAME
62
=head1 NAME
62
63
Lines 507-513 sub get_branch_info { Link Here
507
    ## Get branch info for borrowers home library.
508
    ## Get branch info for borrowers home library.
508
    my $borrower_details = C4::Members::GetMember( borrowernumber => $borrowernumber );
509
    my $borrower_details = C4::Members::GetMember( borrowernumber => $borrowernumber );
509
    my $borrower_branchcode = $borrower_details->{'branchcode'};
510
    my $borrower_branchcode = $borrower_details->{'branchcode'};
510
    my $branch = C4::Branch::GetBranchDetail( $borrower_branchcode );
511
    my $branch = Koha::Libraries->find( $borrower_branchcode )->unblessed;
511
    my %branch_info;
512
    my %branch_info;
512
    foreach my $key( keys %$branch ) {
513
    foreach my $key( keys %$branch ) {
513
        $branch_info{"branches.$key"} = $branch->{$key};
514
        $branch_info{"branches.$key"} = $branch->{$key};
(-)a/misc/cronjobs/notice_unprocessed_suggestions.pl (-2 / +3 lines)
Lines 8-13 use Getopt::Long; Link Here
8
use C4::Budgets qw( GetBudget );
8
use C4::Budgets qw( GetBudget );
9
use C4::Members qw( GetMember );
9
use C4::Members qw( GetMember );
10
use C4::Suggestions qw( GetUnprocessedSuggestions );
10
use C4::Suggestions qw( GetUnprocessedSuggestions );
11
use Koha::Libraries;
11
12
12
my ( $help, $verbose, $confirm, @days );
13
my ( $help, $verbose, $confirm, @days );
13
GetOptions(
14
GetOptions(
Lines 47-54 for my $number_of_days (@days) { Link Here
47
        my $patron = C4::Members::GetMember( borrowernumber => $budget->{budget_owner_id} );
48
        my $patron = C4::Members::GetMember( borrowernumber => $budget->{budget_owner_id} );
48
        my $email_address =
49
        my $email_address =
49
          C4::Members::GetNoticeEmailAddress( $budget->{budget_owner_id} );
50
          C4::Members::GetNoticeEmailAddress( $budget->{budget_owner_id} );
50
        my $library = C4::Branch::GetBranchDetail( $patron->{branchcode} );
51
        my $library = Koha::Libraries->find( $patron->{branchcode} );
51
        my $admin_email_address = $library->{branchemail}
52
        my $admin_email_address = $library->branchemail
52
          || C4::Context->preference('KohaAdminEmailAddress');
53
          || C4::Context->preference('KohaAdminEmailAddress');
53
54
54
        if ($email_address) {
55
        if ($email_address) {
(-)a/misc/cronjobs/overdue_notices.pl (-4 / +5 lines)
Lines 46-51 use C4::Log; Link Here
46
use Koha::Borrower::Debarments qw(AddUniqueDebarment);
46
use Koha::Borrower::Debarments qw(AddUniqueDebarment);
47
use Koha::DateUtils;
47
use Koha::DateUtils;
48
use Koha::Calendar;
48
use Koha::Calendar;
49
use Koha::Libraries;
49
50
50
=head1 NAME
51
=head1 NAME
51
52
Lines 439-446 foreach my $branchcode (@branches) { Link Here
439
        }
440
        }
440
    }
441
    }
441
442
442
    my $branch_details      = C4::Branch::GetBranchDetail($branchcode);
443
    my $library             = Koha::Libraries->find($branchcode);
443
    my $admin_email_address = $branch_details->{'branchemail'}
444
    my $admin_email_address = $library->branchemail
444
      || C4::Context->preference('KohaAdminEmailAddress');
445
      || C4::Context->preference('KohaAdminEmailAddress');
445
    my @output_chunks;    # may be sent to mail or stdout or csv file.
446
    my @output_chunks;    # may be sent to mail or stdout or csv file.
446
447
Lines 680-686 END_SQL Link Here
680
                            branchcode      => $branchcode,
681
                            branchcode      => $branchcode,
681
                            items           => \@items,
682
                            items           => \@items,
682
                            substitute      => {    # this appears to be a hack to overcome incomplete features in this code.
683
                            substitute      => {    # this appears to be a hack to overcome incomplete features in this code.
683
                                                bib             => $branch_details->{'branchname'}, # maybe 'bib' is a typo for 'lib<rary>'?
684
                                                bib             => $library->branchname, # maybe 'bib' is a typo for 'lib<rary>'?
684
                                                'items.content' => $titles,
685
                                                'items.content' => $titles,
685
                                                'count'         => $itemcount,
686
                                                'count'         => $itemcount,
686
                                               },
687
                                               },
Lines 714-720 END_SQL Link Here
714
                              city           => $data->{'city'},
715
                              city           => $data->{'city'},
715
                              phone          => $data->{'phone'},
716
                              phone          => $data->{'phone'},
716
                              cardnumber     => $data->{'cardnumber'},
717
                              cardnumber     => $data->{'cardnumber'},
717
                              branchname     => $branch_details->{'branchname'},
718
                              branchname     => $library->branchname,
718
                              letternumber   => $i,
719
                              letternumber   => $i,
719
                              postcode       => $data->{'zipcode'},
720
                              postcode       => $data->{'zipcode'},
720
                              country        => $data->{'country'},
721
                              country        => $data->{'country'},
(-)a/reserve/request.pl (-1 / +2 lines)
Lines 46-51 use C4::Search; # enabled_staff_search_views Link Here
46
use Koha::DateUtils;
46
use Koha::DateUtils;
47
use Koha::Borrower::Debarments qw(IsDebarred);
47
use Koha::Borrower::Debarments qw(IsDebarred);
48
use Koha::Holds;
48
use Koha::Holds;
49
use Koha::Libraries;
49
50
50
my $dbh = C4::Context->dbh;
51
my $dbh = C4::Context->dbh;
51
my $input = new CGI;
52
my $input = new CGI;
Lines 564-570 foreach my $biblionumber (@biblionumbers) { Link Here
564
        $reserve{'reserve_id'}     = $res->reserve_id();
565
        $reserve{'reserve_id'}     = $res->reserve_id();
565
566
566
        if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
567
        if ( C4::Context->preference('IndependentBranches') && $flags->{'superlibrarian'} != 1 ) {
567
            $reserve{'branchloop'} = [ GetBranchDetail( $res->branchcode() ) ];
568
            $reserve{'branchloop'} = [ Koha::Libraries->find( $res->branchcode() ) ];
568
        }
569
        }
569
        else {
570
        else {
570
            $reserve{'branchloop'} = GetBranchesLoop( $res->branchcode() );
571
            $reserve{'branchloop'} = GetBranchesLoop( $res->branchcode() );
(-)a/t/db_dependent/Branch.t (-14 / +7 lines)
Lines 21-27 use Modern::Perl; Link Here
21
use C4::Context;
21
use C4::Context;
22
use Data::Dumper;
22
use Data::Dumper;
23
23
24
use Test::More tests => 21;
24
use Test::More tests => 19;
25
25
26
use C4::Branch;
26
use C4::Branch;
27
use Koha::Libraries;
27
use Koha::Libraries;
Lines 38-44 can_ok( Link Here
38
      GetBranch
38
      GetBranch
39
      GetBranches
39
      GetBranches
40
      GetBranchesLoop
40
      GetBranchesLoop
41
      GetBranchDetail
42
      ModBranch
41
      ModBranch
43
      GetBranchInfo
42
      GetBranchInfo
44
      mybranch
43
      mybranch
Lines 80-86 my $b1 = { Link Here
80
    branchip       => 'ipA',
79
    branchip       => 'ipA',
81
    branchprinter  => undef,
80
    branchprinter  => undef,
82
    branchnotes    => 'noteA',
81
    branchnotes    => 'noteA',
83
    opac_info      => 'opacA'
82
    opac_info      => 'opacA',
83
    issuing        => undef,
84
};
84
};
85
my $b2 = {
85
my $b2 = {
86
    branchcode     => 'BRB',
86
    branchcode     => 'BRB',
Lines 102-107 my $b2 = { Link Here
102
    branchprinter  => undef,
102
    branchprinter  => undef,
103
    branchnotes    => 'noteB',
103
    branchnotes    => 'noteB',
104
    opac_info      => 'opacB',
104
    opac_info      => 'opacB',
105
    issuing        => undef,
105
};
106
};
106
ModBranch($b1);
107
ModBranch($b1);
107
is( ModBranch($b2), undef, 'the field add is missing' );
108
is( ModBranch($b2), undef, 'the field add is missing' );
Lines 117-128 is( Koha::Libraries->search->count, $count + 1, "branch BRB deleted" Link Here
117
is( GetBranchName( $b1->{branchcode} ),
118
is( GetBranchName( $b1->{branchcode} ),
118
    $b1->{branchname}, "GetBranchName returns the right name" );
119
    $b1->{branchname}, "GetBranchName returns the right name" );
119
120
120
#Test GetBranchDetail
121
my $branchdetail = GetBranchDetail( $b1->{branchcode} );
122
$branchdetail->{add} = 1;
123
$b1->{issuing}       = undef;    # Not used in DB
124
is_deeply( $branchdetail, $b1, 'branchdetail is right' );
125
126
#Test Getbranches
121
#Test Getbranches
127
my $branches = GetBranches();
122
my $branches = GetBranches();
128
is( scalar( keys %$branches ),
123
is( scalar( keys %$branches ),
Lines 149-163 $b1 = { Link Here
149
    branchip       => 'ipA modified',
144
    branchip       => 'ipA modified',
150
    branchprinter  => undef,
145
    branchprinter  => undef,
151
    branchnotes    => 'notesA modified',
146
    branchnotes    => 'notesA modified',
152
    opac_info      => 'opacA modified'
147
    opac_info      => 'opacA modified',
148
    issuing        => undef,
153
};
149
};
154
150
155
ModBranch($b1);
151
ModBranch($b1);
156
is( Koha::Libraries->search->count, $count + 1,
152
is( Koha::Libraries->search->count, $count + 1,
157
    "A branch has been modified, no new branch added" );
153
    "A branch has been modified, no new branch added" );
158
$branchdetail = GetBranchDetail( $b1->{branchcode} );
159
$b1->{issuing} = undef;
160
is_deeply( $branchdetail, $b1 , "GetBranchDetail gives the details of BRA");
161
154
162
#Test categories
155
#Test categories
163
my $count_cat  = Koha::LibraryCategories->search->count;
156
my $count_cat  = Koha::LibraryCategories->search->count;
Lines 236-241 $b2 = { Link Here
236
    branchprinter  => undef,
229
    branchprinter  => undef,
237
    branchnotes    => 'noteB',
230
    branchnotes    => 'noteB',
238
    opac_info      => 'opacB',
231
    opac_info      => 'opacB',
232
    issuing        => undef,
239
    CAT1           => 1,
233
    CAT1           => 1,
240
    CAT2           => 1
234
    CAT2           => 1
241
};
235
};
Lines 244-250 $b2info = GetBranchInfo( $b2->{branchcode} ); Link Here
244
push( @cat, $cat2->{categorycode} );
238
push( @cat, $cat2->{categorycode} );
245
delete $b2->{CAT1};
239
delete $b2->{CAT1};
246
delete $b2->{CAT2};
240
delete $b2->{CAT2};
247
$b2->{issuing}    = undef;
248
$b2->{categories} = \@cat;
241
$b2->{categories} = \@cat;
249
is_deeply( @$b2info[0], $b2, 'BRB has the category CAT1 and CAT2' );
242
is_deeply( @$b2info[0], $b2, 'BRB has the category CAT1 and CAT2' );
250
243
(-)a/t/db_dependent/ILSDI_Services.t (-3 / +3 lines)
Lines 3-9 Link Here
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use C4::Members qw/AddMember GetMember GetBorrowercategory/;
5
use C4::Members qw/AddMember GetMember GetBorrowercategory/;
6
use C4::Branch;
6
use Koha::Libraries;
7
use CGI qw ( -utf8 );
7
use CGI qw ( -utf8 );
8
8
9
use Test::More tests => 15;
9
use Test::More tests => 15;
Lines 37-44 unless ( GetBorrowercategory('UT') ) { Link Here
37
    ('UT','Unit tester',99,99,0.000000,1,0.000000,'C','default');");
37
    ('UT','Unit tester',99,99,0.000000,1,0.000000,'C','default');");
38
}
38
}
39
39
40
# Create branch
40
# Create library
41
unless ( GetBranchDetail('UT') ) {
41
unless ( Koha::Libraries->find('UT') ) {
42
    $dbh->do("INSERT INTO branches (branchcode,branchname) VALUES ('UT','Unit test library');");
42
    $dbh->do("INSERT INTO branches (branchcode,branchname) VALUES ('UT','Unit test library');");
43
}
43
}
44
44
(-)a/t/db_dependent/Items.t (-6 / +6 lines)
Lines 202-214 subtest 'GetItemsInfo tests' => sub { Link Here
202
                holdingbranch => $library2->{branchcode},
202
                holdingbranch => $library2->{branchcode},
203
            }, $biblionumber );
203
            }, $biblionumber );
204
204
205
    my $branch = GetBranchDetail( $library1->{branchcode} );
205
    my $library = Koha::Libraries->find( $library1->{branchcode} )->unblessed;
206
    $branch->{ opac_info } = "homebranch OPAC info";
206
    $library->{ opac_info }= "homebranch OPAC info";
207
    ModBranch($branch);
207
    ModBranch($library);
208
208
209
    $branch = GetBranchDetail( $library2->{branchcode} );
209
    $library = Koha::Libraries->find( $library2->{branchcode} )->unblessed;
210
    $branch->{ opac_info } = "holdingbranch OPAC info";
210
    $library->{ opac_info } = "holdingbranch OPAC info";
211
    ModBranch($branch);
211
    ModBranch($library);
212
212
213
    my @results = GetItemsInfo( $biblionumber );
213
    my @results = GetItemsInfo( $biblionumber );
214
    ok( @results, 'GetItemsInfo returns results');
214
    ok( @results, 'GetItemsInfo returns results');
(-)a/t/db_dependent/Letters.t (-6 / +6 lines)
Lines 18-24 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use Test::More tests => 69;
21
use Test::More tests => 68;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
24
Lines 36-42 $module->mock( Link Here
36
36
37
use_ok('C4::Context');
37
use_ok('C4::Context');
38
use_ok('C4::Members');
38
use_ok('C4::Members');
39
use_ok('C4::Branch');
40
use_ok('C4::Acquisition');
39
use_ok('C4::Acquisition');
41
use_ok('C4::Biblio');
40
use_ok('C4::Biblio');
42
use_ok('C4::Bookseller');
41
use_ok('C4::Bookseller');
Lines 47-52 use Koha::Database; Link Here
47
use Koha::DateUtils qw( dt_from_string output_pref );
46
use Koha::DateUtils qw( dt_from_string output_pref );
48
use Koha::Acquisition::Order;
47
use Koha::Acquisition::Order;
49
use Koha::Acquisition::Bookseller;
48
use Koha::Acquisition::Bookseller;
49
use Koha::Libraries;
50
my $schema = Koha::Database->schema;
50
my $schema = Koha::Database->schema;
51
$schema->storage->txn_begin();
51
$schema->storage->txn_begin();
52
52
Lines 263-275 my $prepared_letter = GetPreparedLetter(( Link Here
263
    substitute  => $substitute,
263
    substitute  => $substitute,
264
    repeat      => $repeat,
264
    repeat      => $repeat,
265
));
265
));
266
my $branch = GetBranchDetail($library->{branchcode});
266
my $retrieved_library = Koha::Libraries->find($library->{branchcode});
267
my $my_title_letter = qq|$branch->{branchname} - $substitute->{status}|;
267
my $my_title_letter = $retrieved_library->branchname . qq| - $substitute->{status}|;
268
my $my_content_letter = qq|Dear Jane Smith,
268
my $my_content_letter = qq|Dear Jane Smith,
269
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.
269
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.
270
270
271
$branch->{branchname}
271
|.$retrieved_library->branchname.qq|
272
$branch->{branchaddress1}
272
|.$retrieved_library->branchaddress1.qq|
273
URL: http://thisisatest.com
273
URL: http://thisisatest.com
274
274
275
The following item(s) is/are currently $substitute->{status}:
275
The following item(s) is/are currently $substitute->{status}:
(-)a/t/db_dependent/Suggestions.t (-2 / +2 lines)
Lines 24-29 use C4::Branch; Link Here
24
use C4::Budgets qw( AddBudgetPeriod AddBudget );
24
use C4::Budgets qw( AddBudgetPeriod AddBudget );
25
25
26
use Koha::DateUtils qw( dt_from_string );
26
use Koha::DateUtils qw( dt_from_string );
27
use Koha::Libraries;
27
28
28
use DateTime::Duration;
29
use DateTime::Duration;
29
use Test::More tests => 105;
30
use Test::More tests => 105;
Lines 62-68 $dbh->do(q|DELETE FROM message_queue|); Link Here
62
$dbh->do(q|INSERT INTO letter(module, code, content) VALUES ('suggestions', 'CHECKED', 'my content')|);
63
$dbh->do(q|INSERT INTO letter(module, code, content) VALUES ('suggestions', 'CHECKED', 'my content')|);
63
64
64
# Add CPL if missing.
65
# Add CPL if missing.
65
if (not defined GetBranchDetail('CPL')) {
66
if (not defined Koha::Libraries->find('CPL')) {
66
    ModBranch({add => 1, branchcode => 'CPL', branchname => 'Centerville'});
67
    ModBranch({add => 1, branchcode => 'CPL', branchname => 'Centerville'});
67
}
68
}
68
69
69
- 

Return to bug 15629