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

Evergreen Git git at git.evergreen-ils.org
Thu May 14 17:25:55 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  e268dedf139e42797f1ae4f4df24bd6bea6a07a5 (commit)
      from  9f0fe2cbc7d94e559a52d32ca1bc60cb9321ec3c (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 e268dedf139e42797f1ae4f4df24bd6bea6a07a5
Author: Bill Erickson <berickxx at gmail.com>
Date:   Wed May 13 10:22:02 2020 -0400

    LP1847800 fm-editor defaultNewRecord backport
    
    Backport the defaultNewRecord option for the fm-editor and auto admin
    pages to support new record creation based on grid filters.
    
    This feature was originally part of LP1840287 which was not backported
    to 3.4
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
index 2d9271830e..bed3d861b4 100644
--- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
+++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
@@ -100,6 +100,9 @@ export class FmRecordEditorComponent
     // behaviour for each field (by field name).
     @Input() fieldOptions: {[fieldName: string]: FmFieldOptions} = {};
 
+    // This is used to set default values when making a new record
+    @Input() defaultNewRecord: IdlObject;
+
     // list of fields that should not be displayed
     @Input() hiddenFieldsList: string[] = [];
     @Input() hiddenFields: string; // comma-separated string version
@@ -356,8 +359,16 @@ export class FmRecordEditorComponent
         //
         // Create a new record from the stub record provided by the
         // caller or a new from-scratch record
-        // Set this._record (not this.record) to avoid loop in initRecord()
-        this._record = this.record || this.idl.create(this.idlClass);
+        if (!this.record) {
+            // NOTE: Set this._record (not this.record) to avoid
+            // loop in initRecord()
+            if (this.defaultNewRecord) {
+                // Clone to avoid polluting the stub record
+                this._record = this.idl.clone(this.defaultNewRecord);
+            } else {
+                this._record = this.idl.create(this.idlClass);
+            }
+        }
         this._recordId = null; // avoid future confusion
 
         return this.getFieldList();
diff --git a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
index 00bc67a47b..09c15579d9 100644
--- a/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
+++ b/Open-ILS/src/eg2/src/app/staff/share/admin-page/admin-page.component.html
@@ -48,7 +48,7 @@
 </eg-grid>
 
 <eg-fm-record-editor #editDialog idlClass="{{idlClass}}" 
-    [fieldOptions]="fieldOptions"
+    [fieldOptions]="fieldOptions" [defaultNewRecord]="defaultNewRecord"
     [preloadLinkedValues]="true" readonlyFields="{{readonlyFields}}">
 </eg-fm-record-editor>
 

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

Summary of changes:
 .../eg2/src/app/share/fm-editor/fm-editor.component.ts    | 15 +++++++++++++--
 .../app/staff/share/admin-page/admin-page.component.html  |  2 +-
 2 files changed, 14 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list