From 3efc30c379f04f292b25cd0e2fa672b270b71414 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 21 Feb 2011 13:59:48 +0100 Subject: [PATCH] Bug 5782: Add warning when ordering a duplicate record from external source Content-Type: text/plain; charset="utf-8" Enhancement for Acquisitions/ordering from external source. Koha already checked for duplicates, but this patch warns the user. Offers the choice to use existing record, use new record or return without making an order. The new template is added for this interaction with the user. --- acqui/neworderempty.pl | 33 ++++++++++++++- .../en/modules/acqui/neworderempty_duplicate.tmpl | 43 ++++++++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tmpl diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 84fc81e..6af057d 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -134,7 +134,14 @@ if ( $ordernumber eq '' and defined $params->{'breedingid'}){ my $duplicatetitle; #look for duplicates - if (! (($biblionumber,$duplicatetitle) = FindDuplicate($marcrecord))){ + ($biblionumber,$duplicatetitle) = FindDuplicate($marcrecord); + if($biblionumber && !$input->param('use_external_source')) { + #if duplicate record found and user did not decide yet, first warn user + #and let him choose between using new record or existing record + Load_Duplicate($duplicatetitle); + exit; + } + #from this point: add a new record if (C4::Context->preference("BiblioAddsAuthorities")){ my ($countlinked,$countcreated)=BiblioAddAuthorities($marcrecord, $params->{'frameworkcode'}); } @@ -163,7 +170,6 @@ if ( $ordernumber eq '' and defined $params->{'breedingid'}){ } } SetImportRecordStatus($params->{'breedingid'}, 'imported'); - } } @@ -471,3 +477,26 @@ sub MARCfindbreeding { return -1; } +sub Load_Duplicate { + my ($duplicatetitle)= @_; + ($template, $loggedinuser, $cookie) = get_template_and_user( + { + template_name => "acqui/neworderempty_duplicate.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { acquisition => 'order_manage' }, +# debug => 1, + } + ); + + $template->param( + biblionumber => $biblionumber, + basketno => $basketno, + booksellerid => $basket->{'booksellerid'}, + breedingid => $params->{'breedingid'}, + duplicatetitle => $duplicatetitle, + ); + + output_html_with_http_headers $input, $cookie, $template->output; +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tmpl new file mode 100644 index 0000000..c85f40f --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty_duplicate.tmpl @@ -0,0 +1,43 @@ + +Koha › Acquisitions › Basket <!-- TMPL_VAR NAME="basketno" --> › Duplicate warning + + + + + + + + + + + + + +
+ +
+
+
+ +

Duplicate warning

+ +

You selected a record from an external source that matches an existing record in your catalog!

+

Click Use Existing if you do not want to create a duplicate record, but you want to add an order from the existing record in your catalog. Click Create New if you still want to create a new record by importing the external (duplicate) record. Click Cancel to return to the basket without making a new order.

+

The existing catalog record can be viewed in a new window by clicking "> + +

+
+ &basketno=&biblionumber='" /> + &basketno=&breedingid=&use_external_source=1'" /> + '" /> +
+
+ +
+
+
+ +
+
+ -- 1.6.0.6