From b1102502aa51ab3384cdfa94faf1237ce8208299 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 10 Feb 2012 11:18:48 +0100 Subject: [PATCH] Bug 6751: Adds a link "Export checkin barcodes" in readingrec to export a file containing a list of checkin barcode for the current day. Signed-off-by: Owen Leonard Signed-off-by: Paul Poulain --- .../prog/en/includes/circ-toolbar.inc | 9 ++++++-- .../en/modules/help/members/readingrec.tt | 4 +++- .../prog/en/modules/members/readingrec.tt | 4 ++++ members/readingrec.pl | 22 ++++++++++++++++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc index 4e583f1a97..efad86e27c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc @@ -33,6 +33,10 @@ function update_child() { [% END %] } +function export_barcodes() { + window.open('/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrowernumber %]&op=export_barcodes'); +} + // prepare DOM for YUI Toolbar $(document).ready(function() { @@ -67,8 +71,9 @@ function update_child() { { text: _("Renew Patron"), onclick: { fn: confirm_reregistration } }, { text: _("Set Permissions"), url: "/cgi-bin/koha/members/member-flags.pl?member=[% borrowernumber %]"[% UNLESS CAN_user_permissions %], disabled: true[% END %]}, { text: _("Delete"), [% UNLESS CAN_user_borrowers %]disabled: true, [% END %] onclick: { fn: confirm_deletion } }, - { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }[% UNLESS is_child %], disabled: true[% END %]} - ]; + { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }[% UNLESS is_child %], disabled: true[% END %]}, + { text: _("Export today's checked in barcodes"), onclick: { fn: export_barcodes }} + ]; new YAHOO.widget.Button({ type: "menu", diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/readingrec.tt index 6e9a837d10..1b3a114532 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/readingrec.tt @@ -4,6 +4,8 @@

The circulation history tab will appear if you have set the intranetreadinghistory preference to allow it to appear. If you have the OPACPrivacy system preference set to 'Allow' and the patron has decided that the library cannot keep this information this tab will only show currently checked out items.

+

You can export today's checked in barcodes by clicking on the link above the table. It simply generates a list of barcodes.

+

See the full documentation for Circulation History in the manual (online).

-[% INCLUDE 'help-bottom.inc' %] \ No newline at end of file +[% INCLUDE 'help-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt index 36f8937eeb..0b31878f40 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -29,6 +29,10 @@ [% IF ( loop_reading ) %]
+
+[% INCLUDE 'table-pager.inc' perpage='20' %] +
+ diff --git a/members/readingrec.pl b/members/readingrec.pl index c4a8237815..d4ecf659f7 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -29,7 +29,7 @@ use C4::Auth; use C4::Output; use C4::Members; use C4::Branch; -use List::MoreUtils qw/any/; +use List::MoreUtils qw/any uniq/; use C4::Dates qw/format_date/; use C4::Members::Attributes qw(GetBorrowerAttributes); @@ -64,6 +64,9 @@ my $limit = 0; my ( $issues ) = GetAllIssues($borrowernumber,$order,$limit); my @loop_reading; +my @barcodes; +my $today = C4::Dates->new(); +$today = $today->output("iso"); foreach my $issue (@{$issues}){ my %line; @@ -80,6 +83,23 @@ foreach my $issue (@{$issues}){ $line{barcode} = $issue->{'barcode'}; $line{volumeddesc} = $issue->{'volumeddesc'}; push(@loop_reading,\%line); + if (($input->param('op') eq 'export_barcodes') and ($today eq $issue->{'returndate'})) { + push( @barcodes, $issue->{'barcode'} ); + } +} + +if ($input->param('op') eq 'export_barcodes') { + my $borrowercardnumber = GetMember( borrowernumber => $borrowernumber )->{'cardnumber'} ; + my $delimiter = "\n"; + binmode( STDOUT, ":encoding(UTF-8)"); + print $input->header( + -type => 'application/octet-stream', + -charset => 'utf-8', + -attachment => "$today-$borrowercardnumber-checkinexport.txt" + ); + my $content = join($delimiter, uniq(@barcodes)); + print $content; + exit; } if ( $data->{'category_type'} eq 'C') { -- 2.39.5
Date