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

(-)a/Koha/Biblio.pm (+32 lines)
Lines 32-37 use Koha::DateUtils qw( dt_from_string ); Link Here
32
32
33
use base qw(Koha::Object);
33
use base qw(Koha::Object);
34
34
35
use Koha::Acquisition::Orders;
35
use Koha::ArticleRequest::Status;
36
use Koha::ArticleRequest::Status;
36
use Koha::ArticleRequests;
37
use Koha::ArticleRequests;
37
use Koha::Biblio::Metadatas;
38
use Koha::Biblio::Metadatas;
Lines 82-87 sub metadata { Link Here
82
    return Koha::Biblio::Metadata->_new_from_dbic($metadata);
83
    return Koha::Biblio::Metadata->_new_from_dbic($metadata);
83
}
84
}
84
85
86
=head3 orders
87
88
my $orders = $biblio->orders();
89
90
Returns a Koha::Acquisition::Orders object
91
92
=cut
93
94
sub orders {
95
    my ( $self ) = @_;
96
97
    my $orders = $self->_result->orders;
98
    return Koha::Acquisition::Orders->_new_from_dbic($orders);
99
}
100
101
=head3 active_orders_count
102
103
my $orders_count = $biblio->active_orders_count();
104
105
Returns the number of active acquisition orders related to this biblio.
106
An order is considered active when it is not cancelled (i.e. when datecancellation
107
is not undef).
108
109
=cut
110
111
sub active_orders_count {
112
    my ( $self ) = @_;
113
114
    return $self->orders->search({ datecancellationprinted => undef })->count;
115
}
116
85
=head3 can_article_request
117
=head3 can_article_request
86
118
87
my $bool = $biblio->can_article_request( $borrower );
119
my $bool = $biblio->can_article_request( $borrower );
(-)a/Koha/Schema/Result/Biblio.pm (-1 / +7 lines)
Lines 417-422 __PACKAGE__->has_one( Link Here
417
  { cascade_copy => 0, cascade_delete => 0 },
417
  { cascade_copy => 0, cascade_delete => 0 },
418
);
418
);
419
419
420
__PACKAGE__->has_many(
421
  "orders",
422
  "Koha::Schema::Result::Aqorder",
423
  { "foreign.biblionumber" => "self.biblionumber" },
424
  { cascade_copy => 0, cascade_delete => 0 },
425
);
426
420
__PACKAGE__->add_columns(
427
__PACKAGE__->add_columns(
421
    "+serial" => { is_boolean => 1 }
428
    "+serial" => { is_boolean => 1 }
422
);
429
);
423
- 

Return to bug 24430