From 735c47c2cc6bce7f039b079dfb8ab64ce3d3045b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 3 Jan 2020 15:41:03 -0500 Subject: [PATCH] LPLP1835982 Holds grid user barcode text generator; handle null Adds a new text generator for the patron barcode template in the staff catalog holds grid. Also adds a name field to the to support the text generator. Teach the cell text generator internals to translate undefined and null values to '' so generator authors don't have to. Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg --- Open-ILS/src/eg2/src/app/share/grid/grid.ts | 3 ++- Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html | 2 +- Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid.ts b/Open-ILS/src/eg2/src/app/share/grid/grid.ts index 59baa63ef4..e4f6715ef6 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid.ts +++ b/Open-ILS/src/eg2/src/app/share/grid/grid.ts @@ -822,7 +822,8 @@ export class GridContext { getColumnTextContent(row: any, col: GridColumn): string { if (this.columnHasTextGenerator(col)) { - return this.cellTextGenerator[col.name](row); + const str = this.cellTextGenerator[col.name](row); + return (str === null || str === undefined) ? '' : str; } else { if (col.cellTemplate) { return ''; // avoid 'undefined' values diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html index b3c7705b36..7e44d6a9fa 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.html @@ -100,7 +100,7 @@ {{hold.ucard_barcode}} - diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts index 666a4f9329..ff2514919e 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts @@ -148,7 +148,8 @@ export class HoldsGridComponent implements OnInit { // Text-ify function for cells that use display templates. this.cellTextGenerator = { title: row => row.title, - cp_barcode: row => (row.cp_barcode == null) ? '' : row.cp_barcode + cp_barcode: row => (row.cp_barcode == null) ? '' : row.cp_barcode, + patron_barcode: row => row.ucard_barcode }; } -- 2.43.2