[open-ils-commits] [GIT] Evergreen ILS branch rel_3_4 updated. 8ed4dce43fadcfe0dbbb38f8a34c3259101fb82c

Evergreen Git git at git.evergreen-ils.org
Tue Jul 28 09:31:27 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, rel_3_4 has been updated
       via  8ed4dce43fadcfe0dbbb38f8a34c3259101fb82c (commit)
       via  4a6f6153a5d36b1db9b3f3486c8032406d27b759 (commit)
       via  92ef6cc3fb080486ce90e512a9d25e04fe4b965b (commit)
      from  e0b6a271e23b9b3ebcf4d0e3cda44d615ac33681 (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 8ed4dce43fadcfe0dbbb38f8a34c3259101fb82c
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 2e3e2ad302..7f0905efc3 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;
@@ -83,14 +86,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 f96bb3adb8..cb39360ecf 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
@@ -36,7 +36,7 @@ import {MakeBookableDialogComponent
 
 // 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;
@@ -56,7 +56,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 db13bb0e2f..5079956d69 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
@@ -15,7 +15,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>
@@ -69,7 +70,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 e397444819..b9e6dcad15 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,12 +3,17 @@ 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';
 import {StaffCatalogService} from '../catalog.service';
 import {BibSummaryComponent} from '@eg/staff/share/bib-summary/bib-summary.component';
 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',
@@ -21,15 +26,21 @@ export class RecordComponent implements OnInit {
     summary: BibRecordSummary;
     searchContext: CatalogSearchContext;
     @ViewChild('recordTabs') recordTabs: NgbTabset;
+
+    @ViewChild('holdingsMaint')
+        holdingsMaint: HoldingsMaintenanceComponent;
+
     defaultTab: string; // eg.cat.default_record_tab
 
     constructor(
         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
     ) {}
 
@@ -115,6 +126,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 4a6f6153a5d36b1db9b3f3486c8032406d27b759
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 bed7a4e149..4ba485c90a 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
@@ -96,17 +96,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
@@ -140,17 +140,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 cf20449f5a..f96bb3adb8 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
@@ -592,12 +592,22 @@ export class HoldingsMaintenanceComponent implements OnInit {
 
     // Which copies in the grid are selected.
     selectedCopyIds(rows: HoldingsEntry[], skipStatus?: number): number[] {
+        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) {
             copyRows = copyRows.filter(
                 c => Number(c.status().id()) !== Number(skipStatus));
         }
-        return copyRows.map(c => Number(c.id()));
+        return copyRows;
     }
 
     selectedCallNumIds(rows: HoldingsEntry[]): number[] {
@@ -725,7 +735,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
@@ -740,7 +775,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;
+                }
             }
         });
 
@@ -767,7 +805,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 3c703e6373..bb11b1ffb0 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
@@ -24,26 +24,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 92ef6cc3fb080486ce90e512a9d25e04fe4b965b
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 a8022d5f59..cf20449f5a 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
@@ -727,14 +727,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;
             }
         });
 
@@ -748,16 +754,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 | 73 +++++++++++++++++-----
 .../app/staff/catalog/record/record.component.html |  5 +-
 .../app/staff/catalog/record/record.component.ts   | 30 +++++++++
 .../app/staff/share/holdings/holdings.service.ts   | 26 ++++----
 6 files changed, 116 insertions(+), 42 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list