The Authority Control Set code expects the format of subfields
that it will be used to build a MARC.Field object to be of the
form: [[code,value],...] This commit makes that true.
Additionally, dojo.filter over a list of lists can cause the
nested array set to be flattened. So, instead, we loop directly.
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
var b_field = this.bibFieldByTag(field.tag);
if (b_field) { // construct an marc authority record
- af = b_field.authority_field();
+ var af = b_field.authority_field();
+
+ var sflist = [];
+ for (var i = 0; i < field.subfields.length; i++) {
+ if (af.sf_list().indexOf(field.subfields[i][0]) > -1) {
+ sflist.push(field.subfields[i]);
+ }
+ }
+
var m = new MARC.Record ({rtype:'AUT'});
m.appendFields(
new MARC.Field ({
tag : af.tag(),
ind1: field.ind1,
ind2: field.ind2,
- subfields: [dojo.filter(
- field.subfields,
- function (sf) { return (af.sf_list().indexOf(sf[0]) > -1) }
- )]
+ subfields: sflist
})
);
var sf_list = [];
for (var j = 0; j < subfields.length; j++) {
var sf = subfields[j];
- sf_list.push( sf.childNodes[1].value );
- sf_list.push( sf.childNodes[2].value );
+ sf_list.push( [ sf.childNodes[1].value, sf.childNodes[2].value ] );
}
var matches = acs.findMatchingAuthorities(