Bug 14806

Summary: Action Log for Modifying borrower messaging preferences
Product: Koha Reporter: Olli-Antti Kivilahti <olli-antti.kivilahti>
Component: PatronsAssignee: Lari Taskula <lari.taskula>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: acampbell, andrewfh, david, gmcharlt, katrin.fischer, kyle.m.hall, lari.taskula, lmstrand, lucas
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 18595    
Bug Blocks: 22794    
Attachments: Bug 14806 - Action Log for Modifying message_transport_types
Bug 14806 - Action Log for Modifying message_transport_types
Bug 14806 - Action Log for Modifying message_transport_types
Bug 14806 - Action Log for Modifying message_transport_types
Bug 14806 - Action Log for Modifying message_transport_types
Bug 14806 - (follow-up) Action Log for Modifying message_transport_types
Bug 14806 - (follow-up) Action Log for Modifying message_transport_types
Bug 14806 - Action Log for Modifying message_transport_types
Bug 14806 - (follow-up) Action Log for Modifying message_transport_types
Bug 14806 - (follow-up) Action Log for Modifying message_transport_types
Bug 14806 - Log changes to borrower message preferences to action logs

Description Olli-Antti Kivilahti 2015-09-11 14:20:56 UTC
This bug enables logging modifications to the koha.borrower_messaging_preferences-table.
Comment 1 Olli-Antti Kivilahti 2015-09-11 14:24:24 UTC Comment hidden (obsolete)
Comment 2 Olli-Antti Kivilahti 2015-09-11 14:31:16 UTC Comment hidden (obsolete)
Comment 3 Olli-Antti Kivilahti 2015-09-11 14:36:11 UTC Comment hidden (obsolete)
Comment 4 Olli-Antti Kivilahti 2015-09-11 14:42:33 UTC Comment hidden (obsolete)
Comment 5 Olli-Antti Kivilahti 2015-09-11 14:54:36 UTC
Created attachment 42486 [details] [review]
Bug 14806 - Action Log for Modifying message_transport_types

TEST PLAN:

0. Activate system preference "BorrowersLog".
1. In intra, edit a Borrowers messaging preferences.
2. In OPAC remove your messaging preferences.
3. SELECT * FROM action_logs ORDER BY timestamp DESC LIMIT 5;
3.1. You should see your new action logs entries.
Comment 6 Lari Taskula 2018-05-17 13:59:02 UTC
Created attachment 75399 [details] [review]
Bug 14806 - (follow-up) Action Log for Modifying message_transport_types

Introducing improvements:
- Centralizing code into new Koha::Patron::Message::Preference(s) objects
- Addings tests
Comment 7 Lari Taskula 2018-05-17 14:07:51 UTC
Created attachment 75400 [details] [review]
Bug 14806 - (follow-up) Action Log for Modifying message_transport_types

Introducing improvements:
- Centralizing code into new Koha::Patron::Message::Preference(s) objects
- Addings tests
Comment 8 Lari Taskula 2019-10-25 12:29:18 UTC
Created attachment 94749 [details] [review]
Bug 14806 - Action Log for Modifying message_transport_types

This is a crude fix.
koha.action_logs-entries are generated when Borrower has been modified using
C4::Form::MessagingPreferences

log entries look like this:

| MEMBERS | MOD MTT | All message_transports removed
| MEMBERS | MOD MTT | [{'_name' => 'Advance_Notice','da' => '4','dig' => 1,'mtt' => ['email']},{'_name' => 'Item_Check_in','mtt' => ['email']},{'_name' => 'Item_Checkout','mtt' => ['email']}]

TEST PLAN:

0. Activate system preference "BorrowersLog".
1. In intra, edit a Borrowers messaging preferences.
2. In OPAC remove your messaging preferences.
3. SELECT * FROM action_logs ORDER BY timestamp DESC LIMIT 5;
3.1. You should see your new action logs entries.
Comment 9 Lari Taskula 2019-10-25 12:29:59 UTC
Created attachment 94750 [details] [review]
Bug 14806 - (follow-up) Action Log for Modifying message_transport_types

Introducing improvements:
- Centralizing code into new Koha::Patron::Message::Preference(s) objects
- Addings tests

To test:
1. prove t/db_dependent/Koha/Patron/Message/Preferences.t
2. Follow test plan of previous patch

Sponsored-by: Koha-Suomi Oy
Comment 10 Lari Taskula 2019-10-25 12:45:01 UTC
Created attachment 94752 [details] [review]
Bug 14806 - (follow-up) Action Log for Modifying message_transport_types

Introducing improvements:
- Centralizing code into new Koha::Patron::Message::Preference(s) objects
- Addings tests

To test:
1. prove t/db_dependent/Koha/Patron/Message/Preferences.t
2. Follow test plan of previous patch

Sponsored-by: Koha-Suomi Oy
Comment 11 David Nind 2020-02-10 10:02:22 UTC
Patch no longer applies because of an issue with bug 18595:

Applying: Bug 18595: Unit tests preparing for GetMessagingPreferences move
Using index info to reconstruct a base tree...
M	t/db_dependent/Circulation.t
M	t/db_dependent/Reserves.t
Falling back to patching base and 3-way merge...
Auto-merging t/db_dependent/Reserves.t
Auto-merging t/db_dependent/Circulation.t
Applying: Bug 18595: Move C4::Members::Messaging::GetMessagingPreferences
.git/rebase-apply/patch:146: trailing whitespace.
This method defines how a user (or a default for a patron category) wants to get a certain 
.git/rebase-apply/patch:272: trailing whitespace.
        
warning: 2 lines add whitespace errors.
Using index info to reconstruct a base tree...
M	C4/Circulation.pm
M	C4/Reserves.pm
M	circ/returns.pl
M	misc/cronjobs/advance_notices.pl
.git/rebase-apply/patch:146: trailing whitespace.
This method defines how a user (or a default for a patron category) wants to get a certain 
.git/rebase-apply/patch:272: trailing whitespace.
        
warning: 2 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging misc/cronjobs/advance_notices.pl
CONFLICT (content): Merge conflict in misc/cronjobs/advance_notices.pl
Auto-merging circ/returns.pl
Auto-merging C4/Reserves.pm
Auto-merging C4/Circulation.pm
error: Failed to merge in the changes.
Patch failed at 0001 Bug 18595: Move C4::Members::Messaging::GetMessagingPreferences
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-18595-Move-C4MembersMessagingGetMessagingPrefe-TcECxc.patch

Cannot apply cleanly patches from bug 18595. Everything will be left dirty.
git bz apply --continue will not continue the process if patches from other bug reports need to be applied.
Comment 12 Andrew Fuerste-Henry 2022-02-28 14:37:32 UTC
Lari, are you still working on this? I'd love to see this enhancement!
Comment 13 Lari Strand 2024-03-08 12:56:08 UTC
Created attachment 162961 [details] [review]
Bug 14806 - Log changes to borrower message preferences to action logs

To test:

1. Change patron's messaging preference/preferences and save
2. Note no entries in patron's modification log
3. Apply patch
4. Change patron's messaging preference/preferences and save
5. Note entries in patron's modification log, one per message type
Comment 14 Lari Strand 2024-03-08 13:02:44 UTC
Mine's a bit hacky but does the job and the added code stays inside the module responsible for the modification process (Messaging.pm). The entries are not in line with other modification logs but they are readable :).
Comment 15 Lucas Gass 2024-03-09 18:01:37 UTC
Lari,

A couple things I see:

1.  FAIL	C4/Members/Messaging.pm
   FAIL	  pod coverage
		POD is missing for 'GetPatronMessagingPreferences'

The new subroutine needs POD coverage.

2. Likely need unit test for sub GetPatronMessagingPreferences

3. Processing additional checks

	* Commit title does not start with 'Bug XXXXX: ' - 189e368f49