View | Details | Raw Unified | Return to bug 6918
Collapse All | Expand All

(-)a/C4/Biblio.pm (-2 / +13 lines)
Lines 2619-2627 more. Link Here
2619
=cut
2619
=cut
2620
2620
2621
sub CountItemsIssued {
2621
sub CountItemsIssued {
2622
    my ($biblionumber) = @_;
2622
    my ($params) = @_;
2623
    my $biblionumber = $params->{'biblionumber'};
2624
    my $count_on_order = $params->{'count_on_order'};
2625
2626
    my $sql = 'SELECT COUNT(*) AS issuedCount FROM items LEFT JOIN issues ON items.itemnumber = issues.itemnumber WHERE items.biblionumber = ?';
2627
2628
    if ( $count_on_order ) {
2629
        $sql .= ' AND ( issues.itemnumber IS NOT NULL OR items.notforloan < 0 )';
2630
    } else {
2631
        $sql .= ' AND issues.itemnumber IS NOT NULL';
2632
    }
2633
2623
    my $dbh            = C4::Context->dbh;
2634
    my $dbh            = C4::Context->dbh;
2624
    my $sth            = $dbh->prepare('SELECT COUNT(*) as issuedCount FROM items, issues WHERE items.itemnumber = issues.itemnumber AND items.biblionumber = ?');
2635
    my $sth            = $dbh->prepare( $sql );
2625
    $sth->execute($biblionumber);
2636
    $sth->execute($biblionumber);
2626
    my $row = $sth->fetchrow_hashref();
2637
    my $row = $sth->fetchrow_hashref();
2627
    return $row->{'issuedCount'};
2638
    return $row->{'issuedCount'};
(-)a/C4/Reserves.pm (-1 / +6 lines)
Lines 1465-1471 sub IsAvailableForItemLevelRequest { Link Here
1465
    if (C4::Context->preference('AllowOnShelfHolds')) {
1465
    if (C4::Context->preference('AllowOnShelfHolds')) {
1466
        return $available_per_item;
1466
        return $available_per_item;
1467
    } else {
1467
    } else {
1468
        return ($available_per_item and ($item->{onloan} or GetReserveStatus($itemnumber) eq "Waiting"));
1468
        return (
1469
            $available_per_item
1470
              and ($item->{onloan}
1471
                or GetReserveStatus($itemnumber) eq "Waiting"
1472
                or $item->{notforloan} < 0 )
1473
        );
1469
    }
1474
    }
1470
}
1475
}
1471
1476
(-)a/C4/VirtualShelves/Page.pm (-1 / +1 lines)
Lines 278-284 sub shelfpage { Link Here
278
                    if(!defined($this_item->{'size'})) { $this_item->{'size'} = "" }; #TT has problems with size
278
                    if(!defined($this_item->{'size'})) { $this_item->{'size'} = "" }; #TT has problems with size
279
                    # Getting items infos for location display
279
                    # Getting items infos for location display
280
                    my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'});
280
                    my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'});
281
                    $this_item->{'itemsissued'} = CountItemsIssued( $this_item->{'biblionumber'} );
281
                    $this_item->{'itemsissued'} = CountItemsIssued({ biblionumber => $this_item->{'biblionumber'} });
282
                    $this_item->{'ITEM_RESULTS'} = \@items_infos;
282
                    $this_item->{'ITEM_RESULTS'} = \@items_infos;
283
                    if ( grep {$_ eq $biblionumber} @cart_list) {
283
                    if ( grep {$_ eq $biblionumber} @cart_list) {
284
                        $this_item->{'incart'} = 1;
284
                        $this_item->{'incart'} = 1;
(-)a/opac/opac-ISBDdetail.pl (-1 / +1 lines)
Lines 81-87 if($query->cookie("bib_list")){ Link Here
81
}
81
}
82
82
83
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
83
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
84
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
84
$template->param( 'ItemsIssued' => CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) );
85
85
86
my $marcflavour      = C4::Context->preference("marcflavour");
86
my $marcflavour      = C4::Context->preference("marcflavour");
87
my $record = GetMarcBiblio($biblionumber);
87
my $record = GetMarcBiblio($biblionumber);
(-)a/opac/opac-MARCdetail.pl (-1 / +1 lines)
Lines 94-100 if($query->cookie("bib_list")){ Link Here
94
}
94
}
95
95
96
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
96
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
97
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
97
$template->param( 'ItemsIssued' => CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) );
98
98
99
# adding the $RequestOnOpac param
99
# adding the $RequestOnOpac param
100
my $RequestOnOpac;
100
my $RequestOnOpac;
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 391-397 if ($session->param('busc')) { Link Here
391
391
392
392
393
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
393
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
394
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
394
$template->param( 'ItemsIssued' => CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) );
395
395
396
396
397
397
(-)a/opac/opac-search.pl (-2 / +1 lines)
Lines 593-599 for (my $i=0;$i<@servers;$i++) { Link Here
593
            if (C4::Context->preference('TagsEnabled') and
593
            if (C4::Context->preference('TagsEnabled') and
594
                C4::Context->preference('TagsShowOnList')) {
594
                C4::Context->preference('TagsShowOnList')) {
595
                if ( my $bibnum = $res->{biblionumber} ) {
595
                if ( my $bibnum = $res->{biblionumber} ) {
596
                    $res->{itemsissued} = CountItemsIssued( $bibnum );
596
                    $res->{itemsissued} = CountItemsIssued({ biblionumber => $bibnum }) );
597
                    $res->{'TagLoop'} = get_tags({
597
                    $res->{'TagLoop'} = get_tags({
598
                        biblionumber => $bibnum,
598
                        biblionumber => $bibnum,
599
                        approved => 1,
599
                        approved => 1,
600
- 

Return to bug 6918