Bug 12029: Remove 'params' from filter_by_unread

It's not used and not needed, you can chain methods.

Also remove unused C4::Koha module and useless statement in tests.

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:
Jonathan Druart 2023-03-23 12:28:31 +01:00 committed by Tomas Cohen Arazi
parent 368dfdc7d0
commit 806cbf8d8c
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
3 changed files with 1 additions and 6 deletions

View file

@ -41,14 +41,11 @@ Koha::Patron::Messages - Koha Message Object set class
=cut
sub filter_by_unread {
my ( $self, $params ) = @_;
$params ||= {};
my ( $self ) = @_;
return $self->search(
{
patron_read_date => { is => undef },
%$params,
}
);
}

View file

@ -19,7 +19,6 @@
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Koha;
use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );

View file

@ -113,7 +113,6 @@ my $current_messages_count = $patron_obj->messages->count;
is( $patron_obj->messages->filter_by_unread->count, $current_messages_count, "No messages have been marked as read" );
$new_message_4->update({ patron_read_date => dt_from_string });
is( $patron_obj->messages->filter_by_unread->count, $current_messages_count - 1, "One message has been marked as read" );
$new_message_4->update({ patron_read_date => undef });
$schema->storage->txn_rollback;