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 $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