</links>
</class>
- <class id="acss"
- controller="open-ils.cstore"
- oils_obj:fieldmapper="actor::cascade_setting_summary"
- oils_persist:virtual="true"
- reporter:label="Cascade Setting Summary">
- <fields>
- <field reporter:label="Setting Name" name="name" reporter:datatype="text"/>
- <field reporter:label="Value" name="value" reporter:datatype="text"/>
- <field reporter:label="Has Org Setting" name="has_org_setting" reporter:datatype="bool"/>
- <field reporter:label="Has User Setting" name="has_user_setting" reporter:datatype="bool"/>
- <field reporter:label="Has Workstation Setting" name="has_workstation_setting" reporter:datatype="bool"/>
- </fields>
- </class>
-
<!-- ********************************************************************************************************************* -->
</IDL>
// If we have already attempted to retrieve a value for this
// setting, then we can tell up front whether applying a value
// at the server will be an option. If not, store locally.
- // Note that the existence of an org unit setting type and no
- // user/ws setting type means applying a value locally is
- // not allowed.
var summary = service.serverSettingSummaries[key];
- if (summary &&
- summary.has_org_setting() === 'f' &&
- summary.has_user_setting() === 'f' &&
- summary.has_workstation_setting() === 'f') {
+ if (summary && !summary.has_staff_setting) {
+
+ if (summary.has_org_setting === 't') {
+ // When no user/ws setting types exist but an org unit
+ // setting type does, it means the value cannot be
+ // applied by an individual user. Nothing left to do.
+ return $q.when();
+ }
+
+ // No setting types of any flavor exist.
+ // Fall back to local storage.
if (value === null) {
// a null value means clear the server setting.
}
service.handleServerItemResponse = function(summary) {
- var key = summary.name();
- var val = summary.value();
+ var key = summary.name;
+ var val = summary.value;
+
+ // For our purposes, we only care if a setting can be stored
+ // as an org setting or a user-or-workstation setting.
+ summary.has_staff_setting = (
+ summary.has_user_setting === 't' ||
+ summary.has_workstation_setting === 't'
+ );
- summary.value(null); // avoid duplicate value caches
+ summary.value = null; // avoid duplicate value caches
service.serverSettingSummaries[key] = summary;
if (val !== null) {
return $q.when(service.keyCache[key] = val);
}
- // Note that the existence of an org unit setting type and no
- // user/ws setting type means applying a value locally is
- // not allowed.
- if (summary.has_org_setting() === 'f' &&
- summary.has_user_setting() === 'f' &&
- summary.has_workstation_setting() === 'f') {
+ if (!summary.has_staff_setting) {
+
+ if (summary.has_org_setting === 't') {
+ // An org unit setting type exists but no value is applied
+ // that this workstation has access to. The existence of
+ // an org unit setting type and no user/ws setting type
+ // means applying a value locally is not allowed.
+ return $q.when(service.keyCache[key] = undefined);
+ }
console.warn('No server setting type exists for '
+ key + ', using local value.');
return service.getBrowserItem(key);
}
- // A server setting type exists, but no server value exists.
- // See if we can migrate a local setting to the server.
+ // A user/ws setting type exists, but no server value exists.
+ // Migrate the local setting to the server.
var deferred = $q.defer();
service.getBrowserItem(key).then(function(browserVal) {