[Bug 22993] New: Messaging preferences not set for patrons imported through API
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Bug ID: 22993 Summary: Messaging preferences not set for patrons imported through API Change sponsored?: --- Product: Koha Version: 18.11 Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: hans.palsson@hkr.se QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Target Milestone: --- It appears that from 18.11.03 (maybe earlier), patrons that are created/imported through the API does not get messaging preferences set as specified in the system preferences ("Default messaging preferences for this patron category"). This should work in the same way that messaging preferences are set for patrons created in the GUI. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|18.11 |master CC| |katrin.fischer@bsz-bw.de Severity|minor |normal -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arthur.suzuki@biblibre.com Assignee|koha-bugs@lists.koha-commun |arthur.suzuki@biblibre.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 131131 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131131&action=edit Bug 22993: Unit tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #2 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 131132 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131132&action=edit Bug 22993: Handle default messaging preferences during patron creation from API TO test: 1 - Set default messaging preferences for a patron category 2 - Create a patron in that category using the API 3 - Verify messaging preferences are not set 4 - Apply patch, restart all 5 - Create another patron 6 - Verify messaging preferences are correctly set 7 - prove -v t/db_dependent/api/v1/patrons.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131131|0 |1 is obsolete| | Attachment #131132|0 |1 is obsolete| | --- Comment #3 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 131358 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131358&action=edit Bug 22993: Unit tests Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #4 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 131359 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131359&action=edit Bug 22993: Handle default messaging preferences during patron creation from API TO test: 1 - Set default messaging preferences for a patron category 2 - Create a patron in that category using the API 3 - Verify messaging preferences are not set 4 - Apply patch, restart all 5 - Create another patron 6 - Verify messaging preferences are correctly set 7 - prove -v t/db_dependent/api/v1/patrons.t Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |tomascohen@gmail.com |y.org | CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131358|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131359|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 131361 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131361&action=edit Bug 22993: Unit tests Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 131362 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131362&action=edit Bug 22993: Handle default messaging preferences during patron creation from API TO test: 1 - Set default messaging preferences for a patron category 2 - Create a patron in that category using the API 3 - Verify messaging preferences are not set 4 - Apply patch, restart all 5 - Create another patron 6 - Verify messaging preferences are correctly set 7 - prove -v t/db_dependent/api/v1/patrons.t Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Well done. Only members/memberentry.pl uses handle_form_action, the rest of the tools that add patrons do what Nick added to the API controller. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|arthur.suzuki@biblibre.com |nick@bywatersolutions.com CC| |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |22.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #8 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to master for 22.05, thanks to everybody involved 🦄 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|22.05.00 |22.05.00,21.11.04 released in| | --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to 21.11.x for 21.11.04 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com Version(s)|22.05.00,21.11.04 |22.05.00,21.11.04,21.05.13 released in| | Status|Pushed to stable |Pushed to oldstable --- Comment #10 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Pushed to 21.05.x for 21.05.13 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net Status|Pushed to oldstable |RESOLVED Resolution|--- |FIXED --- Comment #11 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hi Victor, we applied this manually to our 20.11.16 branch, it's working and needed. Just had to move it a little as there was a tiny conflict with some additional code in master. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #13 from Victor Grousset/tuxayo <victor@tuxayo.net> --- I don't see a simple way to solve the conflict. Can you attach your 20.11.x version here? Here is the conflict I get. We can see that there is another patch missing for 20.11.x that changes stuffs and this ticket just adds the block with if EnhancedMessagingPreferences The 3 sections are: <<<<<<< the code on 20.11.x before the patch ||||||| the code on 21.05.x before the patch ======= the code on 21.05.x after the patch
>
<<<<<<< HEAD $c->res->headers->location( $c->req->url->to_string . '/' . $patron->borrowernumber ); return $c->render( status => 201, openapi => $patron->to_api ||||||| parent of ced32711bb (Bug 22993: Handle default messaging preferences during patron creation from API) my $body = $c->validation->param('body'); my $extended_attributes = delete $body->{extended_attributes} // []; my $patron = Koha::Patron->new_from_api($body)->store; $patron->extended_attributes( [ map { { code => $_->{type}, attribute => $_->{value} } } @$extended_attributes ] ); $c->res->headers->location($c->req->url->to_string . '/' . $patron->borrowernumber); return $c->render( status => 201, openapi => $patron->to_api ); } ======= my $body = $c->validation->param('body'); my $extended_attributes = delete $body->{extended_attributes} // []; my $patron = Koha::Patron->new_from_api($body)->store; $patron->extended_attributes( [ map { { code => $_->{type}, attribute => $_->{value} } } @$extended_attributes ] ); if ( C4::Context->preference('EnhancedMessagingPreferences') ) { C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $patron->borrowernumber, categorycode => $patron->categorycode, } ); } $c->res->headers->location($c->req->url->to_string . '/' . $patron->borrowernumber); return $c->render( status => 201, openapi => $patron->to_api ); }
> ced32711bb (Bug 22993: Handle default messaging preferences during patron creation from API)
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #14 from Victor Grousset/tuxayo <victor@tuxayo.net> --- the changes are due to bug 28002 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #15 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 132300 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=132300&action=edit [20.11] Bug 22993: Handle default messaging preferences during patron creation through API Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #16 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hi Victor, I have attached the patch from our branch. We might want to fix the author still. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #17 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Ok, the code is independent. Moving the new if block in the old code worked :) Backported: Pushed to 20.11.x branch for 20.11.18 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|22.05.00,21.11.04,21.05.13 |22.05.00,21.11.04,21.05.13, released in| |20.11.18 --- Comment #18 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Mid air collision! Thanks, after doublechecking, my solution is the same as yours so it will work :D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22993 --- Comment #19 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Victor Grousset/tuxayo from comment #18)
Mid air collision! Thanks, after doublechecking, my solution is the same as yours so it will work :D
That's the important bit :) -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org