projects
/
koha_fer
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/new/bug_6151'
[koha_fer]
/
members
/
member-password.pl
diff --git
a/members/member-password.pl
b/members/member-password.pl
index
0fefe4f
..
fe24df3
100755
(executable)
--- a/
members/member-password.pl
+++ b/
members/member-password.pl
@@
-14,6
+14,7
@@
use C4::Members;
use C4::Branch;
use C4::Circulation;
use CGI;
use C4::Branch;
use C4::Circulation;
use CGI;
+use C4::Members::Attributes qw(GetBorrowerAttributes);
use Digest::MD5 qw(md5_base64);
use Digest::MD5 qw(md5_base64);
@@
-39,17
+40,21
@@
$flagsrequired->{borrowers}=1;
my $member=$input->param('member');
my $cardnumber = $input->param('cardnumber');
my $destination = $input->param('destination');
my $member=$input->param('member');
my $cardnumber = $input->param('cardnumber');
my $destination = $input->param('destination');
-my
$errormsg
;
+my
@errors
;
my ($bor)=GetMember('borrowernumber' => $member);
if(( $member ne $loggedinuser ) && ($bor->{'category_type'} eq 'S' ) ) {
my ($bor)=GetMember('borrowernumber' => $member);
if(( $member ne $loggedinuser ) && ($bor->{'category_type'} eq 'S' ) ) {
-
$errormsg = 'NOPERMISSION'
unless($staffflags->{'superlibrarian'} || $staffflags->{'staffaccess'} );
+
push(@errors,'NOPERMISSION')
unless($staffflags->{'superlibrarian'} || $staffflags->{'staffaccess'} );
# need superlibrarian for koha-conf.xml fakeuser.
}
my $newpassword = $input->param('newpassword');
# need superlibrarian for koha-conf.xml fakeuser.
}
my $newpassword = $input->param('newpassword');
+my $newpassword2 = $input->param('newpassword2');
+
+push(@errors,'NOMATCH') if ( ( $newpassword && $newpassword2 ) && ($newpassword ne $newpassword2) );
+
my $minpw = C4::Context->preference('minPasswordLength');
my $minpw = C4::Context->preference('minPasswordLength');
-
$errormsg = 'SHORTPASSWORD'
if( $newpassword && $minpw && (length($newpassword) < $minpw ) );
+
push(@errors,'SHORTPASSWORD')
if( $newpassword && $minpw && (length($newpassword) < $minpw ) );
-if ( $newpassword && !
$errormsg
) {
+if ( $newpassword && !
scalar(@errors)
) {
my $digest=md5_base64($input->param('newpassword'));
my $uid = $input->param('newuserid');
my $dbh=C4::Context->dbh;
my $digest=md5_base64($input->param('newpassword'));
my $uid = $input->param('newuserid');
my $dbh=C4::Context->dbh;
@@
-61,13
+66,7
@@
if ( $newpassword && ! $errormsg ) {
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
}
} else {
print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member");
}
} else {
- $errormsg = 'BADUSERID';
- $template->param(othernames => $bor->{'othernames'},
- surname => $bor->{'surname'},
- firstname => $bor->{'firstname'},
- userid => $bor->{'userid'},
- defaultnewpassword => $newpassword
- );
+ push(@errors,'BADUSERID');
}
} else {
my $userid = $bor->{'userid'};
}
} else {
my $userid = $bor->{'userid'};
@@
-78,7
+77,9
@@
if ( $newpassword && ! $errormsg ) {
for (my $i=0; $i<$length; $i++) {
$defaultnewpassword.=substr($chars, int(rand(length($chars))),1);
}
for (my $i=0; $i<$length; $i++) {
$defaultnewpassword.=substr($chars, int(rand(length($chars))),1);
}
-
+
+ $template->param( defaultnewpassword => $defaultnewpassword );
+}
if ( $bor->{'category_type'} eq 'C') {
my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
my $cnt = scalar(@$catcodes);
if ( $bor->{'category_type'} eq 'C') {
my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
my $cnt = scalar(@$catcodes);
@@
-89,7
+90,15
@@
if ( $newpassword && ! $errormsg ) {
$template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' );
my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'});
$template->param( picture => 1 ) if $picture;
$template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' );
my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'});
$template->param( picture => 1 ) if $picture;
-
+
+if (C4::Context->preference('ExtendedPatronAttributes')) {
+ my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'});
+ $template->param(
+ ExtendedPatronAttributes => 1,
+ extendedattributes => $attributes
+ );
+}
+
$template->param( othernames => $bor->{'othernames'},
surname => $bor->{'surname'},
firstname => $bor->{'firstname'},
$template->param( othernames => $bor->{'othernames'},
surname => $bor->{'surname'},
firstname => $bor->{'firstname'},
@@
-111,15
+120,16
@@
$template->param( picture => 1 ) if $picture;
userid => $bor->{'userid'},
destination => $destination,
is_child => ($bor->{'category_type'} eq 'C'),
userid => $bor->{'userid'},
destination => $destination,
is_child => ($bor->{'category_type'} eq 'C'),
- defaultnewpassword => $defaultnewpassword
+ activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
+ minPasswordLength => $minpw
);
);
+if( scalar(@errors )){
+ $template->param( errormsg => 1 );
+ foreach my $error (@errors) {
+ $template->param($error) || $template->param( $error => 1);
+ }
}
}
-$template->param( member => $member,
- errormsg => $errormsg,
- $errormsg => 1 ,
- minPasswordLength => $minpw );
-
output_html_with_http_headers $input, $cookie, $template->output;
output_html_with_http_headers $input, $cookie, $template->output;