throw out NaN data for numeric fields, do not let them become null. user/lew/3_9_1_volcopy_template_glitch
authorLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Tue, 17 Jan 2023 19:57:53 +0000 (14:57 -0500)
committerLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Tue, 17 Jan 2023 19:57:53 +0000 (14:57 -0500)
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts

index 832e4cb..a9409a9 100644 (file)
@@ -294,10 +294,7 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
                     !this.copyWantsChange(copy, field, changeSelection)) {
                     return;
                 }
-                               if(!value)
-                                       copy[field](null);
-                               else
-                                       copy[field](value);
+                               copy[field](value);
                 copy.ischanged(true);
             });
         }
@@ -605,9 +602,12 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
                 promise = this.volcopy.getLocation(value);
             }
                        
-                       if ((field === 'cost' || field === 'price' || field === 'deposit_amount') && value){
+                       if ((field === 'cost' || field === 'price' || field === 'deposit_amount')){
                                // Make sure monetary fields are properly cast as numeric values
-                               promise = Promise.resolve(Number(value));
+                               // and discard if no cast possible.
+                               let n = Number(value);
+                               if(isNaN(n)){return;}
+                               promise = Promise.resolve(n);
                        }
 
             promise.then(val => {