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

(-)a/C4/Overdues.pm (-3 / +6 lines)
Lines 594-607 sub UpdateFine { Link Here
594
    } else {
594
    } else {
595
        if ( $amount ) { # Don't add new fines with an amount of 0
595
        if ( $amount ) { # Don't add new fines with an amount of 0
596
            my $sth4 = $dbh->prepare(
596
            my $sth4 = $dbh->prepare(
597
                "SELECT title FROM biblio LEFT JOIN items ON biblio.biblionumber=items.biblionumber WHERE items.itemnumber=?"
597
                "SELECT title,holdingbranch,barcode FROM biblio LEFT JOIN items ON biblio.biblionumber=items.biblionumber WHERE items.itemnumber=?"
598
            );
598
            );
599
            $sth4->execute($itemnum);
599
            $sth4->execute($itemnum);
600
            my $title = $sth4->fetchrow;
600
            my ($title,$holdingbranch,$barcode) = $sth4->fetchrow;
601
601
602
            my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber);
602
            my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber);
603
603
604
            my $desc = ( $type ? "$type " : '' ) . "$title $due";    # FIXEDME, avoid whitespace prefix on empty $type
604
            my $desc = ( $type ? "$type " : '' ) . "$title"
605
                . ( $holdingbranch ? " Branch:$holdingbranch" : '')
606
                . ( $barcode ? " Barcode:$barcode " : '')
607
                . ( $due ? " Due:$due" : ''); # FIXEDME, avoid whitespace prefix on empty $type
605
608
606
            my $accountline = Koha::Account::Line->new(
609
            my $accountline = Koha::Account::Line->new(
607
                {
610
                {
(-)a/t/db_dependent/Circulation.t (-24 / +54 lines)
Lines 30-36 use Koha::Database; Link Here
30
30
31
use t::lib::TestBuilder;
31
use t::lib::TestBuilder;
32
32
33
use Test::More tests => 83;
33
use Test::More tests => 84;
34
34
35
BEGIN {
35
BEGIN {
36
    use_ok('C4::Circulation');
36
    use_ok('C4::Circulation');
Lines 53-58 my $library = $builder->build({ Link Here
53
my $library2 = $builder->build({
53
my $library2 = $builder->build({
54
    source => 'Branch',
54
    source => 'Branch',
55
});
55
});
56
my $category = $builder->build({
57
    source => 'Category',
58
});
59
my $categorycode = $category->{categorycode};
56
60
57
my $CircControl = C4::Context->preference('CircControl');
61
my $CircControl = C4::Context->preference('CircControl');
58
my $HomeOrHoldingBranch = C4::Context->preference('HomeOrHoldingBranch');
62
my $HomeOrHoldingBranch = C4::Context->preference('HomeOrHoldingBranch');
Lines 185-191 my $sth = C4::Context->dbh->prepare("SELECT COUNT(*) FROM accountlines WHERE amo Link Here
185
$sth->execute();
189
$sth->execute();
186
my ( $original_count ) = $sth->fetchrow_array();
190
my ( $original_count ) = $sth->fetchrow_array();
187
191
188
C4::Context->dbh->do("INSERT INTO borrowers ( cardnumber, surname, firstname, categorycode, branchcode ) VALUES ( '99999999999', 'Hall', 'Kyle', 'S', ? )", undef, $library2->{branchcode} );
192
C4::Context->dbh->do("INSERT INTO borrowers ( cardnumber, surname, firstname, categorycode, branchcode ) VALUES ( '99999999999', 'Hall', 'Kyle', ?, ? )", undef, $categorycode, $library2->{branchcode} );
189
193
190
C4::Circulation::ProcessOfflinePayment({ cardnumber => '99999999999', amount => '123.45' });
194
C4::Circulation::ProcessOfflinePayment({ cardnumber => '99999999999', amount => '123.45' });
191
195
Lines 203-212 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
203
    # Generate test biblio
207
    # Generate test biblio
204
    my $biblio = MARC::Record->new();
208
    my $biblio = MARC::Record->new();
205
    my $title = 'Silence in the library';
209
    my $title = 'Silence in the library';
206
    $biblio->append_fields(
210
207
        MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
211
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
208
        MARC::Field->new('245', ' ', ' ', a => $title),
212
        $biblio->append_fields(
209
    );
213
            MARC::Field->new('200', ' ', ' ', f => 'Moffat, Steven'),
214
            MARC::Field->new('200', ' ', ' ', a => $title),
215
        );
216
    } else {
217
        $biblio->append_fields(
218
            MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
219
            MARC::Field->new('245', ' ', ' ', a => $title),
220
        );
221
    }
210
222
211
    my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, '');
223
    my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, '');
212
224
Lines 252-279 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
252
    my %renewing_borrower_data = (
264
    my %renewing_borrower_data = (
253
        firstname =>  'John',
265
        firstname =>  'John',
254
        surname => 'Renewal',
266
        surname => 'Renewal',
255
        categorycode => 'S',
267
        categorycode => $categorycode,
256
        branchcode => $branch,
268
        branchcode => $branch,
257
    );
269
    );
258
270
259
    my %reserving_borrower_data = (
271
    my %reserving_borrower_data = (
260
        firstname =>  'Katrin',
272
        firstname =>  'Katrin',
261
        surname => 'Reservation',
273
        surname => 'Reservation',
262
        categorycode => 'S',
274
        categorycode => $categorycode,
263
        branchcode => $branch,
275
        branchcode => $branch,
264
    );
276
    );
265
277
266
    my %hold_waiting_borrower_data = (
278
    my %hold_waiting_borrower_data = (
267
        firstname =>  'Kyle',
279
        firstname =>  'Kyle',
268
        surname => 'Reservation',
280
        surname => 'Reservation',
269
        categorycode => 'S',
281
        categorycode => $categorycode,
270
        branchcode => $branch,
282
        branchcode => $branch,
271
    );
283
    );
272
284
273
    my %restricted_borrower_data = (
285
    my %restricted_borrower_data = (
274
        firstname =>  'Alice',
286
        firstname =>  'Alice',
275
        surname => 'Reservation',
287
        surname => 'Reservation',
276
        categorycode => 'S',
288
        categorycode => $categorycode,
277
        debarred => '3228-01-01',
289
        debarred => '3228-01-01',
278
        branchcode => $branch,
290
        branchcode => $branch,
279
    );
291
    );
Lines 566-571 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
566
        undef, $renewing_borrower->{borrowernumber}
578
        undef, $renewing_borrower->{borrowernumber}
567
    );
579
    );
568
580
581
    my $accountlines = Koha::Account::Lines->search({itemnumber => $itemnumber, borrowernumber => $renewing_borrower->{borrowernumber}, amount => '15.00'});
582
    my $accouline = $accountlines->next();
583
    my $itembranch = $item->get_column('holdingbranch');
584
    ok($accouline->description =~ /Silence in the library Branch:$itembranch Barcode:R00000342/);
585
569
    ok( $total_due == 12, 'Borrower only charged replacement fee with both WhenLostForgiveFine and WhenLostChargeReplacementFee enabled' );
586
    ok( $total_due == 12, 'Borrower only charged replacement fee with both WhenLostForgiveFine and WhenLostChargeReplacementFee enabled' );
570
587
571
    C4::Context->dbh->do("DELETE FROM accountlines");
588
    C4::Context->dbh->do("DELETE FROM accountlines");
Lines 621-630 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
621
    #Create another record
638
    #Create another record
622
    my $biblio2 = MARC::Record->new();
639
    my $biblio2 = MARC::Record->new();
623
    my $title2 = 'Something is worng here';
640
    my $title2 = 'Something is worng here';
624
    $biblio2->append_fields(
641
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
625
        MARC::Field->new('100', ' ', ' ', a => 'Anonymous'),
642
        $biblio2->append_fields(
626
        MARC::Field->new('245', ' ', ' ', a => $title2),
643
            MARC::Field->new('200', ' ', ' ', f => 'Anonymous'),
627
    );
644
            MARC::Field->new('200', ' ', ' ', a => $title2),
645
        );
646
    } else {
647
        $biblio2->append_fields(
648
            MARC::Field->new('100', ' ', ' ', a => 'Anonymous'),
649
            MARC::Field->new('245', ' ', ' ', a => $title2),
650
        );
651
    }
628
    my ($biblionumber2, $biblioitemnumber2) = AddBiblio($biblio2, '');
652
    my ($biblionumber2, $biblioitemnumber2) = AddBiblio($biblio2, '');
629
653
630
    #Create third item
654
    #Create third item
Lines 641-647 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
641
    my %a_borrower_data = (
665
    my %a_borrower_data = (
642
        firstname =>  'Fridolyn',
666
        firstname =>  'Fridolyn',
643
        surname => 'SOMERS',
667
        surname => 'SOMERS',
644
        categorycode => 'S',
668
        categorycode => $categorycode,
645
        branchcode => $branch,
669
        branchcode => $branch,
646
    );
670
    );
647
671
Lines 720-726 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
720
    my %a_borrower_data = (
744
    my %a_borrower_data = (
721
        firstname =>  'Kyle',
745
        firstname =>  'Kyle',
722
        surname => 'Hall',
746
        surname => 'Hall',
723
        categorycode => 'S',
747
        categorycode => $categorycode,
724
        branchcode => $branch,
748
        branchcode => $branch,
725
    );
749
    );
726
750
Lines 783-795 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
783
    my $borrowernumber1 = AddMember(
807
    my $borrowernumber1 = AddMember(
784
        firstname    => 'Kyle',
808
        firstname    => 'Kyle',
785
        surname      => 'Hall',
809
        surname      => 'Hall',
786
        categorycode => 'S',
810
        categorycode => $categorycode,
787
        branchcode   => $library2->{branchcode},
811
        branchcode   => $library2->{branchcode},
788
    );
812
    );
789
    my $borrowernumber2 = AddMember(
813
    my $borrowernumber2 = AddMember(
790
        firstname    => 'Chelsea',
814
        firstname    => 'Chelsea',
791
        surname      => 'Hall',
815
        surname      => 'Hall',
792
        categorycode => 'S',
816
        categorycode => $categorycode,
793
        branchcode   => $library2->{branchcode},
817
        branchcode   => $library2->{branchcode},
794
    );
818
    );
795
819
Lines 841-850 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
841
865
842
    #Create another record
866
    #Create another record
843
    my $biblio = MARC::Record->new();
867
    my $biblio = MARC::Record->new();
844
    $biblio->append_fields(
868
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
845
        MARC::Field->new('100', ' ', ' ', a => 'Anonymous'),
869
        $biblio->append_fields(
846
        MARC::Field->new('245', ' ', ' ', a => 'A title'),
870
            MARC::Field->new('200', ' ', ' ', f => 'Anonymous'),
847
    );
871
            MARC::Field->new('200', ' ', ' ', a => 'A title'),
872
        );
873
    } else {
874
        $biblio->append_fields(
875
            MARC::Field->new('100', ' ', ' ', a => 'Anonymous'),
876
            MARC::Field->new('245', ' ', ' ', a => 'A title'),
877
        );
878
    }
848
    my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, '');
879
    my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, '');
849
880
850
    my (undef, undef, $itemnumber) = AddItem(
881
    my (undef, undef, $itemnumber) = AddItem(
Lines 859-865 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
859
    my $borrowernumber = AddMember(
890
    my $borrowernumber = AddMember(
860
        firstname =>  'fn',
891
        firstname =>  'fn',
861
        surname => 'dn',
892
        surname => 'dn',
862
        categorycode => 'S',
893
        categorycode => $categorycode,
863
        branchcode => $branch,
894
        branchcode => $branch,
864
    );
895
    );
865
896
866
- 

Return to bug 16461