Bugzilla – Attachment 172977 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.59 KB, created by
Brendan Lawlor
on 2024-10-18 13:37:26 UTC
(
hide
)
Description:
Bug 37360: Add protected as a borrower mod option
Filename:
MIME Type:
Creator:
Brendan Lawlor
Created:
2024-10-18 13:37:26 UTC
Size:
7.59 KB
patch
obsolete
>From 28068ce124475769c26419dbc0799cfac04a39dd 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 > >Signed-off-by: Catrina <catrina@bywatersolutions.com> >Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> >--- > .../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 e398e1241b..431cf9ea41 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >@@ -260,6 +260,9 @@ > [% IF CanUpdatePasswordExpiration %] > <th>Password expiration date</th> > [% END %] >+ [% IF CanUpdateProtectPatron %] >+ <th>Protected</th> >+ [% END %] > <th>Circulation note</th> > <th>OPAC note</th> > <th>Restriction expiration</th> >@@ -306,6 +309,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 data-order="[% borrower.debarred | html %]">[% borrower.debarred | $KohaDates %]</td> >@@ -363,6 +375,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 6492d2f07b..99f33f788c 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; >@@ -51,8 +51,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 >@@ -178,6 +180,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; >@@ -335,7 +341,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); >@@ -350,11 +359,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; > } > >@@ -363,6 +372,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.39.5
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