Bug 6679 - [SIGNED-OFF] fix 12 perlcritic violations in C4/Auth_with_ldap.pm
Subroutine prototypes used at line 73, column 1. See page 194 of PBP. (Severity: 5) "return" statement with explicit "undef" at line 74, column 24. See page 199 of PBP. (Severity: 5) Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
parent
8cfc1a0804
commit
562335d1c4
1 changed files with 12 additions and 12 deletions
|
@ -47,7 +47,7 @@ BEGIN {
|
|||
# ~ then gets the LDAP entry
|
||||
# ~ and calls the memberadd if necessary
|
||||
|
||||
sub ldapserver_error ($) {
|
||||
sub ldapserver_error {
|
||||
return sprintf('No ldapserver "%s" defined in KOHA_CONF: ' . $ENV{KOHA_CONF}, shift);
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,8 @@ my %config = (
|
|||
update => defined($ldap->{update} ) ? $ldap->{update} : 1, # update from LDAP to Koha database for existing user
|
||||
);
|
||||
|
||||
sub description ($) {
|
||||
my $result = shift or return undef;
|
||||
sub description {
|
||||
my $result = shift or return;
|
||||
return "LDAP error #" . $result->code
|
||||
. ": " . $result->error_name . "\n"
|
||||
. "# " . $result->error_text . "\n";
|
||||
|
@ -197,7 +197,7 @@ return(1, $cardnumber, $userid);
|
|||
# Edit KOHA_CONF so $memberhash{'xxx'} fits your ldap structure.
|
||||
# Ensure that mandatory fields are correctly filled!
|
||||
#
|
||||
sub ldap_entry_2_hash ($$) {
|
||||
sub ldap_entry_2_hash {
|
||||
my $userldapentry = shift;
|
||||
my %borrower = ( cardnumber => shift );
|
||||
my %memberhash;
|
||||
|
@ -209,7 +209,7 @@ sub ldap_entry_2_hash ($$) {
|
|||
hashdump("LDAP key: ",$userldapentry->{$_});
|
||||
}
|
||||
}
|
||||
my $x = $userldapentry->{attrs} or return undef;
|
||||
my $x = $userldapentry->{attrs} or return;
|
||||
foreach (keys %$x) {
|
||||
$memberhash{$_} = join ' ', @{$x->{$_}};
|
||||
$debug and print STDERR sprintf("building \$memberhash{%s} = ", $_, join(' ', @{$x->{$_}})), "\n";
|
||||
|
@ -242,7 +242,7 @@ sub ldap_entry_2_hash ($$) {
|
|||
return %borrower;
|
||||
}
|
||||
|
||||
sub exists_local($) {
|
||||
sub exists_local {
|
||||
my $arg = shift;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $select = "SELECT borrowernumber,cardnumber,userid,password FROM borrowers ";
|
||||
|
@ -271,16 +271,16 @@ sub _do_changepassword {
|
|||
my ($md5password, $cardnum) = $sth->fetchrow;
|
||||
($digest eq $md5password) and return $cardnum;
|
||||
warn "Password mismatch after update to cardnumber=$cardnum (borrowernumber=$borrowerid)";
|
||||
return undef;
|
||||
return;
|
||||
}
|
||||
die "Unexpected error after password update to userid/borrowernumber: $userid / $borrowerid.";
|
||||
}
|
||||
|
||||
sub update_local($$$$) {
|
||||
my $userid = shift or return undef;
|
||||
my $digest = md5_base64(shift) or return undef;
|
||||
my $borrowerid = shift or return undef;
|
||||
my $borrower = shift or return undef;
|
||||
sub update_local {
|
||||
my $userid = shift or return;
|
||||
my $digest = md5_base64(shift) or return;
|
||||
my $borrowerid = shift or return;
|
||||
my $borrower = shift or return;
|
||||
my @keys = keys %$borrower;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $query = "UPDATE borrowers\nSET " .
|
||||
|
|
Loading…
Reference in a new issue