=head1 API
-=head2 Class Methods
+=head2 Class methods
=cut
return $self->search( { found => 'W' } );
}
+=head3 processing
+
+returns a set of holds that are processing from an existing set
+
+=cut
+
+sub processing {
+ my ( $self ) = @_;
+
+ return $self->search( { found => 'P' } );
+}
+
=head3 unfilled
returns a set of holds that are unfilled from an existing set
my $item_level_count = $self->search( { itemnumber => { '!=' => undef } } )->count();
return 'item' if $item_level_count > 0;
+ my $item_group_level_count = $self->search( { item_group_id => { '!=' => undef } } )->count();
+ return 'item_group' if $item_group_level_count > 0;
+
my $record_level_count = $self->search( { itemnumber => undef } )->count();
return 'record' if $record_level_count > 0;
push @bibs_or_items, 'me.itemnumber' => { in => \@itemnumbers } if @itemnumbers;
push @bibs_or_items, 'me.biblionumber' => { in => \@biblionumbers } if @biblionumbers;
- my @branchtransfers = Koha::Item::Transfers->search(
- {
- datearrived => undef,
- datecancelled => undef,
- },
- {
+ my @branchtransfers = Koha::Item::Transfers->filter_by_current->search({}, {
columns => ['itemnumber'],
collapse => 1,
}
)->filter_by_for_hold();
}
-=head3 type
+=head3 filter_by_has_cancellation_requests
+
+ my $with_cancellation_reqs = $holds->filter_by_has_cancellation_requests;
+
+Returns a filtered resultset only containing holds that have cancellation requests.
+
+=cut
+
+sub filter_by_has_cancellation_requests {
+ my ($self) = @_;
+
+ return $self->search( { 'hold_cancellation_request_id' => { '!=' => undef } },
+ { join => 'cancellation_requests' } );
+}
+
+=head3 filter_out_has_cancellation_requests
+
+ my $holds_without_cancellation_requests = $holds->filter_out_has_cancellation_requests;
+
+Returns a filtered resultset without holds with cancellation requests.
+
+=cut
+
+sub filter_out_has_cancellation_requests {
+ my ($self) = @_;
+
+ return $self->search( { 'hold_cancellation_request_id' => { '=' => undef } },
+ { join => 'cancellation_requests' } );
+}
+
+=head2 Internal methods
+
+=head3 _type
=cut