Created attachment 67998 [details] [review] Bug 19452: Replace the truncate option by reset_all The truncate option is not really useful. Its result is probably not what most users of this script expect or need. It truncates both tables borrower_message_preferences and borrower_message_transport_preferences. This (unfortunately) includes deleting messaging preferences for patron categories. After that, adding preferences again will not add categories again, but only borrower preferences which are all disabled. Furthermore, we do not need to disable the foreign key check. Neither do we actually need to truncate, deleting records seems sufficient. Also deleting transport preferences is not needed, since it will be done by a cascade from messaging preferences. This patch replaces -truncate by -reset_all: It will only delete records from borrower_message_preferences directly, and skip patron categories. This allows you to reset all borrower prefs to the untouched prefs from the patron category. In a follow-up report I will propose to add a category parameter in order to allow resetting prefs for specific categories. Test plan: [1] Select a patron category (say ST) and change days_in_advance to x. [2] Select a ST patron and set days_advance to y in his msg prefs. [3] Run borrowers-force-messaging-defaults.pl -doit -reset_all [4] Verify that the patron has been reset to the default prefs (incl. value x in days_in_advance). [5] Verify that the patron category prefs are still intact. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wondering if having this reset option actually makes sense. Or can we just remove it ?
Created attachment 68175 [details] [review] Bug 19452: Remove the truncate option The truncate option is not really useful. Its result is probably not what most users of this script expect or need. It truncates both tables borrower_message_preferences and borrower_message_transport_preferences. This (unfortunately) includes deleting messaging preferences for patron categories. After that, adding preferences again will not add categories again, but only borrower preferences which are all disabled. Furthermore, we do not need to disable the foreign key check. Neither do we actually need to truncate, deleting records seems sufficient. Also deleting transport preferences is not needed, since it will be done by a cascade from messaging preferences. Note that the subsequent call of SetMessagingPreferencesFromDefaults will already delete the records. This makes it possible to remove the truncate option altogether. Test plan: [1] Select a patron category (say ST) and change days_in_advance to x. [2] Select a ST patron and set days_advance to y in his msg prefs. [3] Run borrowers-force-messaging-defaults.pl -doit [4] Verify that the patron has been reset to the default prefs (incl. value x in days_in_advance). [5] Verify that the patron category prefs are still intact. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 68201 [details] [review] Bug 19452: Remove the truncate option The truncate option is not really useful. Its result is probably not what most users of this script expect or need. It truncates both tables borrower_message_preferences and borrower_message_transport_preferences. This (unfortunately) includes deleting messaging preferences for patron categories. After that, adding preferences again will not add categories again, but only borrower preferences which are all disabled. Furthermore, we do not need to disable the foreign key check. Neither do we actually need to truncate, deleting records seems sufficient. Also deleting transport preferences is not needed, since it will be done by a cascade from messaging preferences. Note that the subsequent call of SetMessagingPreferencesFromDefaults will already delete the records. This makes it possible to remove the truncate option altogether. Test plan: [1] Select a patron category (say ST) and change days_in_advance to x. [2] Select a ST patron and set days_advance to y in his msg prefs. [3] Run borrowers-force-messaging-defaults.pl -doit [4] Verify that the patron has been reset to the default prefs (incl. value x in days_in_advance). [5] Verify that the patron category prefs are still intact. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Rebased
Can't really say where the problem lies, but I couldn't apply your patches: > fatal: sha1 information is lacking or useless (misc/maintenance/borrowers-force-messaging-defaults.pl).
(In reply to Charles Farmer from comment #6) > Can't really say where the problem lies, but I couldn't apply your patches: > > fatal: sha1 information is lacking or useless (misc/maintenance/borrowers-force-messaging-defaults.pl). Thx for trying. You need the dependency. First git apply 19451.
You're completely right, I thought I was looking at a "Pushed to master" dependency. I could easily follow the test plan, and saw no issue after qa1.
Created attachment 69203 [details] [review] Bug 19452: Remove the truncate option The truncate option is not really useful. Its result is probably not what most users of this script expect or need. It truncates both tables borrower_message_preferences and borrower_message_transport_preferences. This (unfortunately) includes deleting messaging preferences for patron categories. After that, adding preferences again will not add categories again, but only borrower preferences which are all disabled. Furthermore, we do not need to disable the foreign key check. Neither do we actually need to truncate, deleting records seems sufficient. Also deleting transport preferences is not needed, since it will be done by a cascade from messaging preferences. Note that the subsequent call of SetMessagingPreferencesFromDefaults will already delete the records. This makes it possible to remove the truncate option altogether. Test plan: [1] Select a patron category (say ST) and change days_in_advance to x. [2] Select a ST patron and set days_advance to y in his msg prefs. [3] Run borrowers-force-messaging-defaults.pl -doit [4] Verify that the patron has been reset to the default prefs (incl. value x in days_in_advance). [5] Verify that the patron category prefs are still intact. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Frédéric, as you are the author of this script can you confirm this change?
Created attachment 71652 [details] [review] Bug 19452: Remove the truncate option The truncate option is not really useful. Its result is probably not what most users of this script expect or need. It truncates both tables borrower_message_preferences and borrower_message_transport_preferences. This (unfortunately) includes deleting messaging preferences for patron categories. After that, adding preferences again will not add categories again, but only borrower preferences which are all disabled. Furthermore, we do not need to disable the foreign key check. Neither do we actually need to truncate, deleting records seems sufficient. Also deleting transport preferences is not needed, since it will be done by a cascade from messaging preferences. Note that the subsequent call of SetMessagingPreferencesFromDefaults will already delete the records. This makes it possible to remove the truncate option altogether. Test plan: [1] Select a patron category (say ST) and change days_in_advance to x. [2] Select a ST patron and set days_advance to y in his msg prefs. [3] Run borrowers-force-messaging-defaults.pl -doit [4] Verify that the patron has been reset to the default prefs (incl. value x in days_in_advance). [5] Verify that the patron category prefs are still intact. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Simple rebase
Destroys data unexpectedly... changing this to be a bug. Dependency won't get pushed to stable releases as enh tho.
(In reply to Katrin Fischer from comment #13) > Destroys data unexpectedly... changing this to be a bug. > Dependency won't get pushed to stable releases as enh tho. Are you working on it now? This comment might suggest so..
Not working on it and not saying so - more indicating that a patch for stable vresions might be nice :)
Created attachment 71815 [details] [review] Bug 19452: Remove the truncate option The truncate option is not really useful. Its result is probably not what most users of this script expect or need. It truncates both tables borrower_message_preferences and borrower_message_transport_preferences. This (unfortunately) includes deleting messaging preferences for patron categories. After that, adding preferences again will not add categories again, but only borrower preferences which are all disabled. Furthermore, we do not need to disable the foreign key check. Neither do we actually need to truncate, deleting records seems sufficient. Also deleting transport preferences is not needed, since it will be done by a cascade from messaging preferences. Note that the subsequent call of SetMessagingPreferencesFromDefaults will already delete the records. This makes it possible to remove the truncate option altogether. Test plan: [1] Select a patron category (say ST) and change days_in_advance to x. [2] Select a ST patron and set days_advance to y in his msg prefs. [3] Run borrowers-force-messaging-defaults.pl -doit [4] Verify that the patron has been reset to the default prefs (incl. value x in days_in_advance). [5] Verify that the patron category prefs are still intact. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Charles Farmer <charles.farmer@inLibro.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Pushed to master for 18.05, thanks to everybody involved!
(In reply to Katrin Fischer from comment #15) > more indicating that a patch for > stable vresions might be nice :) Will submit one
Created attachment 72000 [details] [review] Bug 19452: [17.11.x] Remove the truncate option The truncate option is not really useful. Its result is probably not what most users of this script expect or need. It truncates both tables borrower_message_preferences and borrower_message_transport_preferences. This (unfortunately) includes deleting messaging preferences for patron categories. After that, adding preferences again will not add categories again, but only borrower preferences which are all disabled. Furthermore, we do not need to disable the foreign key check. Neither do we actually need to truncate, deleting records seems sufficient. Also deleting transport preferences is not needed, since it will be done by a cascade from messaging preferences. Note that the subsequent call of SetMessagingPreferencesFromDefaults will already delete the records. This makes it possible to remove the truncate option altogether. Test plan: [1] Select a patron category (say ST) and change days_in_advance to x. [2] Select a ST patron and set days_advance to y in his msg prefs. [3] Run borrowers-force-messaging-defaults.pl -doit [4] Verify that the patron has been reset to the default prefs (incl. value x in days_in_advance). [5] Verify that the patron category prefs are still intact. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Charles Farmer <charles.farmer@inLibro.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 72001 [details] [review] Bug 19452: [17.05.x] Remove the truncate option The truncate option is not really useful. Its result is probably not what most users of this script expect or need. It truncates both tables borrower_message_preferences and borrower_message_transport_preferences. This (unfortunately) includes deleting messaging preferences for patron categories. After that, adding preferences again will not add categories again, but only borrower preferences which are all disabled. Furthermore, we do not need to disable the foreign key check. Neither do we actually need to truncate, deleting records seems sufficient. Also deleting transport preferences is not needed, since it will be done by a cascade from messaging preferences. Note that the subsequent call of SetMessagingPreferencesFromDefaults will already delete the records. This makes it possible to remove the truncate option altogether. Test plan: [1] Select a patron category (say ST) and change days_in_advance to x. [2] Select a ST patron and set days_advance to y in his msg prefs. [3] Run borrowers-force-messaging-defaults.pl -doit [4] Verify that the patron has been reset to the default prefs (incl. value x in days_in_advance). [5] Verify that the patron category prefs are still intact. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Charles Farmer <charles.farmer@inLibro.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Can we push to stable branches even if they do not contain Bug 19451 ?
(In reply to Fridolin SOMERS from comment #21) > Can we push to stable branches even if they do not contain Bug 19451 ? Probably. Careful rebase?
Awsome work all! Pushed to stable for 17.11.04
Pushed to 17.05.x for v17.05.10 Realy strange that this script does not have the .pl extension :/