From 5db0f0fedc3dd5dad169cc7744f739a6a2fb8b8a Mon Sep 17 00:00:00 2001 From: mgobat <45852490+mgobat@users.noreply.github.com> Date: Fri, 20 Sep 2024 07:27:25 -0500 Subject: [PATCH] Support alternative call number parts Expose the individual parsed alternative call number parts for inclusion in a label template. GitHub issue #132. --- cloudapp/src/app/models/item.ts | 13 ++++++++- cloudapp/src/app/print/print.component.ts | 32 ++++++++++++++++++++--- cloudapp/src/i18n/en.json | 10 +++++++ cloudapp/src/i18n/zh.json | 10 +++++++ 4 files changed, 60 insertions(+), 5 deletions(-) diff --git a/cloudapp/src/app/models/item.ts b/cloudapp/src/app/models/item.ts index 9faf042..ee58770 100644 --- a/cloudapp/src/app/models/item.ts +++ b/cloudapp/src/app/models/item.ts @@ -45,5 +45,16 @@ export const LABEL_FIELDS = [ 'item_data.call_no_7', 'item_data.call_no_8', 'item_data.call_no_9', - 'item_data.call_no_10' + 'item_data.call_no_10', + 'item_data.alt_call_no_1', + 'item_data.alt_call_no_2', + 'item_data.alt_call_no_3', + 'item_data.alt_call_no_4', + 'item_data.alt_call_no_5', + 'item_data.alt_call_no_6', + 'item_data.alt_call_no_7', + 'item_data.alt_call_no_8', + 'item_data.alt_call_no_9', + 'item_data.alt_call_no_10' + ] \ No newline at end of file diff --git a/cloudapp/src/app/print/print.component.ts b/cloudapp/src/app/print/print.component.ts index 9dd5bb5..1c0f670 100644 --- a/cloudapp/src/app/print/print.component.ts +++ b/cloudapp/src/app/print/print.component.ts @@ -153,6 +153,31 @@ export class PrintComponent implements OnInit { //else return ''; } + case 'item_data.alt_call_no_1': + case 'item_data.alt_call_no_2': + case 'item_data.alt_call_no_3': + case 'item_data.alt_call_no_4': + case 'item_data.alt_call_no_5': + case 'item_data.alt_call_no_6': + case 'item_data.alt_call_no_7': + case 'item_data.alt_call_no_8': + case 'item_data.alt_call_no_9': + case 'item_data.alt_call_no_10': + const altCallNoVal = dot.pick('item_data.alt_call_no', item); + if (!altCallNoVal || !Array.isArray(altCallNoVal)) { + if (this.template.blankFields) + return "
"; + else + return ''; + } + if (detail.substring(22) - 1 < altCallNoVal.length) + return this.getCallNoPart(altCallNoVal, detail.substring (22) - 1); + else { + if (this.template.blankFields) + return "
"; + else + return ''; + } case 'holdings_data.due_back_date:': case 'item_data.arrival_date': case 'item_data.expected_arrival_date': @@ -226,14 +251,13 @@ export class PrintComponent implements OnInit { getCallNoPart(val: Array, part_number) { if (val[part_number] != undefined) { - if (this.template.blankFields && val[part_number] == '') { - return "
"; - } + if (this.template.blankFields && val[part_number] == '') + return "
"; return val[part_number]; } else { if (this.template.blankFields) { - return "
"; + return "
"; } else return ''; diff --git a/cloudapp/src/i18n/en.json b/cloudapp/src/i18n/en.json index 0064309..2a51a9f 100644 --- a/cloudapp/src/i18n/en.json +++ b/cloudapp/src/i18n/en.json @@ -145,6 +145,16 @@ "item_data.call_no_8":"Parsed call number part eight", "item_data.call_no_9":"Parsed call number part nine", "item_data.call_no_10":"Parsed call number part ten", + "item_data.alt_call_no_1":"Parsed alt call number part one", + "item_data.alt_call_no_2":"Parsed alt call number part two", + "item_data.alt_call_no_3":"Parsed alt call number part three", + "item_data.alt_call_no_4":"Parsed alt call number part four", + "item_data.alt_call_no_5":"Parsed alt call number part five", + "item_data.alt_call_no_6":"Parsed alt call number part six", + "item_data.alt_call_no_7":"Parsed alt call number part seven", + "item_data.alt_call_no_8":"Parsed alt call number part eight", + "item_data.alt_call_no_9":"Parsed alt call number part nine", + "item_data.alt_call_no_10":"Parsed alt call number part ten", "dateFormat":"Date format", "dateSeparator":"Date separator character", "pattern": "Call number pattern (Reg Exp)", diff --git a/cloudapp/src/i18n/zh.json b/cloudapp/src/i18n/zh.json index 50c207e..c975224 100644 --- a/cloudapp/src/i18n/zh.json +++ b/cloudapp/src/i18n/zh.json @@ -145,6 +145,16 @@ "item_data.call_no_8":"解析过的索书号第八部分", "item_data.call_no_9":"解析过的索书号第九部分", "item_data.call_no_10":"解析过的索书号第十部分", + "item_data.alt_call_no_1":"Parsed alt call number part one", + "item_data.alt_call_no_2":"Parsed alt call number part two", + "item_data.alt_call_no_3":"Parsed alt call number part three", + "item_data.alt_call_no_4":"Parsed alt call number part four", + "item_data.alt_call_no_5":"Parsed alt call number part five", + "item_data.alt_call_no_6":"Parsed alt call number part six", + "item_data.alt_call_no_7":"Parsed alt call number part seven", + "item_data.alt_call_no_8":"Parsed alt call number part eight", + "item_data.alt_call_no_9":"Parsed alt call number part nine", + "item_data.alt_call_no_10":"Parsed alt call number part ten", "dateFormat":"日期格式", "dateSeparator":"日期分隔符", "pattern": "索书号匹配项(正则表达式)",