From 55bc5787ba3e68ae7e130866f95e70af6b98c6d8 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 8 Jun 2009 15:37:22 +0200 Subject: [PATCH] ZOOM_record_get only returns OPAC record if present --- NEWS | 4 ++++ doc/zoom.xml | 8 ++++++-- src/zoom-c.c | 7 ++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index d7d2c8b..13cb222 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +ZOOM_record_get now renders OPAC records when type=xml. Previously +only the bibliographic record was rendered. For type=opac, an OPAC +record is only returned if it is present. + --- 3.0.45 2009/03/31 Fixed bug #2709: TCP connect returns Invalid argument. diff --git a/doc/zoom.xml b/doc/zoom.xml index ac9eadb..330a3e3 100644 --- a/doc/zoom.xml +++ b/doc/zoom.xml @@ -792,14 +792,18 @@ ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn) MARCXML (converted from ISO2709 to MARCXML by YAZ). - GRS-1 and OPAC records are not supported for this form. + OPAC records are also converted to XML and the + bibliographic record is converted to MARCXML (when possible). + GRS-1 records are not supported for this form. Upon completion, the XML buffer is returned (type const char *) and length is stored in *len. opac - OPAC for record is returned in XML. + OPAC information for record is returned in XML + if an OPAC record is present at the position given. If no + OPAC record is present, a NULL pointer is returned. diff --git a/src/zoom-c.c b/src/zoom-c.c index d02f63a..a7dced4 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -2144,14 +2144,15 @@ ZOOM_API(const char *) { return return_record(rec, len, npr, YAZ_MARC_ISO2709, charset); } - else if (!strcmp (type, "ext")) + else if (!strcmp(type, "ext")) { if (len) *len = -1; return (const char *) npr->u.databaseRecord; } - else if (!strcmp (type, "opac")) + else if (!strcmp(type, "opac")) { - return return_record(rec, len, npr, YAZ_MARC_MARCXML, charset); + if (npr->u.databaseRecord->which == Z_External_OPAC) + return return_record(rec, len, npr, YAZ_MARC_MARCXML, charset); } return 0; } -- 1.7.10.4