Bugzilla – Attachment 183421 Details for
Bug 40219
Welcome Email Sent on Failed Patron Registration via API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40219: Moved Extended Attributes Validation Before Enqueuing Welcome Email
Bug-40219-Moved-Extended-Attributes-Validation-Bef.patch (text/plain), 2.27 KB, created by
Leo Stoyanov
on 2025-06-23 15:40:38 UTC
(
hide
)
Description:
Bug 40219: Moved Extended Attributes Validation Before Enqueuing Welcome Email
Filename:
MIME Type:
Creator:
Leo Stoyanov
Created:
2025-06-23 15:40:38 UTC
Size:
2.27 KB
patch
obsolete
>From 2f31e3da0ceba540b63f20d01f12ffcb575af292 Mon Sep 17 00:00:00 2001 >From: Leo Stoyanov <leo.stoyanov@bywatersolutions.com> >Date: Mon, 23 Jun 2025 15:38:20 +0000 >Subject: [PATCH] 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. >--- > Koha/REST/V1/Patrons.pm | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > >diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm >index 9d25ef7cba..24fba6d65e 100644 >--- a/Koha/REST/V1/Patrons.pm >+++ b/Koha/REST/V1/Patrons.pm >@@ -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} ) ) >@@ -144,8 +147,6 @@ sub add { > } > } > >- $patron->extended_attributes( >- [ map { { code => $_->{type}, attribute => $_->{value} } } @$extended_attributes ] ); > if ( C4::Context->preference('EnhancedMessagingPreferences') ) { > C4::Members::Messaging::SetMessagingPreferencesFromDefaults( > { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40219
: 183421