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 2556-2582 sub GetAnalyticsCount { Link Here
2556
    return ($result);
2555
    return ($result);
2557
}
2556
}
2558
2557
2559
=head2 GetItemHolds
2560
2561
  $holds = &GetItemHolds($biblionumber, $itemnumber);
2562
2563
This function return the count of holds with $biblionumber and $itemnumber
2564
2565
=cut
2566
2567
sub GetItemHolds {
2568
    my ($biblionumber, $itemnumber) = @_;
2569
    my $holds;
2570
    my $dbh            = C4::Context->dbh;
2571
    my $query          = "SELECT count(*)
2572
        FROM  reserves
2573
        WHERE biblionumber=? AND itemnumber=?";
2574
    my $sth = $dbh->prepare($query);
2575
    $sth->execute($biblionumber, $itemnumber);
2576
    $holds = $sth->fetchrow;
2577
    return $holds;
2578
}
2579
2580
=head2 SearchItemsByField
2558
=head2 SearchItemsByField
2581
2559
2582
    my $items = SearchItemsByField($field, $value);
2560
    my $items = SearchItemsByField($field, $value);
(-)a/acqui/basket.pl (-7 / +2 lines)
Lines 465-477 sub get_order_infos { Link Here
465
    my $itemcount = GetItemsCount($biblionumber);
465
    my $itemcount = GetItemsCount($biblionumber);
466
    my $holds_count = $biblio ? $biblio->holds->count : 0;
466
    my $holds_count = $biblio ? $biblio->holds->count : 0;
467
    my @items = GetItemnumbersFromOrder( $ordernumber );
467
    my @items = GetItemnumbersFromOrder( $ordernumber );
468
    my $itemholds;
468
    my $itemholds  = $biblio ? $biblio->holds->search({ itemnumber => { -in => \@items } })->count : 0;
469
    foreach my $item (@items){
469
470
        my $nb = GetItemHolds($biblionumber, $item);
471
        if ($nb){
472
            $itemholds += $nb;
473
        }
474
    }
475
    # 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
470
    # 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
476
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds_count);
471
    $line{can_del_bib}          = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds_count);
477
    $line{items}                = ($itemcount) - (scalar @items);
472
    $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