From: Jane Sandberg Date: Sun, 8 Mar 2020 14:58:09 +0000 (-0700) Subject: LP1845241: Use the correct API call to Undelete a bib record X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d7ed1d2cbd26ceb52957ec52e140b4663bb99260;p=working%2FEvergreen.git LP1845241: Use the correct API call to Undelete a bib record To test: 1) Open up a delete-ready bibliographic record in the Web client (no attached holdings, no located URI, no open orders attached, etc.) 2) Delete it. 3) Undelete it. Note that the "Undelete" button briefly turns into a "Delete" button before changing back to an "Undelete" button. Note that the bib record does not show up in search results within the Web client. 4) Apply this commit. 5) Now try undeleting the record again. Notice that the "Delete" button does not revert to an "Undelete" button. Note also that the record is once again showing up in search results (although you may have to be a bit creative using search terms, due to search results caching). Signed-off-by: Jane Sandberg Signed-off-by: blake Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/templates/staff/cat/share/marcedit_strings.tt2 b/Open-ILS/src/templates/staff/cat/share/marcedit_strings.tt2 index 295078c534..38d279237e 100644 --- a/Open-ILS/src/templates/staff/cat/share/marcedit_strings.tt2 +++ b/Open-ILS/src/templates/staff/cat/share/marcedit_strings.tt2 @@ -12,10 +12,12 @@ angular.module('egCoreMod').run(['egStrings', function(s) { s.CONFIRM_DELETE_BRE_MSG = "[% l('Are you sure you want to delete title record [_1] from the catalog?', '{{id}}') %]"; s.CONFIRM_DELETE_ARE_MSG = "[% l('Are you sure you want to delete authority record [_1] from the catalog?', '{{id}}') %]"; s.ALERT_DELETE_FAILED = "[% l('Could not delete record [_1]: [_2]', '{{id}}', '{{desc}}') %]"; + s.ALERT_UNDELETE_FAILED = "[% l('Could not undelete record [_1]: [_2]', '{{id}}', '{{desc}}') %]"; s.DIRTY_MARC_WARNING = "[% l('There is unsaved data in this record.') %]" s.MARC_ALERT_CREATE_SUCCESS = "[% l('Successfully created new record') %]"; s.MARC_ALERT_CREATE_FAILED = "[% l('Failed to create new record: [_1]', '{{error}}') %]"; s.MARC_ALERT_UPDATE_SUCCESS = "[% l('Successfully updated record') %]"; s.MARC_ALERT_UPDATE_FAILED = "[% l('Failed to update record: [_1]', '{{error}}') %]"; + s.SUCCESS_UNDELETE_RECORD = "[% l('Record is no longer deleted') %]"; }]); 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 3967267aa7..0a6a0dddef 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 @@ -1331,8 +1331,24 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) }; $scope.undeleteRecord = function () { - $scope.Record().deleted(false); - return $scope.saveRecord(); + if ($scope.record_type == 'bre') { + egCore.net.request( + 'open-ils.cat', + 'open-ils.cat.biblio.record_entry.undelete', + egCore.auth.token(), $scope.recordId + ).then(function(resp) { + var evt = egCore.evt.parse(resp); + if (evt) { + return egAlertDialog.open( + egCore.strings.ALERT_UNDELETE_FAILED, + { id : $scope.recordId, desc : evt.desc } + ); + } else { + ngToast.create(egCore.strings.SUCCESS_UNDELETE_RECORD); + loadRecord().then(processOnSaveCallbacks); + } + }); + } }; $scope.validateHeadings = function () {