Bugzilla – Attachment 182995 Details for
Bug 40082
PatronDuplicateMatchingAddFields isn't respected in the OPAC or the API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40082: Use the new duplicate checking method in the API
Bug-40082-Use-the-new-duplicate-checking-method-in.patch (text/plain), 1.87 KB, created by
Matt Blenkinsop
on 2025-06-05 12:52:37 UTC
(
hide
)
Description:
Bug 40082: Use the new duplicate checking method in the API
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2025-06-05 12:52:37 UTC
Size:
1.87 KB
patch
obsolete
>From 30cf5393ff845787bcaa6bb54ee9b724aa71a50e Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Date: Thu, 5 Jun 2025 13:39:49 +0100 >Subject: [PATCH] Bug 40082: Use the new duplicate checking method in the API > >--- > Koha/REST/V1/Patrons.pm | 12 ++++++++++++ > api/v1/swagger/paths/patrons.yaml | 1 + > 2 files changed, 13 insertions(+) > >diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm >index 9d25ef7cba5..6e86c4634a8 100644 >--- a/Koha/REST/V1/Patrons.pm >+++ b/Koha/REST/V1/Patrons.pm >@@ -108,6 +108,18 @@ sub add { > > my $extended_attributes = delete $body->{extended_attributes} // []; > >+ my $confirm_not_duplicate = $c->req->headers->header('x-confirm-not-duplicate'); >+ if ( !$confirm_not_duplicate ) { >+ my $match_result = >+ Koha::Patrons->check_for_existing_matches( Koha::Patron->new_from_api($body)->unblessed ); >+ if ( $match_result->{duplicate_found} ) { >+ return $c->render( >+ status => 409, >+ openapi => { error => 'A patron record matching these details already exists' } >+ ); >+ } >+ } >+ > my $patron = Koha::Patron->new_from_api($body)->store; > > my $overrides = $c->stash('koha.overrides'); >diff --git a/api/v1/swagger/paths/patrons.yaml b/api/v1/swagger/paths/patrons.yaml >index a7df190ba3e..6dcd8e71979 100644 >--- a/api/v1/swagger/paths/patrons.yaml >+++ b/api/v1/swagger/paths/patrons.yaml >@@ -413,6 +413,7 @@ > - patrons > summary: Add patron > parameters: >+ - $ref: "../swagger.yaml#/parameters/confirm_not_duplicate_header" > - name: body > in: body > description: A JSON object containing information about the new patron >-- >2.48.1
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 40082
:
182990
|
182991
|
182992
|
182993
|
182994
| 182995 |
182996
|
182997