[Koha-bugs] [Bug 19452] The -truncate option in borrowers-force-messaging-defaults.pl should not remove category preferences

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Oct 12 14:41:00 CEST 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19452

--- Comment #1 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Created attachment 67998
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67998&action=edit
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 at rijksmuseum.nl>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list