Bugzilla – Attachment 173273 Details for
Bug 37360
Add 'Protected Status' as one of the things that can be updated via Batch Patron Modification tool
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37360: Add protected as a borrower mod option
Bug-37360-Add-protected-as-a-borrower-mod-option.patch (text/plain), 7.39 KB, created by
Jake Deery
on 2024-10-24 14:35:33 UTC
(
hide
)
Description:
Bug 37360: Add protected as a borrower mod option
Filename:
MIME Type:
Creator:
Jake Deery
Created:
2024-10-24 14:35:33 UTC
Size:
7.39 KB
patch
obsolete
>From 622a99a992d20f1d7b9ffd0656d854596458b817 Mon Sep 17 00:00:00 2001 >From: Jake Deery <jake.deery@ptfs-europe.com> >Date: Fri, 30 Aug 2024 11:10:35 +0000 >Subject: [PATCH] Bug 37360: Add protected as a borrower mod option > >This patch adds protected status as a batch borrower modification >option, if the user performing the modification is a superlibrarian. > >TO TEST: > >a) login as a superlibrarian >b) attempt to batch modify these k.t.d user barcodes: > 1) 23529000035676 > 2) 23529001000463 > 3) 23529000050113 >c) notice that there is no protected option >d) APPLY PATCH >e) repeat step b >f) notice that protected is now an option >g) set all borrowers to protected (yes) > 1) notice that the status has changed, in each individual user > record >h) set all borrowers to unprotected (no) > 1) notice that the status has changed, in each individual user > record >i) set the proctedted status back to yes, but also set some other > random options (e.g. city to Cork) > 1) notice that the city and protected status are both updated >j) use the disabled checkbox next to protected > 1) notice that this always sets the protected status to zero >k) SIGN OFF >--- > .../prog/en/modules/tools/modborrowers.tt | 13 ++++++++++ > tools/modborrowers.pl | 24 +++++++++++++------ > 2 files changed, 30 insertions(+), 7 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 b20d910533..67cb3ebb91 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >@@ -261,6 +261,9 @@ > [% IF CanUpdatePasswordExpiration %] > <th>Password expiration date</th> > [% END %] >+ [% IF CanUpdateProtectPatron %] >+ <th>Protected</th> >+ [% END %] > <th>Circulation note</th> > <th>OPAC note</th> > <th>Message</th> >@@ -308,6 +311,15 @@ > <td data-order="9999-99-99">Never</td> > [% END %] > [% END %] >+ [% IF CanUpdateProtectPatron %] >+ <td> >+ [% IF borrower.protected %] >+ Yes >+ [% ELSE %] >+ No >+ [% END %] >+ </td> >+ [% END %] > <td>[% borrower.borrowernotes | $raw | html_line_break %]</td> > <td>[% borrower.opacnote | html %]</td> > <td> >@@ -378,6 +390,7 @@ > [% CASE 'debarred' %]<span>Restriction expiration:</span> > [% CASE 'debarredcomment' %]<span>Restriction comment:</span> > [% CASE 'password_expiration_date' %]<span>Password expiration date:</span> >+ [% CASE 'protected' %]<span>Protected:</span> > [% END %] > </label> > [% IF ( field.type == 'text' ) %] >diff --git a/tools/modborrowers.pl b/tools/modborrowers.pl >index 190fe94b2b..f9f998c7fb 100755 >--- a/tools/modborrowers.pl >+++ b/tools/modborrowers.pl >@@ -22,7 +22,7 @@ > # Batch Edit Patrons > # Modification for patron's fields: > # surname firstname branchcode categorycode city state zipcode country sort1 >-# sort2 dateenrolled dateexpiry borrowernotes >+# sort2 dateenrolled dateexpiry borrowernotes protected > # And for patron attributes. > > use Modern::Perl; >@@ -54,8 +54,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > > my $logged_in_user = Koha::Patrons->find($loggedinuser); > >-$template->param( CanUpdatePasswordExpiration => 1 ) if $logged_in_user->is_superlibrarian; >- >+if ( $logged_in_user->is_superlibrarian ) { >+ $template->param( CanUpdatePasswordExpiration => 1 ); >+ $template->param( CanUpdateProtectPatron => 1 ); >+} > my $dbh = C4::Context->dbh; > > # Show borrower informations >@@ -194,6 +196,10 @@ if ( $op eq 'cud-show' || $op eq 'show' ) { > my @categories_option; > push @categories_option, { value => $_->categorycode, lib => $_->description } for @patron_categories; > unshift @categories_option, { value => "", lib => "" }; >+ my @protected_option; >+ push @protected_option, { value => 1, lib => "Yes" }; >+ push @protected_option, { value => 0, lib => "No" }; >+ unshift @protected_option, { value => "", lib => "" }; > my $bsort1 = GetAuthorisedValues("Bsort1"); > my @sort1_option; > push @sort1_option, { value => $_->{authorised_value}, lib => $_->{lib} } for @$bsort1; >@@ -334,7 +340,10 @@ if ( $op eq 'cud-show' || $op eq 'show' ) { > }, > ); > >- push @fields, { name => "password_expiration_date", type => "date" } if $logged_in_user->is_superlibrarian; >+ if ($logged_in_user->is_superlibrarian) { >+ push @fields, { name => "password_expiration_date", type => "date" } ; >+ push @fields, { name => "protected", type => "select", option => \@protected_option }; >+ } > > $template->param( 'patron_attributes_codes', \@patron_attributes_codes ); > $template->param( 'patron_attributes_values', \@patron_attributes_values ); >@@ -349,11 +358,11 @@ if ( $op eq 'cud-do' ) { > my @disabled = $input->multi_param('disable_input'); > my $infos; > for my $field ( >- qw/surname firstname branchcode categorycode streetnumber address address2 city state zipcode country email phone mobile fax sort1 sort2 dateenrolled dateexpiry password_expiration_date borrowernotes opacnote debarred debarredcomment/ >+ qw/surname firstname branchcode categorycode streetnumber address address2 city state zipcode country email phone mobile fax sort1 sort2 dateenrolled dateexpiry password_expiration_date borrowernotes opacnote debarred debarredcomment protected/ > ) > { >- my $value = $input->param($field); >- $infos->{$field} = $value if $value; >+ my $value = $input->param($field) if $input->param($field) ne ''; >+ $infos->{$field} = $value if defined $value; > $infos->{$field} = "" if grep { $_ eq $field } @disabled; > } > >@@ -362,6 +371,7 @@ if ( $op eq 'cud-do' ) { > } > > delete $infos->{password_expiration_date} unless $logged_in_user->is_superlibrarian; >+ delete $infos->{protected} unless $logged_in_user->is_superlibrarian; > > my @errors; > my @borrowernumbers = $input->multi_param('borrowernumber'); >-- >2.43.0
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 37360
:
170932
|
170991
|
172385
|
172977
|
172978
|
173273
|
173274
|
173275
|
173276