From: Llewellyn Marshall Date: Wed, 23 Nov 2022 18:50:04 +0000 (-0500) Subject: cast cost, price, deposit as numeric when they have a value in the template. When... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=28bd2d6185eb8b22d6071077d4391d61c6df9422;p=working%2FEvergreen.git 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. --- 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);