Bugzilla – Attachment 44582 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: Allow easy printing of patron check-ins for today
Bug-12224-Allow-easy-printing-of-patron-check-ins-.patch (text/plain), 7.65 KB, created by
Joonas Kylmälä
on 2015-11-06 15:42:32 UTC
(
hide
)
Description:
Bug 12224: Allow easy printing of patron check-ins for today
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2015-11-06 15:42:32 UTC
Size:
7.65 KB
patch
obsolete
>From 43f5bb4737bfd7b0bfac3448fadd173151b99d79 Mon Sep 17 00:00:00 2001 >From: Pasi Kallinen <pasi.kallinen@pttk.fi> >Date: Mon, 12 May 2014 12:24:48 +0300 >Subject: [PATCH] Bug 12224: 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 checked-in today -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. > >Signed-off-by: Aleisha <aleishaamohia@hotmail.com> >--- > C4/Members.pm | 66 ++++++++++++++++++++++ > .../data/mysql/en/mandatory/sample_notices.sql | 12 ++++ > installer/data/mysql/updatedatabase.pl | 18 ++++++ > .../prog/en/includes/members-toolbar.inc | 6 ++ > members/printslip.pl | 7 ++- > 5 files changed, 108 insertions(+), 1 deletion(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 171f3c0..6246db2 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -105,6 +105,7 @@ BEGIN { > &GetMessagesCount > > &IssueSlip >+ &CheckInSlip > GetBorrowersWithEmail > > HasOverdues >@@ -2448,6 +2449,71 @@ sub IssueSlip { > ); > } > >+=head2 GetTodaysReturnsForBorrower >+ >+ $returns = GetTodaysReturnsForBorrower($borrowernumber, $branch); >+ >+Return a list of items borrower has checked-in today in branch. >+ >+=cut >+ >+sub GetTodaysReturnsForBorrower { >+ my ($borrowernumber, $branch) = @_; >+ my $dbh = C4::Context->dbh; >+ my $date = POSIX::strftime("%Y-%m-%d",localtime()); >+ >+ my $query = " >+ SELECT itemnumber >+ FROM old_issues >+ WHERE DATE(returndate) = ? >+ AND borrowernumber = ? >+ AND branchcode = ? >+ "; >+ >+ my $sth = $dbh->prepare($query); >+ $sth->execute($date, $borrowernumber, $branch); >+ my @results; >+ >+ while ( my $data = $sth->fetchrow_hashref ) { >+ my $bibdata = GetBiblioFromItemNumber($data->{itemnumber}); >+ push @results, $bibdata; >+ } >+ return \@results; >+} >+ >+=head2 CheckInSlip >+ >+ $letter = CheckInSlip($borrowernumber, $branch [, $message_transport_type ] ); >+ >+Returns the prepared letter data for items patron checked-in today in branch. >+message_transport_type defaults to 'print'. >+ >+=cut >+ >+sub CheckInSlip { >+ my ($borrowernumber, $branch, $mtt) = @_; >+ my $issues = GetTodaysReturnsForBorrower($borrowernumber, $branch); >+ my %repeat = ( >+ 'checkedin' => [ map { >+ 'biblio' => $_, >+ 'items' => $_, >+ 'issues' => $_, >+ }, @$issues ], >+ ); >+ >+ return C4::Letters::GetPreparedLetter ( >+ module => 'circulation', >+ letter_code => 'CHECKINSLIP', >+ branchcode => $branch, >+ tables => { >+ 'branches' => $branch, >+ 'borrowers' => $borrowernumber, >+ }, >+ repeat => \%repeat, >+ message_transport_type => $mtt || 'print', >+ ); >+} >+ > =head2 GetBorrowersWithEmail > > ([$borrnum,$userid], ...) = GetBorrowersWithEmail('me@example.com'); >diff --git a/installer/data/mysql/en/mandatory/sample_notices.sql b/installer/data/mysql/en/mandatory/sample_notices.sql >index 14c5634..cfc6ba3 100644 >--- a/installer/data/mysql/en/mandatory/sample_notices.sql >+++ b/installer/data/mysql/en/mandatory/sample_notices.sql >@@ -162,3 +162,15 @@ VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLI > > <item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item> > ', 'print' ); >+ >+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' >+); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 8a1d1b0..47a3efc 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -11341,6 +11341,24 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.21.00.054"; >+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' >+);"); >+ print "Upgrade to $DBversion done (Bug 12224 - Easy printing of patron check-in slip)\n"; >+ SetVersion($DBversion); >+} >+ > # DEVELOPER PROCESS, search for anything to execute in the db_update directory > # SEE bug 13068 > # if there is anything in the atomicupdate, read and execute it. >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 641bbad..3766064 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -64,6 +64,11 @@ $(document).ready(function(){ > $(".btn-group").removeClass("open"); > return false; > }); >+ $("#printcheckinslip").click(function(){ >+ printx_window("checkinslip"); >+ $(".btn-group").removeClass("open"); >+ return false; >+ }); > $("#searchtohold").click(function(){ > searchToHold(); > return false; >@@ -160,6 +165,7 @@ function searchToHold(){ > [% IF ( CAN_user_borrowers ) %]<li><a id="printsummary" href="#">Print summary</a></li>[% END %] > <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( borrowernumber ) %] > <li><a id="print_overdues" href="#">Print overdues</a></li> > [% END %] >diff --git a/members/printslip.pl b/members/printslip.pl >index dfe93d7..0224893 100755 >--- a/members/printslip.pl >+++ b/members/printslip.pl >@@ -76,7 +76,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > my $borrowernumber = $input->param('borrowernumber'); > 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') { >+ if (my $letter = CheckInSlip($borrowernumber, $session->param('branch') || $branch)) { >+ $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}; > } >-- >1.9.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