</actions>
</permacrud>
</class>
+ <class id="aoncc" controller="open-ils.cstore open-ils.pcrud"
+ oils_obj:fieldmapper="action::open_non_cataloged_circulation"
+ oils_persist:tablename="action.open_non_cataloged_circulation"
+ oils_persist:readonly="true" reporter:core="true"
+ reporter:label="Open Non-cataloged Circulation">
+ <fields oils_persist:primary="id" oils_persist:sequence="action.non_cataloged_circulation_id_seq">
+ <field reporter:label="Circulating Library" name="circ_lib" reporter:datatype="org_unit"/>
+ <field reporter:label="Circulation Date/Time" name="circ_time" reporter:datatype="timestamp"/>
+ <field reporter:label="Non-cat Circulation ID" name="id" reporter:datatype="id" />
+ <field reporter:label="Non-cat Item Type" name="item_type" reporter:datatype="link"/>
+ <field reporter:label="Patron" name="patron" reporter:datatype="link"/>
+ <field reporter:label="Circulating Staff" name="staff" reporter:datatype="link"/>
+ <field reporter:label="Virtual Due Date/Time" name="duedate" reporter:datatype="timestamp" oils_persist:virtual="true"/>
+ </fields>
+ <links>
+ <link field="item_type" reltype="has_a" key="id" map="" class="cnct"/>
+ <link field="staff" reltype="has_a" key="id" map="" class="au"/>
+ <link field="patron" reltype="has_a" key="id" map="" class="au"/>
+ <link field="circ_lib" reltype="has_a" key="id" map="" class="aou"/>
+ </links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <retrieve permission="VIEW_CIRCULATIONS" context_field="circ_lib" />
+ </actions>
+ </permacrud>
+ </class>
<class id="moucs" controller="open-ils.cstore" oils_obj:fieldmapper="money::open_user_circulation_summary" oils_persist:tablename="money.open_usr_circulation_summary" reporter:label="Open User Circulation Summary">
<fields oils_persist:primary="usr" oils_persist:sequence="">
<field name="balance_owed" reporter:datatype="money" />
}
return patronStats = stats;
- })
- .then(_ => {
- return this.net.request(
- 'open-ils.circ',
- 'open-ils.circ.open_non_cataloged_circulation.user.authoritative',
- this.auth.token(), patron.id()
- ).toPromise();
+ }).then(_ => {
+ return this.pcrud.search('aoncc',
+ {patron: patron.id()}, {}, {idlist: true, atomic: true}).toPromise();
}).then(noncats => {
if (noncats && patronStats) {
);
sub fetch_open_noncats {
- my( $self, $conn, $auth, $userid ) = @_;
- my $e = new_editor( authtoken => $auth );
+ my ($self, $conn, $auth, $user_id) = @_;
+
+ my $e = new_editor(authtoken => $auth);
return $e->event unless $e->checkauth;
- $userid ||= $e->requestor->id;
- if( $e->requestor->id ne $userid ) {
- return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # XXX rely on editor perm
+
+ $user_id ||= $e->requestor->id;
+
+ if ($e->requestor->id ne $user_id) {
+ return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
}
- return $U->simplereq(
- 'open-ils.storage',
- 'open-ils.storage.action.open_non_cataloged_circulation.user',
- $userid
+ return $e->search_action_open_non_cataloged_circulation(
+ {patron => $user_id},
+ {idlist => 1}
);
}
my $e = new_editor(authtoken => $auth);
return $e->event unless $e->checkauth;
+ $user_id ||= $e->requestor->id;
if ($e->requestor->id ne $user_id) {
return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
}
- my $ids = $U->simplereq(
- 'open-ils.storage',
- 'open-ils.storage.action.open_non_cataloged_circulation.user',
- $user_id
+ my $ids = $e->search_action_open_non_cataloged_circulation(
+ {patron => $user_id},
+ {idlist => 1}
);
for my $id (@$ids) {
CREATE INDEX non_cat_in_house_use_staff_idx ON action.non_cat_in_house_use ( staff );
CREATE INDEX non_cat_in_house_use_ws_idx ON action.non_cat_in_house_use ( workstation );
+CREATE OR REPLACE VIEW action.open_non_cataloged_circulation AS
+ SELECT ncc.*
+ FROM action.non_cataloged_circulation ncc
+ JOIN config.non_cataloged_type nct ON nct.id = ncc.item_type
+ WHERE ncc.circ_time + nct.circ_duration > CURRENT_TIMESTAMP
+;
+
CREATE TABLE action.survey (
id SERIAL PRIMARY KEY,
owner INT NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
--- /dev/null
+BEGIN;
+
+-- SELECT evergreen.upgrade_deps_block_check('TODO', :eg_version);
+
+CREATE OR REPLACE VIEW action.open_non_cataloged_circulation AS
+ SELECT ncc.*
+ FROM action.non_cataloged_circulation ncc
+ JOIN config.non_cataloged_type nct ON nct.id = ncc.item_type
+ WHERE ncc.circ_time + nct.circ_duration > CURRENT_TIMESTAMP
+;
+
+COMMIT;
+
+