From 06e4d3370068002a303c9a5a03448ee0e1249fc0 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Fri, 29 Jul 2011 18:09:19 -0400 Subject: [PATCH] Vandelay fix for merging without loading new This fix is derivative of da3a453442050482a419deff91d3dc92fdbf132a in master, but with new feature code removed for backport to 2.1 and 2.0. It does the following: - renames 'vlUploadQueueAutoImport' to 'vlUploadQueueImportNoMatch' to match identical change in master and to increase code clarity - honors this flag when doing a merge. Previously, if you checked one of the two auto-merge boxes, any records which did not merge loaded as new records even if the 'Auto-Import Non-Colliding Records' box was not checked. You can now do one, the other, or both together (auto-importing and merging) as needed. Signed-off-by: Dan Wells Signed-off-by: Mike Rylander --- .../perlmods/lib/OpenILS/Application/Vandelay.pm | 3 +- Open-ILS/web/js/ui/default/vandelay/vandelay.js | 49 +++++++++++++++------- .../web/templates/default/vandelay/inc/queue.tt2 | 2 +- .../web/templates/default/vandelay/inc/upload.tt2 | 2 +- 4 files changed, 37 insertions(+), 19 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm index 5c48282809..d1770225c2 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm @@ -622,6 +622,7 @@ sub import_record_list_impl { my $merge_profile = $$args{merge_profile}; my $bib_source = $$args{bib_source}; my $report_all = $$args{report_all}; + my $import_no_match = $$args{import_no_match}; my $overlay_func = 'vandelay.overlay_bib_record'; my $auto_overlay_func = 'vandelay.auto_overlay_bib_record'; @@ -771,7 +772,7 @@ sub import_record_list_impl { } } - if(!$imported and !$error) { + if(!$imported and !$error and $import_no_match and scalar(@{$rec->matches}) == 0) { # match count test should not be necessary, but is a good fail-safe # No overlay / merge occurred. Do a traditional record import by creating a new record diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index a54005f058..1ae7400d0b 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -821,7 +821,7 @@ function vlHandleQueueItemsAction(action) { 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')); @@ -833,8 +833,8 @@ function vlHandleQueueItemsAction(action) { } // 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); @@ -901,23 +901,38 @@ function vlImportAllRecords() { 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(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'); @@ -949,16 +964,18 @@ function batchUpload() { 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) { + + vlImportRecordQueue( + currentType, + currentQueueId, + function() { + retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords); + } + ); } else { retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords); } diff --git a/Open-ILS/web/templates/default/vandelay/inc/queue.tt2 b/Open-ILS/web/templates/default/vandelay/inc/queue.tt2 index e7d6eaf607..6d231f221e 100644 --- a/Open-ILS/web/templates/default/vandelay/inc/queue.tt2 +++ b/Open-ILS/web/templates/default/vandelay/inc/queue.tt2 @@ -21,7 +21,7 @@ &vandelay.auto.import.noncolliding; - + diff --git a/Open-ILS/web/templates/default/vandelay/inc/upload.tt2 b/Open-ILS/web/templates/default/vandelay/inc/upload.tt2 index aca632016e..43e74830a9 100644 --- a/Open-ILS/web/templates/default/vandelay/inc/upload.tt2 +++ b/Open-ILS/web/templates/default/vandelay/inc/upload.tt2 @@ -26,7 +26,7 @@ &vandelay.auto.import.noncolliding; - + -- 2.11.0