Bug 31183: Add Koha::Item::Transfers->filter_by_current

This patch introduces the aforementioned method.

To test:
1. Apply this unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Item/Transfers.t
=> FaIL: method not defined?
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomás Cohen Arazi 2022-07-18 18:33:47 -03:00
parent 3ab8807d7e
commit 96e0402573
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -30,10 +30,27 @@ Koha::Item::Transfers - Koha Item Transfer Object set class
=head1 API
=head2 Class Methods
=head2 Class methods
=head3 filter_by_current
my $current_transfers = $transfers->filter_by_current;
Filters out completed transfers from the resultset.
=cut
sub filter_by_current {
my ( $self ) = @_;
return $self->search(
{
datearrived => undef,
datecancelled => undef,
}
);
}
=head3 type
=cut