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>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 1e02087923)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2022-02-25 20:04:41 +00:00 committed by Andrew Fuerste-Henry
parent bb9cf28aa2
commit ced32711bb
1 changed files with 8 additions and 0 deletions

View File

@ -118,6 +118,14 @@ sub add {
@$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(