Posted by melmore on May 13, 2008 at 7:48pm
Jump to:
| Project: | Millennium OPAC Integration |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | janusman |
| Status: | closed (fixed) |
Issue Summary
when I try to import records I get the following error:
Import error: Could not get bib_recnum for item #i1332605
I sleuthed around in the code a bit and it looks like the problem my be here:
#<div class="bibRecordLink"><a id="recordnum" href="/record=b156849*spi"></a></div>
$ok=preg_match('/<a id="recordnum" href="\/record=(b[0-9]+)/si', $record_html, $matches);
if (!$ok) {
return array("success" => false, "error" => "Could not get bib_recnum for item #$item_recnum");
}In my catalog, the recordlink token outputs the permalink in this format instead:
<div class="bibRecordLink"><a id="recordnum" href="http://catalog.crl.edu:80/record=b1000001">Bookmark this title</a></div>
Comments
#1
Quick fix, for now replace this line in millennium.module:
$ok=preg_match('/<a id="recordnum" href="\/record=(b[0-9]+)/si', $record_html, $matches);with this one
$ok=preg_match('/<a id="recordnum" href=".*?\/record=(b[0-9]+)/si', $record_html, $matches);I will post this to DEV soon.
Good luck!
PS: I'd appreciate a link to your OPAC, and Drupal test site if possible =)
#2
Fixed in DEV.
#3
Automatically closed -- issue fixed for two weeks with no activity.
#4
I've encountered a similar problem. I'm getting the same error:
Import error: Could not get bib_recnum for item #i1000050
I looked around in the module code but I confess I'm in over my head trying to figure out where the problem lies. I suspect our catalog HTML has been quite modified from the default WebPAC.
I'm afraid the site on which I've installed this isn't accessible off-campus (yet) but here is our catalog:
http://consort.library.denison.edu/
I can see that our item records are different from those on other sites such as the CRL catalog. We don't use what I take to be the default HTML for presenting persistent links to the item. For one thing, our persistent links aren't actually links at all:
Persistent link to this record: http://consort.library.denison.edu/record=b2343785~S6a
Another difference is that the surrounding div tag doesn't have id="recordnum".
If this is the problem, I suppose I'll have to tweak the code to deal with how we render our persistent links or talk our administrator into changing the HTML that renders the persistent link url. Does this appear correct to you?
#5
I edited the module code to accept the markup surrounding our persistent links. It's not pretty, but it works, which is good enough for now.
#6
Sorry for not answering in a while, on holiday =)
I guess looking to find ANY text in the HTML with record=bxxxxxx will solve the problem! So, again, a quick fix for now would be replacing this line in millennium.module:
$ok=preg_match('/<a id="recordnum" href="\/record=(b[0-9]+)/si', $record_html, $matches);with this one
$ok=preg_match('/\/record=(b[0-9]+)/si', $record_html, $matches);Can you try this?
#7
I've changed the code to just look for the string record=bXXXXX anywhere inside the HTML of a record, and it seems to work.
I've posted the change to DEV.
#8
Automatically closed -- issue fixed for two weeks with no activity.