Lines 84-90
use C4::Members;
Link Here
|
84 |
|
84 |
|
85 |
=head1 DESCRIPTION |
85 |
=head1 DESCRIPTION |
86 |
|
86 |
|
87 |
This module contains routines for adding, modifying and deleting members/patrons/borrowers |
87 |
This module contains routines for adding, modifying and deleting members/patrons/borrowers |
88 |
|
88 |
|
89 |
=head1 FUNCTIONS |
89 |
=head1 FUNCTIONS |
90 |
|
90 |
|
Lines 126-132
The following will be set where applicable:
Link Here
|
126 |
$flags->{WAITING}->{message} Message -- deprecated |
126 |
$flags->{WAITING}->{message} Message -- deprecated |
127 |
$flags->{WAITING}->{itemlist} ref-to-array: list of available items |
127 |
$flags->{WAITING}->{itemlist} ref-to-array: list of available items |
128 |
|
128 |
|
129 |
=over |
129 |
=over |
130 |
|
130 |
|
131 |
=item C<$flags-E<gt>{ODUES}-E<gt>{itemlist}> is a reference-to-array listing the |
131 |
=item C<$flags-E<gt>{ODUES}-E<gt>{itemlist}> is a reference-to-array listing the |
132 |
overdue items. Its elements are references-to-hash, each describing an |
132 |
overdue items. Its elements are references-to-hash, each describing an |
Lines 142-148
fields from the reserves table of the Koha database.
Link Here
|
142 |
|
142 |
|
143 |
=back |
143 |
=back |
144 |
|
144 |
|
145 |
All the "message" fields that include language generated in this function are deprecated, |
145 |
All the "message" fields that include language generated in this function are deprecated, |
146 |
because such strings belong properly in the display layer. |
146 |
because such strings belong properly in the display layer. |
147 |
|
147 |
|
148 |
The "message" field that comes from the DB is OK. |
148 |
The "message" field that comes from the DB is OK. |
Lines 281-294
sub GetAllIssues {
Link Here
|
281 |
my $dbh = C4::Context->dbh; |
281 |
my $dbh = C4::Context->dbh; |
282 |
my $query = |
282 |
my $query = |
283 |
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp |
283 |
'SELECT *, issues.timestamp as issuestimestamp, issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp |
284 |
FROM issues |
284 |
FROM issues |
285 |
LEFT JOIN items on items.itemnumber=issues.itemnumber |
285 |
LEFT JOIN items on items.itemnumber=issues.itemnumber |
286 |
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber |
286 |
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber |
287 |
LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber |
287 |
LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber |
288 |
WHERE borrowernumber=? |
288 |
WHERE borrowernumber=? |
289 |
UNION ALL |
289 |
UNION ALL |
290 |
SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp |
290 |
SELECT *, old_issues.timestamp as issuestimestamp, old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp |
291 |
FROM old_issues |
291 |
FROM old_issues |
292 |
LEFT JOIN items on items.itemnumber=old_issues.itemnumber |
292 |
LEFT JOIN items on items.itemnumber=old_issues.itemnumber |
293 |
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber |
293 |
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber |
294 |
LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber |
294 |
LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber |
Lines 385-395
sub GetBorrowersToExpunge {
Link Here
|
385 |
my $filtercategory = $params->{'category_code'}; |
385 |
my $filtercategory = $params->{'category_code'}; |
386 |
my $filterbranch = $params->{'branchcode'} || |
386 |
my $filterbranch = $params->{'branchcode'} || |
387 |
((C4::Context->preference('IndependentBranches') |
387 |
((C4::Context->preference('IndependentBranches') |
388 |
&& C4::Context->userenv |
388 |
&& C4::Context->userenv |
389 |
&& !C4::Context->IsSuperLibrarian() |
389 |
&& !C4::Context->IsSuperLibrarian() |
390 |
&& C4::Context->userenv->{branch}) |
390 |
&& C4::Context->userenv->{branch}) |
391 |
? C4::Context->userenv->{branch} |
391 |
? C4::Context->userenv->{branch} |
392 |
: ""); |
392 |
: ""); |
393 |
my $filterpatronlist = $params->{'patron_list_id'}; |
393 |
my $filterpatronlist = $params->{'patron_list_id'}; |
394 |
|
394 |
|
395 |
my $dbh = C4::Context->dbh; |
395 |
my $dbh = C4::Context->dbh; |
Lines 447-459
sub GetBorrowersToExpunge {
Link Here
|
447 |
warn $query if $debug; |
447 |
warn $query if $debug; |
448 |
|
448 |
|
449 |
my $sth = $dbh->prepare($query); |
449 |
my $sth = $dbh->prepare($query); |
450 |
if (scalar(@query_params)>0){ |
450 |
if (scalar(@query_params)>0){ |
451 |
$sth->execute(@query_params); |
451 |
$sth->execute(@query_params); |
452 |
} |
452 |
} |
453 |
else { |
453 |
else { |
454 |
$sth->execute; |
454 |
$sth->execute; |
455 |
} |
455 |
} |
456 |
|
456 |
|
457 |
my @results; |
457 |
my @results; |
458 |
while ( my $data = $sth->fetchrow_hashref ) { |
458 |
while ( my $data = $sth->fetchrow_hashref ) { |
459 |
push @results, $data; |
459 |
push @results, $data; |
Lines 630-647
sub DeleteExpiredOpacRegistrations {
Link Here
|
630 |
my $category_code = C4::Context->preference('PatronSelfRegistrationDefaultCategory'); |
630 |
my $category_code = C4::Context->preference('PatronSelfRegistrationDefaultCategory'); |
631 |
|
631 |
|
632 |
return 0 if not $category_code or not defined $delay or $delay eq q||; |
632 |
return 0 if not $category_code or not defined $delay or $delay eq q||; |
|
|
633 |
my $date_enrolled = dt_from_string(); |
634 |
$date_enrolled->subtract( days => $delay ); |
633 |
|
635 |
|
634 |
my $query = qq| |
636 |
my $registrations_to_del = Koha::Patrons->search({ |
635 |
SELECT borrowernumber |
637 |
dateenrolled => {'<=' => $date_enrolled->ymd}, |
636 |
FROM borrowers |
638 |
categorycode => $category_code, |
637 |
WHERE categorycode = ? AND DATEDIFF( NOW(), dateenrolled ) > ? |; |
639 |
}); |
638 |
|
640 |
|
639 |
my $dbh = C4::Context->dbh; |
|
|
640 |
my $sth = $dbh->prepare($query); |
641 |
$sth->execute( $category_code, $delay ); |
642 |
my $cnt=0; |
641 |
my $cnt=0; |
643 |
while ( my ($borrowernumber) = $sth->fetchrow_array() ) { |
642 |
while ( my $registration = $registrations_to_del->next() ) { |
644 |
Koha::Patrons->find($borrowernumber)->delete; |
643 |
next if $registration->checkouts->count || $registration->account->balance; |
|
|
644 |
$registration->delete; |
645 |
$cnt++; |
645 |
$cnt++; |
646 |
} |
646 |
} |
647 |
return $cnt; |
647 |
return $cnt; |
648 |
- |
|
|