1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Scriptotek\SimpleMarcParser; |
4
|
|
|
|
5
|
|
|
use Danmichaelo\QuiteSimpleXmlElement\QuiteSimpleXmlElement; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @property int $id Local record identifier |
9
|
|
|
* @property string $barcode |
10
|
|
|
* @property string $status |
11
|
|
|
* @property string $location |
12
|
|
|
* @property string $sublocation |
13
|
|
|
* @property string $shelvinglocation |
14
|
|
|
* @property string $callcode |
15
|
|
|
* @property string $use_restrictions |
16
|
|
|
* @property string $circulation_status |
17
|
|
|
* @property string $fulltext |
18
|
|
|
* @property string[] $nonpublic_notes |
19
|
|
|
* @property string[] $public_notes |
20
|
|
|
* @property array $holdings |
21
|
|
|
* @property Carbon\Carbon $acquired |
22
|
|
|
* @property Carbon\Carbon $modified |
23
|
|
|
* @property Carbon\Carbon $created |
24
|
|
|
*/ |
25
|
|
|
class HoldingsRecord extends Record |
26
|
|
|
{ |
27
|
|
|
// 859 $f: Use restrictions / Tilgjengelighet |
28
|
|
|
// Ref: http://www.bibsys.no/files/out/biblev/utlaanstatus-marc21.pdf |
29
|
|
|
// http://norzig.no/profiles/holdings2.html#tab1 |
30
|
|
|
public static $m859_f = array( |
31
|
|
|
'1' => 'Not for loan', |
32
|
|
|
'2' => 'In-library use only', |
33
|
|
|
'3' => 'Overnight only', |
34
|
|
|
'4' => 'Use only in controlled access room', |
35
|
|
|
'5' => 'Renewals not permitted', |
36
|
|
|
'6' => 'Short loan period', |
37
|
|
|
'7' => 'Normal loan period', |
38
|
|
|
'8' => 'Long loan period', |
39
|
|
|
'9' => 'Term loan', |
40
|
|
|
'10' => 'Semester loan', |
41
|
|
|
'11' => 'Available for supply without return', |
42
|
|
|
'12' => 'Not for ILL', |
43
|
|
|
'13' => 'Not for User ILL', |
44
|
|
|
); |
45
|
|
|
|
46
|
|
|
// 859 $h: Circulation status / Utlånsstatus |
47
|
|
|
// Ref: http://www.bibsys.no/files/out/biblev/utlaanstatus-marc21.pdf |
48
|
|
|
// http://norzig.no/profiles/holdings2.html#tab2 |
49
|
|
|
public static $m859_h = array( |
50
|
|
|
'0' => 'Available', |
51
|
|
|
'1' => 'Circulation status undefined', |
52
|
|
|
'2' => 'On order', |
53
|
|
|
'3' => 'Not available; undefined', |
54
|
|
|
'4' => 'On loan', |
55
|
|
|
'5' => 'On loan and not available for recall until earliest recall date', |
56
|
|
|
'6' => 'In process', |
57
|
|
|
'7' => 'Recalled', |
58
|
|
|
'8' => 'On hold', |
59
|
|
|
'9' => 'Waiting to be made available', |
60
|
|
|
'10' => 'In transit (between library locations)', |
61
|
|
|
'11' => 'Claimed returned or never borrowed', |
62
|
|
|
'12' => 'Lost', |
63
|
|
|
'13' => 'Missing, being traced', |
64
|
|
|
'14' => 'Supplied (i.e. return not required', |
65
|
|
|
'15' => 'In binding', |
66
|
|
|
'16' => 'In repair', |
67
|
|
|
'17' => 'Pending transfer', |
68
|
|
|
'18' => 'Missing, overdue', |
69
|
|
|
'19' => 'Withdrawn', |
70
|
|
|
'20' => 'Weeded', |
71
|
|
|
'21' => 'Unreserved', |
72
|
|
|
'22' => 'Damaged', |
73
|
|
|
'23' => 'Non circulating', |
74
|
|
|
'24' => 'Other', |
75
|
|
|
); |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param \Danmichaelo\QuiteSimpleXMLElement\QuiteSimpleXMLElement $data |
79
|
|
|
*/ |
80
|
|
|
public function __construct(QuiteSimpleXmlElement $data = null) |
81
|
|
|
{ |
82
|
|
|
if (is_null($data)) { |
83
|
|
|
return; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
$this->id = $data->text('marc:controlfield[@tag="001"]'); // Dokid |
87
|
|
|
|
88
|
|
|
$this->bibliographic_record = $data->text('marc:controlfield[@tag="004"]') ?: null; // Objektid |
|
|
|
|
89
|
|
|
|
90
|
|
|
$fulltext = array(); |
91
|
|
|
$nonpublic_notes = array(); |
92
|
|
|
$public_notes = array(); |
93
|
|
|
|
94
|
|
|
// 008: Extract datestamp only |
95
|
|
|
$f008 = $data->text('marc:controlfield[@tag="008"]'); |
96
|
|
|
$this->created = $this->parseDateTime(substr($f008, 0, 6)); |
97
|
|
|
|
98
|
|
|
// 009: Reserved for local use |
99
|
|
|
$this->status = $data->text('marc:controlfield[@tag="009"]'); |
100
|
|
|
|
101
|
|
|
foreach ($data->all('marc:datafield') as $node) { |
102
|
|
|
$marcfield = intval($node->attributes()->tag); |
103
|
|
|
switch ($marcfield) { |
104
|
|
|
|
105
|
|
|
case 852: |
106
|
|
|
// http://www.loc.gov/marc/holdings/concise/hd852.html |
107
|
|
|
$this->location = $node->text('marc:subfield[@code="a"]'); // NR |
108
|
|
|
$this->sublocation = $node->text('marc:subfield[@code="b"]'); // R (i praksis??) |
109
|
|
|
$this->shelvinglocation = $node->text('marc:subfield[@code="c"]'); // R (i praksis??) |
110
|
|
|
$this->callcode = $node->text('marc:subfield[@code="h"]'); // NR |
111
|
|
|
|
112
|
|
|
if (($x = $node->text('marc:subfield[@code="x"]')) !== '') { // R |
113
|
|
|
$nonpublic_notes[] = $x; |
114
|
|
|
} |
115
|
|
|
if (($x = $node->text('marc:subfield[@code="z"]')) !== '') { // R |
116
|
|
|
$public_notes[] = $x; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
break; |
120
|
|
|
|
121
|
|
|
case 856: |
122
|
|
|
$description = $node->text('marc:subfield[@code="3"]'); |
123
|
|
|
if (in_array($description, array('Fulltekst', 'Fulltext'))) { |
124
|
|
|
$fulltext[] = array( |
125
|
|
|
'url' => $node->text('marc:subfield[@code="u"]'), |
126
|
|
|
'linktext' => $node->text('marc:subfield[@code="y"]'), |
127
|
|
|
'comment' => $node->text('marc:subfield[@code="z"]'), |
128
|
|
|
); |
129
|
|
|
} |
130
|
|
|
break; |
131
|
|
|
|
132
|
|
|
case 859: |
133
|
|
|
// 859: Forslag til norsk tillegg til MARC 21 for utlånsstatus |
134
|
|
|
// http://www.bibsys.no/files/out/biblev/utlaanstatus-marc21.pdf |
135
|
|
|
// 859 $f: Use restrictions / Tilgjengelighet |
136
|
|
|
$x = $node->text('marc:subfield[@code="f"]'); |
137
|
|
|
if ($x !== '') { |
138
|
|
|
if (isset(self::$m859_f[$x])) { |
139
|
|
|
$this->use_restrictions = self::$m859_f[$x]; |
140
|
|
|
} |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
$x = $node->text('marc:subfield[@code="h"]'); |
144
|
|
|
if ($x !== '') { |
145
|
|
|
if (isset(self::$m859_h[$x])) { |
146
|
|
|
$this->circulation_status = self::$m859_h[$x]; |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
break; |
151
|
|
|
|
152
|
|
|
case 866: |
153
|
|
|
// 866: Textual Holdings-General Information |
154
|
|
|
$this->holdings = $node->text('marc:subfield[@code="a"]'); |
155
|
|
|
|
156
|
|
|
break; |
157
|
|
|
|
158
|
|
|
case 876: |
159
|
|
|
// 866: Item Information - Basic Bibliographic Unit |
160
|
|
|
// $d - Date acquired (R) |
161
|
|
|
$this->acquired = $this->parseDateTime($node->text('marc:subfield[@code="d"]')); |
162
|
|
|
$this->barcode = $node->text('marc:subfield[@code="p"]'); |
163
|
|
|
//$this->status = $node->text('marc:subfield[@code="j"]'); |
164
|
|
|
break; |
165
|
|
|
|
166
|
|
|
} |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
$this->fulltext = $fulltext; |
170
|
|
|
$this->nonpublic_notes = $nonpublic_notes; |
171
|
|
|
$this->public_notes = $public_notes; |
172
|
|
|
} |
173
|
|
|
} |
174
|
|
|
|
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.