<eg-barcode-select #barcodeSelect></eg-barcode-select>
<eg-circ-components></eg-circ-components>
-<eg-copy-alerts-dialog #copyAlertsDialog></eg-copy-alerts-dialog>
<eg-bucket-dialog #bucketDialog></eg-bucket-dialog>
<div class="row">
} else {
this.itemBarcode = null;
- if (this.tab == 'list') {
+ if (this.tab === 'list') {
this.selectInput();
return this.getItemById(res.id);
} else {
flesh : 4,
flesh_fields : {
acp : [
- 'call_number','location','status','floating','circ_modifier',
- 'age_protect','circ_lib','copy_alerts', 'creator',
+ 'call_number', 'location', 'status', 'floating', 'circ_modifier',
+ 'age_protect', 'circ_lib', 'copy_alerts', 'creator',
'editor', 'circ_as_type', 'latest_inventory', 'floating'
],
- acn : ['record','prefix','suffix','label_class', 'owning_lib'],
- bre : ['simple_record','creator','editor'],
+ acn : ['record', 'prefix', 'suffix', 'label_class', 'owning_lib'],
+ bre : ['simple_record', 'creator', 'editor'],
alci : ['inventory_workstation']
},
select : {
// avoid fleshing MARC on the bre
// note: don't add simple_record.. not sure why
- bre : ['id','tcn_value','creator','editor', 'create_date', 'edit_date'],
+ bre : ['id', 'tcn_value', 'creator', 'editor', 'create_date', 'edit_date'],
}
};
loadCircInfo(): Promise<any> {
const copyOrg =
- this.item.call_number().id() == -1 ?
+ this.item.call_number().id() === -1 ?
this.item.circ_lib().id() :
this.item.call_number().owning_lib().id();
return this.org.settings('circ.item_checkout_history.max')
.then(sets => {
this.maxHistoryCount = sets['circ.item_checkout_history.max'] || 4;
- })
+ });
}
})
- .then(_ => {
-
- return this.pcrud.search('aacs',
- {target_copy : this.item.id()},
- { flesh: 2,
- flesh_fields: {
- aacs: [
- 'usr',
- 'workstation',
- 'checkin_workstation',
- 'duration_rule',
- 'max_fine_rule',
- 'recurring_fine_rule'
- ],
- au: ['card']
- },
- order_by: {aacs: 'xact_start desc'},
- limit: 1
- }
-
- ).toPromise();
- })
+
+ .then(_ => this.circs.getLatestCirc(this.item.id()))
.then(circ => {
this.circ = circ;
- if (!circ) return Promise.resolve();
+ if (!circ) { return Promise.resolve(); }
return this.circs.getCircChain(this.circ.id())
.then(summary => {
- this.circSummary = summary
+ this.circSummary = summary;
if (this.maxHistoryCount <= 1) { return; }
return this.circs.getPrevCircChain(this.circ.id())
- .then(summary => {
- if (!summary) { return; }
+ .then(prevSummary => {
+ if (!prevSummary) { return; }
- this.prevCircSummary = summary.summary;
+ this.prevCircSummary = prevSummary.summary;
- if (summary.usr) { // aged circs have no 'usr'.
+ if (prevSummary.usr) { // aged circs have no 'usr'.
- return this.pcrud.retrieve('au', summary.usr,
+ return this.pcrud.retrieve('au', prevSummary.usr,
{flesh : 1, flesh_fields : {au : ['card']}})
.toPromise().then(user => this.prevCircUser = user);
}
import {IdlObject} from '@eg/core/idl.service';
import {NetService} from '@eg/core/net.service';
import {OrgService} from '@eg/core/org.service';
-import {PcrudService} from '@eg/core/pcrud.service';
+import {PcrudService, PcrudQueryOps} from '@eg/core/pcrud.service';
import {EventService, EgEvent} from '@eg/core/event.service';
import {AuthService} from '@eg/core/auth.service';
import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.service';
).toPromise();
}
+
+ getLatestCirc(copyId: number, ops?: PcrudQueryOps): Promise<IdlObject> {
+
+ if (!ops) {
+ ops = {
+ flesh: 2,
+ flesh_fields: {
+ aacs: [
+ 'usr',
+ 'workstation',
+ 'checkin_workstation',
+ 'duration_rule',
+ 'max_fine_rule',
+ 'recurring_fine_rule'
+ ],
+ au: ['card']
+ }
+ };
+ }
+
+ ops.order_by = {aacs: 'xact_start desc'};
+ ops.limit = 1;
+
+ return this.pcrud.search('aacs', {target_copy : copyId}, ops).toPromise();
+ }
}