yaz-ztest: fix bad usage of session handle
[yaz-moved-to-github.git] / ztest / dummy-opac.c
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2012 Index Data
3  * See the file LICENSE for details.
4  */
5 /** \file
6  * \brief Little toy-thing to genearate an OPAC record with some values
7  */
8 #if HAVE_CONFIG_H
9 #include <config.h>
10 #endif
11
12 #include <yaz/wrbuf.h>
13 #include <yaz/marcdisp.h>
14 #include <yaz/odr.h>
15
16 #include "ztest.h"
17
18 Z_OPACRecord *dummy_opac(int num, ODR odr, const char *marc_input)
19 {
20     Z_OPACRecord *rec;
21     int i;
22     rec = (Z_OPACRecord *) odr_malloc(odr, sizeof(*rec));
23     rec->bibliographicRecord =
24         z_ext_record_usmarc(odr, marc_input, strlen(marc_input));
25     rec->num_holdingsData = 1;
26     rec->holdingsData = (Z_HoldingsRecord **)
27         odr_malloc(odr, sizeof(*rec->holdingsData));
28     for (i = 0; i < rec->num_holdingsData; i++)
29     {
30         Z_HoldingsRecord *hr = (Z_HoldingsRecord *)
31             odr_malloc(odr, sizeof(*hr));
32         Z_HoldingsAndCircData *hc = (Z_HoldingsAndCircData *)
33             odr_malloc(odr, sizeof(*hc));
34         
35         rec->holdingsData[i] = hr;
36         hr->which = Z_HoldingsRecord_holdingsAndCirc;
37         hr->u.holdingsAndCirc = hc;
38             
39         hc->typeOfRecord = "u";
40
41         hc->encodingLevel = "u";
42
43         hc->format = 0; /* OPT */
44         hc->receiptAcqStatus = "0";
45         hc->generalRetention = 0; /* OPT */
46         hc->completeness = 0; /* OPT */
47         hc->dateOfReport = "000000";
48         hc->nucCode = "s-FM/GC";
49         hc->localLocation = 
50             "Main or Science/Business Reading Rms - STORED OFFSITE";
51         hc->shelvingLocation = 0; /* OPT */
52         hc->callNumber = "MLCM 89/00602 (N)";
53         hc->shelvingData = "FT MEADE";
54         hc->copyNumber = "Copy 1";
55         hc->publicNote = 0; /* OPT */
56         hc->reproductionNote = 0; /* OPT */
57         hc->termsUseRepro = 0; /* OPT */
58         hc->enumAndChron = 0; /* OPT */
59
60         hc->num_volumes = 0;
61         hc->volumes = 0;
62
63         hc->num_circulationData = 1;
64         hc->circulationData = (Z_CircRecord **)
65              odr_malloc(odr, sizeof(*hc->circulationData));
66         hc->circulationData[0] = (Z_CircRecord *)
67              odr_malloc(odr, sizeof(**hc->circulationData));
68
69         hc->circulationData[0]->availableNow = odr_booldup(odr, 1);
70         hc->circulationData[0]->availablityDate = 0;
71         hc->circulationData[0]->availableThru = 0;
72         hc->circulationData[0]->restrictions = 0;
73         hc->circulationData[0]->itemId = "1226176";
74         hc->circulationData[0]->renewable = odr_booldup(odr, 0);
75         hc->circulationData[0]->onHold = odr_booldup(odr, 0);
76         hc->circulationData[0]->enumAndChron = 0;
77         hc->circulationData[0]->midspine = 0;
78         hc->circulationData[0]->temporaryLocation = 0;
79     }
80     return rec;
81 }
82 /*
83  * Local variables:
84  * c-basic-offset: 4
85  * c-file-style: "Stroustrup"
86  * indent-tabs-mode: nil
87  * End:
88  * vim: shiftwidth=4 tabstop=8 expandtab
89  */
90