Bugzilla – Attachment 51443 Details for
Bug 16461
Add barcode and item type in fine description for overdue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16461 - Add branch and barcode in fine description for overdue
Bug-16461---Add-branch-and-barcode-in-fine-descrip.patch (text/plain), 8.48 KB, created by
Alex Arnaud
on 2016-05-11 14:58:04 UTC
(
hide
)
Description:
Bug 16461 - Add branch and barcode in fine description for overdue
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2016-05-11 14:58:04 UTC
Size:
8.48 KB
patch
obsolete
>From 45ab4ce606f5cb09c3951d201c50396abe254831 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Wed, 11 May 2016 16:57:11 +0200 >Subject: [PATCH] Bug 16461 - Add branch and barcode in fine description for > overdue > >--- > C4/Overdues.pm | 9 ++++-- > t/db_dependent/Circulation.t | 77 +++++++++++++++++++++++++++++++------------- > 2 files changed, 60 insertions(+), 26 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 40f49a7..b49502e 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -594,14 +594,17 @@ sub UpdateFine { > } else { > if ( $amount ) { # Don't add new fines with an amount of 0 > my $sth4 = $dbh->prepare( >- "SELECT title FROM biblio LEFT JOIN items ON biblio.biblionumber=items.biblionumber WHERE items.itemnumber=?" >+ "SELECT title,holdingbranch,barcode FROM biblio LEFT JOIN items ON biblio.biblionumber=items.biblionumber WHERE items.itemnumber=?" > ); > $sth4->execute($itemnum); >- my $title = $sth4->fetchrow; >+ my ($title,$holdingbranch,$barcode) = $sth4->fetchrow; > > my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber); > >- my $desc = ( $type ? "$type " : '' ) . "$title $due"; # FIXEDME, avoid whitespace prefix on empty $type >+ my $desc = ( $type ? "$type " : '' ) . "$title" >+ . ( $holdingbranch ? " Branch:$holdingbranch" : '') >+ . ( $barcode ? " Barcode:$barcode " : '') >+ . ( $due ? " Due:$due" : ''); # FIXEDME, avoid whitespace prefix on empty $type > > my $accountline = Koha::Account::Line->new( > { >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index b1dd6f1..2c283e3 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -30,7 +30,7 @@ use Koha::Database; > > use t::lib::TestBuilder; > >-use Test::More tests => 83; >+use Test::More tests => 84; > > BEGIN { > use_ok('C4::Circulation'); >@@ -53,6 +53,10 @@ my $library = $builder->build({ > my $library2 = $builder->build({ > source => 'Branch', > }); >+my $category = $builder->build({ >+ source => 'Category', >+}); >+my $categorycode = $category->{categorycode}; > > my $CircControl = C4::Context->preference('CircControl'); > my $HomeOrHoldingBranch = C4::Context->preference('HomeOrHoldingBranch'); >@@ -185,7 +189,7 @@ my $sth = C4::Context->dbh->prepare("SELECT COUNT(*) FROM accountlines WHERE amo > $sth->execute(); > my ( $original_count ) = $sth->fetchrow_array(); > >-C4::Context->dbh->do("INSERT INTO borrowers ( cardnumber, surname, firstname, categorycode, branchcode ) VALUES ( '99999999999', 'Hall', 'Kyle', 'S', ? )", undef, $library2->{branchcode} ); >+C4::Context->dbh->do("INSERT INTO borrowers ( cardnumber, surname, firstname, categorycode, branchcode ) VALUES ( '99999999999', 'Hall', 'Kyle', ?, ? )", undef, $categorycode, $library2->{branchcode} ); > > C4::Circulation::ProcessOfflinePayment({ cardnumber => '99999999999', amount => '123.45' }); > >@@ -203,10 +207,18 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > # Generate test biblio > my $biblio = MARC::Record->new(); > my $title = 'Silence in the library'; >- $biblio->append_fields( >- MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), >- MARC::Field->new('245', ' ', ' ', a => $title), >- ); >+ >+ if (C4::Context->preference('marcflavour') eq 'UNIMARC') { >+ $biblio->append_fields( >+ MARC::Field->new('200', ' ', ' ', f => 'Moffat, Steven'), >+ MARC::Field->new('200', ' ', ' ', a => $title), >+ ); >+ } else { >+ $biblio->append_fields( >+ MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), >+ MARC::Field->new('245', ' ', ' ', a => $title), >+ ); >+ } > > my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); > >@@ -252,28 +264,28 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > my %renewing_borrower_data = ( > firstname => 'John', > surname => 'Renewal', >- categorycode => 'S', >+ categorycode => $categorycode, > branchcode => $branch, > ); > > my %reserving_borrower_data = ( > firstname => 'Katrin', > surname => 'Reservation', >- categorycode => 'S', >+ categorycode => $categorycode, > branchcode => $branch, > ); > > my %hold_waiting_borrower_data = ( > firstname => 'Kyle', > surname => 'Reservation', >- categorycode => 'S', >+ categorycode => $categorycode, > branchcode => $branch, > ); > > my %restricted_borrower_data = ( > firstname => 'Alice', > surname => 'Reservation', >- categorycode => 'S', >+ categorycode => $categorycode, > debarred => '3228-01-01', > branchcode => $branch, > ); >@@ -566,6 +578,11 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > undef, $renewing_borrower->{borrowernumber} > ); > >+ my $accountlines = Koha::Account::Lines->search({itemnumber => $itemnumber, borrowernumber => $renewing_borrower->{borrowernumber}, amount => '15.00'}); >+ my $accouline = $accountlines->next(); >+ my $itembranch = $item->get_column('holdingbranch'); >+ ok($accouline->description =~ /Silence in the library Branch:$itembranch Barcode:R00000342/); >+ > ok( $total_due == 12, 'Borrower only charged replacement fee with both WhenLostForgiveFine and WhenLostChargeReplacementFee enabled' ); > > C4::Context->dbh->do("DELETE FROM accountlines"); >@@ -621,10 +638,17 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > #Create another record > my $biblio2 = MARC::Record->new(); > my $title2 = 'Something is worng here'; >- $biblio2->append_fields( >- MARC::Field->new('100', ' ', ' ', a => 'Anonymous'), >- MARC::Field->new('245', ' ', ' ', a => $title2), >- ); >+ if (C4::Context->preference('marcflavour') eq 'UNIMARC') { >+ $biblio2->append_fields( >+ MARC::Field->new('200', ' ', ' ', f => 'Anonymous'), >+ MARC::Field->new('200', ' ', ' ', a => $title2), >+ ); >+ } else { >+ $biblio2->append_fields( >+ MARC::Field->new('100', ' ', ' ', a => 'Anonymous'), >+ MARC::Field->new('245', ' ', ' ', a => $title2), >+ ); >+ } > my ($biblionumber2, $biblioitemnumber2) = AddBiblio($biblio2, ''); > > #Create third item >@@ -641,7 +665,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > my %a_borrower_data = ( > firstname => 'Fridolyn', > surname => 'SOMERS', >- categorycode => 'S', >+ categorycode => $categorycode, > branchcode => $branch, > ); > >@@ -720,7 +744,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > my %a_borrower_data = ( > firstname => 'Kyle', > surname => 'Hall', >- categorycode => 'S', >+ categorycode => $categorycode, > branchcode => $branch, > ); > >@@ -783,13 +807,13 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > my $borrowernumber1 = AddMember( > firstname => 'Kyle', > surname => 'Hall', >- categorycode => 'S', >+ categorycode => $categorycode, > branchcode => $library2->{branchcode}, > ); > my $borrowernumber2 = AddMember( > firstname => 'Chelsea', > surname => 'Hall', >- categorycode => 'S', >+ categorycode => $categorycode, > branchcode => $library2->{branchcode}, > ); > >@@ -841,10 +865,17 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > > #Create another record > my $biblio = MARC::Record->new(); >- $biblio->append_fields( >- MARC::Field->new('100', ' ', ' ', a => 'Anonymous'), >- MARC::Field->new('245', ' ', ' ', a => 'A title'), >- ); >+ if (C4::Context->preference('marcflavour') eq 'UNIMARC') { >+ $biblio->append_fields( >+ MARC::Field->new('200', ' ', ' ', f => 'Anonymous'), >+ MARC::Field->new('200', ' ', ' ', a => 'A title'), >+ ); >+ } else { >+ $biblio->append_fields( >+ MARC::Field->new('100', ' ', ' ', a => 'Anonymous'), >+ MARC::Field->new('245', ' ', ' ', a => 'A title'), >+ ); >+ } > my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, ''); > > my (undef, undef, $itemnumber) = AddItem( >@@ -859,7 +890,7 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > my $borrowernumber = AddMember( > firstname => 'fn', > surname => 'dn', >- categorycode => 'S', >+ categorycode => $categorycode, > branchcode => $branch, > ); > >-- >2.7.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16461
:
51443
|
52052
|
61042