|
Lines 458-471
sub GetMember {
Link Here
|
| 458 |
$debug && warn $select, " ",values %information; |
458 |
$debug && warn $select, " ",values %information; |
| 459 |
my $sth = $dbh->prepare("$select"); |
459 |
my $sth = $dbh->prepare("$select"); |
| 460 |
$sth->execute(map{$information{$_}} keys %information); |
460 |
$sth->execute(map{$information{$_}} keys %information); |
| 461 |
my $data = $sth->fetchall_arrayref({}); |
461 |
my $data = $sth->fetchrow_hashref; |
| 462 |
#FIXME interface to this routine now allows generation of a result set |
462 |
return $data if $data |
| 463 |
#so whole array should be returned but bowhere in the current code expects this |
463 |
# FIXME this routine can now support generation of a resultset |
| 464 |
if (@{$data} ) { |
464 |
# but until that is needed only what is expected by current |
| 465 |
return $data->[0]; |
465 |
# routines will be generated and returned for the sake of |
| 466 |
} |
466 |
# perfomance. |
| 467 |
|
|
|
| 468 |
return; |
| 469 |
} |
467 |
} |
| 470 |
|
468 |
|
| 471 |
=head2 GetMemberRelatives |
469 |
=head2 GetMemberRelatives |
|
Lines 747-759
sub AddMember {
Link Here
|
| 747 |
unless ( $data{'dateenrolled'} ) { |
745 |
unless ( $data{'dateenrolled'} ) { |
| 748 |
$data{'dateenrolled'} = C4::Dates->new()->output("iso"); |
746 |
$data{'dateenrolled'} = C4::Dates->new()->output("iso"); |
| 749 |
} |
747 |
} |
| 750 |
|
748 |
|
| 751 |
my $patron_category = $schema->resultset('Category')->find( $data{'categorycode'} ); |
749 |
# Check the member category privacy level |
|
|
750 |
my $patron_privacy = GetCategoryPrivacy( $data{'categorycode'} ); |
| 752 |
$data{'privacy'} = |
751 |
$data{'privacy'} = |
| 753 |
$patron_category->default_privacy() eq 'default' ? 1 |
752 |
$patron_privacy eq 'default' ? 1 |
| 754 |
: $patron_category->default_privacy() eq 'never' ? 2 |
753 |
: $patron_privacy eq 'never' ? 2 |
| 755 |
: $patron_category->default_privacy() eq 'forever' ? 0 |
754 |
: $patron_privacy eq 'forever' ? 0 |
| 756 |
: undef; |
755 |
: undef; |
| 757 |
# Make a copy of the plain text password for later use |
756 |
# Make a copy of the plain text password for later use |
| 758 |
my $plain_text_password = $data{'password'}; |
757 |
my $plain_text_password = $data{'password'}; |
| 759 |
|
758 |
|
|
Lines 811-827
sub Check_Userid {
Link Here
|
| 811 |
|
810 |
|
| 812 |
return 0 unless ($uid); # userid is a unique column, we should assume NULL is not unique |
811 |
return 0 unless ($uid); # userid is a unique column, we should assume NULL is not unique |
| 813 |
|
812 |
|
| 814 |
return 0 if ( $uid eq C4::Context->config('user') ); |
813 |
my $sql = 'SELECT borrowernumber FROM borrowers WHERE userid=?'; |
| 815 |
|
814 |
$sql .= ' AND borrowernumber != ?' if $borrowernumber; |
| 816 |
my $rs = Koha::Database->new()->schema()->resultset('Borrower'); |
815 |
my $dbh = C4::Context->dbh; |
| 817 |
|
816 |
my $sth = $dbh->prepare($sql); |
| 818 |
my $params; |
817 |
if ($borrowernumber) { |
| 819 |
$params->{userid} = $uid; |
818 |
$sth->execute( $uid, $borrowernumber ); |
| 820 |
$params->{borrowernumber} = { '!=' => $borrowernumber } if ($borrowernumber); |
819 |
} |
| 821 |
|
820 |
else { |
| 822 |
my $count = $rs->count( $params ); |
821 |
$sth->execute($uid); |
| 823 |
|
822 |
} |
| 824 |
return $count ? 0 : 1; |
823 |
my $data = $sth->fetchrow; |
|
|
824 |
return $data ? 0 : 1; |
| 825 |
} |
825 |
} |
| 826 |
|
826 |
|
| 827 |
=head2 Generate_Userid |
827 |
=head2 Generate_Userid |
|
Lines 1318-1324
sub checkcardnumber {
Link Here
|
| 1318 |
return 0 unless defined $cardnumber; |
1318 |
return 0 unless defined $cardnumber; |
| 1319 |
|
1319 |
|
| 1320 |
my $dbh = C4::Context->dbh; |
1320 |
my $dbh = C4::Context->dbh; |
| 1321 |
my $query = "SELECT * FROM borrowers WHERE cardnumber=?"; |
1321 |
my $query = "SELECT borrowernumber FROM borrowers WHERE cardnumber=?"; |
| 1322 |
$query .= " AND borrowernumber <> ?" if ($borrowernumber); |
1322 |
$query .= " AND borrowernumber <> ?" if ($borrowernumber); |
| 1323 |
my $sth = $dbh->prepare($query); |
1323 |
my $sth = $dbh->prepare($query); |
| 1324 |
$sth->execute( |
1324 |
$sth->execute( |
|
Lines 1326-1332
sub checkcardnumber {
Link Here
|
| 1326 |
( $borrowernumber ? $borrowernumber : () ) |
1326 |
( $borrowernumber ? $borrowernumber : () ) |
| 1327 |
); |
1327 |
); |
| 1328 |
|
1328 |
|
| 1329 |
return 1 if $sth->fetchrow_hashref; |
1329 |
return 1 if $sth->fetchrow; |
| 1330 |
|
1330 |
|
| 1331 |
my ( $min_length, $max_length ) = get_cardnumber_length(); |
1331 |
my ( $min_length, $max_length ) = get_cardnumber_length(); |
| 1332 |
return 2 |
1332 |
return 2 |
|
Lines 2535-2540
WHERE categorycode = ? AND DATEDIFF( NOW(), dateenrolled ) > ? |;
Link Here
|
| 2535 |
return $cnt; |
2535 |
return $cnt; |
| 2536 |
} |
2536 |
} |
| 2537 |
|
2537 |
|
|
|
2538 |
=head2 GetBorrowecategoryHash |
| 2539 |
|
| 2540 |
$arrayref_hashref = &GetBorrowercateforyHash; |
| 2541 |
|
| 2542 |
This function returns a hash of borrower categories where the keys are category |
| 2543 |
codes and values are category descriptions. |
| 2544 |
|
| 2545 |
=cut |
| 2546 |
|
| 2547 |
sub GetBorrowercategoryHash { |
| 2548 |
my $categories_list = GetBorrowercategoryList(); |
| 2549 |
my %categories_hash = map { $_->{categorycode} => $_->{description} } @{$categories_list}; |
| 2550 |
return %categories_hash; |
| 2551 |
} |
| 2552 |
|
| 2553 |
=head2 GetCategoryPrivacyHash |
| 2554 |
|
| 2555 |
$hashref = &GetCategoryPrivacyHash |
| 2556 |
Returns the default privacy description of a patron's category given the category code. |
| 2557 |
|
| 2558 |
=cut |
| 2559 |
|
| 2560 |
sub GetCategoryPrivacy { |
| 2561 |
my ($categorycode) = @_; |
| 2562 |
my $dbh = C4::Context->dbh; |
| 2563 |
my $sth = $dbh->prepare( |
| 2564 |
qq{ |
| 2565 |
SELECT default_privacy |
| 2566 |
FROM categories |
| 2567 |
WHERE categorycode = ? |
| 2568 |
}); |
| 2569 |
$sth->execute($categorycode); |
| 2570 |
return $sth->fetchrow; |
| 2571 |
} |
| 2572 |
|
| 2538 |
=head2 DeleteUnverifiedOpacRegistrations |
2573 |
=head2 DeleteUnverifiedOpacRegistrations |
| 2539 |
|
2574 |
|
| 2540 |
Delete all unverified self registrations in borrower_modifications, |
2575 |
Delete all unverified self registrations in borrower_modifications, |