[open-ils-commits] [GIT] Evergreen ILS branch master updated. 1528c22bce523fc79cbdfd2244938db9977d5e57

Evergreen Git git at git.evergreen-ils.org
Mon Jul 27 12:57:51 EDT 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  1528c22bce523fc79cbdfd2244938db9977d5e57 (commit)
       via  caa1460d9575e8f2460f4e983e056cc830205ae5 (commit)
       via  4231540b8ffbb2858ff557e1c596f6d1727594fb (commit)
      from  aa91defb1548dc2228a505dfa4f42b9cda4244fd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1528c22bce523fc79cbdfd2244938db9977d5e57
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon Jul 27 10:58:52 2020 -0400

    LP1878079 Staffcat Add Holdings action support
    
    Teaches the staff catalog Add Holdings button to open the holdings
    editor using the appropriate parameters.  If the holdings maintenance
    grid is active, arguments to pass are based on the grid selection.
    Otherwise it simply open the item editor with a single call number /
    copy to be created 'here'.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.ts
index 52e89bee6b..bb4eca1ce7 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.ts
@@ -1,4 +1,4 @@
-import {Component, OnInit, Input} from '@angular/core';
+import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
 import {Router} from '@angular/router';
 import {StoreService} from '@eg/core/store.service';
 import {CatalogService} from '@eg/share/catalog/catalog.service';
@@ -15,6 +15,9 @@ import {HoldingsService} from '@eg/staff/share/holdings/holdings.service';
 })
 export class RecordActionsComponent implements OnInit {
 
+    @Output() addHoldingsRequested: EventEmitter<void>
+        = new EventEmitter<void>();
+
     recId: number;
     initDone = false;
     searchContext: CatalogSearchContext;
@@ -93,14 +96,9 @@ export class RecordActionsComponent implements OnInit {
             .then(txt => this.toast.success(txt));
     }
 
-    // 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);
+        this.addHoldingsRequested.emit();
     }
-
 }
 
 
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
index 46347e4915..7a064a5468 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
@@ -42,7 +42,7 @@ import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
 
 // The holdings grid models a single HoldingsTree, composed of HoldingsTreeNodes
 // flattened on-demand into a list of HoldingEntry objects.
-class HoldingsTreeNode {
+export class HoldingsTreeNode {
     children: HoldingsTreeNode[];
     nodeType: 'org' | 'callNum' | 'copy';
     target: any;
@@ -62,7 +62,7 @@ class HoldingsTree {
     }
 }
 
-class HoldingsEntry {
+export class HoldingsEntry {
     index: number;
     // org unit shortname, call number label, or copy barcode
     locationLabel: string;
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html
index a9330c3c2b..0630d3b6d8 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.html
@@ -22,7 +22,8 @@
     <!-- push the actions component to the right -->
     <div class="flex-1"></div>
     <div id='staff-catalog-bib-navigation'>
-      <eg-catalog-record-actions [recordId]="recordId">
+      <eg-catalog-record-actions [recordId]="recordId"
+        (addHoldingsRequested)="addHoldingsRequested()">
       </eg-catalog-record-actions>
     </div>
   </div>
@@ -73,7 +74,7 @@
       </ngb-tab>
       <ngb-tab title="Holdings View" i18n-title id="holdings">
         <ng-template ngbTabContent>
-          <eg-holdings-maintenance [recordId]="recordId">
+          <eg-holdings-maintenance #holdingsMaint [recordId]="recordId">
           </eg-holdings-maintenance>
         </ng-template>
       </ngb-tab>
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts
index b900ea8734..e68e01791d 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/record.component.ts
@@ -3,6 +3,7 @@ import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
 import {PcrudService} from '@eg/core/pcrud.service';
 import {IdlObject} from '@eg/core/idl.service';
+import {AuthService} from '@eg/core/auth.service';
 import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context';
 import {CatalogService} from '@eg/share/catalog/catalog.service';
 import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.service';
@@ -11,6 +12,8 @@ import {BibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.compo
 import {StoreService} from '@eg/core/store.service';
 import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
 import {MarcEditorComponent} from '@eg/staff/share/marc-edit/editor.component';
+import {HoldingsMaintenanceComponent} from './holdings.component';
+import {HoldingsService} from '@eg/staff/share/holdings/holdings.service';
 
 @Component({
   selector: 'eg-catalog-record',
@@ -24,6 +27,10 @@ export class RecordComponent implements OnInit {
     searchContext: CatalogSearchContext;
     @ViewChild('recordTabs', { static: true }) recordTabs: NgbTabset;
     @ViewChild('marcEditor', {static: false}) marcEditor: MarcEditorComponent;
+
+    @ViewChild('holdingsMaint', {static: false})
+        holdingsMaint: HoldingsMaintenanceComponent;
+
     defaultTab: string; // eg.cat.default_record_tab
 
     @ViewChild('pendingChangesDialog', {static: false})
@@ -33,9 +40,11 @@ export class RecordComponent implements OnInit {
         private router: Router,
         private route: ActivatedRoute,
         private pcrud: PcrudService,
+        private auth: AuthService,
         private bib: BibRecordService,
         private cat: CatalogService,
         private staffCat: StaffCatalogService,
+        private holdings: HoldingsService,
         private store: StoreService
     ) {}
 
@@ -179,6 +188,25 @@ export class RecordComponent implements OnInit {
         this.staffCat.currentDetailRecordSummary = null;
         this.loadRecord();
     }
+
+    // Our actions component broadcast a request to add holdings.
+    // If our Holdings Maintenance component is active/visible, ask
+    // it to figure out what data to pass to the holdings editor.
+    // Otherwise, just tell it to create a new call number and
+    // copy at the current working location.
+    addHoldingsRequested() {
+        if (this.holdingsMaint && this.holdingsMaint.holdingsGrid) {
+            this.holdingsMaint.openHoldingAdd(
+                this.holdingsMaint.holdingsGrid.context.getSelectedRows(),
+                true, true
+            );
+
+        } else {
+
+            this.holdings.spawnAddHoldingsUi(
+                this.recordId, null, [{owner: this.auth.user().ws_ou()}]);
+        }
+    }
 }
 
 

commit caa1460d9575e8f2460f4e983e056cc830205ae5
Author: Bill Erickson <berickxx at gmail.com>
Date:   Wed May 13 12:17:19 2020 -0400

    LP1878079 Staffcat 'Edit' items / call numbers support
    
    Adds support to the Angular staff catalog to properly handle requests
    to Edit Items, Edit Call Numbers, and Edit Call Numbers and Items.
    Prior to his change, these operations would behave more like Add
    operations than Edit operations.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
index 3d6c4d44ce..86f35cb9e2 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
@@ -102,17 +102,17 @@
 
     <eg-grid-toolbar-action
       i18n-group group="Add" i18n-label label="Add Call Numbers"
-      (onClick)="openHoldingEdit($event, true, false)">
+      (onClick)="openHoldingAdd($event, true, false)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
       i18n-group group="Add" i18n-label label="Add Items"
-      (onClick)="openHoldingEdit($event, false, true)">
+      (onClick)="openHoldingAdd($event, false, true)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
       i18n-group group="Add" i18n-label label="Add Call Numbers and Items"
-      (onClick)="openHoldingEdit($event, true, true)">
+      (onClick)="openHoldingAdd($event, true, true)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
@@ -146,17 +146,17 @@
 
     <eg-grid-toolbar-action
       i18n-group group="Edit" i18n-label label="Edit Call Numbers"
-      (onClick)="openHoldingEdit($event, true, false)">
+      (onClick)="openHoldingEdit($event, false, true)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
       i18n-group group="Edit" i18n-label label="Edit Call Numbers And Items"
-      (onClick)="openHoldingEdit($event, true, true)">
+      (onClick)="openHoldingEdit($event, false, false)">
     </eg-grid-toolbar-action>
 
     <eg-grid-toolbar-action
       i18n-group group="Edit" i18n-label label="Edit Items"
-      (onClick)="openHoldingEdit($event, false, true)">
+      (onClick)="openHoldingEdit($event, true, false)">
     </eg-grid-toolbar-action>
     
     <eg-grid-toolbar-action
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
index 0c529af341..46347e4915 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
@@ -607,6 +607,12 @@ export class HoldingsMaintenanceComponent implements OnInit {
         return this.selectedCopies(rows, skipStatus).map(c => Number(c.id()));
     }
 
+    selectedVolIds(rows: HoldingsEntry[]): number[] {
+        return rows
+            .filter(r => Boolean(r.callNum))
+            .map(r => Number(r.callNum.id()));
+    }
+
     selectedCopies(rows: HoldingsEntry[], skipStatus?: number): IdlObject[] {
         let copyRows = rows.filter(r => Boolean(r.copy)).map(r => r.copy);
         if (skipStatus) {
@@ -747,7 +753,32 @@ export class HoldingsMaintenanceComponent implements OnInit {
         .then(key => this.openAngJsWindow(`cat/printlabels/${key}`));
     }
 
-    openHoldingEdit(rows: HoldingsEntry[], addCallNums: boolean, addCopies: boolean) {
+    openHoldingEdit(rows: HoldingsEntry[], hideVols: boolean, hideCopies: boolean) {
+
+        // Avoid adding call number edit entries for call numbers
+        // that are already represented by selected items.
+
+        const copies = this.selectedCopies(rows);
+        const copyVols = copies.map(c => Number(c.call_number()));
+
+        const volIds = [];
+        this.selectedVolIds(rows).forEach(id => {
+            if (!copyVols.includes(id)) {
+                volIds.push(id);
+            }
+        });
+
+        this.holdings.spawnAddHoldingsUi(
+            this.recordId,
+            volIds,
+            null,
+            copies.map(c => Number(c.id())),
+            hideCopies,
+            hideVols
+        );
+    }
+
+    openHoldingAdd(rows: HoldingsEntry[], addCallNums: boolean, addCopies: boolean) {
 
         // The user may select a set of call numbers by selecting call
         // number and/or item rows.  Owning libs for new call numbers may
@@ -762,7 +793,10 @@ export class HoldingsMaintenanceComponent implements OnInit {
                 callNums.push(r.treeNode.parentNode.target);
 
             } else if (r.treeNode.nodeType === 'org') {
-                orgs[r.treeNode.target.id()] = true;
+                const org = r.treeNode.target;
+                if (org.ou_type().can_have_vols() === 't') {
+                    orgs[org.id()] = true;
+                }
             }
         });
 
@@ -789,7 +823,7 @@ export class HoldingsMaintenanceComponent implements OnInit {
             }
 
             this.holdings.spawnAddHoldingsUi(
-                this.recordId, null, entries, !addCopies);
+                this.recordId, null, entries, null, !addCopies);
         }
     }
 
diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.service.ts b/Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.service.ts
index 5c91a68474..f61d3d4192 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.service.ts
+++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.service.ts
@@ -26,26 +26,28 @@ export class HoldingsService {
 
     // Open the holdings editor UI in a new browser window/tab.
     spawnAddHoldingsUi(
-        recordId: number,               // Bib record ID
-        addToCallNums?: number[],       // Add copies to / modify existing CNs
-        callNumData?: NewCallNumData[], // Creating new call numbers
-        hideCopies?: boolean) {         // Hide the copy edit pane
+        recordId: number,                  // Bib record ID
+        editExistingCallNums?: number[],   // Add copies to / modify existing CNs
+        newCallNumData?: NewCallNumData[], // Creating new call numbers
+        editCopyIds?: number[],            // Edit existing items
+        hideCopies?: boolean,              // Hide the copy edit pane
+        hideVols?: boolean) {
 
         const raw: any[] = [];
 
-        if (addToCallNums) {
-            addToCallNums.forEach(callNumId => raw.push({callnumber: callNumId}));
-        } else if (callNumData) {
-            callNumData.forEach(data => raw.push(data));
+        if (editExistingCallNums) {
+            editExistingCallNums.forEach(
+                callNumId => raw.push({callnumber: callNumId}));
+        } else if (newCallNumData) {
+            newCallNumData.forEach(data => raw.push(data));
         }
 
-        if (raw.length === 0) { raw.push({}); }
-
         this.anonCache.setItem(null, 'edit-these-copies', {
             record_id: recordId,
             raw: raw,
-            hide_vols : false,
-            hide_copies : hideCopies ? true : false
+            copies: editCopyIds,
+            hide_vols : hideVols === true,
+            hide_copies : hideCopies === true
         }).then(key => {
             if (!key) {
                 console.error('Could not create holds cache key!');

commit 4231540b8ffbb2858ff557e1c596f6d1727594fb
Author: Bill Erickson <berickxx at gmail.com>
Date:   Mon May 11 15:10:37 2020 -0400

    LP1878079 Staffcat Add Call Nums honors selected orgs
    
    When adding new call numbers from the Angular staff catalog Holdings
    View grid, take all selected grid rows into consideration when
    determining how many call numbers to add and what their owning libs
    should be.
    
    To test:
    * Navigate to the Holdings View tab of a record detail page in the Angular
      staff catalog.
    * Select multiple rows in the grid which are org unit-only rows (i.e.
      the row does not refer to a specific call number or item).
    * From the action menu / right client menu, select "Add Callnumbers"
    * Confirm that a call number entry for each selected org unit is present
      in the spawned holdings editor.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Jane Sandberg <sandbej at linnbenton.edu>

diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
index bec07303be..0c529af341 100644
--- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
@@ -749,14 +749,20 @@ export class HoldingsMaintenanceComponent implements OnInit {
 
     openHoldingEdit(rows: HoldingsEntry[], addCallNums: boolean, addCopies: boolean) {
 
-        // The user may select a set of call numbers by selecting call number and/or
-        // copy rows.
+        // The user may select a set of call numbers by selecting call
+        // number and/or item rows.  Owning libs for new call numbers may
+        // also come from org unit row selection.
+        const orgs = {};
         const callNums = [];
         rows.forEach(r => {
             if (r.treeNode.nodeType === 'callNum') {
                 callNums.push(r.callNum);
+
             } else if (r.treeNode.nodeType === 'copy') {
                 callNums.push(r.treeNode.parentNode.target);
+
+            } else if (r.treeNode.nodeType === 'org') {
+                orgs[r.treeNode.target.id()] = true;
             }
         });
 
@@ -770,16 +776,15 @@ export class HoldingsMaintenanceComponent implements OnInit {
         } else if (addCallNums) {
             const entries = [];
 
-            if (callNums.length > 0) {
+            // Use selected call numbers as basis for new call numbers.
+            callNums.forEach(v =>
+                entries.push({label: v.label(), owner: v.owning_lib()}));
 
-                // 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 {
+            // Use selected org units as owning libs for new call numbers
+            Object.keys(orgs).forEach(id => entries.push({owner: id}));
 
-                // Otherwise create new call numbers from scratch.
+            if (entries.length === 0) {
+                // Otherwise create new call numbers for "here"
                 entries.push({owner: this.auth.user().ws_ou()});
             }
 

-----------------------------------------------------------------------

Summary of changes:
 .../app/staff/catalog/record/actions.component.ts  | 12 ++--
 .../staff/catalog/record/holdings.component.html   | 12 ++--
 .../app/staff/catalog/record/holdings.component.ts | 67 +++++++++++++++++-----
 .../app/staff/catalog/record/record.component.html |  5 +-
 .../app/staff/catalog/record/record.component.ts   | 28 +++++++++
 .../app/staff/share/holdings/holdings.service.ts   | 26 +++++----
 6 files changed, 109 insertions(+), 41 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list