Skip to content

Commit 4fd3825

Browse files
committed
support certificate number in record metadata
1 parent 2fc2e32 commit 4fd3825

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

gx-view.js

+20
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ function buildRecordUI(doc, url, editHooks) {
169169
}
170170
}
171171

172+
let certificateNumber = findRecordNumber(doc);
173+
if (certificateNumber) {
174+
recordMetadata["Certificate Number"] = certificateNumber;
175+
}
176+
172177
let hookToEditRecordMetadata = null;
173178
let hookToCopyRecordMetadata = null;
174179
if (editHooks.editRecordMetadata) {
@@ -200,6 +205,21 @@ function buildRecordUI(doc, url, editHooks) {
200205
return record;
201206
}
202207

208+
function findRecordNumber(doc) {
209+
if (doc.fields) {
210+
for (let field of doc.fields) {
211+
if (field.type === "http://familysearch.org/types/fields/SourceCertificateType"
212+
|| field.type === "http://familysearch.org/types/fields/SourceCertificateNbr"
213+
|| field.type === "http://familysearch.org/types/fields/SourceEntryNbr") {
214+
if (field.values && field.values.length > 0) {
215+
return field.values[0].text;
216+
}
217+
}
218+
}
219+
}
220+
return null;
221+
}
222+
203223
function isSour(doc) {
204224
if (doc.fields) {
205225
for (let field of doc.fields) {

0 commit comments

Comments
 (0)