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

(-)a/C4/Items.pm (-22 lines)
Lines 92-98 BEGIN { Link Here
92
        ShelfToCart
92
        ShelfToCart
93
93
94
	GetAnalyticsCount
94
	GetAnalyticsCount
95
        GetItemHolds
96
95
97
        SearchItemsByField
96
        SearchItemsByField
98
        SearchItems
97
        SearchItems
Lines 2587-2613 sub GetAnalyticsCount { Link Here
2587
    return ($result);
2586
    return ($result);
2588
}
2587
}
2589
2588
2590
=head2 GetItemHolds
2591
2592
  $holds = &GetItemHolds($biblionumber, $itemnumber);
2593
2594
This function return the count of holds with $biblionumber and $itemnumber
2595
2596
=cut
2597
2598
sub GetItemHolds {
2599
    my ($biblionumber, $itemnumber) = @_;
2600
    my $holds;
2601
    my $dbh            = C4::Context->dbh;
2602
    my $query          = "SELECT count(*)
2603
        FROM  reserves
2604
        WHERE biblionumber=? AND itemnumber=?";
2605
    my $sth = $dbh->prepare($query);
2606
    $sth->execute($biblionumber, $itemnumber);
2607
    $holds = $sth->fetchrow;
2608
    return $holds;
2609
}
2610
2611
=head2 SearchItemsByField
2589
=head2 SearchItemsByField
2612
2590
2613
    my $items = SearchItemsByField($field, $value);
2591
    my $items = SearchItemsByField($field, $value);
(-)a/acqui/basket.pl (-7 / +2 lines)
Lines 469-481 sub get_order_infos { Link Here
469
    my $itemcount = GetItemsCount($biblionumber);
469
    my $itemcount = GetItemsCount($biblionumber);
470
    my $holds_count = $biblio ? $biblio->holds->count : 0;
470
    my $holds_count = $biblio ? $biblio->holds->count : 0;
471
    my @items = GetItemnumbersFromOrder( $ordernumber );
471
    my @items = GetItemnumbersFromOrder( $ordernumber );
472
    my $itemholds;
472
    my $itemholds  = $biblio ? $biblio->holds->search({ itemnumber => { -in => \@items } })->count : 0;
473
    foreach my $item (@items){
473
474
        my $nb = GetItemHolds($biblionumber, $item);
475
        if ($nb){
476
            $itemholds += $nb;
477
        }
478
    }
479
    # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
474
    # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680
480
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds_count);
475
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds_count);
481
    $line{items}                = ($itemcount) - (scalar @items);
476
    $line{items}                = ($itemcount) - (scalar @items);
(-)a/acqui/parcel.pl (-8 / +1 lines)
Lines 245-257 unless( defined $invoice->{closedate} ) { Link Here
245
        my $itemcount = GetItemsCount($biblionumber);
245
        my $itemcount = GetItemsCount($biblionumber);
246
        my $holds_count = $biblio ? $biblio->holds->count : 0;
246
        my $holds_count = $biblio ? $biblio->holds->count : 0;
247
        my @items = GetItemnumbersFromOrder( $ordernumber );
247
        my @items = GetItemnumbersFromOrder( $ordernumber );
248
        my $itemholds;
248
        my $itemholds = $biblio ? $biblio->holds->search({ itemnumber => { -in => \@items } })->count : 0;
249
        foreach my $item (@items){
250
            my $nb = GetItemHolds($biblionumber, $item);
251
            if ($nb){
252
                $itemholds += $nb;
253
            }
254
        }
255
249
256
        my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
250
        my $suggestion   = GetSuggestionInfoFromBiblionumber($line{biblionumber});
257
        $line{suggestionid}         = $suggestion->{suggestionid};
251
        $line{suggestionid}         = $suggestion->{suggestionid};
258
- 

Return to bug 17736