<div><label class="font-weight-bold" i18n>Prefix</label></div>
<div>
<eg-combobox [smallFormControl]="true" [(ngModel)]="batchVolPrefix">
- <eg-combobox-entry *ngFor="let pfx of volcopy.commonData.acn_prefix"
+ <eg-combobox-entry *ngFor="let pfx of batchPrefixes()"
[entryId]="pfx.id()" [entryLabel]="pfx.label()">
</eg-combobox-entry>
</eg-combobox>
<div><label class="font-weight-bold" i18n>Suffix</label></div>
<div>
<eg-combobox [smallFormControl]="true" [(ngModel)]="batchVolSuffix">
- <eg-combobox-entry *ngFor="let sfx of volcopy.commonData.acn_suffix"
+ <eg-combobox-entry *ngFor="let sfx of batchSuffixes()"
[entryId]="sfx.id()" [entryLabel]="sfx.label()">
</eg-combobox-entry>
</eg-combobox>
<eg-combobox-entry
[entryId]="-1" entryLabel="<None>" i18n-entryLabel>
</eg-combobox-entry>
- <eg-combobox-entry *ngFor="let pfx of volcopy.commonData.acn_prefix"
+ <eg-combobox-entry *ngFor="let pfx of orgPrefixes(orgNode.target.id())"
[entryId]="pfx.id()" [entryLabel]="pfx.label()">
</eg-combobox-entry>
</eg-combobox>
<eg-combobox-entry
[entryId]="-1" entryLabel="<None>" i18n-entryLabel>
</eg-combobox-entry>
- <eg-combobox-entry *ngFor="let sfx of volcopy.commonData.acn_suffix"
+ <eg-combobox-entry *ngFor="let sfx of orgSuffixes(orgNode.target.id())"
[entryId]="sfx.id()" [entryLabel]="sfx.label()">
</eg-combobox-entry>
</eg-combobox>
!this.volcopy.defaults.visible.batch_actions;
this.volcopy.saveDefaults();
}
+
+ // Retrieve call number prefixes for the work station OU
+ batchPrefixes(): IdlObject[]{
+ return this.orgPrefixes(this.auth.user().ws_ou());
+ }
+
+ // Retrieve call number suffixes for the work station OU
+ batchSuffixes(): IdlObject[]{
+ return this.orgSuffixes(this.auth.user().ws_ou());
+ }
+
+ // Given an org unit ID, find all call number prefixes belonging to
+ // the org unit, its ancestors, and its descendants
+ orgPrefixes(orgId: number): IdlObject[] {
+ let r = [];
+ this.org.fullPath(orgId,true).forEach( org => {
+ if(this.volcopy.callNumberPrefixMap[org])
+ this.volcopy.callNumberPrefixMap[org].forEach(prefix => r.push(prefix));
+ });
+ return r;
+ }
+
+ // Given an org unit ID, find all call number suffixes belonging to
+ // the org unit, its ancestors, and its descendants
+ orgSuffixes(orgId: number): IdlObject[] {
+ let r = [];
+ this.org.fullPath(orgId,true).forEach( org => {
+ if(this.volcopy.callNumberSuffixMap[org])
+ this.volcopy.callNumberSuffixMap[org].forEach(suffix => r.push(suffix));
+ });
+ return r;
+ }
}
currentContext: VolCopyContext;
statCatEntryMap: {[id: number]: IdlObject} = {}; // entry id => entry
+ callNumberPrefixMap: {[key: string]: IdlObject[]} = {};
+ callNumberSuffixMap: {[key: string]: IdlObject[]} = {};
templateNames: ComboboxEntry[] = [];
templates: any = {};
// specially in the markup.
this.commonData.acn_prefix =
this.commonData.acn_prefix.filter(pfx => pfx.id() !== -1);
-
+ // Map the call number prefixes by their owning libraries
+ this.commonData.acn_prefix.forEach(
+ pfx => {
+ let ol = pfx.owning_lib();
+ if (!this.callNumberPrefixMap[ol]) {
+ this.callNumberPrefixMap[ol] = [];
+ }
+ this.callNumberPrefixMap[ol].push(pfx);
+ }
+ );
+
this.commonData.acn_suffix =
this.commonData.acn_suffix.filter(sfx => sfx.id() !== -1);
-
+ // Map the call number suffixes by their owning libraries
+ this.commonData.acn_suffix.forEach(
+ sfx => {
+ let ol = sfx.owning_lib();
+ if (!this.callNumberSuffixMap[ol]) {
+ this.callNumberSuffixMap[ol] = [];
+ }
+ this.callNumberSuffixMap[ol].push(sfx);
+ }
+ );
+
this.commonData.acp_status.forEach(
stat => this.copyStatuses[stat.id()] = stat);
$client->respond({
acn_prefix => $e->search_asset_call_number_prefix([
- {owning_lib => $org_ids},
+ {id => {'!=' => undef}},
{order_by => {acnp => 'label_sortkey'}}
])
});
$client->respond({
acn_suffix => $e->search_asset_call_number_suffix([
- {owning_lib => $org_ids},
+ {id => {'!=' => undef}},
{order_by => {acns => 'label_sortkey'}}
])
});