[open-ils-commits] [GIT] Evergreen ILS branch master updated. d6e6519437daaa95de8a15a5b3d7e0dee2412126

Evergreen Git git at git.evergreen-ils.org
Sun Dec 17 22:08:42 EST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  d6e6519437daaa95de8a15a5b3d7e0dee2412126 (commit)
      from  1e111dede283983bed2f031cb9ed86db0d2e100e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d6e6519437daaa95de8a15a5b3d7e0dee2412126
Author: blake <blake at mobiusconsortium.org>
Date:   Thu Nov 9 15:35:07 2017 +0000

    lp#1724321 Web Client -- existence of record with duplicate TCN does not prevent import
    
    This routes the MARC import execution back to the z39.50 code instead of using the generic
    MARC editor. This will make use of open-ils.cat.biblio.record.xml.import instead of pcrud.
    
    Test
    1. Edit global flag variable "Cat: Use Internal ID for TCN Value" = false
    2. Perform a z39.50 search, click a result and click "import"
    3. Step two should be successful, now import it again and you should get an error
    4. Click the same result but use "Edit then import"
    5. From the MARC editor, make no changes and click "Import"
    6. It won't complain about duplicate TCNs
    7. Apply the patch
    8. Perform steps 4 and 5
    9. Notice that the editor does not allow you to import the record
    
    Signed-off-by: blake <blake at mobiusconsortium.org>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>
    Signed-off-by: Jason Etheridge <jason at EquinoxInitiative.org>

diff --git a/Open-ILS/src/templates/staff/cat/z3950/t_marc_edit.tt2 b/Open-ILS/src/templates/staff/cat/z3950/t_marc_edit.tt2
index 8e55ebf..bcbe41f 100644
--- a/Open-ILS/src/templates/staff/cat/z3950/t_marc_edit.tt2
+++ b/Open-ILS/src/templates/staff/cat/z3950/t_marc_edit.tt2
@@ -7,7 +7,7 @@
   <div class="modal-body">
     <eg-marc-edit-record dirty-flag="dirty_flag" record-id="record_id" marc-xml="marc_xml"
                          record-type="bre" save-label="{{save_label}}"
-                         on-save="import_record_callback" fast-add="true"
+                         on-save="import_record_callback" fast-add="true" in-place-mode="in_place_mode"
     />
   </div>
   <div class="modal-footer">
diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js
index d525a90..bce2ba7 100644
--- a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js
+++ b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js
@@ -624,7 +624,14 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
             // in-place mode means that the editor is being
             // used just to munge some MARCXML client-side, rather
             // than to (immediately) update the database
-            inPlaceMode : '@',
+            //
+            // In short, we can use inPlaceMode as a way to skip
+            // "normal" bre saving and then process the MARC ourselves
+            // via a callback
+            //
+            // inPlaceMode is r/w to allow our Z39.50 import editor to be
+            // switched back into a normal editor after the initial import
+            inPlaceMode : '=',
             fastAdd : '@',
             flatOnly : '@',
             embedded : '@',
diff --git a/Open-ILS/web/js/ui/default/staff/cat/z3950/app.js b/Open-ILS/web/js/ui/default/staff/cat/z3950/app.js
index 09bf70f..83be9ce 100644
--- a/Open-ILS/web/js/ui/default/staff/cat/z3950/app.js
+++ b/Open-ILS/web/js/ui/default/staff/cat/z3950/app.js
@@ -212,20 +212,25 @@ function($scope , $q , $location , $timeout , $window,  egCore , egGridDataProvi
         });
         return groups;
     };
+
     $scope.import = function() {
-        var deferred = $q.defer();
         var items = $scope.gridControls.selectedItems();
+        return $scope._import(items[0]['marcxml']);
+    };
+
+    $scope._import = function(marc_xml) {
+        var deferred = $q.defer();
         egCore.net.request(
             'open-ils.cat',
             'open-ils.cat.biblio.record.xml.import',
             egCore.auth.token(),
-            items[0]['marcxml'],
+            marc_xml,
             null, // FIXME bib source
             null,
             null,
             $scope.selectFieldStripGroups()
         ).then(
-            function() { deferred.resolve() },
+            function(result) { deferred.resolve(result) },
             null, // onerror
             function(result) {
                 var evt = egCore.evt.parse(result);
@@ -265,6 +270,7 @@ function($scope , $q , $location , $timeout , $window,  egCore , egGridDataProvi
     $scope.spawn_editor = function() {
         var items = $scope.gridControls.selectedItems();
         var recId = 0;
+        var _import = $scope._import;
         $uibModal.open({
             templateUrl: './cat/z3950/t_marc_edit',
             backdrop: 'static',
@@ -278,9 +284,23 @@ function($scope , $q , $location , $timeout , $window,  egCore , egGridDataProvi
                 $scope.ok = function(args) { $uibModalInstance.close(args) }
                 $scope.cancel = function () { $uibModalInstance.dismiss() }
                 $scope.save_label = egCore.strings.IMPORT_BUTTON_LABEL;
-                $scope.import_record_callback = function (record_id) {
-                    recId = record_id;
-                    $scope.save_label = egCore.strings.SAVE_BUTTON_LABEL;
+                // Wiring up angular inPlaceMode for editing later
+                $scope.in_place_mode = true;
+                $scope.import_record_callback = function () {
+                    if($scope.in_place_mode) {
+                        // This timeout is required to allow angular to finish variable assignments
+                        // in the marcediter app. Allowing marc_xml to propigate here.
+                        $timeout( function() {
+                            _import($scope.marc_xml).then( function(record_obj) {
+                                if( record_obj.id ) {
+                                    $scope.record_id = record_obj.id();
+                                    $scope.save_label = egCore.strings.SAVE_BUTTON_LABEL;
+                                    // Successful import, no longer want this special z39.50 callback to execute.
+                                    $scope.in_place_mode = undefined;
+                                }
+                            });
+                        });
+                    }
                 };
             }]
         }).result.then(function () {

-----------------------------------------------------------------------

Summary of changes:
 .../src/templates/staff/cat/z3950/t_marc_edit.tt2  |    2 +-
 .../js/ui/default/staff/cat/services/marcedit.js   |    9 +++++-
 Open-ILS/web/js/ui/default/staff/cat/z3950/app.js  |   32 ++++++++++++++++----
 3 files changed, 35 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list