Copy location selector in the copy editor now includes locations from all
org units above, at, and below the workstation org unit.
Previously, copy locations at "lower" org units were not included.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Carol Witt <wittc@cwmars.org>
<div *ngIf="displayAttr('location')">
<ng-template #locationTemplate>
<eg-item-location-select (valueChange)="values['location'] = $event"
- [contextOrgIds]="affectedOrgIds()"
+ [contextOrgIds]="copyLocationOrgs()"
domId='location-input' [required]="true" permFilter="UPDATE_COPY">
</eg-item-location-select>
</ng-template>
this.batchAttrs.filter(attr => attr.editing).forEach(attr => attr.save());
}
- affectedOrgIds(): number[] {
+ copyLocationOrgs(): number[] {
if (!this.context) { return []; }
- return this.context.orgNodes().map(n => n.target.id());
+
+ // Make sure every org unit represented by the edit batch
+ // is represented.
+ const ids = this.context.orgNodes().map(n => n.target.id());
+
+ // Make sure all locations within the "full path" of our
+ // workstation org unit are included.
+ return ids.concat(this.org.fullPath(this.auth.user().ws_ou()));
}
}