cast cost, price, deposit as numeric when they have a value in the template. When...
authorLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Wed, 23 Nov 2022 18:50:04 +0000 (13:50 -0500)
committerLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Wed, 23 Nov 2022 19:12:06 +0000 (14:12 -0500)
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts

index e5f08be..832e4cb 100644 (file)
@@ -294,8 +294,10 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
                     !this.copyWantsChange(copy, field, changeSelection)) {
                     return;
                 }
-
-                copy[field](value);
+                               if(!value)
+                                       copy[field](null);
+                               else
+                                       copy[field](value);
                 copy.ischanged(true);
             });
         }
@@ -602,6 +604,11 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
                 // May be a 'remote' location.  Fetch as needed.
                 promise = this.volcopy.getLocation(value);
             }
+                       
+                       if ((field === 'cost' || field === 'price' || field === 'deposit_amount') && value){
+                               // Make sure monetary fields are properly cast as numeric values
+                               promise = Promise.resolve(Number(value));
+                       }
 
             promise.then(val => {
                 this.applyCopyValue(field, val);