Bug 40219: Moved Extended Attributes Validation Before Enqueuing Welcome Email
Test Plan: 1. Configure Koha with: AutoEmailNewUser = "Send" and create a mandatory extended attribute that will cause validation to fail; for example, set for the attribute to display in the OPAC, to be editable in the OPAC, and to be mandatory. That means this bug must be tested before Bug 40220, where the validation failure is resolved. 2. Setup your Postman, or any other mock API software, to obtain an OAuth token (/api/v1/oauth/token) and to register a patron (/api/v1/patrons). 3. With the OAuth token, send a POST request to /api/v1/patrons with valid patron data and invalid or missing mandatory extended attribute data. 4. Observe the API response with the 400 error and notice that the welcome email was delviered despite the fact that no patron account was created. 5. Apply the patch and repeat step 3. Notice that the API response still contains the 400 error, but no welcome email was sent. Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com>
This commit is contained in:
parent
115b32d883
commit
328b77458f
|
|
@ -110,6 +110,9 @@ sub add {
|
|||
|
||||
my $patron = Koha::Patron->new_from_api($body)->store;
|
||||
|
||||
$patron->extended_attributes(
|
||||
[ map { { code => $_->{type}, attribute => $_->{value} } } @$extended_attributes ] );
|
||||
|
||||
my $overrides = $c->stash('koha.overrides');
|
||||
if ( $overrides->{welcome_yes}
|
||||
|| ( C4::Context->preference("AutoEmailNewUser") && !$overrides->{welcome_no} ) )
|
||||
|
|
@ -145,8 +148,6 @@ sub add {
|
|||
}
|
||||
}
|
||||
|
||||
$patron->extended_attributes(
|
||||
[ map { { code => $_->{type}, attribute => $_->{value} } } @$extended_attributes ] );
|
||||
if ( C4::Context->preference('EnhancedMessagingPreferences') ) {
|
||||
C4::Members::Messaging::SetMessagingPreferencesFromDefaults(
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue