controller : ['$scope','itemSvc','egCore',
function ( $scope , itemSvc , egCore ) {
$scope.callNumber = $scope.copies[0].call_number();
+ $scope.callNumber.owning_lib(null)
if (!$scope.callNumber.label()) $scope.callNumber.empty_label = true;
$scope.empty_label = false;
$scope.empty_label_string = window.empty_label_string;
$scope.idTracker = function (x) { if (x && x.id) return x.id() };
+ if($scope.callNumber.owning_lib()){
+ // XXX $() is not working! arg
+ $scope.focusNextBarcode = function (i, prev_bc) {
+ var n;
+ var yep = false;
+ angular.forEach($scope.copies, function (cp) {
+ if (n) return;
+
+ if (cp.id() == i) {
+ yep = true;
+ return;
+ }
- // XXX $() is not working! arg
- $scope.focusNextBarcode = function (i, prev_bc) {
- var n;
- var yep = false;
- angular.forEach($scope.copies, function (cp) {
- if (n) return;
-
- if (cp.id() == i) {
- yep = true;
- return;
- }
-
- if (yep) n = cp.id();
- });
+ if (yep) n = cp.id();
+ });
- if (n) {
- var next = '#' + $scope.callNumber.id() + '_' + n;
- var el = $(next);
- if (el) {
- if (!itemSvc.currently_generating) el.focus();
- if (prev_bc && itemSvc.auto_gen_barcode && el.val() == "") {
- itemSvc.nextBarcode(prev_bc).then(function(bc){
- el.focus();
- el.val(bc);
- el.trigger('change');
- });
- } else {
- itemSvc.currently_generating = false;
+ if (n) {
+ var next = '#' + $scope.callNumber.id() + '_' + n;
+ var el = $(next);
+ if (el) {
+ if (!itemSvc.currently_generating) el.focus();
+ if (prev_bc && itemSvc.auto_gen_barcode && el.val() == "") {
+ itemSvc.nextBarcode(prev_bc).then(function(bc){
+ el.focus();
+ el.val(bc);
+ el.trigger('change');
+ });
+ } else {
+ itemSvc.currently_generating = false;
+ }
}
+ } else {
+ $scope.focusNext($scope.callNumber.id(),prev_bc)
}
- } else {
- $scope.focusNext($scope.callNumber.id(),prev_bc)
}
- }
- $scope.suffix_list = [];
- itemSvc.get_suffixes($scope.callNumber.owning_lib()).then(function(list){
- $scope.suffix_list = list;
- $scope.$watch('callNumber.suffix()', function (v) {
- if (angular.isObject(v)) v = v.id();
- $scope.suffix = $scope.suffix_list.filter( function (s) {
- return s.id() == v;
- })[0];
- });
+ $scope.suffix_list = [];
+ itemSvc.get_suffixes($scope.callNumber.owning_lib()).then(function(list){
+ $scope.suffix_list = list;
+ $scope.$watch('callNumber.suffix()', function (v) {
+ if (angular.isObject(v)) v = v.id();
+ $scope.suffix = $scope.suffix_list.filter( function (s) {
+ return s.id() == v;
+ })[0];
+ });
- });
- $scope.updateSuffix = function () {
- angular.forEach($scope.copies, function(cp) {
- cp.call_number().suffix($scope.suffix);
- cp.call_number().ischanged(1);
});
- }
+ $scope.updateSuffix = function () {
+ angular.forEach($scope.copies, function(cp) {
+ cp.call_number().suffix($scope.suffix);
+ cp.call_number().ischanged(1);
+ });
+ }
- $scope.prefix_list = [];
- itemSvc.get_prefixes($scope.callNumber.owning_lib()).then(function(list){
- $scope.prefix_list = list;
- $scope.$watch('callNumber.prefix()', function (v) {
- if (angular.isObject(v)) v = v.id();
- $scope.prefix = $scope.prefix_list.filter(function (p) {
- return p.id() == v;
- })[0];
- });
+ $scope.prefix_list = [];
+ itemSvc.get_prefixes($scope.callNumber.owning_lib()).then(function(list){
+ $scope.prefix_list = list;
+ $scope.$watch('callNumber.prefix()', function (v) {
+ if (angular.isObject(v)) v = v.id();
+ $scope.prefix = $scope.prefix_list.filter(function (p) {
+ return p.id() == v;
+ })[0];
+ });
- });
- $scope.updatePrefix = function () {
- angular.forEach($scope.copies, function(cp) {
- cp.call_number().prefix($scope.prefix);
- cp.call_number().ischanged(1);
});
+ $scope.updatePrefix = function () {
+ angular.forEach($scope.copies, function(cp) {
+ cp.call_number().prefix($scope.prefix);
+ cp.call_number().ischanged(1);
+ });
+ }
}
+
$scope.$watch('callNumber.owning_lib()', function(oldLib, newLib) {
if (oldLib == newLib) return;
var currentPrefix = $scope.callNumber.prefix();
$scope.callNumber.empty_label = $scope.empty_label = true;
} else {
$scope.callNumber.empty_label = $scope.empty_label = false;
- }
+ }
+
});
$scope.prefix = $scope.callNumber.prefix();
$scope.owning_lib = egCore.org.get($scope.lib);
$scope.$watch('owning_lib', function (oldLib, newLib) {
if (oldLib == newLib) return;
- angular.forEach( Object.keys($scope.struct), function (cn) {
- $scope.struct[cn][0].call_number().owning_lib( $scope.owning_lib.id() );
- $scope.struct[cn][0].call_number().ischanged(1);
- });
+ if($scope.owning_lib){
+ angular.forEach( Object.keys($scope.struct), function (cn) {
+ $scope.struct[cn][0].call_number().owning_lib( $scope.owning_lib.id() );
+ $scope.struct[cn][0].call_number().ischanged(1);
+ });
+ }
+
+
});
$scope.cant_have_vols = function (id) { return !egCore.org.CanHaveVolumes(id); };
$scope.new_lib_to_add = egCore.org.get(egCore.auth.user().ws_ou());
$scope.changeNewLib = function (org) {
- $scope.new_lib_to_add = org;
+ if(!$scope.cant_have_vols(org)) {
+ $scope.new_lib_to_add = org;
+ }
}
$scope.addLibToStruct = function () {
var newLib = $scope.new_lib_to_add;
$scope.fast_add,
true
);
-
$scope.data.addCopy(cp);
// manually increase cn_count numeric input
$scope.workingGridControls.selectedItems(),
function (cp) {
$scope.dirty = true;
+
cp.stat_cat_entries(
angular.forEach( cp.stat_cat_entries(), function (e) {
'open-ils.actor.anon_cache.get_value',
dataKey, 'edit-these-copies'
).then(function (data) {
-
if (data) {
if (data.hide_vols && !$scope.defaults.always_volumes) $scope.show_vols = false;
if (data.hide_copies) {
} else if (i.call_number().empty_label && $scope.require_label) {
can_save = false;
}
+ if(!i.call_number().owning_lib()){
+ can_save = false;
+ }
}
);
$scope.floating_list = list;
});
createSimpleUpdateWatcher('floating');
-
createSimpleUpdateWatcher('circ_lib');
createSimpleUpdateWatcher('circulate');
createSimpleUpdateWatcher('holdable');
if (typeof cnHash[cn_id].suffix() == 'object')
cnHash[cn_id].suffix(cnHash[cn_id].suffix().id()); // un-object-ize some fields
});
-
if ($scope.only_vols) { // strip off copies when we're in vol-only mode
angular.forEach(cnHash, function (v, k) {
cnHash[k].copies([]);
});
if (!foundMatch) {
egCore.pcrud.search('acpt',
- {
+ {
owner : egCore.org.fullPath(egCore.auth.user().ws_ou(), true),
label : tagLabel,
tag_type : $scope.tag_type
$scope.templates[n] = tmpl;
$scope.template_name_list = Object.keys($scope.templates).sort();
-
- itemSvc.save_acp_templates($scope.templates);
+ itemSvc.save_acp_templates($scope.templates);
$scope.$parent.fetchTemplates();
$scope.dirty = false;
} else {
// save all templates, as we might do after an import
+
itemSvc.save_acp_templates($scope.templates);
$scope.$parent.fetchTemplates();
}
angular.forEach(Object.keys(newTemplates), function (k) {
$scope.templates[k] = newTemplates[k];
});
+
itemSvc.save_acp_templates($scope.templates);
$scope.fetchTemplates();
} catch (E) {