From 74130f08dff33a3c9409f95618903d6fb751c44e Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 26 Mar 2026 15:11:21 +0000 Subject: [PATCH] Bug 42112: Add option when changing a patron's category: allow choosing what to do for the expiry date and messaging preferences To test: 1. APPLY PATCH, updatedatabase, restart_all 2. Find 2 new system preferences UpdateDateExpiryOnCategoryChange and UpdateMessagingPrefsOnCategoryChange 3. Each was the same options: -Never update -Always ask, default to no -Always ask, default to yes -Always update without asking 4. Go to Administration > Patron categories 5. Edit or create some categories with different Enrollment periods and messaaging preferences 6. Try each of the options for BOTH system preferences, making sure they work as described. Signed-off-by: David Nind Signed-off-by: Emily Lamancusa Signed-off-by: Pedro Amorim --- .../data/mysql/atomicupdate/bug_42112.pl | 27 +++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 + .../en/modules/admin/preferences/patrons.pref | 16 ++++ .../prog/en/modules/members/memberentrygen.tt | 36 ++++++--- .../prog/js/messaging-preference-form.js | 80 +++++++++++++++++-- 5 files changed, 147 insertions(+), 14 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_42112.pl diff --git a/installer/data/mysql/atomicupdate/bug_42112.pl b/installer/data/mysql/atomicupdate/bug_42112.pl new file mode 100755 index 0000000000..584feb2930 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_42112.pl @@ -0,0 +1,27 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "42112", + description => "Add UpdateExpiryDateOnCategoryChange and UpdateMessagingPrefsOnCategoryChange", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do( + q{ + INSERT IGNORE INTO systempreferences (`variable`,`value`) + VALUES ('UpdateExpiryDateOnCategoryChange', 'softyes') + } + ); + $dbh->do( + q{ + INSERT IGNORE INTO systempreferences (`variable`,`value`) + VALUES ('UpdateMessagingPrefsOnCategoryChange', 'softyes') + } + ); + + say_success( $out, "System preference UpdateExpiryDateOnCategoryChange added." ); + say_success( $out, "System preference UpdateMessagingPrefsOnCategoryChange added." ); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 671dd1898b..a825996c88 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -868,11 +868,13 @@ INSERT INTO systempreferences ( `variable`, `value` ) VALUES ('UniqueItemFields','barcode'), ('UnseenRenewals','0'), ('UnsubscribeReflectionDelay',''), +('UpdateExpiryDateOnCategoryChange', 'softyes'), ('UpdateItemLocationOnCheckin', ''), ('UpdateItemLocationOnCheckout', ''), ('UpdateItemLostStatusWhenPaid', '0'), ('UpdateItemLostStatusWhenWriteoff', '0'), ('UpdateItemWhenLostFromHoldList',''), +('UpdateMessagingPrefsOnCategoryChange','softyes'), ('UpdateNotForLoanStatusOnCheckin', ''), ('UpdateNotForLoanStatusOnCheckout', ''), ('UpdateTotalIssuesOnCirc','0'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index e7fdda20a0..43a705700f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -99,6 +99,22 @@ Patrons: 1: Do 0: "Don't" - charge a fee when a patron changes to a category with an enrollment fee. + - + - pref: UpdateExpiryDateOnCategoryChange + choices: + yes: "Always update without asking" + softyes: "Ask before updating, default to yes" + softno: "Ask before updating, default to no" + no: "Never update" + - the date expiry when changing an existing patron to a new category. + - + - pref: UpdateMessagingPrefsOnCategoryChange + choices: + yes: "Always update without asking" + softyes: "Ask before updating, default to yes" + softno: "Ask before updating, default to no" + no: "Never update" + - messaging preferences when changing an existing patron to a new category. - - Select which patron activities should be tracked to signify patron activity. Each time that one of these activities occurs, borrowers.lastseen will update with the current date and time. - pref: TrackLastPatronActivityTriggers diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index e6c055a81d..d103c29a4e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1598,7 +1598,6 @@ -