From 521174867d5457ddeb861018216d62257f37886a Mon Sep 17 00:00:00 2001
From: Aleisha Amohia
Date: Fri, 18 Sep 2020 11:58:05 +1200
Subject: [PATCH] Bug 12224: Print a slip of borrower's checkins for today
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
To test:
1) Apply patch and run installer
2) Check out two items (or more) to a borrower
3) Check in two items (or more) for this borrower (you should end up on
circ/returns.pl)
4) Notice the checked-in items table has started building. There should
be a new column with the button 'Print checkin slip' in each row.
5) Click the button and confirm the checkin slip opens for printing in a
new window.
6) Go to the patron's account
7) Click the Print dropdown. Confirm there is a 'Print checkin slip'
option. Click this and confirm the checkin slip opens for printing in a
new window.
Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Signed-off-by: Owen Leonard
Signed-off-by: David Nind
Signed-off-by: Alexandra Speer
Signed-off-by: Katrin Fischer
Signed-off-by: Christian Stelzenmüller
Signed-off-by: Martin Renvoize
Signed-off-by: Katrin Fischer
---
.../bug_12224-add_CHECKINSLIP_notice.perl | 22 +++++++++++
.../data/mysql/en/mandatory/sample_notices.yml | 23 +++++++++++
.../mysql/fr-CA/obligatoire/sample_notices.sql | 15 ++++++-
.../mysql/fr-FR/1-Obligatoire/sample_notices.sql | 17 +++++++-
installer/data/mysql/it-IT/necessari/notices.sql | 17 +++++++-
.../mysql/nb-NO/1-Obligatorisk/sample_notices.sql | 17 +++++++-
.../data/mysql/pl-PL/mandatory/sample_notices.sql | 17 +++++++-
.../data/mysql/ru-RU/mandatory/sample_notices.sql | 17 +++++++-
.../data/mysql/uk-UA/mandatory/sample_notices.sql | 17 +++++++-
.../prog/en/includes/members-toolbar.inc | 1 +
.../intranet-tmpl/prog/en/modules/circ/returns.tt | 11 ++++++
koha-tmpl/intranet-tmpl/prog/js/members-menu.js | 5 +++
members/printslip.pl | 46 +++++++++++++++++++++-
13 files changed, 217 insertions(+), 8 deletions(-)
create mode 100644 installer/data/mysql/atomicupdate/bug_12224-add_CHECKINSLIP_notice.perl
diff --git a/installer/data/mysql/atomicupdate/bug_12224-add_CHECKINSLIP_notice.perl b/installer/data/mysql/atomicupdate/bug_12224-add_CHECKINSLIP_notice.perl
new file mode 100644
index 0000000000..fc33a72771
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_12224-add_CHECKINSLIP_notice.perl
@@ -0,0 +1,22 @@
+$DBversion = 'XXX';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do(q{ INSERT IGNORE INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) VALUES
+ ('circulation','CHECKINSLIP','','Checkin slip',1,'Checkin slip',
+"<>
+Checked in items for <> <> <> <>
+(<>)
+
+<>
+
+Checked in today
+
+
+<>
+Barcode: <>
+
+",
+ 'print')
+ });
+
+ NewVersion( $DBversion, 12224, "Add CHECKINSLIP notice" );
+}
diff --git a/installer/data/mysql/en/mandatory/sample_notices.yml b/installer/data/mysql/en/mandatory/sample_notices.yml
index 705cebffee..9d4f02ecb0 100644
--- a/installer/data/mysql/en/mandatory/sample_notices.yml
+++ b/installer/data/mysql/en/mandatory/sample_notices.yml
@@ -1454,3 +1454,26 @@ tables:
- "[% ELSE %]"
- "The following item, [% biblio.title %], has correctly been renewed and is now due on [% checkout.date_due | $KohaDates as_due_date => 1 %]"
- "[% END %]"
+
+ - module: circulation
+ code: CHECKINSLIP
+ branchcode: ""
+ name: "Checkin slip"
+ is_html: 1
+ title: "Checkin slip"
+ message_transport_type: print
+ lang: default
+ content:
+ - "<>
"
+ - "Checked in items for <> <> <> <>
"
+ - "(<>)
"
+ - ""
+ - "<>
"
+ - ""
+ - "Checked in today
"
+ - ""
+ - ""
+ - "<>
"
+ - "Barcode: <>
"
+ - "
"
+ - ""
diff --git a/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql b/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql
index b18d65998b..d8d4f40410 100644
--- a/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql
+++ b/installer/data/mysql/fr-CA/obligatoire/sample_notices.sql
@@ -22,7 +22,20 @@ INSERT INTO `letter` (module, code, branchcode, name, is_html, title, content, m
('suggestions','ACCEPTED','','Suggestion d\'achat acceptée',0,'Suggestion d\'achat acceptée','Bonjour <> <>,\r\n\r\nVous nous avez suggéré l\'achat du document <> par <>.\r\n\r\nNous avons évalué votre suggestion aujourdhui. Le document sera commandé dès que possible. Vous serez tenu au courant par courriel quand le document aura été commandé et quand il sera disponible à la bibliothèque.\r\n\r\nPour toute question, veuillez nous contacter à l\'adresse suivante : <>.\r\n\r\nMerci.\r\n\r\n<>','email'),
('suggestions','AVAILABLE','','Suggestion d\'achat disponible',0,'Suggestion d\'achat disponible','Bonjour <> <>,\r\n\r\nVous nous avez suggéré l\'achat du document <> par <>.\r\n\r\nNous avons le plaisir de vous informer que le document fait aujourd\'hui partie de nos collection et qu\'il est disponible à la bibliothèque.\r\n\r\nPour toute question, veuillez nous contacter à l\'adresse suivante : <>.\r\n\r\nMerci.\r\n\r\n<>','email'),
('suggestions','ORDERED','','Suggestion d\'achat commandée',0,'Suggestion d\'achat commandée','Bonjour <> <>,\r\n\r\nVous nous avez suggéré l\'achat du document <> par <>.\r\n\r\nNous avons le plaisir de vous informer que le document a été commandé.\r\n\r\nVous recevrez une nouvelle notification quand le document sera disponible à bibliothèque.\r\n\r\nPour toute question, veuillez nous contacter à l\'adresse suivante : <>.\r\n\r\nMerci.\r\n\r\n<>','email'),
-('suggestions','REJECTED','','Suggestion d\'achat rejetée',0,'Suggestion d\'achat rejetée','Bonjour <> <>,\r\n\r\nVous nous avez suggéré l\'achat du document <> par <>.\r\n\r\nNous avons évalué votre suggestion aujourd\'hui et décidé de ne pas l\'acheter cette fois.\r\n\r\nLa raison de notre refus est : <>\r\n\r\nPour toute question, veuillez nous contacter à l\'adresse suivante : <>.\r\n\r\nMerci.\r\n\r\n<>','email');
+('suggestions','REJECTED','','Suggestion d\'achat rejetée',0,'Suggestion d\'achat rejetée','Bonjour <> <>,\r\n\r\nVous nous avez suggéré l\'achat du document <> par <>.\r\n\r\nNous avons évalué votre suggestion aujourd\'hui et décidé de ne pas l\'acheter cette fois.\r\n\r\nLa raison de notre refus est : <>\r\n\r\nPour toute question, veuillez nous contacter à l\'adresse suivante : <>.\r\n\r\nMerci.\r\n\r\n<>','email'),
+('circulation','CHECKINSLIP','','Checkin slip',1,'Checkin slip',"<>
+Checked in items for <> <> <> <>
+(<>)
+
+<>
+
+Checked in today
+
+
+<>
+Barcode: <>
+
+", 'print');
INSERT INTO `letter` (module, code, name, title, content, is_html, message_transport_type)
VALUES ('suggestions','NEW_SUGGESTION','Nouvelle suggestion','Nouvelle suggestion','Suggestion en attente
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
index 7a6a858bca..5e1b68ceec 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql
@@ -50,7 +50,22 @@ VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New suggestion','Su
Reason for suggestion: <>
Notes: <>
-
',1, 'email');
+ ',1, 'email'),
+ ('circulation','CHECKINSLIP','Checkin slip','Checkin slip',
+ "<>
+ Checked in items for <> <> <> <>
+ (<>)
+
+ <>
+
+ Checked in today
+
+
+ <>
+ Barcode: <>
+
+ ",1, 'print');
+
INSERT INTO `letter` (module, code, name, title, content, is_html)
VALUES ('circulation','ISSUESLIP','Ticket de de prêt','Ticket de prêt', '<>
Prêts à <> <> <> <>
diff --git a/installer/data/mysql/it-IT/necessari/notices.sql b/installer/data/mysql/it-IT/necessari/notices.sql
index 4698c350fa..2deffe4af3 100644
--- a/installer/data/mysql/it-IT/necessari/notices.sql
+++ b/installer/data/mysql/it-IT/necessari/notices.sql
@@ -55,7 +55,22 @@ VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New suggestion','Su
Reason for suggestion: <>
Notes: <>
- ',1, 'email');
+ ',1, 'email'),
+ ('circulation','CHECKINSLIP','Checkin slip','Checkin slip',
+ "<>
+ Checked in items for <> <> <> <>
+ (<>)
+
+ <>
+
+ Checked in today
+
+
+ <>
+ Barcode: <>
+
+ ",1, 'print');
+
INSERT INTO letter (module, code, name, title, content, is_html)
VALUES ('circulation','ISSUESLIP','Ricevuta di prestito','Ricevuta di prestito', '<>
Prestito a <> <> <> <>
diff --git a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql
index 30083c98aa..1e0563771b 100644
--- a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql
+++ b/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql
@@ -70,7 +70,22 @@ VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New suggestion','Su
Reason for suggestion: <>
Notes: <>
- ',1, 'email');
+ ',1, 'email'),
+ ('circulation','CHECKINSLIP','Checkin slip','Checkin slip',
+ "<>
+ Checked in items for <> <> <> <>
+ (<>)
+
+ <>
+
+ Checked in today
+
+
+ <>
+ Barcode: <>
+
+ ",1, 'print');
+
INSERT INTO `letter` (module, code, name, title, content, is_html)
VALUES ('circulation','ISSUESLIP','Utlån','Utlån', '<>
Utlånt til <> <> <> <>
diff --git a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql
index 64970f6ea3..e320733373 100644
--- a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql
+++ b/installer/data/mysql/pl-PL/mandatory/sample_notices.sql
@@ -49,7 +49,22 @@ VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New suggestion','Su
Reason for suggestion: <>
Notes: <>
- ',1, 'email');
+ ',1, 'email'),
+ ('circulation','CHECKINSLIP','Checkin slip','Checkin slip',
+ "<>
+ Checked in items for <> <> <> <>
+ (<>)
+
+ <>
+
+ Checked in today
+
+
+ <>
+ Barcode: <>
+
+ ",1, 'print');
+
INSERT INTO `letter` (module, code, name, title, content, is_html)
VALUES ('circulation','ISSUESLIP','Issue slip','Issue slip', '<>
Checked out to <> <> <> <>
diff --git a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql
index 465e5f1ad5..8341257064 100644
--- a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql
+++ b/installer/data/mysql/ru-RU/mandatory/sample_notices.sql
@@ -48,7 +48,22 @@ VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New suggestion','Su
Reason for suggestion: <>
Notes: <>
- ',1, 'email');
+ ',1, 'email'),
+ ('circulation','CHECKINSLIP','Checkin slip','Checkin slip',
+ "<>
+ Checked in items for <> <> <> <>
+ (<>)
+
+ <>
+
+ Checked in today
+
+
+ <>
+ Barcode: <>
+
+ ",1, 'print');
+
INSERT INTO `letter` (module, code, name, title, content, is_html)
VALUES ('circulation','ISSUESLIP','Issue slip','Issue slip', '<>
Checked out to <> <> <> <>
diff --git a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql
index 3c79c2866d..857a1a94b8 100644
--- a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql
+++ b/installer/data/mysql/uk-UA/mandatory/sample_notices.sql
@@ -113,7 +113,22 @@ VALUES ('suggestions','NEW_SUGGESTION','New suggestion','New suggestion','Su
Reason for suggestion: <>
Notes: <>
- ',1, 'email');
+ ',1, 'email'),
+ ('circulation','CHECKINSLIP','Checkin slip','Checkin slip',
+ "<>
+ Checked in items for <> <> <> <>
+ (<>)
+
+ <>
+
+ Checked in today
+
+
+ <>
+ Barcode: <>
+
+ ",1, 'print');
+
INSERT INTO `letter` (module, code, name, title, content, is_html, message_transport_type) VALUES
('members', 'DISCHARGE', 'підтвердження на розрахування',
'Розрахування для відвідувача — <> <>', '
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
index bebe5a143c..bb9abf4089 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
@@ -27,6 +27,7 @@
[% IF patron.has_overdues %]
Print overdues
[% END %]
+ Print checkin slip
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
index b5754e8b7f..a956317761 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt
@@ -857,6 +857,7 @@
Collection |
Patron |
Note |
+ |
@@ -942,6 +943,9 @@
[% riloo.itemnotes_nonpublic | html %]
[% END %]
+
+ Print checkin slip
+ |
[% END # /FOREACH riloo %]
@@ -1139,6 +1143,13 @@
}
});
$('[data-toggle="tooltip"]').tooltip();
+
+ $("#printcheckinslip").click(function(){
+ var borrowernumber = $(this).data('borrowernumber');
+ window.open("/cgi-bin/koha/members/printslip.pl?borrowernumber=" + borrowernumber + "&print=checkinslip", "printwindow");
+ return false;
+ });
+
});
[% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js
index 9db8b24bbe..806c063cc2 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js
@@ -71,6 +71,11 @@ $(document).ready(function(){
$(".btn-group").removeClass("open");
return false;
});
+ $("#printcheckinslip").click(function(){
+ printx_window("checkinslip");
+ $(".btn-group").removeClass("open");
+ return false;
+ });
$("#printclearscreen").click(function(){
printx_window("slip");
window.location.replace("/cgi-bin/koha/circ/circulation.pl");
diff --git a/members/printslip.pl b/members/printslip.pl
index debbbded6c..389f5a6c88 100755
--- a/members/printslip.pl
+++ b/members/printslip.pl
@@ -39,6 +39,7 @@ use C4::Auth qw/:DEFAULT get_session/;
use C4::Output;
use C4::Members;
use C4::Koha;
+use Koha::DateUtils;
#use Smart::Comments;
#use Data::Dumper;
@@ -79,7 +80,50 @@ output_and_exit_if_error( $input, $cookie, $template, { module => 'members', log
my $branch=C4::Context->userenv->{'branch'};
my ($slip, $is_html);
-if (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
+if ( $print eq 'checkinslip' ) {
+ my $checkinslip_branch = $session->param('branch') ? $session->param('branch') : $branch;
+
+ # get today's checkins
+ 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 );
+ $today_start = Koha::Database->new->schema->storage->datetime_parser->format_datetime( $today_start );
+ $today_end = Koha::Database->new->schema->storage->datetime_parser->format_datetime( $today_end );
+ my $todays_checkins = Koha::Old::Checkouts->search({
+ returndate => {
+ '>=' => $today_start,
+ '<=' => $today_end,
+ },
+ borrowernumber => $borrowernumber,
+ branchcode => $checkinslip_branch,
+ });
+
+ my @checkins;
+ while ( my $c = $todays_checkins->next ) {
+ push @checkins, {
+ biblio => $c->item->biblio->unblessed,
+ items => $c->item->unblessed,
+ };
+ }
+ my %repeat = (
+ checkedin => \@checkins,
+ );
+
+ my $letter = C4::Letters::GetPreparedLetter(
+ module => 'circulation',
+ letter_code => 'CHECKINSLIP',
+ branchcode => $checkinslip_branch,
+ tables => {
+ branches => $checkinslip_branch,
+ borrowers => $borrowernumber,
+ },
+ repeat => \%repeat,
+ message_transport_type => 'print'
+ );
+
+ $slip = $letter->{content};
+ $is_html = $letter->{is_html};
+
+} elsif (my $letter = IssueSlip ($session->param('branch') || $branch, $borrowernumber, $print eq "qslip")) {
$slip = $letter->{content};
$is_html = $letter->{is_html};
}
--
2.11.0