use Carp;
-use C4::Biblio qw( GetRecordValue GetMarcBiblio GetFrameworkCode );
+use C4::Biblio qw();
use Koha::Database;
use Koha::DateUtils qw( dt_from_string );
=cut
+=head3 store
+
+Overloaded I<store> method to set default values
+
+=cut
+
+sub store {
+ my ( $self ) = @_;
+
+ $self->datecreated( dt_from_string ) unless $self->datecreated;
+
+ return $self->SUPER::store;
+}
+
=head3 subtitles
my @subtitles = $biblio->subtitles();
sub subtitles {
my ( $self ) = @_;
- return map { $_->{subfield} } @{ GetRecordValue( 'subtitle', GetMarcBiblio( $self->id ), $self->frameworkcode ) };
+ return map { $_->{subfield} } @{
+ C4::Biblio::GetRecordValue(
+ 'subtitle',
+ C4::Biblio::GetMarcBiblio({ biblionumber => $self->id }),
+ $self->frameworkcode ) };
}
=head3 can_article_request
return Koha::Holds->_new_from_dbic($hold_rs);
}
-=head3 holds_placed_before_today
+=head3 current_holds
-my $holds = $biblio->holds_placed_before_today
+my $holds = $biblio->current_holds
Return the holds placed on this bibliographic record.
It does not include future holds.
=cut
-sub holds_placed_before_today {
+sub current_holds {
my ($self) = @_;
my $dtf = Koha::Database->new->schema->storage->datetime_parser;
return $self->holds(
return $self->{_subscriptions};
}
+=head3 has_items_waiting_or_intransit
+
+my $itemsWaitingOrInTransit = $biblio->has_items_waiting_or_intransit
+
+Tells if this bibliographic record has items waiting or in transit.
+
+=cut
+
+sub has_items_waiting_or_intransit {
+ my ( $self ) = @_;
+
+ if ( Koha::Holds->search({ biblionumber => $self->id,
+ found => ['W', 'T'] })->count ) {
+ return 1;
+ }
+
+ foreach my $item ( $self->items ) {
+ return 1 if $item->get_transfer;
+ }
+
+ return 0;
+}
=head3 type