From 28bd2d6185eb8b22d6071077d4391d61c6df9422 Mon Sep 17 00:00:00 2001 From: Llewellyn Marshall Date: Wed, 23 Nov 2022 13:50:04 -0500 Subject: [PATCH] cast cost, price, deposit as numeric when they have a value in the template. When they don't have a value, nullify the holding's field when template is applied. --- .../src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts index e5f08bebdf..832e4cbfbd 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts @@ -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); -- 2.11.0