Summary: | Let borrowers-force-messaging-defaults.pl optionally add preferences only when not already present | ||
---|---|---|---|
Product: | Koha | Reporter: | Marcel de Rooy <m.de.rooy> |
Component: | Command-line Utilities | Assignee: | Marcel de Rooy <m.de.rooy> |
Status: | CLOSED FIXED | QA Contact: | Josef Moravec <josef.moravec> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | jonathan.druart, josef.moravec, nick, robin |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18197 | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: |
This report adds the command-line option 'no-overwrite' so that you can add preferences only when they are not yet
present (in other words: skip patrons that already set their prefs).
|
Version(s) released in: | |
Circulation function: | |||
Bug Depends on: | 19472 | ||
Bug Blocks: | 19452 | ||
Attachments: |
Bug 19451: Add no_overwrite option to borrowers-force-messaging-defaults.pl
Bug 19451: Add no_overwrite option to borrowers-force-messaging-defaults.pl Bug 19451: Add no_overwrite option to borrowers-force-messaging-defaults.pl Bug 19451: Add no_overwrite option to borrowers-force-messaging-defaults.pl Bug 19451: (QA follow-up) Change parameter name no_overwrite to no-overwrite for consistency Bug 19451: (QA follow-up) Replace weird subquery |
Description
Marcel de Rooy
2017-10-12 10:15:54 UTC
Renaming empty_only to no_overwrite which might be better understood. Created attachment 67989 [details] [review] Bug 19451: Add no_overwrite option to borrowers-force-messaging-defaults.pl This option allows you to add preferences only when they are not yet present. In other words: skip patrons that already set their prefs. Test plan: [1] Delete all borrower messaging prefs for a patron. [2] Run borrowers-force-messaging-defaults.pl -no_overwrite -doit Verify that the patron now has default msg preferences. [3] Change his settings and make them non-default. For instance, increase days in advance. [4] Run borrowers-force-messaging-defaults.pl -no_overwrite -doit Verify that the patron still has the non-default settings. [5] Run borrowers-force-messaging-defaults.pl -doit Verify that the patron msg prefs have been overwritten. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 68200 [details] [review] Bug 19451: Add no_overwrite option to borrowers-force-messaging-defaults.pl This option allows you to add preferences only when they are not yet present. In other words: skip patrons that already set their prefs. Test plan: [1] Delete all borrower messaging prefs for a patron. [2] Run borrowers-force-messaging-defaults.pl -no_overwrite -doit Verify that the patron now has default msg preferences. [3] Change his settings and make them non-default. For instance, increase days in advance. [4] Run borrowers-force-messaging-defaults.pl -no_overwrite -doit Verify that the patron still has the non-default settings. [5] Run borrowers-force-messaging-defaults.pl -doit Verify that the patron msg prefs have been overwritten. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Rebased Created attachment 68844 [details] [review] Bug 19451: Add no_overwrite option to borrowers-force-messaging-defaults.pl This option allows you to add preferences only when they are not yet present. In other words: skip patrons that already set their prefs. Test plan: [1] Delete all borrower messaging prefs for a patron. [2] Run borrowers-force-messaging-defaults.pl -no_overwrite -doit Verify that the patron now has default msg preferences. [3] Change his settings and make them non-default. For instance, increase days in advance. [4] Run borrowers-force-messaging-defaults.pl -no_overwrite -doit Verify that the patron still has the non-default settings. [5] Run borrowers-force-messaging-defaults.pl -doit Verify that the patron msg prefs have been overwritten. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Owen Leonard <oleonard@myacpl.org> Created attachment 71327 [details] [review] Bug 19451: Add no_overwrite option to borrowers-force-messaging-defaults.pl This option allows you to add preferences only when they are not yet present. In other words: skip patrons that already set their prefs. Test plan: [1] Delete all borrower messaging prefs for a patron. [2] Run borrowers-force-messaging-defaults.pl -no-overwrite -doit Verify that the patron now has default msg preferences. [3] Change his settings and make them non-default. For instance, increase days in advance. [4] Run borrowers-force-messaging-defaults.pl -no-overwrite -doit Verify that the patron still has the non-default settings. [5] Run borrowers-force-messaging-defaults.pl -doit Verify that the patron msg prefs have been overwritten. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Created attachment 71328 [details] [review] Bug 19451: (QA follow-up) Change parameter name no_overwrite to no-overwrite for consistency Signed-off-by: Josef Moravec <josef.moravec@gmail.com> + if( $no_overwrite ) { + $sql .= " AND (SELECT COUNT(*) FROM borrower_message_preferences mp WHERE mp.borrowernumber=bo.borrowernumber) = 0" + } This is weird, I think you want to add a join here instead. Created attachment 71367 [details] [review] Bug 19451: (QA follow-up) Replace weird subquery As requested, we add a JOIN and make the SELECT distinct. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tested that no-overwrite still works as expected. Pushed to master for 18.05, thanks to everybody involved! Awesome work all! Enhancement, not backported to stable. |