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

(-)a/C4/Biblio.pm (-2 / +13 lines)
Lines 2629-2637 more. Link Here
2629
=cut
2629
=cut
2630
2630
2631
sub CountItemsIssued {
2631
sub CountItemsIssued {
2632
    my ($biblionumber) = @_;
2632
    my ($params) = @_;
2633
    my $biblionumber = $params->{'biblionumber'};
2634
    my $count_on_order = $params->{'count_on_order'};
2635
    
2636
    my $sql = 'SELECT COUNT(*) AS issuedCount FROM items LEFT JOIN issues ON items.itemnumber = issues.itemnumber WHERE items.biblionumber = ?';
2637
    
2638
    if ( $count_on_order ) {
2639
        $sql .= ' AND ( issues.itemnumber IS NOT NULL OR items.notforloan < 0 )';
2640
    } else {
2641
        $sql .= ' AND issues.itemnumber IS NOT NULL';
2642
    }
2643
    
2633
    my $dbh            = C4::Context->dbh;
2644
    my $dbh            = C4::Context->dbh;
2634
    my $sth            = $dbh->prepare('SELECT COUNT(*) as issuedCount FROM items, issues WHERE items.itemnumber = issues.itemnumber AND items.biblionumber = ?');
2645
    my $sth            = $dbh->prepare( $sql );
2635
    $sth->execute($biblionumber);
2646
    $sth->execute($biblionumber);
2636
    my $row = $sth->fetchrow_hashref();
2647
    my $row = $sth->fetchrow_hashref();
2637
    return $row->{'issuedCount'};
2648
    return $row->{'issuedCount'};
(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 1441-1447 sub IsAvailableForItemLevelRequest { Link Here
1441
    if (C4::Context->preference('AllowOnShelfHolds')) {
1441
    if (C4::Context->preference('AllowOnShelfHolds')) {
1442
        return $available_per_item;
1442
        return $available_per_item;
1443
    } else {
1443
    } else {
1444
        return ($available_per_item and ($item->{onloan} or GetReserveStatus($itemnumber) eq "W")); 
1444
        return ($available_per_item and ($item->{onloan} or $item->{notforloan} < 0 or GetReserveStatus($itemnumber) eq "W" ));
1445
    }
1445
    }
1446
}
1446
}
1447
1447
(-)a/C4/VirtualShelves/Page.pm (-1 / +1 lines)
Lines 271-277 sub shelfpage { Link Here
271
                    $this_item->{'normalized_isbn'} = GetNormalizedISBN(undef,$record,$marcflavour);
271
                    $this_item->{'normalized_isbn'} = GetNormalizedISBN(undef,$record,$marcflavour);
272
                    # Getting items infos for location display
272
                    # Getting items infos for location display
273
                    my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'});
273
                    my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'});
274
                    $this_item->{'itemsissued'} = CountItemsIssued( $this_item->{'biblionumber'} );
274
                    $this_item->{'itemsissued'} = CountItemsIssued({ biblionumber => $this_item->{'biblionumber'} });
275
                    $this_item->{'ITEM_RESULTS'} = \@items_infos;
275
                    $this_item->{'ITEM_RESULTS'} = \@items_infos;
276
                    if ( grep {$_ eq $biblionumber} @cart_list) {
276
                    if ( grep {$_ eq $biblionumber} @cart_list) {
277
                        $this_item->{'incart'} = 1;
277
                        $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 390-396 if ($session->param('busc')) { Link Here
390
390
391
391
392
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
392
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
393
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
393
$template->param( 'ItemsIssued' => CountItemsIssued({ biblionumber => $biblionumber, count_on_order => 1 }) );
394
394
395
395
396
396
(-)a/opac/opac-search.pl (-2 / +1 lines)
Lines 550-556 for (my $i=0;$i<@servers;$i++) { Link Here
550
            $tag_quantity = C4::Context->preference('TagsShowOnList')) {
550
            $tag_quantity = C4::Context->preference('TagsShowOnList')) {
551
            foreach (@newresults) {
551
            foreach (@newresults) {
552
                my $bibnum = $_->{biblionumber} or next;
552
                my $bibnum = $_->{biblionumber} or next;
553
                $_->{itemsissued} = CountItemsIssued( $bibnum );
553
                $_->{itemsissued} = CountItemsIssued({ biblionumber => $bibnum });
554
                $_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight',
554
                $_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight',
555
                                        limit=>$tag_quantity });
555
                                        limit=>$tag_quantity });
556
            }
556
            }
557
- 

Return to bug 6918