my $auto_overlay_exact = $$args{auto_overlay_exact};
my $auto_overlay_1match = $$args{auto_overlay_1match};
+ my $auto_overlay_best = $$args{auto_overlay_best_match};
+ my $match_quality_ratio = $$args{match_quality_ratio};
my $merge_profile = $$args{merge_profile};
my $bib_source = $$args{bib_source};
+ my $import_no_match = $$args{import_no_match};
my $overlay_func = 'vandelay.overlay_bib_record';
my $auto_overlay_func = 'vandelay.auto_overlay_bib_record';
+ my $auto_overlay_best_func = 'vandelay.auto_overlay_bib_record_with_best'; # XXX bib-only
my $retrieve_func = 'retrieve_vandelay_queued_bib_record';
my $update_func = 'update_vandelay_queued_bib_record';
my $search_func = 'search_vandelay_queued_bib_record';
}
}
- if(!$imported and !$error) {
+ if(!$imported and !$error and $auto_overlay_best and scalar(@{$rec->matches}) > 0 ) {
+
+ # caller says to overlay the best match
+
+ my $res = $e->json_query(
+ {
+ from => [
+ $auto_overlay_best_func,
+ $rec->id,
+ $merge_profile,
+ $match_quality_ratio
+ ]
+ }
+ );
+
+ if($res and ($res = $res->[0])) {
+
+ if($res->{$auto_overlay_best_func} eq 't') {
+ $logger->info("vl: $type auto-overlay-best succeeded for queued rec " . $rec->id);
+ $imported = 1;
+ } else {
+ $report_args{import_error} = 'overlay.record.quality' if $match_quality_ratio > 0;
+ $logger->info("vl: $type auto-overlay-best failed for queued rec " . $rec->id);
+ }
+
+ } else {
+ $error = 1;
+ $logger->error("vl: Error attempting overlay with func=$auto_overlay_best_func, ".
+ "quality_ratio=$match_quality_ratio, profile=$merge_profile, record=$rec_id");
+ }
+ }
+
+ if(!$imported and !$error and $import_no_match and scalar(@{$rec->matches}) == 0) {
# No overlay / merge occurred. Do a traditional record import by creating a new record
INSERT INTO vandelay.import_error ( code, description ) VALUES ( 'import.auth.duplicate.acn', oils_i18n_gettext('import.auth.duplicate.acn', 'Import failed due to Accession Number collision', 'vie', 'description') );
INSERT INTO vandelay.import_error ( code, description ) VALUES ( 'import.xml.malformed', oils_i18n_gettext('import.xml.malformed', 'Malformed record cause Import failure', 'vie', 'description') );
INSERT INTO vandelay.import_error ( code, description ) VALUES ( 'overlay.xml.malformed', oils_i18n_gettext('overlay.xml.malformed', 'Malformed record cause Overlay failure', 'vie', 'description') );
+INSERT INTO vandelay.import_error ( code, description ) VALUES ( 'overlay.record.quality', oils_i18n_gettext('overlay.record.quality', 'New record had insufficient quality', 'vie', 'description') );
INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES (
'ui.cat.volume_copy_editor.horizontal',
queueItemsImportDialog.hide();
// hack to set the widgets the import funcs will be looking at. Reset them below.
- vlUploadQueueAutoImport.attr('value', vlUploadQueueAutoImport2.attr('value'));
+ vlUploadQueueImportNoMatch.attr('value', vlUploadQueueImportNoMatch2.attr('value'));
vlUploadQueueAutoOverlayExact.attr('value', vlUploadQueueAutoOverlayExact2.attr('value'));
vlUploadQueueAutoOverlay1Match.attr('value', vlUploadQueueAutoOverlay1Match2.attr('value'));
vlUploadMergeProfile.attr('value', vlUploadMergeProfile2.attr('value'));
}
// reset the widgets to prevent accidental future actions
- vlUploadQueueAutoImport.attr('value', false);
- vlUploadQueueAutoImport2.attr('value', false);
+ vlUploadQueueImportNoMatch.attr('value', false);
+ vlUploadQueueImportNoMatch2.attr('value', false);
vlUploadQueueAutoOverlayExact.attr('value', false);
vlUploadQueueAutoOverlayExact2.attr('value', false);
vlUploadQueueAutoOverlay1Match.attr('value', false);
function(){displayGlobalDiv('vl-queue-div');});
}
-function vlImportRecordQueue(type, queueId, noMatchOnly, onload) {
+function vlImportRecordQueue(type, queueId, onload) {
displayGlobalDiv('vl-generic-progress-with-total');
var method = 'open-ils.vandelay.bib_queue.import';
- if(noMatchOnly)
- method = method.replace('import', 'nomatch.import');
if(type == 'auth')
method = method.replace('bib', 'auth');
+
+ var mergeOpt = false;
var options = {};
+
+ if(vlUploadQueueImportNoMatch.checked) {
+ options.import_no_match = true;
+ vlUploadQueueImportNoMatch.checked = false;
+ }
+
if(vlUploadQueueAutoOverlayExact.checked) {
options.auto_overlay_exact = true;
vlUploadQueueAutoOverlayExact.checked = false;
+ mergeOpt = true;
+ }
+
+ if(vlUploadQueueAutoOverlayBestMatch.checked) {
+ options.auto_overlay_best_match = true;
+ vlUploadQueueAutoOverlayBestMatch.checked = false;
+ options.match_quality_ratio = vlUploadQueueAutoOverlayBestMatchRatio.attr('value');
+ mergeOpt = true;
}
if(vlUploadQueueAutoOverlay1Match.checked) {
options.auto_overlay_1match = true;
vlUploadQueueAutoOverlay1Match.checked = false;
+ mergeOpt = true;
+ }
+
+ if(!mergeOpt) {
+ // in the interest of speed, if no merge options are
+ // chosen, tell the back-end code to only process records
+ // that have no matches
+ method = method.replace('.import', 'nomatch.import');
}
var profile = vlUploadMergeProfile.attr('value');
currentType = dijit.byId('vl-record-type').getValue();
var handleProcessSpool = function() {
- if(vlUploadQueueAutoImport.checked || vlUploadQueueAutoOverlayExact.checked || vlUploadQueueAutoOverlay1Match.checked) {
- var noMatchOnly = !vlUploadQueueAutoOverlayExact.checked && !vlUploadQueueAutoOverlay1Match.checked;
- vlImportRecordQueue(
- currentType,
- currentQueueId,
- noMatchOnly,
- function() {
- retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
- }
- );
+ if(
+ vlUploadQueueImportNoMatch.checked ||
+ vlUploadQueueAutoOverlayExact.checked ||
+ vlUploadQueueAutoOverlay1Match.checked ||
+ vlUploadQueueAutoOverlayBestMatch.checked ) {
+
+ vlImportRecordQueue(
+ currentType,
+ currentQueueId,
+ function() {
+ retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+ }
+ );
} else {
retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
}
<!ENTITY vandelay.auto.import.auto_overlay_1match "Merge/Overlay Single Matches">
<!ENTITY vandelay.auto.import.auto_overlay_best "Merge/Overlay Best Match">
<!ENTITY vandelay.auto.import.auto_overlay_best_ratio "Best Match Minimum Quality Ratio">
+<!ENTITY vandelay.auto.import.auto_overlay_best_ratio.desc "New Record Quaility / Quality of Best Match">
<!ENTITY vandelay.auto.import.merge_profile "Merge/Overlay Profile">
<!ENTITY vandelay.auto.width "Auto Width">
<!ENTITY vandelay.back.to.import.queue "Back To Import Queue">
formatter : vlFormatViewMatchMARC
},
{name: 'Match Score', field:'match_score'},
- {name: 'Match Quality', field:'match_quality'},
+ {name: 'Matched Record Quality', field:'match_quality'},
{name: '&vandelay.creator;', get: vlGetCreator},
{name: '&vandelay.create.date;', field:'create_date', get: vlGetDateTimeField},
{name: '&vandelay.last.edit.date;', field:'edit_date', get: vlGetDateTimeField},
<tr>
<td>&vandelay.auto.import.noncolliding;</td>
<td colspan='4'>
- <input jsId='vlUploadQueueAutoImport' dojoType='dijit.form.CheckBox'/>
+ <input jsId='vlUploadQueueImportNoMatch' dojoType='dijit.form.CheckBox'/>
</td>
</tr>
<tr>
</tr>
<tr>
<td>&vandelay.auto.import.auto_overlay_best_ratio;</td>
- <td colspan='4'><input style='width:3em' value='0.0' jsId='vlUploadQueueAutoOverlayBestMatchRatio' dojoType='dijit.form.TextBox'/></td>
+ <td colspan='4'>
+ <input style='width:3em' value='0.0' jsId='vlUploadQueueAutoOverlayBestMatchRatio' dojoType='dijit.form.TextBox'/>
+ <span style='padding-left: 10px; font-size:90%'>(&vandelay.auto.import.auto_overlay_best_ratio.desc;)</span>
+ </td>
</tr>
<tr><td colspan='2' style='border-bottom:1px solid #888'></td></tr>