From 0e164801d3759cbeeb7624b3f5cf5c0432db0f02 Mon Sep 17 00:00:00 2001
From: Lari Taskula <lari.taskula@hypernova.fi>
Date: Fri, 10 Feb 2023 10:48:19 +0000
Subject: [PATCH] Bug 17499: Replace Koha::MessageAttribute(s) with
 Koha::Patron::MessagePreference::Attribute(s)

To test:
1. prove t/db_dependent/Illrequests.t
2. grep -rn 'Koha::MessageAttribute', observe no results in Koha code
---
 Koha/MessageAttribute.pm     | 43 -----------------------------
 Koha/MessageAttributes.pm    | 52 ------------------------------------
 t/db_dependent/Illrequests.t |  6 ++---
 3 files changed, 3 insertions(+), 98 deletions(-)
 delete mode 100644 Koha/MessageAttribute.pm
 delete mode 100644 Koha/MessageAttributes.pm

diff --git a/Koha/MessageAttribute.pm b/Koha/MessageAttribute.pm
deleted file mode 100644
index c728b3415f..0000000000
--- a/Koha/MessageAttribute.pm
+++ /dev/null
@@ -1,43 +0,0 @@
-package Koha::MessageAttribute;
-
-# Copyright PTFS Europe 2020
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# Koha is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Koha; if not, see <http://www.gnu.org/licenses>.
-
-use Modern::Perl;
-
-
-use base qw(Koha::Object);
-
-=head1 NAME
-
-Koha::MessageAttribute - Koha MessageAttribute Object class
-
-=head1 API
-
-=head2 Internal methods
-
-=cut
-
-=head3 _type
-
-=cut
-
-sub _type {
-    return 'MessageAttribute';
-}
-
-1;
diff --git a/Koha/MessageAttributes.pm b/Koha/MessageAttributes.pm
deleted file mode 100644
index 5bc7057508..0000000000
--- a/Koha/MessageAttributes.pm
+++ /dev/null
@@ -1,52 +0,0 @@
-package Koha::MessageAttributes;
-
-# Copyright PTFS Europe 2020
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# Koha is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Koha; if not, see <http://www.gnu.org/licenses>.
-
-use Modern::Perl;
-
-
-use base qw(Koha::Objects);
-use Koha::MessageAttribute;
-
-=head1 NAME
-
-Koha::MessageAttributes - Koha MessageAttributes Object set class
-
-=head1 API
-
-=head2 Internal methods
-
-=cut
-
-=head3 _type
-
-=cut
-
-sub _type {
-    return 'MessageAttribute';
-}
-
-=head3 object_class
-
-=cut
-
-sub object_class {
-    return 'Koha::MessageAttribute';
-}
-
-1;
diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Illrequests.t
index f33181ce1a..23e257a51e 100755
--- a/t/db_dependent/Illrequests.t
+++ b/t/db_dependent/Illrequests.t
@@ -29,7 +29,7 @@ use Koha::Patrons;
 use Koha::ItemTypes;
 use Koha::Items;
 use Koha::Libraries;
-use Koha::MessageAttributes;
+use Koha::Patron::MessagePreference::Attributes;
 use Koha::Notice::Templates;
 use Koha::AuthorisedValueCategories;
 use Koha::AuthorisedValues;
@@ -1014,7 +1014,7 @@ subtest 'Helpers' => sub {
     is($illrq_obj->requires_moderation, 'CANCREQ', "requires_moderation: Yes.");
 
     #send_patron_notice
-    my $attr = Koha::MessageAttributes->find({ message_name => 'Ill_ready' });
+    my $attr = Koha::Patron::MessagePreference::Attributes->find({ message_name => 'Ill_ready' });
     C4::Members::Messaging::SetMessagingPreference({
         borrowernumber => $patron->{borrowernumber},
         message_attribute_id => $attr->message_attribute_id,
@@ -1034,7 +1034,7 @@ subtest 'Helpers' => sub {
     is($notice, 'ILL_PICKUP_READY' ,"Notice is correctly created");
 
     # ill update notice, passes additional text parameter
-    my $attr_update = Koha::MessageAttributes->find({ message_name => 'Ill_update' });
+    my $attr_update = Koha::Patron::MessagePreference::Attributes->find({ message_name => 'Ill_update' });
     C4::Members::Messaging::SetMessagingPreference({
         borrowernumber => $patron->{borrowernumber},
         message_attribute_id => $attr_update->message_attribute_id,
-- 
2.25.1