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