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'});
}
}
}
SetImportRecordStatus($params->{'breedingid'}, 'imported');
- }
}
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;
+}
--- /dev/null
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<title>Koha › Acquisitions › Basket <!-- TMPL_VAR NAME="basketno" --> › Duplicate warning</title>
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+
+<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
+<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/additem.js"></script>
+<script type="text/javascript">
+</script>
+</head>
+<body>
+
+<!-- TMPL_INCLUDE NAME="header.inc" -->
+<!-- TMPL_INCLUDE NAME="acquisitions-search.inc" -->
+
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR NAME="basketno" -->">Basket <!-- TMPL_VAR NAME="basketno" --></a> › Duplicate warning</div>
+
+<div id="doc3" class="yui-t2">
+
+<div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
+
+<h2>Duplicate warning</h2>
+
+<p>You selected a record from an external source that matches an existing record in your catalog!</p>
+<p>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.</p>
+<p>The existing catalog record can be viewed in a new window by clicking <a target="_blank" href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="duplicatetitle" --></a>
+
+<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform">
+ <fieldset class="action">
+ <input type="button" value="Use Existing" onclick="window.location='/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->&basketno=<!-- TMPL_VAR NAME="basketno" -->&biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->'" />
+ <input type="button" value="Create New" onclick="window.location='/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->&basketno=<!-- TMPL_VAR NAME="basketno" -->&breedingid=<!-- TMPL_VAR NAME="breedingid" -->&use_external_source=1'" />
+ <input type="button" value="Cancel" onclick="window.location='/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR NAME="basketno" -->'" />
+ </fieldset>
+</form>
+
+</div>
+</div>
+<div class="yui-b">
+<!-- TMPL_INCLUDE NAME="acquisitions-menu.inc" -->
+</div>
+</div>
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->