Lines 2524-2537
sub _adjust_pubyear {
Link Here
|
2524 |
|
2524 |
|
2525 |
=head2 CountItemsIssued |
2525 |
=head2 CountItemsIssued |
2526 |
|
2526 |
|
2527 |
my $count = CountItemsIssued( $biblionumber ); |
2527 |
my $count = CountItemsIssued( { biblionumber => $biblionumber, count_on_order => 0 || 1 ); |
2528 |
|
2528 |
|
2529 |
=cut |
2529 |
=cut |
2530 |
|
2530 |
|
2531 |
sub CountItemsIssued { |
2531 |
sub CountItemsIssued { |
2532 |
my ($biblionumber) = @_; |
2532 |
my ($params) = @_; |
|
|
2533 |
my $biblionumber = $params->{'biblionumber'}; |
2534 |
my $count_on_order = $params->{'count_on_order'}; |
2535 |
|
2536 |
my $sql = 'SELECT COUNT(*) AS issuedCount FROM items LEFT JOIN issues ON items.itemnumber = issues.itemnumber WHERE items.biblionumber = ?'; |
2537 |
|
2538 |
if ( $count_on_order ) { |
2539 |
$sql .= ' AND ( issues.itemnumber IS NOT NULL OR items.notforloan < 0 )'; |
2540 |
} else { |
2541 |
$sql .= ' AND issues.itemnumber IS NOT NULL'; |
2542 |
} |
2543 |
|
2533 |
my $dbh = C4::Context->dbh; |
2544 |
my $dbh = C4::Context->dbh; |
2534 |
my $sth = $dbh->prepare('SELECT COUNT(*) as issuedCount FROM items, issues WHERE items.itemnumber = issues.itemnumber AND items.biblionumber = ?'); |
2545 |
my $sth = $dbh->prepare( $sql ); |
2535 |
$sth->execute($biblionumber); |
2546 |
$sth->execute($biblionumber); |
2536 |
my $row = $sth->fetchrow_hashref(); |
2547 |
my $row = $sth->fetchrow_hashref(); |
2537 |
return $row->{'issuedCount'}; |
2548 |
return $row->{'issuedCount'}; |