LP1823367 Move away from "volume" moniker internally
authorDan Wells <dbw2@calvin.edu>
Thu, 18 Jul 2019 19:20:39 +0000 (15:20 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 1 Aug 2019 18:11:27 +0000 (14:11 -0400)
It isn't really correct to use "volume" and "call number"
interchangeably.  This code substitutes various forms of the second
for various forms of the first within the internal variable and
function names.  To help contain the change, it tries to only do so
for values which are native to eg2, and not leaking from or into other
interfaces.

Understanding that this change is somewhat disruptive, I still think it
is in our overall best interest, as it will help us from falling into
old habits, and it will help future coders better understand the
relationship between the code and the interface.

Note, this code does not change any filenames.  This is for review
purposes to allow the changes to be more easily observed.  If accepted,
we should change couple of affected filenames as well.

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html
Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.html
Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.css
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
Open-ILS/src/eg2/src/app/staff/share/holdings/delete-volcopy-dialog.component.html
Open-ILS/src/eg2/src/app/staff/share/holdings/delete-volcopy-dialog.component.ts
Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.module.ts
Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.service.ts
Open-ILS/src/eg2/src/app/staff/share/holds/holds.service.ts

index a63c69a..fa04d86 100644 (file)
         </div>
         <div class="col-lg-2">{{ctx.holdMeta.bibSummary.display.author}}</div>
         <div class="col-lg-2">
-          <ng-container *ngIf="ctx.holdMeta.volume; else anyValue">
-            {{ctx.holdMeta.volume.label()}}
+          <ng-container *ngIf="ctx.holdMeta.callNum; else anyValue">
+            {{ctx.holdMeta.callNum.label()}}
           </ng-container>
         </div>
         <div class="col-lg-1">
index 1d3856d..62008a4 100644 (file)
@@ -5,8 +5,8 @@
   i18n-text text="Record Overlay Target Set"></eg-string>
 <eg-string key="catalog.record.toast.holdTransfer" 
   i18n-text text="Hold Transfer Target Set"></eg-string>
-<eg-string key="catalog.record.toast.volumeTransfer" 
-  i18n-text text="Call Number Transfer Target Set"></eg-string>
+<eg-string key="catalog.record.toast.holdingTransfer" 
+  i18n-text text="Holding Transfer Target Set"></eg-string>
 <eg-string key="catalog.record.toast.cleared" 
   text="Record Marks Cleared"></eg-string>
 
@@ -23,7 +23,7 @@
     <button class="btn btn-outline-primary ml-1" i18n>Place Hold</button>
   </a>
 
-  <button class="btn btn-outline-primary ml-1" (click)="addVolumes()" i18n>
+  <button class="btn btn-outline-primary ml-1" (click)="addHoldings()" i18n>
     Add Holdings
   </button>
 
             (Currently {{targets.holdTransfer.current}})</ng-container>
         </span>
       </button>
-      <button class="dropdown-item" (click)="mark('volumeTransfer')">
+      <button class="dropdown-item" (click)="mark('holdingTransfer')">
         <span i18n>
-          Call Number Transfer<ng-container *ngIf="targets.volumeTransfer.current">
-            (Currently {{targets.volumeTransfer.current}})</ng-container>
+          Holding Transfer<ng-container *ngIf="targets.holdingTransfer.current">
+            (Currently {{targets.holdingTransfer.current}})</ng-container>
         </span>
       </button>
       <button class="dropdown-item" (click)="clearMarks()">
index 23ed696..2e3e2ad 100644 (file)
@@ -32,8 +32,8 @@ export class RecordActionsComponent implements OnInit {
             key: 'eg.circ.hold.title_transfer_target',
             current: null
         },
-        volumeTransfer: {
-            key: 'eg.cat.marked_volume_transfer_record',
+        holdingTransfer: {
+            key: 'eg.cat.marked_holding_transfer_record',
             current: null
         }
     };
@@ -83,11 +83,11 @@ export class RecordActionsComponent implements OnInit {
             .then(txt => this.toast.success(txt));
     }
 
-    // TODO: Support adding copies to existing volumes by getting
-    // selected volumes from the holdings grid.
-    // TODO: Support adding like volumes by getting selected
-    // volumes from the holdings grid.
-    addVolumes() {
+    // TODO: Support adding copies to existing call numbers by getting
+    // selected call numbers from the holdings grid.
+    // TODO: Support adding like call numbers by getting selected
+    // call numbers from the holdings grid.
+    addHoldings() {
         this.holdings.spawnAddHoldingsUi(this.recId);
     }
 
index 0a60418..18412da 100644 (file)
@@ -5,7 +5,7 @@
 
 /* colors are based on "Evergreen Green", tinted and desaturated */
 
-.holdings-volume-row {
+.holdings-callNum-row {
     background-color: #c9efe4;
 }
 
index 6925b88..3c09dde 100644 (file)
@@ -48,7 +48,7 @@
 <eg-mark-missing-dialog #markMissingDialog></eg-mark-missing-dialog>
 <eg-copy-alerts-dialog #copyAlertsDialog></eg-copy-alerts-dialog>
 <eg-replace-barcode-dialog #replaceBarcode></eg-replace-barcode-dialog>
-<eg-delete-volcopy-dialog #deleteVolcopy></eg-delete-volcopy-dialog>
+<eg-delete-holding-dialog #deleteHolding></eg-delete-holding-dialog>
 <eg-bucket-dialog #bucketDialog></eg-bucket-dialog>
 <eg-conjoined-items-dialog #conjoinedDialog></eg-conjoined-items-dialog>
 <eg-make-bookable-dialog #makeBookableDialog></eg-make-bookable-dialog>
     <!-- checkboxes / filters -->
 
     <eg-grid-toolbar-checkbox i18n-label label="Show Call Numbers"
-      #volsCheckbox (onChange)="toggleShowVolumes($event)">
+      #callNumsCheckbox (onChange)="toggleShowCallNums($event)">
     </eg-grid-toolbar-checkbox> 
     <eg-grid-toolbar-checkbox i18n-label label="Show Copies" 
       #copiesCheckbox (onChange)="toggleShowCopies($event)">
     </eg-grid-toolbar-checkbox> 
     <eg-grid-toolbar-checkbox i18n-label label="Show Empty Call Numbers"
-      #emptyVolsCheckbox (onChange)="toggleShowEmptyVolumes($event)">
+      #emptyCallNumsCheckbox (onChange)="toggleShowEmptyCallNums($event)">
     </eg-grid-toolbar-checkbox> 
     <eg-grid-toolbar-checkbox i18n-label label="Show Empty Libs"            
       #emptyLibsCheckbox (onChange)="toggleShowEmptyLibs($event)">
 
     <eg-grid-toolbar-action
       i18n-group group="Add" i18n-label label="Add Call Numbers"
-      (onClick)="openVolCopyEdit($event, true, false)">
+      (onClick)="openHoldingEdit($event, true, false)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
       i18n-group group="Add" i18n-label label="Add Items"
-      (onClick)="openVolCopyEdit($event, false, true)">
+      (onClick)="openHoldingEdit($event, false, true)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
       i18n-group group="Add" i18n-label label="Add Call Numbers and Items"
-      (onClick)="openVolCopyEdit($event, true, true)">
+      (onClick)="openHoldingEdit($event, true, true)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
 
     <eg-grid-toolbar-action
       i18n-group group="Edit" i18n-label label="Edit Call Numbers"
-      (onClick)="openVolCopyEdit($event, true, false)">
+      (onClick)="openHoldingEdit($event, true, false)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
       i18n-group group="Edit" i18n-label label="Edit Call Numbers And Items"
-      (onClick)="openVolCopyEdit($event, true, true)">
+      (onClick)="openHoldingEdit($event, true, true)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
       i18n-group group="Edit" i18n-label label="Edit Items"
-      (onClick)="openVolCopyEdit($event, false, true)">
+      (onClick)="openHoldingEdit($event, false, true)">
     </eg-grid-toolbar-action>
     
     <eg-grid-toolbar-action
 
     <eg-grid-toolbar-action
       i18n-group group="Delete" i18n-label label="Delete Empty Call Numbers"
-      (onClick)="deleteHoldings($event, 'vols')">
+      (onClick)="deleteHoldings($event, 'callNums')">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
     </eg-grid-column>
     <eg-grid-column name="id" path="copy.id" [hidden]="true" label="Item ID" i18n-label>
     </eg-grid-column>
-    <eg-grid-column path="volume.id" [hidden]="true" label="Call Number ID" i18n-label>
+    <eg-grid-column path="callNum.id" [hidden]="true" label="Call Number ID" i18n-label>
     </eg-grid-column>
     <eg-grid-column name="owner_label" [flex]="4"
       [cellTemplate]="locationTemplate" [cellContext]="gridTemplateContext" 
       label="Location/Barcode" [disableTooltip]="true" i18n-label>
     </eg-grid-column>
-    <eg-grid-column path="volumeCount" datatype="number" label="Call Numbers" i18n-label>
+    <eg-grid-column path="callNumCount" datatype="number" label="Call Numbers" i18n-label>
     </eg-grid-column>
     <eg-grid-column path="copyCount" datatype="number" label="Copies" i18n-label>
     </eg-grid-column>
-    <eg-grid-column path="volume._label" name="call_number.label" 
+    <eg-grid-column path="callNum._label" name="call_number.label" 
       label="Call Number" i18n-label>
     </eg-grid-column>
     <eg-grid-column path="copy.barcode" name="barcode" label="Barcode" i18n-label>
     </eg-grid-column>
     <eg-grid-column i18n-label label="Circ Library" path="copy.circ_lib" 
       name="circ_lib.name" datatype="org_unit"></eg-grid-column>
-    <eg-grid-column i18n-label label="Owning Library" path="volume.owning_lib" 
+    <eg-grid-column i18n-label label="Owning Library" path="callNum.owning_lib" 
       datatype="org_unit"></eg-grid-column>
     <eg-grid-column i18n-label label="Due Date" path="circ.due_date" 
       datatype="timestamp"></eg-grid-column>
       path="copy.status.name" name="status_name">
     </eg-grid-column>
     <eg-grid-column i18n-label label="Call Number Prefix" 
-      path="volume.prefix.label" name="call_number.prefix.label" [hidden]="true">
+      path="callNum.prefix.label" name="call_number.prefix.label" [hidden]="true">
     </eg-grid-column>
     <eg-grid-column i18n-label label="Call Number Suffix" 
-      path="volume.suffix.label" name="call_number.suffix.label" [hidden]="true">
+      path="callNum.suffix.label" name="call_number.suffix.label" [hidden]="true">
     </eg-grid-column>
     <eg-grid-column i18n-label label="Active/Create Date" 
       path="copy.active_date" datatype="timestamp">
index a412521..bc23905 100644 (file)
@@ -25,7 +25,7 @@ import {CopyAlertsDialogComponent
     } from '@eg/staff/share/holdings/copy-alerts-dialog.component';
 import {ReplaceBarcodeDialogComponent
     } from '@eg/staff/share/holdings/replace-barcode-dialog.component';
-import {DeleteVolcopyDialogComponent
+import {DeleteHoldingDialogComponent
     } from '@eg/staff/share/holdings/delete-volcopy-dialog.component';
 import {BucketDialogComponent
     } from '@eg/staff/share/buckets/bucket-dialog.component';
@@ -38,12 +38,12 @@ import {MakeBookableDialogComponent
 // flattened on-demand into a list of HoldingEntry objects.
 class HoldingsTreeNode {
     children: HoldingsTreeNode[];
-    nodeType: 'org' | 'volume' | 'copy';
+    nodeType: 'org' | 'callNum' | 'copy';
     target: any;
     parentNode: HoldingsTreeNode;
     expanded: boolean;
     copyCount: number;
-    volumeCount: number;
+    callNumCount: number;
     constructor() {
         this.children = [];
     }
@@ -62,11 +62,11 @@ class HoldingsEntry {
     locationLabel: string;
     // location label indentation depth
     locationDepth: number | null;
-    volumeCount: number | null;
+    callNumCount: number | null;
     copyCount: number | null;
     callNumberLabel: string;
     copy: IdlObject;
-    volume: IdlObject;
+    callNum: IdlObject;
     circ: IdlObject;
     treeNode: HoldingsTreeNode;
 }
@@ -85,12 +85,12 @@ export class HoldingsMaintenanceComponent implements OnInit {
     @ViewChild('holdingsGrid') holdingsGrid: GridComponent;
 
     // Manage visibility of various sub-sections
-    @ViewChild('volsCheckbox')
-        private volsCheckbox: GridToolbarCheckboxComponent;
+    @ViewChild('callNumsCheckbox')
+        private callNumsCheckbox: GridToolbarCheckboxComponent;
     @ViewChild('copiesCheckbox')
         private copiesCheckbox: GridToolbarCheckboxComponent;
-    @ViewChild('emptyVolsCheckbox')
-        private emptyVolsCheckbox: GridToolbarCheckboxComponent;
+    @ViewChild('emptyCallNumsCheckbox')
+        private emptyCallNumsCheckbox: GridToolbarCheckboxComponent;
     @ViewChild('emptyLibsCheckbox')
         private emptyLibsCheckbox: GridToolbarCheckboxComponent;
     @ViewChild('markDamagedDialog')
@@ -101,8 +101,8 @@ export class HoldingsMaintenanceComponent implements OnInit {
         private copyAlertsDialog: CopyAlertsDialogComponent;
     @ViewChild('replaceBarcode')
         private replaceBarcode: ReplaceBarcodeDialogComponent;
-    @ViewChild('deleteVolcopy')
-        private deleteVolcopy: DeleteVolcopyDialogComponent;
+    @ViewChild('deleteHolding')
+        private deleteHolding: DeleteHoldingDialogComponent;
     @ViewChild('bucketDialog')
         private bucketDialog: BucketDialogComponent;
     @ViewChild('conjoinedDialog')
@@ -168,11 +168,11 @@ export class HoldingsMaintenanceComponent implements OnInit {
         this.contextOrg = this.staffCat.searchContext.searchOrg;
 
         this.rowClassCallback = (row: any): string => {
-            if (row.volume) {
+            if (row.callNum) {
                 if (row.copy) {
                     return 'holdings-copy-row';
                 } else {
-                    return 'holdings-volume-row';
+                    return 'holdings-callNum-row';
                 }
             } else {
                 // Add a generic org unit class and a depth-specific
@@ -218,13 +218,13 @@ export class HoldingsMaintenanceComponent implements OnInit {
             'cat.holdings_show_vols'
         ]);
 
-        // Show volumes by default when no preference is set.
-        let showVols = settings['cat.holdings_show_vols'];
-        if (showVols === null) { showVols = true; }
+        // Show call numbers by default when no preference is set.
+        let showCallNums = settings['cat.holdings_show_vols'];
+        if (showCallNums === null) { showCallNums = true; }
 
-        this.volsCheckbox.checked(showVols);
+        this.callNumsCheckbox.checked(showCallNums);
         this.copiesCheckbox.checked(settings['cat.holdings_show_copies']);
-        this.emptyVolsCheckbox.checked(settings['cat.holdings_show_empty']);
+        this.emptyCallNumsCheckbox.checked(settings['cat.holdings_show_empty']);
         this.emptyLibsCheckbox.checked(settings['cat.holdings_show_empty_org']);
 
         this.initHoldingsTree();
@@ -248,28 +248,28 @@ export class HoldingsMaintenanceComponent implements OnInit {
     toggleShowCopies(value: boolean) {
         this.store.setItem('cat.holdings_show_copies', value);
         if (value) {
-            // Showing copies implies showing volumes
-            this.volsCheckbox.checked(true);
+            // Showing copies implies showing call numbers
+            this.callNumsCheckbox.checked(true);
         }
         this.renderFromPrefs = true;
         this.holdingsGrid.reload();
     }
 
-    toggleShowVolumes(value: boolean) {
+    toggleShowCallNums(value: boolean) {
         this.store.setItem('cat.holdings_show_vols', value);
         if (!value) {
-            // Hiding volumes implies hiding empty vols and copies.
+            // Hiding call numbers implies hiding empty call numbers and copies.
             this.copiesCheckbox.checked(false);
-            this.emptyVolsCheckbox.checked(false);
+            this.emptyCallNumsCheckbox.checked(false);
         }
         this.renderFromPrefs = true;
         this.holdingsGrid.reload();
     }
 
-    toggleShowEmptyVolumes(value: boolean) {
+    toggleShowEmptyCallNums(value: boolean) {
         this.store.setItem('cat.holdings_show_empty', value);
         if (value) {
-            this.volsCheckbox.checked(true);
+            this.callNumsCheckbox.checked(true);
         }
         this.renderFromPrefs = true;
         this.holdingsGrid.reload();
@@ -311,7 +311,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
 
         this.treeNodeCache = {
             org: {},
-            volume: {},
+            callNum: {},
             copy: {}
         };
 
@@ -337,7 +337,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
                 return 1;
             } else {
                 // TODO: should this use label sortkey instead of
-                // the compiled volume label?
+                // the compiled call number label?
                 return a.target._label < b.target._label ? -1 : 1;
             }
         });
@@ -349,8 +349,8 @@ export class HoldingsMaintenanceComponent implements OnInit {
 
         if (node.nodeType === 'org') {
             node.copyCount = 0;
-            node.volumeCount = 0;
-        } else if (node.nodeType === 'volume') {
+            node.callNumCount = 0;
+        } else if (node.nodeType === 'callNum') {
             node.copyCount = 0;
         }
 
@@ -360,14 +360,14 @@ export class HoldingsMaintenanceComponent implements OnInit {
             this.setTreeCounts(child);
             if (node.nodeType === 'org') {
                 node.copyCount += child.copyCount;
-                if (child.nodeType === 'volume') {
-                    node.volumeCount++;
+                if (child.nodeType === 'callNum') {
+                    node.callNumCount++;
                 } else {
-                    hasChildOrgWithData = child.volumeCount > 0;
-                    hasChildOrgSansData = child.volumeCount === 0;
-                    node.volumeCount += child.volumeCount;
+                    hasChildOrgWithData = child.callNumCount > 0;
+                    hasChildOrgSansData = child.callNumCount === 0;
+                    node.callNumCount += child.callNumCount;
                 }
-            } else if (node.nodeType === 'volume') {
+            } else if (node.nodeType === 'callNum') {
                 node.copyCount = node.children.length;
                 if (this.renderFromPrefs) {
                     node.expanded = this.copiesCheckbox.checked();
@@ -376,9 +376,9 @@ export class HoldingsMaintenanceComponent implements OnInit {
         });
 
         if (this.renderFromPrefs && node.nodeType === 'org') {
-            if (node.copyCount > 0 && this.volsCheckbox.checked()) {
+            if (node.copyCount > 0 && this.callNumsCheckbox.checked()) {
                 node.expanded = true;
-            } else if (node.volumeCount > 0 && this.emptyVolsCheckbox.checked()) {
+            } else if (node.callNumCount > 0 && this.emptyCallNumsCheckbox.checked()) {
                 node.expanded = true;
             } else if (hasChildOrgWithData) {
                 node.expanded = true;
@@ -399,31 +399,31 @@ export class HoldingsMaintenanceComponent implements OnInit {
 
         switch (node.nodeType) {
             case 'org':
-                if (node.volumeCount === 0
+                if (node.callNumCount === 0
                     && !this.emptyLibsCheckbox.checked()) {
                     return;
                 }
                 entry.locationLabel = node.target.shortname();
                 entry.locationDepth = node.target.ou_type().depth();
                 entry.copyCount = node.copyCount;
-                entry.volumeCount = node.volumeCount;
+                entry.callNumCount = node.callNumCount;
                 this.sortOrgNodeChildren(node);
                 break;
 
-            case 'volume':
+            case 'callNum':
                 if (this.renderFromPrefs) {
-                    if (!this.volsCheckbox.checked()) {
+                    if (!this.callNumsCheckbox.checked()) {
                         return;
                     }
                     if (node.copyCount === 0
-                        && !this.emptyVolsCheckbox.checked()) {
+                        && !this.emptyCallNumsCheckbox.checked()) {
                         return;
                     }
                 }
                 entry.locationLabel = node.target._label;
                 entry.locationDepth = node.parentNode.target.ou_type().depth() + 1;
                 entry.callNumberLabel = entry.locationLabel;
-                entry.volume = node.target;
+                entry.callNum = node.target;
                 entry.copyCount = node.copyCount;
                 break;
 
@@ -431,7 +431,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
                 entry.locationLabel = node.target.barcode();
                 entry.locationDepth = node.parentNode.parentNode.target.ou_type().depth() + 2;
                 entry.callNumberLabel = node.parentNode.target.label(); // TODO
-                entry.volume = node.parentNode.target;
+                entry.callNum = node.parentNode.target;
                 entry.copy = node.target;
                 entry.circ = node.target._circ;
                 break;
@@ -456,7 +456,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
         this.renderFromPrefs = false;
     }
 
-    // Grab volumes, copies, and related data.
+    // Grab call numbers, copies, and related data.
     fetchHoldings(pager: Pager): Observable<any> {
         if (!this.recordId) { return of([]); }
 
@@ -485,7 +485,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
                 },
                 {authoritative: true}
             ).subscribe(
-                vol => this.appendVolume(vol),
+                callNum => this.appendCallNum(callNum),
                 err => {},
                 ()  => {
                     this.refreshHoldings = false;
@@ -512,64 +512,64 @@ export class HoldingsMaintenanceComponent implements OnInit {
         })).toPromise();
     }
 
-    // Compile prefix + label + suffix into field volume._label;
-    setVolumeLabel(volume: IdlObject) {
-        const pfx = volume.prefix() ? volume.prefix().label() : '';
-        const sfx = volume.suffix() ? volume.suffix().label() : '';
-        volume._label = pfx ? pfx + ' ' : '';
-        volume._label += volume.label();
-        volume._label += sfx ? ' ' + sfx : '';
+    // Compile prefix + label + suffix into field callNum._label;
+    setCallNumLabel(callNum: IdlObject) {
+        const pfx = callNum.prefix() ? callNum.prefix().label() : '';
+        const sfx = callNum.suffix() ? callNum.suffix().label() : '';
+        callNum._label = pfx ? pfx + ' ' : '';
+        callNum._label += callNum.label();
+        callNum._label += sfx ? ' ' + sfx : '';
     }
 
-    // Create the tree node for the volume if it doesn't already exist.
+    // Create the tree node for the call number if it doesn't already exist.
     // Do the same for its linked copies.
-    appendVolume(volume: IdlObject) {
-        let volNode = this.treeNodeCache.volume[volume.id()];
-        this.setVolumeLabel(volume);
-
-        if (volNode) {
-            const pNode = this.treeNodeCache.org[volume.owning_lib()];
-            if (volNode.parentNode.target.id() !== pNode.target.id()) {
-                // Volume owning library changed.  Un-link it from the previous
-                // org unit collection before adding to the new one.
+    appendCallNum(callNum: IdlObject) {
+        let callNumNode = this.treeNodeCache.callNum[callNum.id()];
+        this.setCallNumLabel(callNum);
+
+        if (callNumNode) {
+            const pNode = this.treeNodeCache.org[callNum.owning_lib()];
+            if (callNumNode.parentNode.target.id() !== pNode.target.id()) {
+                // Call number owning library changed.  Un-link it from the
+                // previous org unit collection before adding to the new one.
                 // XXX TODO: ^--
-                volNode.parentNode = pNode;
-                volNode.parentNode.children.push(volNode);
+                callNumNode.parentNode = pNode;
+                callNumNode.parentNode.children.push(callNumNode);
             }
         } else {
-            volNode = new HoldingsTreeNode();
-            volNode.nodeType = 'volume';
-            volNode.parentNode = this.treeNodeCache.org[volume.owning_lib()];
-            volNode.parentNode.children.push(volNode);
-            this.treeNodeCache.volume[volume.id()] = volNode;
+            callNumNode = new HoldingsTreeNode();
+            callNumNode.nodeType = 'callNum';
+            callNumNode.parentNode = this.treeNodeCache.org[callNum.owning_lib()];
+            callNumNode.parentNode.children.push(callNumNode);
+            this.treeNodeCache.callNum[callNum.id()] = callNumNode;
         }
 
-        volNode.target = volume;
+        callNumNode.target = callNum;
 
-        volume.copies()
+        callNum.copies()
             .filter((copy: IdlObject) => (copy.deleted() !== 't'))
             .sort((a: IdlObject, b: IdlObject) => a.barcode() < b.barcode() ? -1 : 1)
-            .forEach((copy: IdlObject) => this.appendCopy(volNode, copy));
+            .forEach((copy: IdlObject) => this.appendCopy(callNumNode, copy));
     }
 
     // Find or create a copy node.
-    appendCopy(volNode: HoldingsTreeNode, copy: IdlObject) {
+    appendCopy(callNumNode: HoldingsTreeNode, copy: IdlObject) {
         let copyNode = this.treeNodeCache.copy[copy.id()];
 
         if (copyNode) {
             const oldParent = copyNode.parentNode;
-            if (oldParent.target.id() !== volNode.target.id()) {
-                // TODO: copy changed owning volume.  Remove it from
-                // the previous volume before adding to the new volume.
-                copyNode.parentNode = volNode;
-                volNode.children.push(copyNode);
+            if (oldParent.target.id() !== callNumNode.target.id()) {
+                // TODO: copy changed owning call number.  Remove it from
+                // the previous call number before adding to the new call number.
+                copyNode.parentNode = callNumNode;
+                callNumNode.children.push(copyNode);
             }
         } else {
             // New node required
             copyNode = new HoldingsTreeNode();
             copyNode.nodeType = 'copy';
-            volNode.children.push(copyNode);
-            copyNode.parentNode = volNode;
+            callNumNode.children.push(copyNode);
+            copyNode.parentNode = callNumNode;
             this.treeNodeCache.copy[copy.id()] = copyNode;
         }
 
@@ -592,10 +592,10 @@ export class HoldingsMaintenanceComponent implements OnInit {
         return copyRows.map(c => Number(c.id()));
     }
 
-    selectedVolumeIds(rows: HoldingsEntry[]): number[] {
+    selectedCallNumIds(rows: HoldingsEntry[]): number[] {
         return rows
-            .filter(r => r.treeNode.nodeType === 'volume')
-            .map(r => Number(r.volume.id()));
+            .filter(r => r.treeNode.nodeType === 'callNum')
+            .map(r => Number(r.callNum.id()));
     }
 
     async showMarkDamagedDialog(rows: HoldingsEntry[]) {
@@ -650,7 +650,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
             return;
         }
 
-        // Action may only apply to a single org or volume row.
+        // Action may only apply to a single org or call number row.
         const node = rows[0].treeNode;
         if (node.nodeType === 'copy') {
             return;
@@ -661,17 +661,17 @@ export class HoldingsMaintenanceComponent implements OnInit {
         if (node.nodeType === 'org') {
             orgId = node.target.id();
 
-            // Clear volume target when performed on an org unit row
-            this.localStore.removeLocalItem('eg.cat.transfer_target_vol');
+            // Clear call number target when performed on an org unit row
+            this.localStore.removeLocalItem('eg.cat.transfer_target_callnum');
 
-        } else if (node.nodeType === 'volume') {
+        } else if (node.nodeType === 'callNum') {
 
-            // All volume nodes are children of org nodes.
+            // All call number nodes are children of org nodes.
             orgId = node.parentNode.target.id();
 
-            // Add volume target when performed on a volume row.
+            // Add call number target when performed on a call number row.
             this.localStore.setLocalItem(
-                'eg.cat.transfer_target_vol', node.target.id());
+                'eg.cat.transfer_target_callnum', node.target.id());
         }
 
         this.localStore.setLocalItem('eg.cat.transfer_target_record', this.recordId);
@@ -717,39 +717,39 @@ export class HoldingsMaintenanceComponent implements OnInit {
         .then(key => this.openAngJsWindow(`cat/printlabels/${key}`));
     }
 
-    openVolCopyEdit(rows: HoldingsEntry[], addVols: boolean, addCopies: boolean) {
+    openHoldingEdit(rows: HoldingsEntry[], addCallNums: boolean, addCopies: boolean) {
 
-        // The user may select a set of volumes by selecting volume and/or
+        // The user may select a set of call numbers by selecting call number and/or
         // copy rows.
-        const volumes = [];
+        const callNums = [];
         rows.forEach(r => {
-            if (r.treeNode.nodeType === 'volume') {
-                volumes.push(r.volume);
+            if (r.treeNode.nodeType === 'callNum') {
+                callNums.push(r.callNum);
             } else if (r.treeNode.nodeType === 'copy') {
-                volumes.push(r.treeNode.parentNode.target);
+                callNums.push(r.treeNode.parentNode.target);
             }
         });
 
-        if (addCopies && !addVols) {
-            // Adding copies to an existing set of volumes.
-            if (volumes.length > 0) {
-                const volIds = volumes.map(v => Number(v.id()));
-                this.holdings.spawnAddHoldingsUi(this.recordId, volIds);
+        if (addCopies && !addCallNums) {
+            // Adding copies to an existing set of call numbers.
+            if (callNums.length > 0) {
+                const callNumIds = callNums.map(v => Number(v.id()));
+                this.holdings.spawnAddHoldingsUi(this.recordId, callNumIds);
             }
 
-        } else if (addVols) {
+        } else if (addCallNums) {
             const entries = [];
 
-            if (volumes.length > 0) {
+            if (callNums.length > 0) {
 
-                // When adding volumes, if any are selected in the grid,
-                // create volumes that have the same label and owner.
-                volumes.forEach(v =>
+                // When adding call numbers, if any are selected in the grid,
+                // create call numbers that have the same label and owner.
+                callNums.forEach(v =>
                     entries.push({label: v.label(), owner: v.owning_lib()}));
 
                 } else {
 
-                // Otherwise create new volumes from scratch.
+                // Otherwise create new call numbers from scratch.
                 entries.push({owner: this.auth.user().ws_ou()});
             }
 
@@ -786,56 +786,56 @@ export class HoldingsMaintenanceComponent implements OnInit {
         );
     }
 
-    // mode 'vols' -- only delete empty volumes
+    // mode 'callNums' -- only delete empty call numbers
     // mode 'copies' -- only delete selected copies
-    // mode 'both' -- delete selected copies and selected volumes, plus all
-    // copies linked to selected volumes, regardless of whether they are selected.
-    deleteHoldings(rows: HoldingsEntry[], mode: 'vols' | 'copies' | 'both') {
-        const volHash: any = {};
-
-        if (mode === 'vols' || mode === 'both') {
-            // Collect the volumes to be deleted.
-            rows.filter(r => r.treeNode.nodeType === 'volume').forEach(r => {
-                const vol = this.idl.clone(r.volume);
-                if (mode === 'vols') {
-                    if (vol.copies().length > 0) {
-                        // cannot delete non-empty volume in this mode.
+    // mode 'both' -- delete selected copies and selected call numbers, plus all
+    // copies linked to selected call numbers, regardless of whether they are selected.
+    deleteHoldings(rows: HoldingsEntry[], mode: 'callNums' | 'copies' | 'both') {
+        const callNumHash: any = {};
+
+        if (mode === 'callNums' || mode === 'both') {
+            // Collect the call numbers to be deleted.
+            rows.filter(r => r.treeNode.nodeType === 'callNum').forEach(r => {
+                const callNum = this.idl.clone(r.callNum);
+                if (mode === 'callNums') {
+                    if (callNum.copies().length > 0) {
+                        // cannot delete non-empty call number in this mode.
                         return;
                     }
                 } else {
-                    vol.copies().forEach(c => c.isdeleted(true));
+                    callNum.copies().forEach(c => c.isdeleted(true));
                 }
-                vol.isdeleted(true);
-                volHash[vol.id()] = vol;
+                callNum.isdeleted(true);
+                callNumHash[callNum.id()] = callNum;
             });
         }
 
         if (mode === 'copies' || mode === 'both') {
-            // Collect the copies to be deleted, including their volumes
-            // since the API expects fleshed volume objects.
+            // Collect the copies to be deleted, including their call numbers
+            // since the API expects fleshed call number objects.
             rows.filter(r => r.treeNode.nodeType === 'copy').forEach(r => {
-                const vol = r.treeNode.parentNode.target;
-                if (!volHash[vol.id()]) {
-                    volHash[vol.id()] = this.idl.clone(vol);
-                    volHash[vol.id()].copies([]);
+                const callNum = r.treeNode.parentNode.target;
+                if (!callNumHash[callNum.id()]) {
+                    callNumHash[callNum.id()] = this.idl.clone(callNum);
+                    callNumHash[callNum.id()].copies([]);
                 }
                 const copy = this.idl.clone(r.copy);
                 copy.isdeleted(true);
-                volHash[vol.id()].copies().push(copy);
+                callNumHash[callNum.id()].copies().push(copy);
             });
         }
 
-        if (Object.keys(volHash).length === 0) {
+        if (Object.keys(callNumHash).length === 0) {
             // No data to process.
             return;
         }
 
         // Note forceDeleteCopies should not be necessary here, since we
-        // manually marked all copies as deleted on deleted volumes in
+        // manually marked all copies as deleted on deleted call numbers in
         // "both" mode.
-        this.deleteVolcopy.forceDeleteCopies = mode === 'both';
-        this.deleteVolcopy.volumes = Object.values(volHash);
-        this.deleteVolcopy.open({size: 'sm'}).subscribe(
+        this.deleteHolding.forceDeleteCopies = mode === 'both';
+        this.deleteHolding.callNums = Object.values(callNumHash);
+        this.deleteHolding.open({size: 'sm'}).subscribe(
             modified => {
                 if (modified) {
                     this.hardRefresh();
index 30b0f2c..5bde3a7 100644 (file)
@@ -17,7 +17,7 @@
       </button>
     </div>
     <div class="modal-body">
-      <p i18n>Delete {{numVols}} call numbers and {{numCopies}} copies?</p>
+      <p i18n>Delete {{numCallNums}} call numbers and {{numCopies}} copies?</p>
     </div>
     <div class="modal-footer">
       <ng-container>
index ad0e673..3978374 100644 (file)
@@ -16,25 +16,25 @@ import {StringComponent} from '@eg/share/string/string.component';
  */
 
 @Component({
-  selector: 'eg-delete-volcopy-dialog',
+  selector: 'eg-delete-holding-dialog',
   templateUrl: 'delete-volcopy-dialog.component.html'
 })
 
-export class DeleteVolcopyDialogComponent
+export class DeleteHoldingDialogComponent
     extends DialogComponent implements OnInit {
 
     // List of "acn" objects which may contain copies.
     // Objects of either type marked "isdeleted" will be deleted.
-    @Input() volumes: IdlObject[];
+    @Input() callNums: IdlObject[];
 
     // If true, just ask the server to delete all attached copies
     // for any deleted call numbers.
-    // Note if this is true and a volume is provided that does not contain
-    // of its fleshed copies, the number of copies to delete will not be
+    // Note if this is true and a call number is provided that does not
+    // contain its fleshed copies, the number of copies to delete will not be
     // reported correctly.
     @Input() forceDeleteCopies: boolean;
 
-    numVols: number;
+    numCallNums: number;
     numCopies: number;
     numSucceeded: number;
     numFailed: number;
@@ -59,17 +59,17 @@ export class DeleteVolcopyDialogComponent
     ngOnInit() {}
 
     open(args: NgbModalOptions): Observable<boolean> {
-        this.numVols = 0;
+        this.numCallNums = 0;
         this.numCopies = 0;
         this.numSucceeded = 0;
         this.numFailed = 0;
 
-        this.volumes.forEach(vol => {
-            if (vol.isdeleted()) {
-                this.numVols++;
+        this.callNums.forEach(callNum => {
+            if (callNum.isdeleted()) {
+                this.numCallNums++;
             }
-            if (Array.isArray(vol.copies())) {
-                vol.copies().forEach(c => {
+            if (Array.isArray(callNum.copies())) {
+                callNum.copies().forEach(c => {
                     if (c.isdeleted() || this.forceDeleteCopies) {
                         // Marking copies deleted in forceDeleteCopies mode
                         // is not required, but we do it here so we can
@@ -81,8 +81,8 @@ export class DeleteVolcopyDialogComponent
             }
         });
 
-        if (this.numVols === 0 && this.numCopies === 0) {
-            console.debug('Volcopy delete called with no usable data');
+        if (this.numCallNums === 0 && this.numCopies === 0) {
+            console.debug('Holdings delete called with no usable data');
             return throwError(false);
         }
 
@@ -98,7 +98,7 @@ export class DeleteVolcopyDialogComponent
         this.net.request(
             'open-ils.cat',
             'open-ils.cat.asset.volume.fleshed.batch.update.override',
-            this.auth.token(), this.volumes, 1, flags
+            this.auth.token(), this.callNums, 1, flags
         ).toPromise().then(
             result => {
                 const evt = this.evt.parse(result);
index d9ae4fb..be49554 100644 (file)
@@ -5,7 +5,7 @@ import {MarkDamagedDialogComponent} from './mark-damaged-dialog.component';
 import {MarkMissingDialogComponent} from './mark-missing-dialog.component';
 import {CopyAlertsDialogComponent} from './copy-alerts-dialog.component';
 import {ReplaceBarcodeDialogComponent} from './replace-barcode-dialog.component';
-import {DeleteVolcopyDialogComponent} from './delete-volcopy-dialog.component';
+import {DeleteHoldingDialogComponent} from './delete-volcopy-dialog.component';
 import {ConjoinedItemsDialogComponent} from './conjoined-items-dialog.component';
 
 @NgModule({
@@ -14,7 +14,7 @@ import {ConjoinedItemsDialogComponent} from './conjoined-items-dialog.component'
       MarkMissingDialogComponent,
       CopyAlertsDialogComponent,
       ReplaceBarcodeDialogComponent,
-      DeleteVolcopyDialogComponent,
+      DeleteHoldingDialogComponent,
       ConjoinedItemsDialogComponent
     ],
     imports: [
@@ -25,7 +25,7 @@ import {ConjoinedItemsDialogComponent} from './conjoined-items-dialog.component'
       MarkMissingDialogComponent,
       CopyAlertsDialogComponent,
       ReplaceBarcodeDialogComponent,
-      DeleteVolcopyDialogComponent,
+      DeleteHoldingDialogComponent,
       ConjoinedItemsDialogComponent
     ],
     providers: [
index 87b0ff1..3c703e6 100644 (file)
@@ -7,7 +7,7 @@ import {AnonCacheService} from '@eg/share/util/anon-cache.service';
 import {AuthService} from '@eg/core/auth.service';
 import {EventService} from '@eg/core/event.service';
 
-interface NewVolumeData {
+interface NewCallNumData {
     owner: number;
     label?: string;
 }
@@ -25,16 +25,16 @@ export class HoldingsService {
     // Open the holdings editor UI in a new browser window/tab.
     spawnAddHoldingsUi(
         recordId: number,               // Bib record ID
-        addToVols?: number[],           // Add copies to / modify existing vols
-        volumeData?: NewVolumeData[],   // Creating new volumes
+        addToCallNums?: number[],           // Add copies to / modify existing CNs
+        callNumData?: NewCallNumData[],   // Creating new call numbers
         hideCopies?: boolean) {         // Hide the copy edit pane
 
         const raw: any[] = [];
 
-        if (addToVols) {
-            addToVols.forEach(volId => raw.push({callnumber: volId}));
-        } else if (volumeData) {
-            volumeData.forEach(data => raw.push(data));
+        if (addToCallNums) {
+            addToCallNums.forEach(callNumId => raw.push({callnumber: callNumId}));
+        } else if (callNumData) {
+            callNumData.forEach(data => raw.push(data));
         }
 
         if (raw.length === 0) { raw.push({}); }
index 91a45ae..231b44c 100644 (file)
@@ -39,8 +39,8 @@ export interface HoldRequest {
 
 // A fleshed hold request target object containing whatever data is
 // available for each hold type / target.  E.g. a TITLE hold will
-// not have a value for 'volume', but a COPY hold will, since all
-// copies have volumes.  Every HoldRequestTarget will have a bibId and
+// not have a value for 'callNum', but a COPY hold will, since all
+// copies have call numbers.  Every HoldRequestTarget will have a bibId and
 // bibSummary.  Some values come directly from the API call, others
 // applied locally.
 export interface HoldRequestTarget {
@@ -50,7 +50,7 @@ export interface HoldRequestTarget {
     bibId?: number;
     bibSummary?: BibRecordSummary;
     part?: IdlObject;
-    volume?: IdlObject;
+    callNum?: IdlObject;
     copy?: IdlObject;
     issuance?: IdlObject;
     metarecord_filters?: any;