Lines 45-52
BEGIN {
Link Here
|
45 |
GetMemberDetails |
45 |
GetMemberDetails |
46 |
GetMember |
46 |
GetMember |
47 |
|
47 |
|
48 |
GetAllIssues |
|
|
49 |
|
50 |
GetBorrowersToExpunge |
48 |
GetBorrowersToExpunge |
51 |
|
49 |
|
52 |
IssueSlip |
50 |
IssueSlip |
Lines 238-296
sub patronflags {
Link Here
|
238 |
return ( \%flags ); |
236 |
return ( \%flags ); |
239 |
} |
237 |
} |
240 |
|
238 |
|
241 |
=head2 GetAllIssues |
|
|
242 |
|
243 |
$issues = &GetAllIssues($borrowernumber, $sortkey, $limit); |
244 |
|
245 |
Looks up what the patron with the given borrowernumber has borrowed, |
246 |
and sorts the results. |
247 |
|
248 |
C<$sortkey> is the name of a field on which to sort the results. This |
249 |
should be the name of a field in the C<issues>, C<biblio>, |
250 |
C<biblioitems>, or C<items> table in the Koha database. |
251 |
|
252 |
C<$limit> is the maximum number of results to return. |
253 |
|
254 |
C<&GetAllIssues> an arrayref, C<$issues>, of hashrefs, the keys of which |
255 |
are the fields from the C<issues>, C<biblio>, C<biblioitems>, and |
256 |
C<items> tables of the Koha database. |
257 |
|
258 |
=cut |
259 |
|
260 |
#' |
261 |
sub GetAllIssues { |
262 |
my ( $borrowernumber, $order, $limit ) = @_; |
263 |
|
264 |
return unless $borrowernumber; |
265 |
$order = 'date_due desc' unless $order; |
266 |
|
267 |
my $dbh = C4::Context->dbh; |
268 |
my $query = |
269 |
'SELECT issues.*, items.*, biblio.*, biblioitems.*, issues.timestamp as issuestimestamp, issues.renewals_count AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp,borrowers.firstname,borrowers.surname |
270 |
FROM issues |
271 |
LEFT JOIN items on items.itemnumber=issues.itemnumber |
272 |
LEFT JOIN borrowers on borrowers.borrowernumber=issues.issuer_id |
273 |
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber |
274 |
LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber |
275 |
WHERE issues.borrowernumber=? |
276 |
UNION ALL |
277 |
SELECT old_issues.*, items.*, biblio.*, biblioitems.*, old_issues.timestamp as issuestimestamp, old_issues.renewals_count AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp,borrowers.firstname,borrowers.surname |
278 |
FROM old_issues |
279 |
LEFT JOIN items on items.itemnumber=old_issues.itemnumber |
280 |
LEFT JOIN borrowers on borrowers.borrowernumber=old_issues.issuer_id |
281 |
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber |
282 |
LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber |
283 |
WHERE old_issues.borrowernumber=? AND old_issues.itemnumber IS NOT NULL |
284 |
order by ' . $order; |
285 |
if ($limit) { |
286 |
$query .= " limit $limit"; |
287 |
} |
288 |
|
289 |
my $sth = $dbh->prepare($query); |
290 |
$sth->execute( $borrowernumber, $borrowernumber ); |
291 |
return $sth->fetchall_arrayref( {} ); |
292 |
} |
293 |
|
294 |
sub checkcardnumber { |
239 |
sub checkcardnumber { |
295 |
my ( $cardnumber, $borrowernumber ) = @_; |
240 |
my ( $cardnumber, $borrowernumber ) = @_; |
296 |
|
241 |
|
297 |
- |
|
|