Bugzilla – Attachment 187267 Details for
Bug 7132
Check for duplicates when creating a new record in acquisitions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7132: Acq: Check for duplicates when ordering from empty record
Bug-7132-Acq-Check-for-duplicates-when-ordering-fr.patch (text/plain), 8.31 KB, created by
Julian Maurice
on 2025-10-02 12:34:54 UTC
(
hide
)
Description:
Bug 7132: Acq: Check for duplicates when ordering from empty record
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2025-10-02 12:34:54 UTC
Size:
8.31 KB
patch
obsolete
>From aefead3b95b2ba269ed51e87f8d578d4cbe30c3a Mon Sep 17 00:00:00 2001 >From: Laura_Escamilla <laura.escamilla@bywatersolutions.com> >Date: Mon, 29 Sep 2025 16:43:05 +0000 >Subject: [PATCH] Bug 7132: Acq: Check for duplicates when ordering from empty > record >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To test using a new empty record: > >1. Ensure you have a vendor and a new basket available for ordering. > Click on â+Add to basketâ and select âFrom a new (empty) recordâ >2. Choose an existing record to test with for example âCSS : the > definitive guideâ > (http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=12&searchid=scs_1759160315801) >3. Copy over the main details from the existing record in order to fill > out the required details of the new order. I.e Title, and Koha item > type. Click add item and then select a fund. Itâs not necessary to > fill anything else out. >4. Click save and notice that the duplicate record is not found. >5. Apply the patch and restart_all. Clear cache in your browser if > necessary. >6. Repeat steps 2 - 4. This time a duplicate warning will appear. Ensure > that all options of the duplicate warning work as expected. >7. Sign off and have a great day! > >Signed-off-by: Kim Gnerre <kgnerre@hotchkiss.org> >Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> >--- > acqui/addorder.pl | 38 +++++++++++++++ > .../modules/acqui/neworderempty_duplicate.tt | 48 +++++++++++++------ > 2 files changed, 72 insertions(+), 14 deletions(-) > >diff --git a/acqui/addorder.pl b/acqui/addorder.pl >index d8aa9e781fe..9d04c065649 100755 >--- a/acqui/addorder.pl >+++ b/acqui/addorder.pl >@@ -128,6 +128,7 @@ use C4::Budgets qw( GetBudget GetBudgetSpent GetBudgetOrdered FieldsForCalcu > use C4::Items qw( AddItemFromMarc ); > use C4::Log qw( logaction ); > use C4::Output qw( output_html_with_http_headers ); >+use C4::Search qw( FindDuplicate ); > use C4::Suggestions qw( ModSuggestion ); > use Koha::Acquisition::Baskets; > use Koha::Acquisition::Currencies qw( get_active ); >@@ -147,6 +148,8 @@ my $op = $input->param('op') // q{}; > if ( $op eq 'cud-order' ) { > my $use_ACQ_framework = $input->param('use_ACQ_framework'); > >+ my $confirm_not_duplicate = $input->param('confirm_not_duplicate') || 0; >+ > # Check if order total amount exceed allowed budget > my $confirm_budget_exceeding = $input->param('confirm_budget_exceeding'); > unless ($confirm_budget_exceeding) { >@@ -328,6 +331,41 @@ if ( $op eq 'cud-order' ) { > } > C4::Acquisition::FillWithDefaultValues($record); > >+ if ( !$confirm_not_duplicate ) { >+ my ( $dupe_biblionumber, $dupe_title ) = FindDuplicate($record); >+ >+ if ($dupe_biblionumber) { >+ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "acqui/neworderempty_duplicate.tt", >+ query => $input, >+ type => "intranet", >+ flagsrequired => { acquisition => 'order_manage' }, >+ } >+ ); >+ >+ my $vars = $input->Vars; >+ my @vars_loop; >+ foreach ( keys %$vars ) { >+ push @vars_loop, { name => $_, values => [ $input->multi_param($_) ] }; >+ } >+ >+ my $booksellerid = $input->param('booksellerid') // ''; >+ my $basketno = $input->param('basketno') // ''; >+ >+ $template->param( >+ biblionumber => $dupe_biblionumber, >+ duplicatetitle => $dupe_title, >+ booksellerid => $booksellerid, >+ basketno => $basketno, >+ vars_loop => \@vars_loop, >+ ); >+ >+ output_html_with_http_headers $input, $cookie, $template->output; >+ exit; >+ } >+ } >+ > # create the record in catalogue, with framework '' > my ( $biblionumber, $bibitemnum ) = AddBiblio( $record, '' ); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tt >index 78cb23489db..744a921957c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tt >@@ -33,10 +33,12 @@ > [% WRAPPER 'main-container.inc' aside='acquisitions-menu' %] > <div class="alert alert-warning"> > <h1>Duplicate warning</h1> >- <p >- >You selected a record from an external source that matches an existing record in your catalog: >- <a target="_blank" title="Open in new window" href="[% PROCESS biblio_a_href biblionumber => biblionumber %]"><i class="fa-solid fa-window-restore"></i> [% duplicatetitle | html %]</a></p >- > >+ [% IF breedingid %] >+ <p>You selected a record from an external source that matches an existing record in your catalog:</p> >+ [% ELSE %] >+ <p>The details you entered match an existing record in your catalog:</p> >+ [% END %] >+ <a target="_blank" title="Open in new window" href="[% PROCESS biblio_a_href biblionumber => biblionumber %]"><i class="fa-solid fa-window-restore"></i> [% duplicatetitle | html %]</a> > </div> > > <div class="row"> >@@ -66,16 +68,34 @@ > > <div class="col-sm-4"> > <div style="border: 1px solid #DDD; padding:1em;"> >- <form method="post" action="/cgi-bin/koha/acqui/neworderempty.pl"> >- [% INCLUDE 'csrf-token.inc' %] >- <h4>Create new record</h4> >- <p>Create a new record by importing the external (duplicate) record.</p> >- <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" /> >- <input type="hidden" name="basketno" value="[% basketno | html %]" /> >- <input type="hidden" name="breedingid" value="[% breedingid | html %]" /> >- <input type="hidden" name="op" value="cud-use_external_source" /> >- <input type="submit" class="btn btn-primary" value="Create new" /> >- </form> >+ [% IF breedingid %] >+ <form method="post" action="/cgi-bin/koha/acqui/neworderempty.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <h4>Create new record</h4> >+ <p>Create a new record by importing the external (duplicate) record.</p> >+ <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" /> >+ <input type="hidden" name="basketno" value="[% basketno | html %]" /> >+ <input type="hidden" name="breedingid" value="[% breedingid | html %]" /> >+ <input type="hidden" name="op" value="cud-use_external_source" /> >+ <input type="submit" class="btn btn-primary" value="Create new" /> >+ </form> >+ [% ELSE %] >+ <form method="post" action="/cgi-bin/koha/acqui/addorder.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <h4>Create new record</h4> >+ <p>Create a new record with the details you entered.</p> >+ <input type="hidden" name="op" value="cud-order" /> >+ <input type="hidden" name="confirm_not_duplicate" value="1" /> >+ [% FOREACH var IN vars_loop %] >+ [% FOREACH val IN var.values %] >+ [% IF var.name != 'confirm_not_duplicate' %] >+ <input type="hidden" name="[% var.name | html %]" value="[% val | html %]" /> >+ [% END %] >+ [% END %] >+ [% END %] >+ <button type="submit" class="btn btn-primary">Create new</button> >+ </form> >+ [% END %] > </div> > </div> > </div> >-- >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 7132
:
187062
|
187103
| 187267