</actions>
</permacrud>
</class>
- <class id="combcirc" controller="open-ils.cstore" oils_obj:fieldmapper="action::all_circulation" oils_persist:tablename="action.all_circulation" reporter:core="true" reporter:label="Combined Aged and Active Circulations" oils_persist:readonly="true">
+ <class id="combcirc" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="action::all_circulation" oils_persist:tablename="action.all_circulation" reporter:core="true" reporter:label="Combined Aged and Active Circulations" oils_persist:readonly="true">
<fields oils_persist:primary="id" oils_persist:sequence="money.billable_xact_id_seq">
<field reporter:label="Check In Library" name="checkin_lib" reporter:datatype="org_unit"/>
<field reporter:label="Check In Staff" name="checkin_staff" reporter:datatype="link"/>
<link field="parent_circ" reltype="might_have" key="id" map="" class="acirc"/>
<link field="usr" reltype="has_a" key="id" map="" class="au"/>
</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="acirc" controller="open-ils.cstore" oils_obj:fieldmapper="action::aged_circulation" oils_persist:tablename="action.aged_circulation" reporter:core="true" reporter:label="Aged (patronless) Circulation">
<fields oils_persist:primary="id" oils_persist:sequence="money.billable_xact_id_seq">
<div class="row" ng-repeat="circ in circ_list">
<div class="flex-row">
<div class="flex-cell well">
- <a href="./circ/patron/{{circ.usr().id()}}/checkout" target="_self">
+ <a ng-if="circ.usr()" target="_self"
+ href="./circ/patron/{{circ.usr().id()}}/checkout">
[% l('[_1], [_2] [_3] : [_4]',
'{{circ.usr().family_name()}}'
'{{circ.usr().first_given_name()}}'
'{{circ.usr().second_given_name()}}'
'{{circ.usr().card().barcode()}}') %]
</a>
+ <span ng-if="!circ.usr()">[% l('<Aged Circulation>') | html %]</span>
<span class="pad-horiz">[% l('Circulation ID: [_1]', '{{circ.id()}}') %]</span>
</div>
<div>
<div class="flex-cell">[% l('Patron') %]</div>
<div class="flex-cell well">
<a href="./circ/patron/{{prev_circ_usr.id()}}/checkout"
- ng-if="prev_circ_summary" target="_self">
+ ng-if="prev_circ_usr" target="_self">
[% l('[_1], [_2] [_3] : [_4]',
- '{{prev_circ_usr.family_name()}}'
- '{{prev_circ_usr.first_given_name()}}'
- '{{prev_circ_usr.second_given_name()}}'
- '{{prev_circ_usr.card().barcode()}}') %]
+ '{{prev_circ_usr.family_name()}}'
+ '{{prev_circ_usr.first_given_name()}}'
+ '{{prev_circ_usr.second_given_name()}}'
+ '{{prev_circ_usr.card().barcode()}}') %]
</a>
+ <span ng-show="!prev_circ_usr">
+ [% l('<Aged Circulation>') | html %]
+ </span>
</div>
</div>
delete $scope.circ;
delete $scope.circ_summary;
delete $scope.prev_circ_summary;
+ delete $scope.prev_circ_usr;
if (!copyId) return;
egCore.pcrud.search('circ',
).then(null, null, function(summary) {
$scope.prev_circ_summary = summary.summary;
- egCore.pcrud.retrieve('au', summary.usr,
- {flesh : 1, flesh_fields : {au : ['card']}})
+ if (summary.usr) { // aged circs have no 'usr'.
+ egCore.pcrud.retrieve('au', summary.usr,
+ {flesh : 1, flesh_fields : {au : ['card']}})
- .then(function(user) {
- $scope.prev_circ_usr = user;
- });
+ .then(function(user) { $scope.prev_circ_usr = user });
+ }
});
});
}
$scope.retrieveAllPatrons = function() {
var users = new Set();
angular.forEach($scope.circ_list.map(function(circ) { return circ.usr(); }),function(usr) {
- users.add(usr);
+ // aged circs have no 'usr'.
+ if (usr) users.add(usr);
});
users.forEach(function(usr) {
$timeout(function() {
}).then(function(count) {
- egCore.pcrud.search('circ',
+ egCore.pcrud.search('combcirc',
{target_copy : copyId},
{ flesh : 2,
flesh_fields : {
- circ : [
+ combcirc : [
'usr',
'workstation',
'checkin_workstation',
],
au : ['card']
},
- order_by : {circ : 'xact_start desc'},
+ order_by : {combcirc : 'xact_start desc'},
limit : count
}