From c44239a933aa3ccb4b745dbf1c30b8fe05ff8c8f Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Tue, 8 Oct 2024 04:20:13 +0000 Subject: [PATCH] Bug 23295: (follow-up) Add 'NOTICE_FAILURE_SUSPENSION' as a new system restriction type Sponsored-by: Catalyst IT Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer --- Koha/Notice/Message.pm | 2 +- .../bug_23295-add_system_restriction_types.pl | 18 ++++++++++++++++++ .../en/mandatory/patron_restriction_types.yml | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23295-add_system_restriction_types.pl diff --git a/Koha/Notice/Message.pm b/Koha/Notice/Message.pm index b94207a62e..5679807106 100644 --- a/Koha/Notice/Message.pm +++ b/Koha/Notice/Message.pm @@ -115,7 +115,7 @@ sub restrict_patron_when_notice_fails { AddDebarment( { borrowernumber => $self->borrowernumber, - type => 'SUSPENSION', + type => 'NOTICE_FAILURE_SUSPENSION', comment => $comment, expiration => undef, } diff --git a/installer/data/mysql/atomicupdate/bug_23295-add_system_restriction_types.pl b/installer/data/mysql/atomicupdate/bug_23295-add_system_restriction_types.pl new file mode 100644 index 0000000000..617b402eb1 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23295-add_system_restriction_types.pl @@ -0,0 +1,18 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "23295", + description => "Automatically debar patrons if SMS or email notice fail", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + try { + $dbh->do(q{INSERT IGNORE INTO restriction_types (code, display_text, is_system, is_default) VALUES ('NOTICE_FAILURE_SUSPENSION', 'Notice failure suspension', 1, 0)}); + say_success( $out, "Added a new system restriction_types 'NOTICE_FAILURE_SUSPENSION'" ); + } + catch { + say_failure( $out, "Database modification failed with errors: $_" ); + }; + }, +}; diff --git a/installer/data/mysql/en/mandatory/patron_restriction_types.yml b/installer/data/mysql/en/mandatory/patron_restriction_types.yml index 8486145898..d8ca85b80d 100644 --- a/installer/data/mysql/en/mandatory/patron_restriction_types.yml +++ b/installer/data/mysql/en/mandatory/patron_restriction_types.yml @@ -44,3 +44,8 @@ tables: display_text: "Discharge" is_system: 1 is_default: 0 + + - code: "NOTICE_FAILURE_SUSPENSION" + display_text: "Notice failure suspension" + is_system: 1 + is_default: 0 -- 2.39.5