LP1888723 Volcopy parts on demand; checkdigit preference
authorBill Erickson <berickxx@gmail.com>
Mon, 14 Sep 2020 18:43:25 +0000 (14:43 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Sun, 15 Aug 2021 23:55:29 +0000 (19:55 -0400)
Support creating monograph parts on the fly in the Angular holdings
editor.

Create a separate preference for controlling the visibility of the 'Use
Checkdigit' checkbox.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/cat/volcopy/config.component.html
Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html
Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts
Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.html
Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts

index ab8f41b..1fc031a 100644 (file)
               </div>
             </li>
             <li class="list-group-item">
+              <div class="form-check form-check-inline">
+                <input class="form-check-input" type="checkbox" 
+                  id="hide-use_checkdigit-column" 
+                  [(ngModel)]="volcopy.defaults.hidden.use_checkdigit">
+                <label class="form-check-label" for="hide-use_checkdigit-column" i18n>
+                  Hide Use Checkdigit
+                </label>
+              </div>
+            </li>
+            <li class="list-group-item">
               <!--
                 Copy_number_vc distinguishes from copy_number so the field
                 can appear in the volcopy UI and/or attr editor independently.
index c846598..5926461 100644 (file)
           </ng-container>
         </div>
         <div class="p-1" [ngStyle]="{flex: flexAt(10)}">
-          <ng-container *ngIf="displayColumn('copy_part')">
-            <ng-container *ngIf="!recordHasParts(volNode.target.record())">
-              <label i18n>N/A</label>
-            </ng-container>
-            <ng-container *ngIf="recordHasParts(volNode.target.record())">
-              <eg-combobox
-                [selectedId]="copyNode.target.parts()[0] ? copyNode.target.parts()[0].id() : null"
-                [smallFormControl]="true"
-                (onChange)="copyPartChanged(copyNode, $event)">
-                <eg-combobox-entry 
-                  *ngFor="let part of volcopy.bibParts[volNode.target.record()]"
-                  [entryId]="part.id()" [entryLabel]="part.label()">
-                </eg-combobox-entry>
-              </eg-combobox>
-            </ng-container>
+        <ng-container *ngIf="displayColumn('copy_part')">
+            <eg-combobox
+              [selectedId]="copyNode.target.parts()[0] ? copyNode.target.parts()[0].id() : null"
+              [smallFormControl]="true" [allowFreeText]="true"
+              (onChange)="copyPartChanged(copyNode, $event)">
+              <eg-combobox-entry 
+                *ngFor="let part of volcopy.bibParts[volNode.target.record()]"
+                [entryId]="part.id()" [entryLabel]="part.label()">
+              </eg-combobox-entry>
+            </eg-combobox>
           </ng-container>
         </div>
         <div class="p-1" [ngStyle]="{flex: flexAt(11)}">
index f12dae1..7dddc63 100644 (file)
@@ -238,12 +238,22 @@ export class VolEditComponent implements OnInit {
 
         if (entry) {
 
-            const newPart =
-                this.volcopy.bibParts[copy.call_number().record()]
-                .filter(p => p.id() === entry.id)[0];
+            let newPart;
+            if (entry.freetext) {
+                newPart = this.idl.create('bmp');
+                newPart.isnew(true);
+                newPart.record(copy.call_number().record());
+                newPart.label(entry.label);
 
-            // Nothing to change?
-            if (part && part.id() === newPart.id()) { return; }
+            } else {
+
+                newPart =
+                    this.volcopy.bibParts[copy.call_number().record()]
+                    .filter(p => p.id() === entry.id)[0];
+
+                // Nothing to change?
+                if (part && part.id() === newPart.id()) { return; }
+            }
 
             copy.parts([newPart]);
             copy.ischanged(true);
index ccb5e5b..fc25423 100644 (file)
             i18n>Print Labels?</label>                                             
         </div>
 
-        <ng-container *ngIf="tab === 'holdings' && 
-          volcopy.defaults.hidden.generate_barcodes !== true">
+        <ng-container *ngIf="tab === 'holdings'">
           <!-- 
             These actions could cause confusion or unintended
             consequences if visible on any other tabs
           -->
-          <div class="form-check form-check-inline">
-            <input class="form-check-input" type="checkbox" id="use-checkdigit" 
-              (change)="toggleCheckbox('use_checkdigit')"
-              [ngModel]="volcopy.defaults.values.use_checkdigit"/>
-            <label class="form-check-label" for="use-checkdigit" i18n>
-              Use Checkdigit
-            </label>
-          </div>
-          <button class="btn btn-sm btn-outline-dark label-with-material-icon"
-            (click)="volcopy.genBarcodesRequested.emit()">
-            <span i18n>Generate Barcodes</span>
-            <span class="material-icons">refresh</span>
-          </button>
+          <ng-container *ngIf="volcopy.defaults.hidden.use_checkdigit !== true">
+            <div class="form-check form-check-inline">
+              <input class="form-check-input" type="checkbox" id="use-checkdigit" 
+                (change)="toggleCheckbox('use_checkdigit')"
+                [ngModel]="volcopy.defaults.values.use_checkdigit"/>
+              <label class="form-check-label" for="use-checkdigit" i18n>
+                Use Checkdigit
+              </label>
+            </div>
+          </ng-container>
+          <ng-container *ngIf="volcopy.defaults.hidden.generate_barcodes !== true">
+            <button class="btn btn-sm btn-outline-dark label-with-material-icon"
+              (click)="volcopy.genBarcodesRequested.emit()">
+              <span i18n>Generate Barcodes</span>
+              <span class="material-icons">refresh</span>
+            </button>
+          </ng-container>
         </ng-container>
 
         <div class="flex-1"> </div>
index 7d065ec..8f3559f 100644 (file)
@@ -406,8 +406,8 @@ export class VolCopyService {
 
         if (recordIds.length === 0) { return; }
 
-        // Avoid doubling up
-        if (this.bibParts[recordIds[0]]) { return; }
+        // All calls fetch updated data since we may be creating
+        // new mono parts during editing.
 
         this.pcrud.search('bmp',
             {record: recordIds, deleted: 'f'})