From cbf6a3961e7278902d409acaf2ef590049c4d757 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Wed, 23 Mar 2022 11:30:54 +0100 Subject: [PATCH] [20.11] Bug 22993: Handle default messaging preferences during patron creation through API Signed-off-by: Katrin Fischer --- Koha/REST/V1/Patrons.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm index abefe227a5..8f719bc3a8 100644 --- a/Koha/REST/V1/Patrons.pm +++ b/Koha/REST/V1/Patrons.pm @@ -136,6 +136,15 @@ sub add { my $patron = Koha::Patron->new_from_api( $c->validation->param('body') )->store; + 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, -- 2.11.0