Improve the regex to account for linefeeds in multi-subfield ISSN tags
authordbs <dbs@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 12 Nov 2009 17:04:32 +0000 (17:04 +0000)
committerdbs <dbs@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 12 Nov 2009 17:04:32 +0000 (17:04 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/trunk@715 6d9bc8c9-1ec2-4278-b937-99fde70a366f

web/opac/skin/lul/xml/rdetail/rdetail_summary.xml

index 7283b3e..114f50c 100644 (file)
                                    <script type='opac/slot-format'><![CDATA[
                                        unHideMe($('tag022'));
                                        var issn_raw = dojo.trim(dojox.data.dom.textContent(item));
-                                       var issn = issn_raw.replace(/^.*?(\d{4}).(\d{3}(\d|x)).*?$/i, "$1-$2");
+                                       // textContent returns multiple subfields concatenated with linefeeds,
+                                       // so our regex needs to match against linefeeds. "." does not match
+                                       // linefeeds, so get \s into the mix
+                                        var issn = issn_raw.replace(/^(\s|.)*?(\d{4}).(\d{3,4}[xX]?)(\s|.)*/, "$2-$3");
+
                                        var ses = new OpenSRF.ClientSession('open-ils.resolver');       
                                        var req = ses.request('open-ils.resolver.resolve_holdings.raw', 'issn', issn);  
                                        req.oncomplete = function(r) {