Bugzilla – Attachment 91477 Details for
Bug 12224
Allow easy printing of patron check-in slip
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12224: (follow-up) Allow easy printing of patron check-ins for today
0002-Bug-12224-follow-up-Allow-easy-printing-of-patron-ch.patch (text/plain), 10.88 KB, created by
Johanna Räisä
on 2019-07-12 07:42:59 UTC
(
hide
)
Description:
Bug 12224: (follow-up) Allow easy printing of patron check-ins for today
Filename:
MIME Type:
Creator:
Johanna Räisä
Created:
2019-07-12 07:42:59 UTC
Size:
10.88 KB
patch
obsolete
>From 88480dc16132ec45dc2c69b5ef374ebfe9af6449 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <j.kylmala@gmail.com> >Date: Mon, 24 Aug 2015 09:08:31 +0000 >Subject: [PATCH 2/3] Bug 12224: (follow-up) Allow easy printing of patron > check-ins for today > >This adds a printing option to the staff client patron details page >to print a list of items the patron returned today at this branch. > >To test: > >1) Apply patch. >2) Check in tools > Notices & Slips that you have CHECKINSLIP slip, > and have print message there. If not, run updatedatabase.pl >3) Check-in items for a patron. >4) Go to that patron's detail page, and from the Print-menu in > the toolbar, select "Print check-in slip" >5) You should get a slip of the patron's checked-in items. >6) Optionally, test Check-ins for the same patron, but in different > branches - should only print items for the current branch. >7) Optionally, test Check-ins for the same patron, but returned > in different day - should only print items for today. >8) Run unit test t/db_dependent/Members/IssueSlip.t > >Sponsored-by: Koha-Suomi Oy >--- > .../bug_12224_checkin_syspref.perl | 21 ++++ > .../mysql/en/mandatory/sample_notices.sql | 18 ++-- > installer/data/mysql/updatedatabase.pl | 18 ---- > .../prog/en/includes/members-toolbar.inc | 4 +- > t/db_dependent/Members/IssueSlip.t | 97 ++++++++++++++++++- > 5 files changed, 130 insertions(+), 28 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_12224_checkin_syspref.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_12224_checkin_syspref.perl b/installer/data/mysql/atomicupdate/bug_12224_checkin_syspref.perl >new file mode 100644 >index 0000000000..dba6f5270e >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_12224_checkin_syspref.perl >@@ -0,0 +1,21 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do("INSERT INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) >+ VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<h3><<branches.branchname>></h3> >+ Checked in by <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> >+ (<<borrowers.cardnumber>>) <br /> >+ >+ <<today>><br /> >+ <h4>Checked In Today</h4> >+ <checkedin> >+ <p> >+ <<biblio.title>><br> >+ Barcode: <<items.barcode>><br> >+ </p> >+ </checkedin>', 'print' >+ );"); >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 12224 - Allow easy printing of patron check-in slip)\n"; >+} >\ No newline at end of file >diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql >index 9508bb778d..b13843dd88 100644 >--- a/installer/data/mysql/en/mandatory/sample_notices.sql >+++ b/installer/data/mysql/en/mandatory/sample_notices.sql >@@ -316,14 +316,18 @@ INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, > > INSERT INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, `title`, `content`, `message_transport_type`) VALUES > ('circulation', 'SR_SLIP', '', 'Stock rotation slip', 0, 'Stock rotation report', 'Stock rotation report for [% branch.name %]:\r\n\r\n[% IF branch.items.size %][% branch.items.size %] items to be processed for this branch.\r\n[% ELSE %]No items to be processed for this branch\r\n[% END %][% FOREACH item IN branch.items %][% IF item.reason != \'in-demand\' %]Title: [% item.title %]\r\nAuthor: [% item.author %]\r\nCallnumber: [% item.callnumber %]\r\nLocation: [% item.location %]\r\nBarcode: [% item.barcode %]\r\nOn loan?: [% item.onloan %]\r\nStatus: [% item.reason %]\r\nCurrent library: [% item.branch.branchname %] [% item.branch.branchcode %]\r\n\r\n[% END %][% END %]', 'email'); >+ > INSERT INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) >-VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<<borrowers.firstname>> <<borrowers.surname>><br> >-<<branches.branchname>>, <<today>><br> >-You returned these items today: >-<ul> >+VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<h3><<branches.branchname>></h3> >+Checked in by <<borrowers.title>> <<borrowers.firstname>> <<borrowers.initials>> <<borrowers.surname>> <br /> >+(<<borrowers.cardnumber>>) <br /> >+ >+<<today>><br /> >+<h4>Checked In Today</h4> > <checkedin> >-<li><<biblio.author>>: <<biblio.title>><br> >+<p> >+<<biblio.title>><br> > Barcode: <<items.barcode>><br> >-</checkedin> >-</ul>', 'print' >+</p> >+</checkedin>'', 'print' > ); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 3b6e454cbe..603dc34c14 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -18881,24 +18881,6 @@ if( CheckVersion( $DBversion ) ) { > print "Upgrade to $DBversion done (Bug 18928 - Move holdallowed, hold_fulfillment_policy, returnbranch to circulation_rules)\n"; > } > >-$DBversion = '19.06.00.011'; >-if ( CheckVersion($DBversion) ) { >- $dbh->do(" >- INSERT INTO letter (module, code, branchcode, name, is_html, title, content, message_transport_type) >- VALUES ( 'circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '1', 'Items returned today', '<<borrowers.firstname>> <<borrowers.surname>><br> >- <<branches.branchname>>, <<today>><br> >- You returned these items today: >- <ul> >- <checkedin> >- <li><<biblio.author>>: <<biblio.title>><br> >- Barcode: <<items.barcode>><br> >- </checkedin> >- </ul>', 'print' >- );"); >- SetVersion($DBversion); >- print "Upgrade to $DBversion done (Bug 12224 - Easy printing of patron check-in slip)\n"; >-} >- > # SEE bug 13068 > # if there is anything in the atomicupdate, read and execute it. > my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/'; >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 c7fa409ae0..9abb3c5d50 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -32,8 +32,8 @@ > <li><a id="printsummary" href="#">Print summary</a></li> > <li><a id="printslip" href="#">Print slip</a></li> > <li><a id="printquickslip" href="#">Print quick slip</a></li> >- <li><a id="printcheckinslip" href="#">Print checked-in today -slip</a></li> >- [% IF Borrowers.HasOverdues( patron.borrowernumber ) %] >+ <li><a id="printcheckinslip" href="#">Print check-in slip</a></li> >+ [% IF Borrowers.HasOverdues( borrowernumber ) %] > <li><a id="print_overdues" href="#">Print overdues</a></li> > [% END %] > </ul> >diff --git a/t/db_dependent/Members/IssueSlip.t b/t/db_dependent/Members/IssueSlip.t >index 2280045f27..2f35744e74 100644 >--- a/t/db_dependent/Members/IssueSlip.t >+++ b/t/db_dependent/Members/IssueSlip.t >@@ -19,7 +19,7 @@ > use Modern::Perl; > > use Data::Dumper; # REMOVEME with diag >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::MockModule; > use Test::MockTime qw( set_fixed_time ); > use t::lib::TestBuilder; >@@ -94,6 +94,18 @@ $dbh->do(q| > INSERT INTO letter( module, code, branchcode, name, is_html, title, content, message_transport_type) VALUES ('circulation', 'ISSUEQSLIP', '', 'Issue Quick Slip', 0, 'Issue Quick Slip', ?, 'email') > |, {}, $quick_slip_content); > >+my $checkin_slip_content = <<EOS; >+Checked in today: >+<checkedin> >+Title: <<biblio.title>> >+Barcode: <<items.barcode>> >+</checkedin> >+EOS >+ >+$dbh->do(q| >+ INSERT INTO letter( module, code, branchcode, name, is_html, title, content, message_transport_type) VALUES ('circulation', 'CHECKINSLIP', '', 'Printed check-in slip', '0', 'Items returned today', ?, 'print') >+|, {}, $checkin_slip_content); >+ > my ( $title1, $title2 ) = ( 'My title 1', 'My title 2' ); > my ( $barcode1, $barcode2 ) = ('BC0101', 'BC0202' ); > my $record = MARC::Record->new; >@@ -128,6 +140,89 @@ $module->mock( 'userenv', sub { { branch => $branchcode } } ); > my $today = dt_from_string; > my $yesterday = dt_from_string->subtract_duration( DateTime::Duration->new( days => 1 ) ); > >+subtest 'Check-in slip' => sub { >+ plan tests => 2; >+ >+ subtest 'Empty slip' => sub { >+ plan tests => 1; >+ >+ my $today_daily = $today->clone->set( hour => 23, minute => 59 ); >+ my ( $date_due, $issue_date ); >+ $date_due = $today_daily; >+ $issue_date = $today_daily->clone->subtract_duration( DateTime::Duration->new( minutes => 1 ) ); >+ AddIssue( $borrower, $barcode1, $date_due, undef, $issue_date ); >+ >+ my $slip = CheckInSlip($borrowernumber, $branchcode ); >+ my $empty_slip = <<EOS; >+Checked in today: >+ >+EOS >+ is( $slip->{content}, $empty_slip, 'No checked in returns an empty slip' ); >+ >+ AddReturn( $barcode1, $branchcode ); >+ }; >+ >+ subtest 'Daily returns' => sub { >+ plan tests => 3; >+ my $slip = CheckInSlip($borrowernumber, $branchcode ); >+ my $expected_slip = <<EOS; >+Checked in today: >+ >+Title: $title1 >+Barcode: $barcode1 >+ >+EOS >+ is( $slip->{content}, $expected_slip, 'CheckInSlip should return a slip with one check-in' ); >+ >+ my $today_daily = $today->clone->set( hour => 23, minute => 59 ); >+ my ( $date_due, $issue_date ); >+ $date_due = $today_daily; >+ $issue_date = $today_daily->clone->subtract_duration( DateTime::Duration->new( minutes => 1 ) ); >+ AddIssue( $borrower, $barcode1, $date_due, undef, $issue_date ); >+ AddReturn( $barcode1, $branchcode ); >+ >+ $slip = CheckInSlip($borrowernumber, $branchcode ); >+ $expected_slip = <<EOS; >+Checked in today: >+ >+Title: $title1 >+Barcode: $barcode1 >+ >+ >+Title: $title1 >+Barcode: $barcode1 >+ >+EOS >+ is( $slip->{content}, $expected_slip, 'CheckInSlip should return a slip with 2 same check-in' ); >+ >+ $today_daily = $today->clone->set( hour => 01, minute => 59 ); >+ $date_due = $today_daily; >+ $issue_date = $today_daily->clone->subtract_duration( DateTime::Duration->new( minutes => 1 ) ); >+ AddIssue( $borrower, $barcode2, $date_due, undef, $issue_date ); >+ AddReturn( $barcode2, $branchcode ); >+ >+ $slip = CheckInSlip($borrowernumber, $branchcode ); >+ $expected_slip = <<EOS; >+Checked in today: >+ >+Title: $title1 >+Barcode: $barcode1 >+ >+ >+Title: $title1 >+Barcode: $barcode1 >+ >+ >+Title: $title2 >+Barcode: $barcode2 >+ >+EOS >+ is( $slip->{content}, $expected_slip, 'CheckInSlip should return a slip with 3 check-in' ); >+ >+ }; >+ >+}; >+ > subtest 'Issue slip' => sub { > plan tests => 3; > >-- >2.17.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12224
:
28194
|
29693
|
41819
|
41820
|
44574
|
44576
|
44582
|
44584
|
91476
|
91477
|
91478
|
96970
|
96972
|
110308
|
110395
|
110396
|
110403
|
110404
|
110516
|
110529
|
110530
|
110531
|
110576
|
110577
|
110578
|
114121
|
114122
|
114123
|
114124
|
116135
|
116482
|
116485
|
116486
|
116487
|
116488
|
116489
|
117245
|
117246
|
117247
|
117248
|
117249
|
117250
|
117620
|
117812
|
117813
|
117814
|
117815
|
117816
|
117817
|
117818
|
117819