Bugzilla – Attachment 70240 Details for
Bug 19837
Add multiple patrons to a list by cardnumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19837 - Add error feedback for duplicatred or unfound cardnumbers
Bug-19837---Add-error-feedback-for-duplicatred-or-.patch (text/plain), 3.37 KB, created by
Nick Clemens (kidclamp)
on 2018-01-03 01:42:06 UTC
(
hide
)
Description:
Bug 19837 - Add error feedback for duplicatred or unfound cardnumbers
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-01-03 01:42:06 UTC
Size:
3.37 KB
patch
obsolete
>From dc0b3c7d2f4fb9c2bea3258f31bde465232b617a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 3 Jan 2018 01:40:13 +0000 >Subject: [PATCH] Bug 19837 - Add error feedback for duplicatred or unfound > cardnumbers > >To test: >1 - Enter some patrons on a list >2 - 'Enter multiple cardnumbers' >3 - Make sure to add some that are already in list, some that don't >exist, and some new patrons >4 - Verify results are as expected with warnings >--- > .../prog/en/modules/patron_lists/list.tt | 28 ++++++++++++++++++++++ > patron_lists/list.pl | 15 +++++++++++- > 2 files changed, 42 insertions(+), 1 deletion(-) > >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 d18bf6f..104335d 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 >@@ -31,6 +31,34 @@ > <div class="yui-b"> > <h1>[% list.name |html %]</h1> > >+ [% IF ( not_found.size > 0 ) %] >+ <div class="dialog alert"><p>Warning, the following cardnumbers were not found:</p></div> >+ <table style="margin:auto;"> >+ <thead> >+ <tr><th>Cardnumbers not found</th></tr> >+ </thead> >+ <tbody> >+ [% FOREACH nf IN not_found %] >+ <tr><td>[% nf |html %]</td></td> >+ [% END %] >+ </tbody> >+ </table> >+ [% END %] >+ >+ [% IF ( existed.size > 0 ) %] >+ <div class="dialog alert"><p>Warning, the following cardnumbers were already in this list:</p></div> >+ <table style="margin:auto;"> >+ <thead> >+ <tr><th>Cardnumbers already in list</th></tr> >+ </thead> >+ <tbody> >+ [% FOREACH ed IN existed %] >+ <tr><td>[% ed |html %]</td></td> >+ [% END %] >+ </tbody> >+ </table> >+ [% END %] >+ > <form action="list.pl" id="add_patrons" method="post" class="clearfix"> > <fieldset class="rows"> > <legend>Add patrons</legend> >diff --git a/patron_lists/list.pl b/patron_lists/list.pl >index 91e6370..71bfa38 100755 >--- a/patron_lists/list.pl >+++ b/patron_lists/list.pl >@@ -41,12 +41,25 @@ my ( $template, $logged_in_user, $cookie ) = get_template_and_user( > my ($list) = > GetPatronLists( { patron_list_id => scalar $cgi->param('patron_list_id') } ); > >+my @existing = $list->patron_list_patrons; >+ > 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 @results = AddPatronsToList( { list => $list, cardnumbers => \@patrons_by_barcode } ); >+ my %found = map { $_->borrowernumber->cardnumber => 1 } @results; >+ my %exist = map { $_->borrowernumber->cardnumber => 1 } @existing; >+ my (@not_found, @existed); >+ foreach my $barcode ( @patrons_by_barcode ){ >+ push (@not_found, $barcode) unless defined $found{$barcode}; >+ push (@existed, $barcode) if defined $exist{$barcode}; >+ } >+ $template->param( >+ not_found => \@not_found, >+ existed => \@existed, >+ ); > } > > my @patrons_to_add = $cgi->multi_param('patrons_to_add'); >-- >2.1.4
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 19837
:
69913
|
70240
|
70277
|
70278
|
71910
|
71911