</permacrud>
</class>
- <class id="coustl" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::org_unit_setting_type_log" oils_persist:tablename="config.org_unit_setting_type_log" reporter:label="Organizational Unit Setting Type Log">
+ <class id="coustl" controller="open-ils.cstore" oils_obj:fieldmapper="config::org_unit_setting_type_log" oils_persist:tablename="config.org_unit_setting_type_log" reporter:label="Organizational Unit Setting Type Log">
<fields oils_persist:primary="id" oils_persist:sequence="config.org_unit_setting_type_log_id_seq">
<field reporter:label="ID" name="id" reporter:datatype="id"/>
<field name="date_applied" reporter:datatype="timestamp"/>
<link field="field_name" reltype="has_a" key="name" map="" class="coust"/>
<link field="org" reltype="has_a" key="id" map="" class="aou"/>
</links>
- <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
- <actions>
- <create permission="ADMIN_ORG_UNIT_SETTING_TYPE" context_field="org"/>
- <retrieve permission="STAFF_LOGIN" context_field="org"/>
- <update permission="ADMIN_ORG_UNIT_SETTING_TYPE_LOG" context_field="org"/>
- <delete permission="ADMIN_ORG_UNIT_SETTING_TYPE_LOG" context_field="org"/>
- </actions>
- </permacrud>
</class>
<class id="aaactsc" controller="open-ils.reporter-store" oils_obj:fieldmapper="action::archive_actor_stat_cat" oils_persist:tablename="action.archive_actor_stat_cat" reporter:label="Circ-Archived Patron Statistical Category Entries">
<fields oils_persist:primary="id" oils_persist:sequence="action.archive_actor_stat_cat_id_seq">
}
__PACKAGE__->register_method(
+ method => "fetch_visible_ou_settings_log",
+ api_name => "open-ils.actor.org_unit.settings.history.visible.retrieve",
+ signature => {
+ desc => "Retrieves the log entries for the specified OU setting. " .
+ "If the setting has a view permission, the results are limited " .
+ "to entries at the OUs that the user has the view permission. ",
+ params => [
+ {desc => 'Authentication token', type => 'string'},
+ {desc => 'Setting name', type => 'string'}
+ ],
+ return => {desc => 'List of fieldmapper objects of the log entries, Event on error'}
+ }
+);
+
+sub fetch_visible_ou_settings_log {
+ my( $self, $client, $auth, $setting ) = @_;
+
+ my $e = new_editor(authtoken => $auth);
+ return $e->event unless $e->checkauth;
+ return $e->die_event unless $e->allowed("STAFF_LOGIN");
+ return OpenILS::Event->new('BAD_PARAMS') unless defined($setting);
+
+ my $type = $e->retrieve_config_org_unit_setting_type([
+ $setting,
+ {flesh => 1, flesh_fields => {coust => ['view_perm']}}
+ ]);
+ return OpenILS::Event->new('BAD_PARAMS', note => 'setting type not found')
+ unless $type;
+
+ my $query = { field_name => $setting };
+ if ($type->view_perm) {
+ $query->{org} = $U->user_has_work_perm_at($e, $type->view_perm->code, {descendants => 1});
+ if (scalar @{ $query->{org} } == 0) {
+ # user doesn't have the view permission anywhere, so return nothing
+ return [];
+ }
+ }
+
+ my $results = $e->search_config_org_unit_setting_type_log([$query, {'order_by' => 'date_applied ASC'}])
+ or return $e->die_event;
+ return $results;
+}
+
+__PACKAGE__->register_method(
method => "user_settings",
authoritative => 1,
api_name => "open-ils.actor.patron.settings.retrieve",
dojo.byId('osHistName').innerHTML = osSettings[name].label;
var data = dojo.byId('histTitle').innerHTML;
- var thisHist = pcrud.search('coustl', {'field_name':name});
- for(var i in thisHist.reverse()) {
- d = thisHist[i].date_applied();
- a = ouNames[thisHist[i].org()];
- o = thisHist[i].original_value();
- if(o) o=o.replace(/\&/g,'&').replace(/</g,'<').replace(/>/g,'>');
- n = thisHist[i].new_value();
- if(n) n=n.replace(/\&/g,'&').replace(/</g,'<').replace(/>/g,'>');
- r = thisHist[i].org();
- // Table is: Date | Org Name | Orig Value | New Value | Revert
- data += "<tr><td>" + d + "</td><td>" + a + "</td><td>" + o +
- "</td><td>" + n + "</td><td>" +
- "<a href='javascript:void(0);' onclick='osRevertSetting(" + r + ", "" + name +"","+o+");'>"+dojo.byId('os-revert').innerHTML+"</a></td></tr>";
- }
+ fieldmapper.standardRequest(
+ [ 'open-ils.actor',
+ 'open-ils.actor.org_unit.settings.history.visible.retrieve' ],
+ { async: true,
+ params: [authtoken, name],
+ oncomplete: function(r) {
+ var thisHist = r.recv().content();
+ if(e = openils.Event.parse(thisHist))
+ return alert(e);
+ for(var i in thisHist.reverse()) {
+ d = thisHist[i].date_applied();
+ a = ouNames[thisHist[i].org()];
+ o = thisHist[i].original_value();
+ if(o) o=o.replace(/\&/g,'&').replace(/</g,'<').replace(/>/g,'>');
+ n = thisHist[i].new_value();
+ if(n) n=n.replace(/\&/g,'&').replace(/</g,'<').replace(/>/g,'>');
+ r = thisHist[i].org();
+ // Table is: Date | Org Name | Orig Value | New Value | Revert
+ data += "<tr><td>" + d + "</td><td>" + a + "</td><td>" + o +
+ "</td><td>" + n + "</td><td>" +
+ "<a href='javascript:void(0);' onclick='osRevertSetting(" + r + ", "" + name +"","+o+");'>"+dojo.byId('os-revert').innerHTML+"</a></td></tr>";
+ }
- dojo.byId('historyData').innerHTML = data;
+ dojo.byId('historyData').innerHTML = data;
- showProcessingDialog(false);
- osHistDialog.show();
+ showProcessingDialog(false);
+ osHistDialog.show();
+ }
+ }
+ );
}
function showAlert(message, timeout) {