From d63cd0efbb9c59bab5de2aa67b3fb4831221a105 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 15 Dec 2017 17:26:12 +0000 Subject: [PATCH] Bug 19837: Add multiple patrons to a list by barcode This patch adds the interface change and basic functionality for an option to add multiple patrons to a patron list by scanning barcodes. To test, apply the patch and go to Tools -> Patron lists. - Create a patron list if necessary, and got to the "Add patrons" screen. - Test the process for adding patrons using the "Patron search" text input. - Test the process for adding patrons using the "Enter multiple card numbers" option. This should really have some error-handling added to it: Onscreen messages when a non-existing patron card number is submitted or when a patron already exists on the list. Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- .../prog/en/modules/patron_lists/list.tt | 68 +++++++++++++++---- patron_lists/list.pl | 9 +++ 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt index ba846b5901..9f2eba1b8e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/list.tt @@ -5,6 +5,20 @@ [% INCLUDE 'doc-head-close.inc' %] + @@ -18,25 +32,41 @@

[% list.name |html %]

-
-
+ +
Add patrons +
    +
  1. + + +
  2. + +
  3. +   + Enter multiple card numbers
  4. +
  5. + + +
  6. +
+
+
+ +
- - -
+
-
- Patrons to be added -
+
+ Patrons to be added +
-
- - - Cancel -
+
+ + + Cancel
-
@@ -159,6 +189,16 @@ return false; } }); + + $("#add_patrons_by_barcode a").on("click", function(){ + $("#add_patrons_by_barcode, #patron_search_line").hide(); + $("#add_patrons_by_search, #patron_barcodes_line, #patron_barcodes_submit").show(); + }); + + $("#add_patrons_by_search a").on("click", function(){ + $("#add_patrons_by_barcode, #patron_search_line").show(); + $("#add_patrons_by_search, #patron_barcodes_line, #patron_barcodes_submit").hide(); + }); }); [% END %] diff --git a/patron_lists/list.pl b/patron_lists/list.pl index 9a21681c2b..91e6370475 100755 --- a/patron_lists/list.pl +++ b/patron_lists/list.pl @@ -24,6 +24,7 @@ use CGI qw ( -utf8 ); use C4::Auth; use C4::Output; use Koha::List::Patron; +use List::MoreUtils qw/uniq/; my $cgi = new CGI; @@ -40,6 +41,14 @@ my ( $template, $logged_in_user, $cookie ) = get_template_and_user( my ($list) = GetPatronLists( { patron_list_id => scalar $cgi->param('patron_list_id') } ); +my $cardnumbers = $cgi->param('patrons_by_barcode'); +my @patrons_by_barcode; + +if ( $cardnumbers ){ + push my @patrons_by_barcode, uniq( split(/\s\n/, $cardnumbers) ); + AddPatronsToList( { list => $list, cardnumbers => \@patrons_by_barcode } ); +} + my @patrons_to_add = $cgi->multi_param('patrons_to_add'); if (@patrons_to_add) { AddPatronsToList( { list => $list, cardnumbers => \@patrons_to_add } ); -- 2.39.5