Lines 73-79
BEGIN {
Link Here
|
73 |
&GetBorNotifyAcctRecord |
73 |
&GetBorNotifyAcctRecord |
74 |
|
74 |
|
75 |
&GetBorrowersToExpunge |
75 |
&GetBorrowersToExpunge |
76 |
&GetBorrowersWhoHaveNeverBorrowed |
|
|
77 |
&GetBorrowersWithIssuesHistoryOlderThan |
76 |
&GetBorrowersWithIssuesHistoryOlderThan |
78 |
|
77 |
|
79 |
&IssueSlip |
78 |
&IssueSlip |
Lines 1151-1203
sub GetBorrowersToExpunge {
Link Here
|
1151 |
return \@results; |
1150 |
return \@results; |
1152 |
} |
1151 |
} |
1153 |
|
1152 |
|
1154 |
=head2 GetBorrowersWhoHaveNeverBorrowed |
|
|
1155 |
|
1156 |
$results = &GetBorrowersWhoHaveNeverBorrowed |
1157 |
|
1158 |
This function get all borrowers who have never borrowed. |
1159 |
|
1160 |
I<$result> is a ref to an array which all elements are a hasref. |
1161 |
|
1162 |
=cut |
1163 |
|
1164 |
sub GetBorrowersWhoHaveNeverBorrowed { |
1165 |
my $filterbranch = shift || |
1166 |
((C4::Context->preference('IndependentBranches') |
1167 |
&& C4::Context->userenv |
1168 |
&& !C4::Context->IsSuperLibrarian() |
1169 |
&& C4::Context->userenv->{branch}) |
1170 |
? C4::Context->userenv->{branch} |
1171 |
: ""); |
1172 |
my $dbh = C4::Context->dbh; |
1173 |
my $query = " |
1174 |
SELECT borrowers.borrowernumber,max(timestamp) as latestissue |
1175 |
FROM borrowers |
1176 |
LEFT JOIN issues ON borrowers.borrowernumber = issues.borrowernumber |
1177 |
WHERE issues.borrowernumber IS NULL |
1178 |
"; |
1179 |
my @query_params; |
1180 |
if ($filterbranch && $filterbranch ne ""){ |
1181 |
$query.=" AND borrowers.branchcode= ?"; |
1182 |
push @query_params,$filterbranch; |
1183 |
} |
1184 |
warn $query if $debug; |
1185 |
|
1186 |
my $sth = $dbh->prepare($query); |
1187 |
if (scalar(@query_params)>0){ |
1188 |
$sth->execute(@query_params); |
1189 |
} |
1190 |
else { |
1191 |
$sth->execute; |
1192 |
} |
1193 |
|
1194 |
my @results; |
1195 |
while ( my $data = $sth->fetchrow_hashref ) { |
1196 |
push @results, $data; |
1197 |
} |
1198 |
return \@results; |
1199 |
} |
1200 |
|
1201 |
=head2 GetBorrowersWithIssuesHistoryOlderThan |
1153 |
=head2 GetBorrowersWithIssuesHistoryOlderThan |
1202 |
|
1154 |
|
1203 |
$results = &GetBorrowersWithIssuesHistoryOlderThan($date) |
1155 |
$results = &GetBorrowersWithIssuesHistoryOlderThan($date) |