Bug 30318 - Cannot override default patron messaging preferences when creating a patron in staff interface
Summary: Cannot override default patron messaging preferences when creating a patron i...
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
: 26520 (view as bug list)
Depends on:
Blocks: 37339
  Show dependency treegraph
 
Reported: 2022-03-18 15:41 UTC by Nick Clemens (kidclamp)
Modified: 2024-07-25 11:11 UTC (History)
12 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06,23.05.12
Circulation function:


Attachments
Bug 30318: Don't reset messaging preferences when form is empty (2.13 KB, patch)
2024-04-19 12:35 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 30318: Don't reset messaging preferences when form is empty (2.19 KB, patch)
2024-04-19 16:15 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 30318: Don't reset messaging preferences when form is empty (2.26 KB, patch)
2024-04-23 08:57 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2022-03-18 15:41:14 UTC
The issue appears to be in C4/Form/MessagingPreferences.pm  

73 sub handle_form_action {
...
104     if (! $prefs_set && $insert){
105         # this is new borrower, and we have no preferences set, use the defaults
106     $target_params->{categorycode} = $categorycode;
107         C4::Members::Messaging::SetMessagingPreferencesFromDefaults( $target_params );
108     }
...


To recreate:
1 - Enable EnhancedMessagingPreferences system preference
2 - Set some defaults for a category
3 - Create a new patron in this category
4 - Uncheck all messages before saving
5 - Note patron is created with the defaults set
Comment 1 Katrin Fischer 2022-07-18 21:26:22 UTC
Still valid, but you have to remove all settings, if you only remove some, the settings are saved correctly.
Comment 2 Katrin Fischer 2023-12-10 09:05:18 UTC
*** Bug 26520 has been marked as a duplicate of this bug. ***
Comment 3 David Nind 2024-01-19 06:09:45 UTC
Bug and nuances described in Christopher and George's koha-US The Terrific Every-Other-Thursday Training Video (19 January 2024): https://www.youtube.com/watch?v=vtjWbfQhHCU
Comment 4 Kristi 2024-02-01 20:45:57 UTC
This is a much needed fix for us.
Comment 5 Chanel Wheeler 2024-04-18 20:21:49 UTC
We really need this too.
Comment 6 Nick Clemens (kidclamp) 2024-04-19 12:35:28 UTC
Created attachment 165170 [details] [review]
Bug 30318: Don't reset messaging preferences when form is empty

In testing, the messaging preferences are set in the form when EnhancedMessagingPreferences is enabled.
Switching categories silently updates the preferences unless you have made changes, in which case the
user is warned and can confirm if they want to reset or not. The code only applies to patron creatoin, and
does not seem to be taken into account during OPAC self-registration.

It seems the silent defaulting when saving can be removed in favor of the current updates/warns in the actual
form.

To test:
 1 - Set some messaging preferences for at least two categories
 2 - Enter a new patron
 3 - Confirm switching categories correctly defaults the messaging preferences
 4 - Edit the preferences and switch to another category with defaults
 5 - Confirm the warning appears, and preferences are set if confirmed and ignored if not
 6 - Set to a category with defaults, uncheck all, and save
 7 - Ooof, patron is defaulted
 8 - Apply patch
 9 - Repeat 1-5 and confirm nothing has changed
10 - Set to a category with defaults, uncheck all, save
11 - Confirm patron is saved with no preferences
Comment 7 Andrew Fuerste-Henry 2024-04-19 16:15:08 UTC
Created attachment 165217 [details] [review]
Bug 30318: Don't reset messaging preferences when form is empty

In testing, the messaging preferences are set in the form when EnhancedMessagingPreferences is enabled.
Switching categories silently updates the preferences unless you have made changes, in which case the
user is warned and can confirm if they want to reset or not. The code only applies to patron creatoin, and
does not seem to be taken into account during OPAC self-registration.

It seems the silent defaulting when saving can be removed in favor of the current updates/warns in the actual
form.

To test:
 1 - Set some messaging preferences for at least two categories
 2 - Enter a new patron
 3 - Confirm switching categories correctly defaults the messaging preferences
 4 - Edit the preferences and switch to another category with defaults
 5 - Confirm the warning appears, and preferences are set if confirmed and ignored if not
 6 - Set to a category with defaults, uncheck all, and save
 7 - Ooof, patron is defaulted
 8 - Apply patch
 9 - Repeat 1-5 and confirm nothing has changed
10 - Set to a category with defaults, uncheck all, save
11 - Confirm patron is saved with no preferences

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 8 David Nind 2024-04-20 12:13:25 UTC
It looks like Andrew has signed this one off, but the status hasn't been changed.
Comment 9 Andrew Fuerste-Henry 2024-04-22 15:17:20 UTC
(In reply to David Nind from comment #8)
> It looks like Andrew has signed this one off, but the status hasn't been
> changed.

So I did, thank you.
Comment 10 Martin Renvoize (ashimema) 2024-04-23 08:57:28 UTC
Created attachment 165359 [details] [review]
Bug 30318: Don't reset messaging preferences when form is empty

In testing, the messaging preferences are set in the form when EnhancedMessagingPreferences is enabled.
Switching categories silently updates the preferences unless you have made changes, in which case the
user is warned and can confirm if they want to reset or not. The code only applies to patron creatoin, and
does not seem to be taken into account during OPAC self-registration.

It seems the silent defaulting when saving can be removed in favor of the current updates/warns in the actual
form.

To test:
 1 - Set some messaging preferences for at least two categories
 2 - Enter a new patron
 3 - Confirm switching categories correctly defaults the messaging preferences
 4 - Edit the preferences and switch to another category with defaults
 5 - Confirm the warning appears, and preferences are set if confirmed and ignored if not
 6 - Set to a category with defaults, uncheck all, and save
 7 - Ooof, patron is defaulted
 8 - Apply patch
 9 - Repeat 1-5 and confirm nothing has changed
10 - Set to a category with defaults, uncheck all, save
11 - Confirm patron is saved with no preferences

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize (ashimema) 2024-04-23 08:58:04 UTC
The change makes sense, QA scripts are happy.

Passing QA
Comment 12 Katrin Fischer 2024-04-26 06:53:27 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 13 Lucas Gass (lukeg) 2024-05-28 20:18:33 UTC
Backported to 23.05.x for upcoming 23.05.12