|
Lines 22-28
Link Here
|
| 22 |
# Batch Edit Patrons |
22 |
# Batch Edit Patrons |
| 23 |
# Modification for patron's fields: |
23 |
# Modification for patron's fields: |
| 24 |
# surname firstname branchcode categorycode city state zipcode country sort1 |
24 |
# surname firstname branchcode categorycode city state zipcode country sort1 |
| 25 |
# sort2 dateenrolled dateexpiry borrowernotes |
25 |
# sort2 dateenrolled dateexpiry borrowernotes protected |
| 26 |
# And for patron attributes. |
26 |
# And for patron attributes. |
| 27 |
|
27 |
|
| 28 |
use Modern::Perl; |
28 |
use Modern::Perl; |
|
Lines 54-61
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
| 54 |
|
54 |
|
| 55 |
my $logged_in_user = Koha::Patrons->find($loggedinuser); |
55 |
my $logged_in_user = Koha::Patrons->find($loggedinuser); |
| 56 |
|
56 |
|
| 57 |
$template->param( CanUpdatePasswordExpiration => 1 ) if $logged_in_user->is_superlibrarian; |
57 |
if ( $logged_in_user->is_superlibrarian ) { |
| 58 |
|
58 |
$template->param( CanUpdatePasswordExpiration => 1 ); |
|
|
59 |
$template->param( CanUpdateProtectPatron => 1 ); |
| 60 |
} |
| 59 |
my $dbh = C4::Context->dbh; |
61 |
my $dbh = C4::Context->dbh; |
| 60 |
|
62 |
|
| 61 |
# Show borrower informations |
63 |
# Show borrower informations |
|
Lines 194-199
if ( $op eq 'cud-show' || $op eq 'show' ) {
Link Here
|
| 194 |
my @categories_option; |
196 |
my @categories_option; |
| 195 |
push @categories_option, { value => $_->categorycode, lib => $_->description } for @patron_categories; |
197 |
push @categories_option, { value => $_->categorycode, lib => $_->description } for @patron_categories; |
| 196 |
unshift @categories_option, { value => "", lib => "" }; |
198 |
unshift @categories_option, { value => "", lib => "" }; |
|
|
199 |
my @protected_option; |
| 200 |
push @protected_option, { value => 1, lib => "Yes" }; |
| 201 |
push @protected_option, { value => 0, lib => "No" }; |
| 202 |
unshift @protected_option, { value => "", lib => "" }; |
| 197 |
my $bsort1 = GetAuthorisedValues("Bsort1"); |
203 |
my $bsort1 = GetAuthorisedValues("Bsort1"); |
| 198 |
my @sort1_option; |
204 |
my @sort1_option; |
| 199 |
push @sort1_option, { value => $_->{authorised_value}, lib => $_->{lib} } for @$bsort1; |
205 |
push @sort1_option, { value => $_->{authorised_value}, lib => $_->{lib} } for @$bsort1; |
|
Lines 334-340
if ( $op eq 'cud-show' || $op eq 'show' ) {
Link Here
|
| 334 |
}, |
340 |
}, |
| 335 |
); |
341 |
); |
| 336 |
|
342 |
|
| 337 |
push @fields, { name => "password_expiration_date", type => "date" } if $logged_in_user->is_superlibrarian; |
343 |
if ($logged_in_user->is_superlibrarian) { |
|
|
344 |
push @fields, { name => "password_expiration_date", type => "date" } ; |
| 345 |
push @fields, { name => "protected", type => "select", option => \@protected_option }; |
| 346 |
} |
| 338 |
|
347 |
|
| 339 |
$template->param( 'patron_attributes_codes', \@patron_attributes_codes ); |
348 |
$template->param( 'patron_attributes_codes', \@patron_attributes_codes ); |
| 340 |
$template->param( 'patron_attributes_values', \@patron_attributes_values ); |
349 |
$template->param( 'patron_attributes_values', \@patron_attributes_values ); |
|
Lines 349-359
if ( $op eq 'cud-do' ) {
Link Here
|
| 349 |
my @disabled = $input->multi_param('disable_input'); |
358 |
my @disabled = $input->multi_param('disable_input'); |
| 350 |
my $infos; |
359 |
my $infos; |
| 351 |
for my $field ( |
360 |
for my $field ( |
| 352 |
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/ |
361 |
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/ |
| 353 |
) |
362 |
) |
| 354 |
{ |
363 |
{ |
| 355 |
my $value = $input->param($field); |
364 |
my $value = $input->param($field) if $input->param($field) ne ''; |
| 356 |
$infos->{$field} = $value if $value; |
365 |
$infos->{$field} = $value if defined $value; |
| 357 |
$infos->{$field} = "" if grep { $_ eq $field } @disabled; |
366 |
$infos->{$field} = "" if grep { $_ eq $field } @disabled; |
| 358 |
} |
367 |
} |
| 359 |
|
368 |
|
|
Lines 362-367
if ( $op eq 'cud-do' ) {
Link Here
|
| 362 |
} |
371 |
} |
| 363 |
|
372 |
|
| 364 |
delete $infos->{password_expiration_date} unless $logged_in_user->is_superlibrarian; |
373 |
delete $infos->{password_expiration_date} unless $logged_in_user->is_superlibrarian; |
|
|
374 |
delete $infos->{protected} unless $logged_in_user->is_superlibrarian; |
| 365 |
|
375 |
|
| 366 |
my @errors; |
376 |
my @errors; |
| 367 |
my @borrowernumbers = $input->multi_param('borrowernumber'); |
377 |
my @borrowernumbers = $input->multi_param('borrowernumber'); |
| 368 |
- |
|
|