Bug 19452: [17.05.x] Remove the truncate option
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 12 Oct 2017 11:13:41 +0000 (13:13 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 27 Mar 2018 08:48:37 +0000 (10:48 +0200)
commitac54d831df9d865f600f20e42ef29a7a2833bd4c
tree6ae0845e1a998168b79b55910c0fae41d7382774
parentda33f365debdd09c8f9b8af2ca904d2f72d3c062
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>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
misc/maintenance/borrowers-force-messaging-defaults