webstaff: inform on record save failure, and mark the page clean on successful save
authorMike Rylander <mrylander@gmail.com>
Tue, 13 Oct 2015 16:24:29 +0000 (12:24 -0400)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:51 +0000 (14:58 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js

index 412c02e..0086d41 100644 (file)
@@ -1083,6 +1083,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                         $scope.controlfields = $scope.record.fields.filter(function(f){ return f.isControlfield() });
                         $scope.datafields = $scope.record.fields.filter(function(f){ return !f.isControlfield() });
                         $scope.save_stack_depth = $scope.record_undo_stack.length;
+                        $scope.dirtyFlag = false;
                         $scope.flat_text_marc = $scope.record.toBreaker();
 
                         if ($scope.record_type == 'bre') {
@@ -1275,7 +1276,9 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                     if ($scope.recordId) {
                         return egCore.pcrud.update(
                             $scope.Record()
-                        ).then(function() {
+                        ).then(function() { // success
+                            $scope.save_stack_depth = $scope.record_undo_stack.length;
+                            $scope.dirtyFlag = false;
                             if ($scope.enable_fast_add) {
                                 egCore.net.request(
                                     'open-ils.actor',
@@ -1299,6 +1302,8 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                                     }
                                 });
                             }
+                        }, function() { // failure
+                            alert('Could not save the record!');
                         }).then(loadRecord).then(processOnSaveCallbacks);
                     } else {
                         $scope.Record().creator(egCore.auth.user().id());