@@ -, +, @@
---
Koha/Checkout.pm | 14 +++++++++++++-
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt | 9 ++++++---
members/pay.pl | 2 ++
t/db_dependent/Koha/Checkouts.t | 6 +++++-
4 files changed, 26 insertions(+), 5 deletions(-)
--- a/Koha/Checkout.pm
+++ a/Koha/Checkout.pm
@@ -21,11 +21,12 @@ package Koha::Checkout;
use Modern::Perl;
use Carp;
+use DateTime;
use Koha::Database;
-use DateTime;
use Koha::DateUtils;
use Koha::Items;
+use Koha::Libraries;
use base qw(Koha::Object);
@@ -88,6 +89,17 @@ sub patron {
return Koha::Patron->_new_from_dbic( $patron_rs );
}
+=head library
+
+=cut
+
+sub library {
+ my ($self) = @_;
+
+ my $library_rs = $self->_result->branch;
+ return Koha::Library->_new_from_dbic( $library_rs );
+}
+
=head3 type
=cut
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
@@ -40,6 +40,7 @@
|
Fines & charges |
+ Checked out from |
Description |
Payment note |
Account type |
@@ -49,7 +50,7 @@
- Total due: |
+ Total due: |
[% total | $Price %] |
@@ -74,6 +75,9 @@
+
+ [% line.checkout.library.branchname %]
+ |
[% SWITCH line.accounttype %]
[% CASE 'Pay' %]Payment, thanks
@@ -109,8 +113,7 @@
[% END %]
[% IF ( account_grp.total ) %]
|
-
- Sub total: |
+ Sub total: |
[% account_grp.total | $Price %] |
[% END %]
--- a/members/pay.pl
+++ a/members/pay.pl
@@ -40,6 +40,7 @@ use C4::Koha;
use C4::Overdues;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::Patrons;
+use Koha::Checkouts;
use Koha::Patron::Categories;
use URI::Escape;
@@ -135,6 +136,7 @@ sub add_accounts_to_template {
my $biblio = $item->biblio;
$account_line->{biblionumber} = $biblio->biblionumber;
$account_line->{title} = $biblio->title;
+ $account_line->{checkout} = Koha::Checkouts->find($accountline->{issue_id});
}
push @accounts, $account_line;
}
--- a/t/db_dependent/Koha/Checkouts.t
+++ a/t/db_dependent/Koha/Checkouts.t
@@ -19,7 +19,7 @@
use Modern::Perl;
-use Test::More tests => 7;
+use Test::More tests => 9;
use Koha::Checkouts;
use Koha::Database;
@@ -49,6 +49,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' );
@@ -103,5 +106,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;
--