my $query;
my $sth;
if ($borrowernumber) {
- $sth = $dbh->prepare("select borrowers.*,category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode where borrowernumber=?");
+ $sth = $dbh->prepare("select borrowers.*,category_type,categories.description from borrowers left join categories on borrowers.categorycode=categories.categorycode where borrowernumber=?");
$sth->execute($borrowernumber);
}
elsif ($cardnumber) {
- $sth = $dbh->prepare("select borrowers.*,category_type from borrowers left join categories on borrowers.categorycode=categories.categorycode where cardnumber=?");
+ $sth = $dbh->prepare("select borrowers.*,category_type,categories.description from borrowers left join categories on borrowers.categorycode=categories.categorycode where cardnumber=?");
$sth->execute($cardnumber);
}
else {
FROM borrowers
LEFT JOIN categories on borrowers.categorycode=categories.categorycode
";
- if ( defined $type && ( $type eq 'cardnumber' || $type eq 'firstname'|| $type eq 'userid'|| $type eq 'borrowernumber' ) ){
+ if (defined($type) and ( $type eq 'cardnumber' || $type eq 'firstname'|| $type eq 'userid'|| $type eq 'borrowernumber' ) ){
$information = uc $information;
$sth = $dbh->prepare("$select WHERE $type=?");
} else {
}
$sth->execute($information);
my $data = $sth->fetchrow_hashref;
- $sth->finish;
($data) and return ($data);
- if ($type eq 'cardnumber' || $type eq 'firstname') { # otherwise, try with firstname
+ if (defined($type) and ($type eq 'cardnumber' || $type eq 'firstname')) { # otherwise, try with firstname
$sth = $dbh->prepare("$select WHERE firstname like ?");
$sth->execute($information);
$data = $sth->fetchrow_hashref;
- $sth->finish;
($data) and return ($data);
}
return undef;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare(
- "SELECT * FROM issues
+ "SELECT *,issues.timestamp as timestamp FROM issues
LEFT JOIN items ON issues.itemnumber=items.itemnumber
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
my $dbh = C4::Context->dbh;
my $count = 0;
my $query =
- "SELECT *,items.timestamp AS itemstimestamp
+ "SELECT *,issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
FROM issues
LEFT JOIN items on items.itemnumber=issues.itemnumber
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber
LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber
WHERE borrowernumber=?
UNION ALL
- SELECT *,items.timestamp AS itemstimestamp
+ SELECT *,old_issues.renewals AS renewals,items.renewals AS totalrenewals,items.timestamp AS itemstimestamp
FROM old_issues
LEFT JOIN items on items.itemnumber=old_issues.itemnumber
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber