From: Mike Rylander Date: Mon, 20 Apr 2015 17:46:52 +0000 (-0400) Subject: webstaff: Add "delete" and "undelete" actions to the MARC editor X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0b1cb633752637356441d7694b18ad088164446e;p=working%2FEvergreen.git webstaff: Add "delete" and "undelete" actions to the MARC editor Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 b/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 index 1e1374ea3c..6ca56dee35 100644 --- a/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 +++ b/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 @@ -128,4 +128,6 @@ + + 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 d3029e3d10..24b401f5af 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 @@ -808,7 +808,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) ).then(function(rec) { $scope.in_redo = true; $scope[$scope.record_type] = rec; - $scope.record = new MARC21.Record({ marcxml : $scope[$scope.record_type].marc() }); + $scope.record = new MARC21.Record({ marcxml : $scope.Record().marc() }); $scope.calculated_record_type = $scope.record.recordType(); $scope.controlfields = $scope.record.fields.filter(function(f){ return f.isControlfield() }); $scope.datafields = $scope.record.fields.filter(function(f){ return !f.isControlfield() }); @@ -816,7 +816,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) $scope.flat_text_marc = $scope.record.toBreaker(); if ($scope.record_type == 'bre') { - $scope.bib_source = $scope[$scope.record_type].source(); + $scope.bib_source = $scope.Record().source(); } }).then(function(){ @@ -901,11 +901,28 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) return true; }; + $scope.Record = function () { + return $scope[$scope.record_type]; + return $scope.saveRecord(); + }; + + $scope.deleteRecord = function () { + $scope.Record().deleted(true); + return $scope.saveRecord(); + }; + + $scope.undeleteRecord = function () { + $scope.Record().deleted(false); + return $scope.saveRecord(); + }; + $scope.saveRecord = function () { $scope.mangle_005(); - $scope[$scope.record_type].marc($scope.record.toXmlString()); + $scope.Record().editor(egCore.auth.user().id()); + $scope.Record().edit_date('now'); + $scope.Record().marc($scope.record.toXmlString()); return egCore.pcrud.update( - $scope[$scope.record_type] + $scope.Record() ).then(loadRecord); };