Bug 29926: Add ability for superlibrarians to batch edit password expiration dates
To test: 1 - Sign in as a superlibrarian 2 - Tools->Batch patron modification 3 - Add patrons with and without pasword expiration set 4 - Confirm dates display correctly on modification page, or show never 5 - Check the box to delete all dates 6 - Confirm patrons now show 'Never' 7 - Edit patrons again, set a date 8 - Confirm date is set correctly 9 - Sign in as a user with catalogue/tools/borrowers permissions, but not superlibrarian 10 - Confirm y9ou do not see, and cannnot edit password expiration dates Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
6ae0b3c76c
commit
60c8534b8d
|
|
@ -229,6 +229,9 @@
|
|||
<th>Mobile</th>
|
||||
<th>Registration date</th>
|
||||
<th>Expiry date</th>
|
||||
[% IF CanUpdatePasswordExpiration %]
|
||||
<th>Password expiration date</th>
|
||||
[% END %]
|
||||
<th>Circulation note</th>
|
||||
<th>OPAC note</th>
|
||||
<th>Restriction expiration</th>
|
||||
|
|
@ -265,6 +268,15 @@
|
|||
<td>[% borrower.mobile | html %]</td>
|
||||
<td data-order="[% borrower.dateenrolled | html %]">[% borrower.dateenrolled | $KohaDates %]</td>
|
||||
<td data-order="[% borrower.dateexpiry | html %]">[% borrower.dateexpiry | $KohaDates %]</td>
|
||||
[% IF CanUpdatePasswordExpiration %]
|
||||
[% IF borrower.password_expiration_date %]
|
||||
<td data-order="[% borrower.password_expiration_date | html %]">
|
||||
[% borrower.password_expiration_date | $KohaDates %]
|
||||
</td>
|
||||
[% ELSE %]
|
||||
<td data-order="9999-99-99">Never</td>
|
||||
[% END %]
|
||||
[% END %]
|
||||
<td>[% borrower.borrowernotes | html %]</td>
|
||||
<td>[% borrower.opacnote | html %]</td>
|
||||
<td data-order="[% borrower.debarred | html %]">[% borrower.debarred | $KohaDates %]</td>
|
||||
|
|
@ -320,6 +332,7 @@
|
|||
[% CASE 'opacnote' %]<span>OPAC note:</span>
|
||||
[% CASE 'debarred' %]<span>Restriction expiration:</span>
|
||||
[% CASE 'debarredcomment' %]<span>Restriction comment:</span>
|
||||
[% CASE 'password_expiration_date' %]<span>Password expiration date:</span>
|
||||
[% END %]
|
||||
</label>
|
||||
[% IF ( field.type == 'text' ) %]
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ 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;
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
# Show borrower informations
|
||||
|
|
@ -330,6 +332,8 @@ if ( $op eq 'show' ) {
|
|||
},
|
||||
);
|
||||
|
||||
push @fields, { name => "password_expiration_date", type => "date" } if $logged_in_user->is_superlibrarian;
|
||||
|
||||
$template->param('patron_attributes_codes', \@patron_attributes_codes);
|
||||
$template->param('patron_attributes_values', \@patron_attributes_values);
|
||||
|
||||
|
|
@ -341,16 +345,18 @@ if ( $op eq '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 sort1 sort2 dateenrolled dateexpiry borrowernotes opacnote debarred debarredcomment/ ) {
|
||||
for my $field ( qw/surname firstname branchcode categorycode streetnumber address address2 city state zipcode country email phone mobile sort1 sort2 dateenrolled dateexpiry password_expiration_date borrowernotes opacnote debarred debarredcomment/ ) {
|
||||
my $value = $input->param($field);
|
||||
$infos->{$field} = $value if $value;
|
||||
$infos->{$field} = "" if grep { $_ eq $field } @disabled;
|
||||
}
|
||||
|
||||
for my $field ( qw( dateenrolled dateexpiry debarred ) ) {
|
||||
for my $field ( qw( dateenrolled dateexpiry debarred password_expiration_date ) ) {
|
||||
$infos->{$field} = dt_from_string($infos->{$field}) if $infos->{$field};
|
||||
}
|
||||
|
||||
delete $infos->{password_expiration_date} unless $logged_in_user->is_superlibrarian;
|
||||
|
||||
my @attributes = $input->multi_param('patron_attributes');
|
||||
my @attr_values = $input->multi_param('patron_attributes_value');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue