From 81fdd92b6ba85a5bf4a36ed177057734d10950b8 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 19 Jul 2019 15:40:08 +0100 Subject: [PATCH] Bug 15283: Switch default ISSUEQSLIP notice to TT Test Plan: 1) Apply this patch 2) Replace your ISSUESLIP with the following: [%- USE KohaDates -%]

[% branch.branchname %]

Checked out to [% patron.title %] [% patron.firstname %] [% patron.initials %] [% patron.surname %]
([% patron.cardnumber %])
[% today | $KohaDates %]

Checked Out Today

[% FOREACH checkout IN patron.todays_checkouts %]

[% checkout.item.biblio.title %]
Barcode: [% checkout.item.barcode %]
Date due: [% checkout.date_due %]

[% END %] 3) Print a quick slip for a patron, note the data is complete Rescued-by: Martin Renvoize Signed-off-by: Martin Renvoize --- Koha/Patron.pm | 39 +++++++++++++++++++ .../mysql/en/mandatory/sample_notices.sql | 20 +++++----- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index f0ab2d4d3e..eef53b553b 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -882,6 +882,45 @@ sub checkouts { return Koha::Checkouts->_new_from_dbic( $checkouts ); } +=head3 todays_checkouts + +my $todays_checkouts = $patron->todays_checkouts + +This method will return a filtered set of patron checkouts limited by those that have taken place today. + +=cut + +sub todays_checkouts { + my ($self) = @_; + my $dtf = Koha::Database->new->schema->storage->datetime_parser; + my $today_start = + dt_from_string->set( hour => 0, minute => 0, second => 0 ); + my $today_end = + dt_from_string->set( hour => 23, minute => 59, second => 0 ); + + my $checkouts = $self->_result->issues->search( + { + -or => { + issuedate => { + '>=' => $dtf->format_datetime($today_start), + '<=' => $dtf->format_datetime($today_end), + }, + lastreneweddate => { + '>=' => $dtf->format_datetime($today_start), + '<=' => $dtf->format_datetime($today_end), + } + } + }, + { + order_by => [ + -desc => 'me.lastreneweddate', + -desc => 'me.issuedate' + ] + } + ); + return Koha::Checkouts->_new_from_dbic($checkouts); +} + =head3 pending_checkouts my $pending_checkouts = $patron->pending_checkouts diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql index 6d676e73e6..210353064f 100644 --- a/installer/data/mysql/en/mandatory/sample_notices.sql +++ b/installer/data/mysql/en/mandatory/sample_notices.sql @@ -91,20 +91,22 @@ Date due: <>

', 1), -('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '

<>

-Checked out to <> <> <> <>
-(<>)
+('circulation','ISSUEQSLIP','Issue Quick Slip','Issue Quick Slip', '[%- USE KohaDates -%] +

[% branch.branchname %]

+Checked out to [% patron.title %] [% patron.firstname %] [% patron.initials %] [% patron.surname %]
+([% patron.cardnumber %])
-<>
+[% today | $KohaDates %]

Checked Out Today

- +[% FOREACH checkout IN patron.todays_checkouts %]

-<>
-Barcode: <>
-Date due: <>
+ [% checkout.item.biblio.title %]
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]

-
', 1), +[% END %] +', 1), ('circulation','HOLD_SLIP','Hold Slip','Hold Slip', '
Date: <>

Transfer to/Hold in <>

-- 2.20.1