From 806cbf8d8c302f8d2cf5926b2330abab28c03cf2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 23 Mar 2023 12:28:31 +0100 Subject: [PATCH] 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 Signed-off-by: Tomas Cohen Arazi --- Koha/Patron/Messages.pm | 5 +---- opac/opac-dismiss-message.pl | 1 - t/db_dependent/Koha/Patron/Messages.t | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Koha/Patron/Messages.pm b/Koha/Patron/Messages.pm index 063c70364b..a906477287 100644 --- a/Koha/Patron/Messages.pm +++ b/Koha/Patron/Messages.pm @@ -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, } ); } diff --git a/opac/opac-dismiss-message.pl b/opac/opac-dismiss-message.pl index 84c5906b6a..789825c035 100755 --- a/opac/opac-dismiss-message.pl +++ b/opac/opac-dismiss-message.pl @@ -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 ); diff --git a/t/db_dependent/Koha/Patron/Messages.t b/t/db_dependent/Koha/Patron/Messages.t index 69a4bb428b..31f8cf92b4 100755 --- a/t/db_dependent/Koha/Patron/Messages.t +++ b/t/db_dependent/Koha/Patron/Messages.t @@ -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; -- 2.39.5