From a2b8f7b5d0d2c14b36ab3c4da6d6af1445da9bee Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 14 Mar 2019 12:03:58 -0400 Subject: [PATCH] LP1776736 Record merge marc edit repairs 1. Fixes issues where edits to MARC records would fail to save during merge. 2. Provide options to select flat or non-flat text editor in edit mode for record merges. 3. Allow record editor action buttons/selectors to flow down horizontally when they don't fit in a narrow space. Signed-off-by: Bill Erickson Signed-off-by: Dan Wells --- .../cat/bucket/record/t_merge_records.tt2 | 3 +- .../templates/staff/cat/share/t_marcedit.tt2 | 14 +++---- Open-ILS/src/templates/staff/css/cat.css.tt2 | 1 + .../ui/default/staff/cat/bucket/record/app.js | 42 ++++++++++++------- .../ui/default/staff/cat/services/marcedit.js | 2 +- 5 files changed, 37 insertions(+), 25 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/bucket/record/t_merge_records.tt2 b/Open-ILS/src/templates/staff/cat/bucket/record/t_merge_records.tt2 index 1a5ee26272..cdfed1973c 100644 --- a/Open-ILS/src/templates/staff/cat/bucket/record/t_merge_records.tt2 +++ b/Open-ILS/src/templates/staff/cat/bucket/record/t_merge_records.tt2 @@ -42,8 +42,7 @@ -
-
+
+
-
+
-
-
+
+
[% l('Record Type') %] {{calculated_record_type}}
-
+
-
+
diff --git a/Open-ILS/src/templates/staff/css/cat.css.tt2 b/Open-ILS/src/templates/staff/css/cat.css.tt2 index cbbdfbaadf..4a05b28002 100644 --- a/Open-ILS/src/templates/staff/css/cat.css.tt2 +++ b/Open-ILS/src/templates/staff/css/cat.css.tt2 @@ -18,6 +18,7 @@ .marcfastitemadd, .marctypesource { border-bottom: solid thin gray; + flex-wrap: wrap; } .marcedit { diff --git a/Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js b/Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js index 769f9f8bbb..a9fa25e132 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js @@ -557,6 +557,25 @@ function($scope, $q , $routeParams, bucketSvc, egCore, $window, egHolds.transfer_all_bib_holds_to_marked_title(bib_ids); } + // Refresh and update a single bib record. + // Returns a promise. + function updateOneRecord(recId, marcXml) { + + return egCore.net.request( + 'open-ils.cat', + 'open-ils.cat.biblio.record.xml.update', + egCore.auth.token(), recId, marcXml + ).then(function(result) { + var evt = egCore.evt.parse(result); + if (evt) { + alert(evt); + return $q.reject(evt); + } else { + return result; // bib record + } + }); + } + // opens the record merge dialog $scope.openRecordMergeDialog = function(records) { $uibModal.open({ @@ -642,19 +661,15 @@ function($scope, $q , $routeParams, bucketSvc, egCore, $window, } $scope.post_edit_inplace = function() { $scope.editing_inplace = false; + updateOneRecord($scope.lead_id, $scope.lead.marc_xml); } + $scope.edit_lead_inplace = function() { $scope.editing_inplace = true; } $scope.edit_lead = function() { var lead = { marc_xml : $scope.lead.marc_xml }; - - // passing the on-save callback this way is a - // hack - this invocation of the MARC editor doesn't - // need it, but for some reason using this stomps - // over the callback set by the other MARC editor - // instance - var callback = $scope.post_edit_inplace; + var parentScope = $scope; $uibModal.open({ templateUrl: './cat/bucket/record/t_edit_lead_record', @@ -667,7 +682,10 @@ function($scope, $q , $routeParams, bucketSvc, egCore, $window, $scope.dirty_flag = false; $scope.ok = function() { $uibModalInstance.close() } $scope.cancel = function () { $uibModalInstance.dismiss() } - $scope.on_save = callback; + $scope.on_save = function() { + parentScope.lead.marc_xml = $scope.lead.marc_xml; + parentScope.post_edit_inplace(); + } }] }).result.then(function() { $scope.lead.marc_xml = lead.marc_xml; @@ -680,13 +698,7 @@ function($scope, $q , $routeParams, bucketSvc, egCore, $window, function update_bib() { if (args.merge_profile) { - return egCore.pcrud.retrieve('bre', args.lead_id) - .then(function(rec) { - rec.marc(args.lead.marc_xml); - rec.edit_date('now'); - rec.editor(egCore.auth.user().id()); - return egCore.pcrud.update(rec); - }); + return updateOneRecord(args.lead_id, args.lead.marc_xml); } else { return $q.when(); } 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 d288669533..4d2f9c97a5 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 @@ -709,7 +709,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) $scope.enable_fast_add = false; $scope.fast_item_callnumber = ''; $scope.fast_item_barcode = ''; - + $scope.flatEditor = { isEnabled : $scope.flatOnly ? true : false }; egCore.hatch.getItem('cat.marcedit.flateditor').then(function(val) { -- 2.43.2