<field reporter:label="Circulations Performed as Staff" name="performed_circulations" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Fund Allocation Percentages" name="fund_alloc_pcts" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Reservations" name="reservations" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="User Activity Entries" name="usr_activity" oils_persist:virtual="true" reporter:datatype="link"/>
</fields>
<links>
<link field="demographic" reltype="might_have" key="id" map="" class="rud"/>
<link field="performed_circulations" reltype="has_many" key="circ_staff" map="" class="circ"/>
<link field="fund_alloc_pcts" reltype="has_many" key="allocator" map="" class="acqfap"/>
<link field="reservations" reltype="has_many" key="usr" map="" class="bresv"/>
+ <link field="usr_activity" reltype="has_many" key="usr" map="" class="auact"/>
</links>
</class>
<class id="cuat" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::usr_activity_type" oils_persist:tablename="config.usr_activity_type" reporter:label="User Activity Type">
</links>
<permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
<actions>
- <retrieve permission="VIEW_USER">
+ <retrieve permission="RUN_REPORTS">
<context link="usr" field="home_ou" />
</retrieve>
</actions>
"addresses",
"billing_address",
"mailing_address",
- "stat_cat_entries" ];
+ "stat_cat_entries",
+ "usr_activity" ];
return new_flesh_user($user_id, $fields, $e);
}
$fetch_penalties = 1;
}
+ my $fetch_usr_act = 0;
+ if(grep {$_ eq 'usr_activity'} @$fields) {
+ $fields = [grep {$_ ne 'usr_activity'} @$fields];
+ $fetch_usr_act = 1;
+ }
+
my $user = $e->retrieve_actor_user(
[
$id,
);
}
+ # retrieve the most recent usr_activity entry
+ if ($fetch_usr_act) {
+
+ # max number to return for simple patron fleshing
+ my $limit = $U->ou_ancestor_setting_value(
+ $e->requestor->ws_ou,
+ 'circ.patron.usr_activity_retrieve.max');
+
+ my $opts = {
+ flesh => 1,
+ flesh_fields => {auact => ['etype']},
+ order_by => {auact => 'event_time DESC'},
+ };
+
+ # 0 == none, <0 == return all
+ $limit = 1 unless defined $limit;
+ $opts->{limit} = $limit if $limit > 0;
+
+ $user->usr_activity(
+ ($limit == 0) ?
+ [] : # skip the DB call
+ $e->search_actor_usr_activity([{usr => $user->id}, $opts])
+ );
+ }
+
$e->rollback;
$user->clear_passwd();
return $user;
-- reserve the first 1000 slots
SELECT SETVAL('config.usr_activity_type_id_seq'::TEXT, 1000);
+INSERT INTO config.org_unit_setting_type
+ (name, label, description, grp, datatype)
+ VALUES (
+ 'circ.patron.usr_activity_retrieve.max',
+ oils_i18n_gettext(
+ 'circ.patron.usr_activity_retrieve.max',
+ 'Max user activity entries to retrieve (staff client)',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.patron.usr_activity_retrieve.max',
+ 'Sets the maxinum number of recent user activity entries to retrieve for display in the staff client. 0 means show none, -1 means show all. Default is 1.',
+ 'coust',
+ 'description'
+ ),
+ 'gui',
+ 'integer'
+ );
+
-- reserve the first 1000 slots
SELECT SETVAL('config.usr_activity_type_id_seq'::TEXT, 1000);
+INSERT INTO config.org_unit_setting_type
+ (name, label, description, grp, datatype)
+ VALUES (
+ 'circ.patron.usr_activity_retrieve.max',
+ oils_i18n_gettext(
+ 'circ.patron.usr_activity_retrieve.max',
+ 'Max user activity entries to retrieve (staff client)',
+ 'coust',
+ 'label'
+ ),
+ oils_i18n_gettext(
+ 'circ.patron.usr_activity_retrieve.max',
+ 'Sets the maxinum number of recent user activity entries to retrieve for display in the staff client. 0 means show none, -1 means show all. Default is 1.',
+ 'coust',
+ 'description'
+ ),
+ 'gui',
+ 'integer'
+ );
+
+
COMMIT;
/*