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

(-)a/C4/Biblio.pm (-2 / +13 lines)
Lines 2637-2645 more. Link Here
2637
=cut
2637
=cut
2638
2638
2639
sub CountItemsIssued {
2639
sub CountItemsIssued {
2640
    my ($biblionumber) = @_;
2640
    my ($params) = @_;
2641
    my $biblionumber = $params->{'biblionumber'};
2642
    my $count_on_order = $params->{'count_on_order'};
2643
2644
    my $sql = 'SELECT COUNT(*) AS issuedCount FROM items LEFT JOIN issues ON items.itemnumber = issues.itemnumber WHERE items.biblionumber = ?';
2645
2646
    if ( $count_on_order ) {
2647
        $sql .= ' AND ( issues.itemnumber IS NOT NULL OR items.notforloan < 0 )';
2648
    } else {
2649
        $sql .= ' AND issues.itemnumber IS NOT NULL';
2650
    }
2651
2641
    my $dbh            = C4::Context->dbh;
2652
    my $dbh            = C4::Context->dbh;
2642
    my $sth            = $dbh->prepare('SELECT COUNT(*) as issuedCount FROM items, issues WHERE items.itemnumber = issues.itemnumber AND items.biblionumber = ?');
2653
    my $sth            = $dbh->prepare( $sql );
2643
    $sth->execute($biblionumber);
2654
    $sth->execute($biblionumber);
2644
    my $row = $sth->fetchrow_hashref();
2655
    my $row = $sth->fetchrow_hashref();
2645
    return $row->{'issuedCount'};
2656
    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