</div>
<button class="btn btn-default" ng-click="saveRecord()">Save</button>
<button class="btn btn-default" ng-click="seeBreaker()">Breaker</button>
+ <button ng-hide="Record().deleted()" class="btn btn-default" ng-click="deleteRecord()">Delete</button>
+ <button ng-show="Record().deleted()" class="btn btn-default" ng-click="undeleteRecord()">Undelete</button>
</div>
).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() });
$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(){
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);
};