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