From 25d68bee972a2aaa402baea6672645fccb725991 Mon Sep 17 00:00:00 2001
From: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk>
Date: Thu, 17 Apr 2025 15:41:09 +0100
Subject: [PATCH] Bug 30301: Restore check for mandatory notice

---
 misc/cronjobs/membership_expiry.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/misc/cronjobs/membership_expiry.pl b/misc/cronjobs/membership_expiry.pl
index cef5ef6720c..043e4dcdb97 100755
--- a/misc/cronjobs/membership_expiry.pl
+++ b/misc/cronjobs/membership_expiry.pl
@@ -291,6 +291,12 @@ while ( my $expiring_patron = $upcoming_mem_expires->next ) {
         message_name  => 'Patron_Expiry',
     };
 
+    my $is_notice_mandatory = grep( $expiring_patron->categorycode, @mandatory_expiry_notice_categories );
+    if ($is_notice_mandatory) {
+        $sending_params->{expiry_notice_mandatory} = 1;
+        $sending_params->{primary_contact_method}  = $expiring_patron->primary_contact_method;
+    }
+
     my $result = $expiring_patron->queue_notice($sending_params);
     $count_enqueued++ if $result->{sent};
 }
-- 
2.48.1