Bugzilla – Attachment 91951 Details for
Bug 13552
Add debar option to batch patron modification
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13552: (follow-up) Add debar option to batch patron modification
Bug-13552-follow-up-Add-debar-option-to-batch-patr.patch (text/plain), 7.22 KB, created by
Owen Leonard
on 2019-08-04 17:45:24 UTC
(
hide
)
Description:
Bug 13552: (follow-up) Add debar option to batch patron modification
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2019-08-04 17:45:24 UTC
Size:
7.22 KB
patch
obsolete
>From fbbf6425ac94e0facb213f9c3d4168285cb9f489 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Tue, 9 Jul 2019 13:51:31 +0000 >Subject: [PATCH] Bug 13552: (follow-up) Add debar option to batch patron > modification > >As per test feedback I've changed wording from debarrment to restriction > >Added insertion into the borrower_debarments table and removal from >borrower_debarments table (and borrowers.debarred and >borrowers.debarredcomment) when either 'Restriction >expiration' or 'Restriction comment' are ticket to be disabled/deleted. > >Test plan (please follow this instead of following test plan in the >first patch): > >1. Go to Tools > Batch patron modification > >2. Input the cardnumbers of several (undebarred/unrestricted) patrons >and submit > >3. Notice there is no input for setting Restriction expiration date or >Restriction comment > >Also notice in the list of matching borrowers at the top of the page >there is no display of the 'Restriction expiration' or 'Restriction >comment' values for the patron > >4. Apply patch > >5. Restart memcached and plack > >6. Refresh the page notice 'Restriction expiration' (a date picker >input) and 'Restriction comment'are now input options > >Also notice in the table at the top of the page 'Restriction >expiration' and 'Restriction comment' are shown on the far right of the table (you may need >to scroll to see this) > >7. Pick a date in the 'Restriction expired' datepicker and write in text into >the 'Restriction comment' field and submit > >8. Notice in the next loaded page the selected patrons have the >'Restriction expiration' and 'Restriction comment' values you entered > >9. Query the borrower_debarments database table and check that the new >debarments are added to this table > >10. Go back to the Batch patron modification page and re-input the same >cardnumbers > >11. Write text into the 'Restriction comment' field and don't pick a >'Restriction expiration' value and submit > >12. Notice in the next loaded page the selected patrons have the >'Restriction expiration' value of 9999-12-31 and 'Restriction comment' >value you just entered > >13. Query the borrowers table and notice the borrowers.debarred value >for the modified patrons is '9999-12-31' and the >borrower.debarredcomment is what you inputted in step 11 > >14. Query the borrower_debarments table and notice the expiration value >is NULL and the comment value is set to what you entered in step 11 > >Also note the addition of the new debarment has not removed the existing >debarment on the patrons > >15. Click on the cardnumber link of one of the patrons and notice the red >text on their patron account page informing you they are restricted >until the date you set > >16. In the Koha home directory enter Koha shell: >sudo koha-shell <instancename> > >17. Run: prove xt > >18. All tests should pass > >19. Repeat step 10 and tick the checkbox beside the 'Restriction >expiration' field and submit > >20. In the next loaded screen notice the 'Restricted expiration'and >'Restricted comment' are empty > >Check the borrower_debarments table and notice all restrictions for the >patron are removed. > >Check the borrowers table and notice the debarred and debarredcomment >fields are empty for the patrons > >21. Repeat steps 10 and 11 to make a new restriction > >22. Repeat step 19 and this time check the 'Restriction comment' field >and submit and observe that also clears the restriction in the next >loaded page, in the borrower_debarments and borrowers table > >23. Sign off > >Sponsored-By: Brimbank Library, Australia > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > .../prog/en/modules/tools/modborrowers.tt | 8 ++++---- > tools/modborrowers.pl | 22 ++++++++++++++++++++++ > 2 files changed, 26 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >index 7b817a1..542c4ad 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >@@ -149,8 +149,8 @@ > <th class="title-string">Expiry date</th> > <th>Circulation note</th> > <th>Opac Note</th> >- <th>Debarred till</th> >- <th>Debarred comment</th> >+ <th>Restriction expiration</th> >+ <th>Restriction comment</th> > [% FOREACH attrh IN attributes_header %] > <th>[% attrh.attribute | html %]</th> > [% END %] >@@ -234,9 +234,9 @@ > [% CASE 'opacnote' %] > OPAC note: > [% CASE 'debarred' %] >- Debarred till: >+ Restriction expiration: > [% CASE 'debarredcomment' %] >- Debarred comment: >+ Restriction comment: > [% END %] > </label> > [% IF ( field.type == 'text' ) %] >diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl >index 5ab22ab..eaa93ea 100755 >--- a/tools/modborrowers.pl >+++ b/tools/modborrowers.pl >@@ -38,6 +38,7 @@ use Koha::DateUtils qw( dt_from_string ); > use Koha::List::Patron; > use Koha::Libraries; > use Koha::Patron::Categories; >+use Koha::Patron::Debarments; > use Koha::Patrons; > > my $input = new CGI; >@@ -306,6 +307,27 @@ if ( $op eq 'do' ) { > for my $borrowernumber ( @borrowernumbers ) { > # If at least one field are filled, we want to modify the borrower > if ( defined $infos ) { >+ # If a debarred date or debarred comment has been submitted make a new debarment >+ if ( $infos->{debarred} || $infos->{debarredcomment} ) { >+ AddDebarment( >+ { >+ borrowernumber => $borrowernumber, >+ type => 'MANUAL', >+ comment => $infos->{debarredcomment}, >+ expiration => $infos->{debarred}, >+ }); >+ } >+ >+ # If debarment date or debarment comment are disabled then remove all debarrments >+ if ( grep { /debarred/ } @disabled ) { >+ eval { >+ my $debarrments = GetDebarments( { borrowernumber => $borrowernumber } ); >+ foreach my $debarment (@$debarrments) { >+ DelDebarment( $debarment->{'borrower_debarment_id'} ); >+ } >+ }; >+ } >+ > $infos->{borrowernumber} = $borrowernumber; > eval { Koha::Patrons->find( $borrowernumber )->set($infos)->store; }; > if ( $@ ) { # FIXME We could provide better error handling here >-- >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 13552
:
91422
|
91425
|
91433
|
91950
|
91951
|
92103
|
92104