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

(-)a/Koha/Acquisition/Order.pm (-14 lines)
Lines 194-213 sub holds { Link Here
194
    );
194
    );
195
}
195
}
196
196
197
=head3 holds_count
198
199
    my $count = $order->holds_count
200
201
Returns the holds count associated to the order.
202
203
=cut
204
205
sub holds_count {
206
    my ($self) = @_;
207
208
    return $self->holds->count;
209
}
210
211
=head3 items
197
=head3 items
212
198
213
    my $items = $order->items
199
    my $items = $order->items
(-)a/Koha/Biblio.pm (-18 / +4 lines)
Lines 100-117 sub orders { Link Here
100
100
101
=head3 active_orders_count
101
=head3 active_orders_count
102
102
103
my $orders_count = $biblio->active_orders_count();
103
my $active_orders = $biblio->active_orders();
104
104
105
Returns the number of active acquisition orders related to this biblio.
105
Returns the active acquisition orders related to this biblio.
106
An order is considered active when it is not cancelled (i.e. when datecancellation
106
An order is considered active when it is not cancelled (i.e. when datecancellation
107
is not undef).
107
is not undef).
108
108
109
=cut
109
=cut
110
110
111
sub active_orders_count {
111
sub active_orders {
112
    my ( $self ) = @_;
112
    my ( $self ) = @_;
113
113
114
    return $self->orders->search({ datecancellationprinted => undef })->count;
114
    return $self->orders->search({ datecancellationprinted => undef });
115
}
115
}
116
116
117
=head3 can_article_request
117
=head3 can_article_request
Lines 411-430 sub items { Link Here
411
    return Koha::Items->_new_from_dbic( $items_rs );
411
    return Koha::Items->_new_from_dbic( $items_rs );
412
}
412
}
413
413
414
=head3 items_count
415
416
my $items_count = $biblio->items();
417
418
Returns the count of the the related Koha::Items object for this biblio
419
420
=cut
421
422
sub items_count {
423
    my ($self) = @_;
424
425
    return $self->_result->items->count;
426
}
427
428
=head3 itemtype
414
=head3 itemtype
429
415
430
my $itemtype = $biblio->itemtype();
416
my $itemtype = $biblio->itemtype();
(-)a/Koha/Object.pm (-1 / +8 lines)
Lines 431-437 sub to_api { Link Here
431
            my $curr = $embed;
431
            my $curr = $embed;
432
            my $next = $embeds->{$curr}->{children};
432
            my $next = $embeds->{$curr}->{children};
433
433
434
            my $children = $self->$curr;
434
            my $children;
435
            my $method = $curr;
436
            if ( $method =~ q{^(.*)_count$} ) {
437
                $children = $self->$1;
438
                $children = $children->count;
439
            } else {
440
                $children = $self->$curr;
441
            }
435
442
436
            if ( defined $children and ref($children) eq 'ARRAY' ) {
443
            if ( defined $children and ref($children) eq 'ARRAY' ) {
437
                my @list = map {
444
                my @list = map {
(-)a/acqui/basket.pl (-2 / +2 lines)
Lines 136-142 if ( $op eq 'delete_confirm' ) { Link Here
136
        foreach my $myorder (@orders){
136
        foreach my $myorder (@orders){
137
            my $biblionumber = $myorder->{'biblionumber'};
137
            my $biblionumber = $myorder->{'biblionumber'};
138
            my $biblio = Koha::Biblios->find( $biblionumber );
138
            my $biblio = Koha::Biblios->find( $biblionumber );
139
            my $countbiblio = $biblio->active_orders_count;
139
            my $countbiblio = $biblio->active_orders->count;
140
            my $ordernumber = $myorder->{'ordernumber'};
140
            my $ordernumber = $myorder->{'ordernumber'};
141
            my $cnt_subscriptions = $biblio->subscriptions->count;
141
            my $cnt_subscriptions = $biblio->subscriptions->count;
142
            my $itemcount = $biblio->items->count;
142
            my $itemcount = $biblio->items->count;
Lines 477-483 sub get_order_infos { Link Here
477
    my $biblionumber = $order->{'biblionumber'};
477
    my $biblionumber = $order->{'biblionumber'};
478
    if ( $biblionumber ) { # The biblio still exists
478
    if ( $biblionumber ) { # The biblio still exists
479
        my $biblio = Koha::Biblios->find( $biblionumber );
479
        my $biblio = Koha::Biblios->find( $biblionumber );
480
        my $countbiblio = $biblio->active_orders_count;
480
        my $countbiblio = $biblio->active_orders->count;
481
481
482
        my $ordernumber = $order->{'ordernumber'};
482
        my $ordernumber = $order->{'ordernumber'};
483
        my $cnt_subscriptions = $biblio->subscriptions->count;
483
        my $cnt_subscriptions = $biblio->subscriptions->count;
(-)a/acqui/parcel.pl (-2 / +1 lines)
Lines 241-247 unless( defined $invoice->{closedate} ) { Link Here
241
241
242
        my $biblionumber = $line{'biblionumber'};
242
        my $biblionumber = $line{'biblionumber'};
243
        my $biblio = Koha::Biblios->find( $biblionumber );
243
        my $biblio = Koha::Biblios->find( $biblionumber );
244
        my $countbiblio = $biblio->active_orders_count;
244
        my $countbiblio = $biblio->active_orders->count;
245
        my $ordernumber = $line{'ordernumber'};
245
        my $ordernumber = $line{'ordernumber'};
246
        my $order_object = Koha::Acquisition::Orders->find($ordernumber);
246
        my $order_object = Koha::Acquisition::Orders->find($ordernumber);
247
        my $cnt_subscriptions = $biblio ? $biblio->subscriptions->count: 0;
247
        my $cnt_subscriptions = $biblio ? $biblio->subscriptions->count: 0;
248
- 

Return to bug 24467