Bugzilla – Attachment 176837 Details for
Bug 38927
Unecessary call to FindDuplicate if x-confirm-not-duplicate is passed to POST /biblios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38927: Only call FindDuplicate if required
Bug-38927-Only-call-FindDuplicate-if-required.patch (text/plain), 2.04 KB, created by
Paul Derscheid
on 2025-01-20 17:49:51 UTC
(
hide
)
Description:
Bug 38927: Only call FindDuplicate if required
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2025-01-20 17:49:51 UTC
Size:
2.04 KB
patch
obsolete
>From 920cc99c0d976e42bd6b57d0cc66e6a06ab352c4 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 20 Jan 2025 10:27:33 -0300 >Subject: [PATCH] Bug 38927: Only call FindDuplicate if required > >This patch makes the code call `FindDuplicate` only if >`x-confirm-not-duplicate` is not passed. This makes sense, as having it >passed makes it override any duplicate found. > >This patch doesn't change any end user behavior, just makes the code >more efficient. > >To test: >1. Run: > $ ktd --shell > k$ prove t/db_dependent/api/v1/biblios.t >=> SUCCESS: Tests pass >2. Apply this patch >3. Repeat 1 >=> SUCCESS: Tests pass, no behavior change >4. Sign off :-D > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> >--- > Koha/REST/V1/Biblios.pm | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > >diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm >index 035d215c52..0b5db5dc9a 100644 >--- a/Koha/REST/V1/Biblios.pm >+++ b/Koha/REST/V1/Biblios.pm >@@ -691,17 +691,18 @@ sub add { > ); > } > >- my ( $duplicatebiblionumber, $duplicatetitle ); >- ( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($record); >- > my $confirm_not_duplicate = $headers->header('x-confirm-not-duplicate'); > >- return $c->render( >- status => 400, >- openapi => { >- error => "Duplicate biblio $duplicatebiblionumber", >- } >- ) unless !$duplicatebiblionumber || $confirm_not_duplicate; >+ if ( !$confirm_not_duplicate ) { >+ my ( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($record); >+ >+ return $c->render( >+ status => 400, >+ openapi => { >+ error => "Duplicate biblio $duplicatebiblionumber", >+ } >+ ) if $duplicatebiblionumber; >+ } > > my ( $biblio_id ) = AddBiblio( $record, $frameworkcode, { record_source_id => $record_source_id } ); > >-- >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 38927
:
176806
|
176825
| 176837