From 8fc558027b8eaa137724ef253d3ee13e40d5c8ba Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 13 Dec 2016 13:23:18 +0000 Subject: [PATCH] Bug 15985: Include transacting library in fines Some librarians would like to see the library an item was checked out from in the fines table on the fines payment page. Test Plan: 1) Apply this patch 2) Find a patron with overdue items that have fines 3) Browse to the pay fines page 4) Note the new "checked out from" column Signed-off-by: Jason Robb Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- Koha/Checkout.pm | 12 ++++++++++++ .../intranet-tmpl/prog/en/modules/members/pay.tt | 10 +++++++--- members/pay.pl | 1 + t/db_dependent/Koha/Checkouts.t | 6 +++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm index 9180bf4df7..95446ff9c4 100644 --- a/Koha/Checkout.pm +++ b/Koha/Checkout.pm @@ -28,6 +28,7 @@ use Koha::Checkouts::ReturnClaims; use Koha::Database; use Koha::DateUtils; use Koha::Items; +use Koha::Libraries; use base qw(Koha::Object); @@ -162,6 +163,17 @@ sub claim_returned { }; } +=head library + +=cut + +sub library { + my ($self) = @_; + + my $library_rs = $self->_result->branch; + return Koha::Library->_new_from_dbic( $library_rs ); +} + =head2 Internal methods =head3 _type diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt index 406b3b0766..5fbf41e3d3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt @@ -47,6 +47,7 @@   Actions Account type + Checked out from Description Date Barcode @@ -84,6 +85,9 @@ [% PROCESS account_type_description account=line %] + + [% line.checkout.library.branchname %] + [%- IF line.description %][% line.description | html %][% END %] [% IF line.itemnumber %]([% line.item.biblio.title | html %])[% END %] @@ -118,16 +122,16 @@ - Total due: + Total due: [% total | $Price %] [% IF outstanding_credits.total_outstanding < 0 %] - Outstanding credits could be applied: + Outstanding credits could be applied: - Total due if credit applied: + Total due if credit applied: [% total + outstanding_credits.total_outstanding | $Price %] [% END %] diff --git a/members/pay.pl b/members/pay.pl index d78debc7ee..6ab70c5bfe 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -40,6 +40,7 @@ use C4::Koha; use C4::Overdues; use Koha::Patrons; use Koha::Items; +use Koha::Checkouts; use Koha::Patron::Categories; use URI::Escape; diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t index dfb90e42a8..3bfa8cd755 100644 --- a/t/db_dependent/Koha/Checkouts.t +++ b/t/db_dependent/Koha/Checkouts.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 7; +use Test::More tests => 9; use C4::Circulation; use Koha::Checkouts; @@ -50,6 +50,9 @@ my $new_checkout_2 = Koha::Checkout->new( } )->store; +is( $new_checkout_1->library->id, $library->{branchcode}, 'Got correct library for checkout1' ); +is( $new_checkout_2->library->id, $library->{branchcode}, 'Got correct library for checkout2' ); + like( $new_checkout_1->issue_id, qr|^\d+$|, 'Adding a new checkout should have set the issue_id' ); is( Koha::Checkouts->search->count, $nb_of_checkouts + 2, 'The 2 checkouts should have been added' ); @@ -125,5 +128,6 @@ subtest 'patron' => sub { $retrieved_checkout_1->delete; is( Koha::Checkouts->search->count, $nb_of_checkouts + 1, 'Delete should have deleted the checkout' ); + $schema->storage->txn_rollback; -- 2.24.2 (Apple Git-127)