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 51-58
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
Link Here
|
51 |
|
51 |
|
52 |
my $logged_in_user = Koha::Patrons->find( $loggedinuser ); |
52 |
my $logged_in_user = Koha::Patrons->find( $loggedinuser ); |
53 |
|
53 |
|
54 |
$template->param( CanUpdatePasswordExpiration => 1 ) if $logged_in_user->is_superlibrarian; |
54 |
if ($logged_in_user->is_superlibrarian) { |
55 |
|
55 |
$template->param( CanUpdatePasswordExpiration => 1 ); |
|
|
56 |
$template->param( CanUpdateProtectPatron => 1 ); |
57 |
} |
56 |
my $dbh = C4::Context->dbh; |
58 |
my $dbh = C4::Context->dbh; |
57 |
|
59 |
|
58 |
# Show borrower informations |
60 |
# Show borrower informations |
Lines 178-183
if ( $op eq 'cud-show' || $op eq 'show' ) {
Link Here
|
178 |
my @categories_option; |
180 |
my @categories_option; |
179 |
push @categories_option, { value => $_->categorycode, lib => $_->description } for @patron_categories; |
181 |
push @categories_option, { value => $_->categorycode, lib => $_->description } for @patron_categories; |
180 |
unshift @categories_option, { value => "", lib => "" }; |
182 |
unshift @categories_option, { value => "", lib => "" }; |
|
|
183 |
my @protected_option; |
184 |
push @protected_option, { value => 1, lib => "Yes" }; |
185 |
push @protected_option, { value => 0, lib => "No" }; |
186 |
unshift @protected_option, { value => "", lib => "" }; |
181 |
my $bsort1 = GetAuthorisedValues("Bsort1"); |
187 |
my $bsort1 = GetAuthorisedValues("Bsort1"); |
182 |
my @sort1_option; |
188 |
my @sort1_option; |
183 |
push @sort1_option, { value => $_->{authorised_value}, lib => $_->{lib} } for @$bsort1; |
189 |
push @sort1_option, { value => $_->{authorised_value}, lib => $_->{lib} } for @$bsort1; |
Lines 335-341
if ( $op eq 'cud-show' || $op eq 'show' ) {
Link Here
|
335 |
}, |
341 |
}, |
336 |
); |
342 |
); |
337 |
|
343 |
|
338 |
push @fields, { name => "password_expiration_date", type => "date" } if $logged_in_user->is_superlibrarian; |
344 |
if ($logged_in_user->is_superlibrarian) { |
|
|
345 |
push @fields, { name => "password_expiration_date", type => "date" } ; |
346 |
push @fields, { name => "protected", type => "select", option => \@protected_option }; |
347 |
} |
339 |
|
348 |
|
340 |
$template->param('patron_attributes_codes', \@patron_attributes_codes); |
349 |
$template->param('patron_attributes_codes', \@patron_attributes_codes); |
341 |
$template->param('patron_attributes_values', \@patron_attributes_values); |
350 |
$template->param('patron_attributes_values', \@patron_attributes_values); |
Lines 350-360
if ( $op eq 'cud-do' ) {
Link Here
|
350 |
my @disabled = $input->multi_param('disable_input'); |
359 |
my @disabled = $input->multi_param('disable_input'); |
351 |
my $infos; |
360 |
my $infos; |
352 |
for my $field ( |
361 |
for my $field ( |
353 |
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/ |
362 |
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/ |
354 |
) |
363 |
) |
355 |
{ |
364 |
{ |
356 |
my $value = $input->param($field); |
365 |
my $value = $input->param($field) if $input->param($field) ne ''; |
357 |
$infos->{$field} = $value if $value; |
366 |
$infos->{$field} = $value if defined $value; |
358 |
$infos->{$field} = "" if grep { $_ eq $field } @disabled; |
367 |
$infos->{$field} = "" if grep { $_ eq $field } @disabled; |
359 |
} |
368 |
} |
360 |
|
369 |
|
Lines 363-368
if ( $op eq 'cud-do' ) {
Link Here
|
363 |
} |
372 |
} |
364 |
|
373 |
|
365 |
delete $infos->{password_expiration_date} unless $logged_in_user->is_superlibrarian; |
374 |
delete $infos->{password_expiration_date} unless $logged_in_user->is_superlibrarian; |
|
|
375 |
delete $infos->{protected} unless $logged_in_user->is_superlibrarian; |
366 |
|
376 |
|
367 |
my @errors; |
377 |
my @errors; |
368 |
my @borrowernumbers = $input->multi_param('borrowernumber'); |
378 |
my @borrowernumbers = $input->multi_param('borrowernumber'); |
369 |
- |
|
|