PHP XMLOPAC Class update

Another update to the III XMLOPAC class. The function get_opac_data() now returns the number of holds a bib-item has. Originally I thought this wasn’t going to be possible since I didn’t see anything overtly obvious in the XML result set, but I did see a bunch of weird “HOLD” elements with a lot of useless associated data. My hunch was that each one of these represented a bib-level hold, and I was right! Anyway, by tallying the number of these hold objects in the XML, I was able to determine the number of holds for that record.

Incidentally, this is what the nonsense looks like to SimpleXML:

[21] => SimpleXMLElement Object (
   [VARFLDPRIMARY] => SimpleXMLElement Object ( 
    [VARFLD] => SimpleXMLElement Object (
       [HEADER] => SimpleXMLElement Object ( 
        [TAG] => 8
        [NAME] => HOLD 
        [LABEL] => Hold 
        [SEQUENCENUM] => 12
      )
      [DisplayForm] => SimpleXMLElement Object ( )
      [RTL] => 0
      [FIELDDATA] => SimpleXMLElement Object ( )
    )
  )
)

What a mess. Anyway, it’s workable, the number of holds is now passed back, keyed by “holds”. If there are no holds, there will be no holds key in the result.


About this entry