@@ -, +, @@
Toolkit
---
Koha/Borrower.pm | 13 +++
Koha/Checkout.pm | 119 ++++++++++++++++++++
Koha/Checkouts.pm | 62 ++++++++++
Koha/Item.pm | 15 ++-
.../data/mysql/de-DE/mandatory/sample_notices.sql | 33 +++---
.../data/mysql/en/mandatory/sample_notices.sql | 26 +++--
.../data/mysql/es-ES/mandatory/sample_notices.sql | 26 +++--
.../mysql/fr-FR/1-Obligatoire/sample_notices.sql | 32 +++---
installer/data/mysql/it-IT/necessari/notices.sql | 32 +++---
.../mysql/nb-NO/1-Obligatorisk/sample_notices.sql | 32 +++---
.../data/mysql/pl-PL/mandatory/sample_notices.sql | 26 +++--
.../data/mysql/ru-RU/mandatory/sample_notices.sql | 26 +++--
.../data/mysql/uk-UA/mandatory/sample_notices.sql | 26 +++--
13 files changed, 353 insertions(+), 115 deletions(-)
create mode 100644 Koha/Checkout.pm
create mode 100644 Koha/Checkouts.pm
--- a/Koha/Borrower.pm
+++ a/Koha/Borrower.pm
@@ -22,6 +22,7 @@ use Modern::Perl;
use Carp;
use Koha::Database;
+use Koha::Checkouts;
use base qw(Koha::Object);
@@ -35,6 +36,18 @@ Koha::Borrower - Koha Borrower Object class
=cut
+=head3 checkouts
+
+=cut
+
+sub checkouts {
+ my ( $self, $params, $attributes ) = @_;
+
+ $params->{borrowernumber} = $self->id;
+
+ return Koha::Checkouts->search( $params, $attributes );
+}
+
=head3 type
=cut
--- a/Koha/Checkout.pm
+++ a/Koha/Checkout.pm
@@ -0,0 +1,119 @@
+package Koha::Checkout;
+
+# Copyright ByWater Solutions 2015
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 3 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+
+use Carp;
+
+use C4::Overdues qw( GetFine );
+use Koha::DateUtils qw( dt_from_string output_pref );
+
+use Koha::Items;
+
+use base qw(Koha::Object);
+
+=head1 NAME
+
+Koha::Issue - Koha Checkout object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 is_overdue
+
+=cut
+
+sub is_overdue {
+ my ($self) = @_;
+
+ unless ( defined $self->{_is_overdue} ) {
+ my $today = dt_from_string();
+ my $date_due = dt_from_string( $self->date_due );
+
+ $self->{_is_overdue} = DateTime->compare( $date_due, $today ) == -1;
+ }
+
+ return $self->{_is_overdue};
+}
+
+=cut
+
+=head3 fine
+
+Returns the amount in fines owed for this checkout, if any
+
+=cut
+
+sub fine {
+ my ($self) = @_;
+
+ return GetFine( $self->itemnumber, $self->borrowernumber );
+}
+
+=head3 is_from_today
+
+Returns true if this checkout was either created today, or the item was renewed today
+
+=cut
+
+sub is_from_today {
+ my ($self) = @_;
+
+ unless ( defined $self->{_is_from_today} ) {
+ my $today = output_pref( { dt => dt_from_string, dateformat => 'iso', dateonly => 1 } );
+
+ $self->{_is_from_today} = (
+ substr( $self->issuedate, 0, 10 ) eq $today
+ || substr( $self->lastreneweddate, 0, 10 ) eq $today
+ );
+ }
+
+ return $self->{_is_from_today};
+}
+
+=head3 item
+
+=cut
+
+sub item {
+ my ( $self ) = @_;
+
+ $self->{_item} ||= Koha::Items->find( $self->itemnumber );
+
+ return $self->{_item};
+}
+
+=head3 type
+
+=cut
+
+sub type {
+ return 'Issue';
+}
+
+=head1 AUTHOR
+
+Kyle M Hall
-<
+ [% checkout.item.biblio.title %]
-<
+ [% checkout.item.biblio.title %]
-<
+ [% checkout.item.biblio.title %]
-<
+ [% checkout.item.biblio.title %]
-<
+ [% checkout.item.biblio.title %]
-<
+ [% checkout.item.biblio.title %]
-<
+ [% checkout.item.biblio.title %]
', 1),
-('circulation','ISSUEQSLIP','Kurzquittung','Kurzquittung', 'Ausleihquittung
-Bibliothek: <
-Ausleihe an: <
-Ausweisnummer: <
-
-<
-
-Heutige Ausleihen
-
-Barcode: <
-Signatur: <
-Fällig am: <
-[% branch.branchname %]
+Checked out to [% borrower.title %] [% borrower.firstname %] [% borrower.initials %] [% borrower.surname %]
+([% borrower.cardnumber %])
+
+[% today | $KohaDates %]
+
+Checked Out Today
+[% FOREACH checkout IN borrower.checkouts %]
+ [% IF checkout.is_from_today %]
+
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]
+ Vormerkung
Abholbereit seit: <
--- a/installer/data/mysql/en/mandatory/sample_notices.sql
+++ a/installer/data/mysql/en/mandatory/sample_notices.sql
@@ -63,20 +63,24 @@ 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 [% borrower.title %] [% borrower.firstname %] [% borrower.initials %] [% borrower.surname %]
+([% borrower.cardnumber %])
-<
+[% today | $KohaDates %]
Checked Out Today
-
-Barcode: <
-Date due: <
-
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]
+ Date: <
Transfer to/Hold in <
--- a/installer/data/mysql/es-ES/mandatory/sample_notices.sql
+++ a/installer/data/mysql/es-ES/mandatory/sample_notices.sql
@@ -55,20 +55,24 @@ 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 [% borrower.title %] [% borrower.firstname %] [% borrower.initials %] [% borrower.surname %]
+([% borrower.cardnumber %])
-<
+[% today | $KohaDates %]
Checked Out Today
-
-Barcode: <
-Date due: <
-
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]
+ Date: <
Transfer to/Hold in <
--- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
+++ a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
@@ -57,20 +57,24 @@ Retour le : <
', 1),
-('circulation','ISSUEQSLIP','Ticket rapide','Ticket rapide', '<
-Prêts à <
-(<
-
-<
-
-Emprunts du jour
-
-Code à barres : <
-Retour le : <
-[% branch.branchname %]
+Checked out to [% borrower.title %] [% borrower.firstname %] [% borrower.initials %] [% borrower.surname %]
+([% borrower.cardnumber %])
+
+[% today | $KohaDates %]
+
+Checked Out Today
+[% FOREACH checkout IN borrower.checkouts %]
+ [% IF checkout.is_from_today %]
+
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]
+ Date : <
Transfert vers/Réservé à <
--- a/installer/data/mysql/it-IT/necessari/notices.sql
+++ a/installer/data/mysql/it-IT/necessari/notices.sql
@@ -57,20 +57,24 @@ Data di scadenza: <
', 1),
-('circulation','ISSUEQSLIP','Ricevuta (sintetica)','Ricevuta (sintetica)', '<
-Prestato/i a <
-(<
-
-<
-
-Prestati oggi
-
-Codice a barre: <
-Data di scadenza: <
-[% branch.branchname %]
+Checked out to [% borrower.title %] [% borrower.firstname %] [% borrower.initials %] [% borrower.surname %]
+([% borrower.cardnumber %])
+
+[% today | $KohaDates %]
+
+Checked Out Today
+[% FOREACH checkout IN borrower.checkouts %]
+ [% IF checkout.is_from_today %]
+
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]
+ Data: <
Trasferita a/Prenotata in <
--- a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql
+++ a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql
@@ -78,20 +78,24 @@ Innleveringsfrist: <
', 1),
-('circulation','ISSUEQSLIP','Utlån (enkel)','Utlån (enkel)', '<
-Utlånt til <
-(<
-
-<
-
-Utlånt i dag
-
-Strekkode: <
-Innleveringsfrist: <
-[% branch.branchname %]
+Checked out to [% borrower.title %] [% borrower.firstname %] [% borrower.initials %] [% borrower.surname %]
+([% borrower.cardnumber %])
+
+[% today | $KohaDates %]
+
+Checked Out Today
+[% FOREACH checkout IN borrower.checkouts %]
+ [% IF checkout.is_from_today %]
+
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]
+ Dato: <
Overfør til/Reservasjon hos <
--- a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql
+++ a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql
@@ -56,20 +56,24 @@ 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 [% borrower.title %] [% borrower.firstname %] [% borrower.initials %] [% borrower.surname %]
+([% borrower.cardnumber %])
-<
+[% today | $KohaDates %]
Checked Out Today
-
-Barcode: <
-Date due: <
-
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]
+ Date: <
Transfer to/Hold in <
--- a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql
+++ a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql
@@ -56,20 +56,24 @@ estamp>>
-<
-Barcode: <
-Date due: <
-
+ [% checkout.item.biblio.title %]
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]
+
-<
-Barcode: <
-Date due: <
-
+ [% checkout.item.biblio.title %]
+ Barcode: [% checkout.item.barcode %]
+ Date due: [% checkout.date_due %]
+