From: Bill Erickson Date: Mon, 4 Mar 2013 15:48:12 +0000 (-0500) Subject: Import bib trash fields : XUL Z39.50 UI X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3335c54783c03cb6e6e31d26e79f22cd4adb0e0c;p=contrib%2FConifer.git Import bib trash fields : XUL Z39.50 UI In the Z39.50 staff search interface, staff may now select from optional MARC trash field groups (within the org unit range) to be applied to incoming Z39.50 records. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index a02e3ea847..47cf83da50 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -3037,6 +3037,7 @@ + diff --git a/Open-ILS/xul/staff_client/server/cat/z3950.js b/Open-ILS/xul/staff_client/server/cat/z3950.js index cf78b115c8..07763b2f79 100644 --- a/Open-ILS/xul/staff_client/server/cat/z3950.js +++ b/Open-ILS/xul/staff_client/server/cat/z3950.js @@ -33,6 +33,8 @@ cat.z3950.prototype = { obj.load_creds(); + buildStripTags(); + JSAN.use('circ.util'); var columns = circ.util.columns( { @@ -781,7 +783,19 @@ cat.z3950.prototype = { function save_marc (new_marcxml) { try { - var r = obj.network.simple_request('MARC_XML_RECORD_IMPORT', [ ses(), new_marcxml, biblio_source ]); + + // extract the import strip groups + var strip_grps = dojo.query('[strip-fields-cbox]').filter( + function(grp) { return grp.checked }).map( + function(grp) { return grp.getAttribute('value') }); + + var r = obj.network.simple_request( + 'MARC_XML_RECORD_IMPORT', [ + ses(), new_marcxml, biblio_source, + null, null, strip_grps + ] + ); + if (typeof r.ilsevent != 'undefined') { switch(Number(r.ilsevent)) { case 1704 /* TCN_EXISTS */ : @@ -809,7 +823,10 @@ cat.z3950.prototype = { obj.error.sdump('D_ERROR','option ' + p + 'chosen'); switch(p) { case 0: - var r3 = obj.network.simple_request('MARC_XML_RECORD_UPDATE', [ ses(), r.payload.dup_record, new_marcxml, biblio_source ]); + var r3 = obj.network.simple_request('MARC_XML_RECORD_UPDATE', [ + ses(), r.payload.dup_record, + new_marcxml, biblio_source, null, strip_grps + ]); if (typeof r3.ilsevent != 'undefined') { throw(r3); } else { @@ -830,7 +847,7 @@ cat.z3950.prototype = { var r2 = obj.network.request( api.MARC_XML_RECORD_IMPORT.app, api.MARC_XML_RECORD_IMPORT.method + '.override', - [ ses(), new_marcxml, biblio_source ] + [ ses(), new_marcxml, biblio_source, null, null, strip_grps ] ); if (typeof r2.ilsevent != 'undefined') { throw(r2); @@ -950,7 +967,14 @@ cat.z3950.prototype = { function overlay_marc (new_marcxml) { try { if (! obj.confirm_overlay( [ obj.data.marked_record ] ) ) { return; } - var r = obj.network.simple_request('MARC_XML_RECORD_REPLACE', [ ses(), obj.data.marked_record, new_marcxml, biblio_source ]); + + var strip_grps = dojo.query('[strip-fields-cbox]').filter( + function(grp) { return grp.checked }).map( + function(grp) { return grp.getAttribute('value') }); + + var r = obj.network.simple_request('MARC_XML_RECORD_REPLACE', + [ ses(), obj.data.marked_record, new_marcxml, biblio_source, null, strip_grps ]); + if (typeof r.ilsevent != 'undefined') { switch(Number(r.ilsevent)) { case 1704 /* TCN_EXISTS */ : @@ -979,7 +1003,8 @@ cat.z3950.prototype = { var r2 = obj.network.request( api.MARC_XML_RECORD_REPLACE.app, api.MARC_XML_RECORD_REPLACE.method + '.override', - [ ses(), obj.data.marked_record, new_marcxml, biblio_source ] + [ ses(), obj.data.marked_record, new_marcxml, + biblio_source, null, strip_grps ] ); if (typeof r2.ilsevent != 'undefined') { throw(r2); @@ -1155,4 +1180,49 @@ cat.z3950.prototype = { }, } +function buildStripTags() { + + // give me every non-always-apply trash field + // group owned at my workstation or ancestor, + var query = { + always_apply : 'f', + owner : {'in' : { + select : {aou : [{ + column : 'id', + transform : 'actor.org_unit_ancestors', + result_field : 'id' + }]}, + from : 'aou', + where : {id : ses('ws_ou')}} + } + }; + + fieldmapper.standardRequest( + ['open-ils.pcrud', 'open-ils.pcrud.search.vibtg.atomic'], + { async : true, + params : [ses(), query, {order_by : {vibtg : ['label']}}], + oncomplete : function(r) { + var resp = r.recv(); + if (resp) buildStripTags2(resp.content()); + } + } + ); +} + +function buildStripTags2(grps) { + if (!grps || grps.length == 0) return; + + $('strip-fields-hbox').className = ''; + + dojo.forEach(grps, function(grp) { + var cbox = dojo.create('checkbox', { + label : grp.label(), + value : grp.id(), + 'strip-fields-cbox' : 1 + }); + dojo.place(cbox, $('strip-fields-hbox')); + }); +} + + dump('exiting cat.z3950.js\n'); diff --git a/Open-ILS/xul/staff_client/server/cat/z3950.xul b/Open-ILS/xul/staff_client/server/cat/z3950.xul index 7c02ef465f..5f8b217cdd 100644 --- a/Open-ILS/xul/staff_client/server/cat/z3950.xul +++ b/Open-ILS/xul/staff_client/server/cat/z3950.xul @@ -166,6 +166,10 @@ + +