embedded : '@',
recordType : '@',
maxUndo : '@',
+ importIsTrue : '@',
saveLabel : '@'
},
link: function (scope, element, attrs) {
}, function() { // failure
alert('Could not save the record!');
}).then(loadRecord).then(processOnSaveCallbacks);
- } else {
- $scope.Record().creator(egCore.auth.user().id());
- $scope.Record().create_date('now');
- return egCore.pcrud.create(
- $scope.Record()
- ).then(function(bre) {
- $scope.recordId = bre.id();
- $scope.caretRecId = $scope.recordId;
- if ($scope.enable_fast_add) {
+ } else { // csharp - this is where we add the checks
+ // Am I a z39.50 import? If so, make sure I don't
+ // match any existing TCNs
+ if ($scope.import_is_true) {
+ $scope.import = function() {
+ var deferred = $q.defer();
+ var items = $scope.gridControls.selectedItems();
egCore.net.request(
- 'open-ils.actor',
- 'open-ils.actor.anon_cache.set_value',
- null, 'edit-these-copies', {
- record_id: $scope.recordId,
- raw: [{
- label : $scope.fast_item_callnumber,
- barcode : $scope.fast_item_barcode,
- }],
- hide_vols : false,
- hide_copies : false
- }
- ).then(function(key) {
- if (key) {
- var url = egCore.env.basePath + 'cat/volcopy/' + key;
- $timeout(function() { $window.open(url, '_blank') });
- } else {
- alert('Could not create anonymous cache key!');
+ 'open-ils.cat',
+ 'open-ils.cat.biblio.record.xml.import',
+ egCore.auth.token(),
+ items[0]['marcxml'],
+ null, // FIXME bib source
+ null,
+ null,
+ $scope.selectFieldStripGroups()
+ ).then(
+ function() { deferred.resolve() },
+ null, // onerror
+ function(result) {
+ egConfirmDialog.open(
+ egCore.strings.IMPORTED_RECORD_FROM_Z3950,
+ egCore.strings.IMPORTED_RECORD_FROM_Z3950_AS_ID,
+ { id : result.id() },
+ egCore.strings.GO_TO_RECORD,
+ egCore.strings.GO_BACK
+ ).result.then(function() {
+ // NOTE: $location.path('/cat/catalog/record/' + result.id()) did not work
+ // for some reason
+ $window.location.href = egCore.env.basePath + 'cat/catalog/record/' + result.id();
+ });
}
- });
- }
- }).then(loadRecord).then(processOnSaveCallbacks);
+ );
+
+ return deferred.promise;
+ };
+ } else {
+ $scope.Record().creator(egCore.auth.user().id());
+ $scope.Record().create_date('now');
+ return egCore.pcrud.create(
+ $scope.Record()
+ ).then(function(bre) {
+ $scope.recordId = bre.id();
+ $scope.caretRecId = $scope.recordId;
+ if ($scope.enable_fast_add) {
+ egCore.net.request(
+ 'open-ils.actor',
+ 'open-ils.actor.anon_cache.set_value',
+ null, 'edit-these-copies', {
+ record_id: $scope.recordId,
+ raw: [{
+ label : $scope.fast_item_callnumber,
+ barcode : $scope.fast_item_barcode,
+ }],
+ hide_vols : false,
+ hide_copies : false
+ }
+ ).then(function(key) {
+ if (key) {
+ var url = egCore.env.basePath + 'cat/volcopy/' + key;
+ $timeout(function() { $window.open(url, '_blank') });
+ } else {
+ alert('Could not create anonymous cache key!');
+ }
+ });
+ }
+ }).then(loadRecord).then(processOnSaveCallbacks);
+ }
}
-
};
$scope.seeBreaker = function () {