Skip to content

Commit

Permalink
Support alternative call number parts
Browse files Browse the repository at this point in the history
Expose the individual parsed alternative call number parts for inclusion in a label template. GitHub issue #132.
  • Loading branch information
mgobat committed Sep 20, 2024
1 parent 56152f6 commit 5db0f0f
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
13 changes: 12 additions & 1 deletion cloudapp/src/app/models/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

]
32 changes: 28 additions & 4 deletions cloudapp/src/app/print/print.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 " <BR>";
else
return '';
}
if (detail.substring(22) - 1 < altCallNoVal.length)
return this.getCallNoPart(altCallNoVal, detail.substring (22) - 1);
else {
if (this.template.blankFields)
return " <BR>";
else
return '';
}
case 'holdings_data.due_back_date:':
case 'item_data.arrival_date':
case 'item_data.expected_arrival_date':
Expand Down Expand Up @@ -226,14 +251,13 @@ export class PrintComponent implements OnInit {

getCallNoPart(val: Array<string>, part_number) {
if (val[part_number] != undefined) {
if (this.template.blankFields && val[part_number] == '') {
return " <BR>";
}
if (this.template.blankFields && val[part_number] == '')
return "<BR>";
return val[part_number];
}
else {
if (this.template.blankFields) {
return " <BR>";
return "<BR>";
}
else
return '';
Expand Down
10 changes: 10 additions & 0 deletions cloudapp/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
10 changes: 10 additions & 0 deletions cloudapp/src/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "索书号匹配项(正则表达式)",
Expand Down

0 comments on commit 5db0f0f

Please sign in to comment.