Line 0
Link Here
|
|
|
1 |
use utf8; |
2 |
package Koha::Schema::Result::Holding; |
3 |
|
4 |
# Created by DBIx::Class::Schema::Loader |
5 |
# DO NOT MODIFY THE FIRST PART OF THIS FILE |
6 |
|
7 |
=head1 NAME |
8 |
|
9 |
Koha::Schema::Result::Holding |
10 |
|
11 |
=cut |
12 |
|
13 |
use strict; |
14 |
use warnings; |
15 |
|
16 |
use base 'DBIx::Class::Core'; |
17 |
|
18 |
=head1 TABLE: C<holdings> |
19 |
|
20 |
=cut |
21 |
|
22 |
__PACKAGE__->table("holdings"); |
23 |
|
24 |
=head1 ACCESSORS |
25 |
|
26 |
=head2 holding_id |
27 |
|
28 |
data_type: 'integer' |
29 |
is_auto_increment: 1 |
30 |
is_nullable: 0 |
31 |
|
32 |
unique identifier assigned to each holdings record |
33 |
|
34 |
=head2 biblionumber |
35 |
|
36 |
data_type: 'integer' |
37 |
default_value: 0 |
38 |
is_foreign_key: 1 |
39 |
is_nullable: 0 |
40 |
|
41 |
foreign key from biblio table used to link this record to the right bib record |
42 |
|
43 |
=head2 frameworkcode |
44 |
|
45 |
data_type: 'varchar' |
46 |
default_value: (empty string) |
47 |
is_nullable: 0 |
48 |
size: 4 |
49 |
|
50 |
foreign key from the biblio_framework table to identify which framework was used in cataloging this record |
51 |
|
52 |
=head2 holdingbranch |
53 |
|
54 |
data_type: 'varchar' |
55 |
is_foreign_key: 1 |
56 |
is_nullable: 1 |
57 |
size: 10 |
58 |
|
59 |
foreign key from the branches table for the library that owns this record (MARC21 852$a) |
60 |
|
61 |
=head2 location |
62 |
|
63 |
data_type: 'varchar' |
64 |
is_nullable: 1 |
65 |
size: 80 |
66 |
|
67 |
authorized value for the shelving location for this record (MARC21 852$b) |
68 |
|
69 |
=head2 ccode |
70 |
|
71 |
data_type: 'varchar' |
72 |
is_nullable: 1 |
73 |
size: 80 |
74 |
|
75 |
authorized value for the collection code associated with this item (MARC21 852$g) |
76 |
|
77 |
=head2 callnumber |
78 |
|
79 |
data_type: 'varchar' |
80 |
is_nullable: 1 |
81 |
size: 255 |
82 |
|
83 |
call number (852$h+$i in MARC21) |
84 |
|
85 |
=head2 suppress |
86 |
|
87 |
data_type: 'tinyint' |
88 |
default_value: 0 |
89 |
is_nullable: 0 |
90 |
|
91 |
Boolean indicating whether the record is suppressed in OPAC |
92 |
|
93 |
=head2 timestamp |
94 |
|
95 |
data_type: 'timestamp' |
96 |
datetime_undef_if_invalid: 1 |
97 |
default_value: current_timestamp |
98 |
is_nullable: 0 |
99 |
|
100 |
date and time this record was last touched |
101 |
|
102 |
=head2 datecreated |
103 |
|
104 |
data_type: 'date' |
105 |
datetime_undef_if_invalid: 1 |
106 |
is_nullable: 0 |
107 |
|
108 |
the date this record was added to Koha |
109 |
|
110 |
=head2 deleted_on |
111 |
|
112 |
data_type: 'datetime' |
113 |
datetime_undef_if_invalid: 1 |
114 |
is_nullable: 1 |
115 |
|
116 |
the date this record was deleted |
117 |
|
118 |
=cut |
119 |
|
120 |
__PACKAGE__->add_columns( |
121 |
"holding_id", |
122 |
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, |
123 |
"biblionumber", |
124 |
{ |
125 |
data_type => "integer", |
126 |
default_value => 0, |
127 |
is_foreign_key => 1, |
128 |
is_nullable => 0, |
129 |
}, |
130 |
"frameworkcode", |
131 |
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 4 }, |
132 |
"holdingbranch", |
133 |
{ data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, |
134 |
"location", |
135 |
{ data_type => "varchar", is_nullable => 1, size => 80 }, |
136 |
"ccode", |
137 |
{ data_type => "varchar", is_nullable => 1, size => 80 }, |
138 |
"callnumber", |
139 |
{ data_type => "varchar", is_nullable => 1, size => 255 }, |
140 |
"suppress", |
141 |
{ data_type => "tinyint", default_value => 0, is_nullable => 0 }, |
142 |
"timestamp", |
143 |
{ |
144 |
data_type => "timestamp", |
145 |
datetime_undef_if_invalid => 1, |
146 |
default_value => \"current_timestamp", |
147 |
is_nullable => 0, |
148 |
}, |
149 |
"datecreated", |
150 |
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 }, |
151 |
"deleted_on", |
152 |
{ |
153 |
data_type => "datetime", |
154 |
datetime_undef_if_invalid => 1, |
155 |
is_nullable => 1, |
156 |
}, |
157 |
); |
158 |
|
159 |
=head1 PRIMARY KEY |
160 |
|
161 |
=over 4 |
162 |
|
163 |
=item * L</holding_id> |
164 |
|
165 |
=back |
166 |
|
167 |
=cut |
168 |
|
169 |
__PACKAGE__->set_primary_key("holding_id"); |
170 |
|
171 |
=head1 RELATIONS |
172 |
|
173 |
=head2 biblionumber |
174 |
|
175 |
Type: belongs_to |
176 |
|
177 |
Related object: L<Koha::Schema::Result::Biblio> |
178 |
|
179 |
=cut |
180 |
|
181 |
__PACKAGE__->belongs_to( |
182 |
"biblionumber", |
183 |
"Koha::Schema::Result::Biblio", |
184 |
{ biblionumber => "biblionumber" }, |
185 |
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, |
186 |
); |
187 |
|
188 |
=head2 holdingbranch |
189 |
|
190 |
Type: belongs_to |
191 |
|
192 |
Related object: L<Koha::Schema::Result::Branch> |
193 |
|
194 |
=cut |
195 |
|
196 |
__PACKAGE__->belongs_to( |
197 |
"holdingbranch", |
198 |
"Koha::Schema::Result::Branch", |
199 |
{ branchcode => "holdingbranch" }, |
200 |
{ |
201 |
is_deferrable => 1, |
202 |
join_type => "LEFT", |
203 |
on_delete => "RESTRICT", |
204 |
on_update => "CASCADE", |
205 |
}, |
206 |
); |
207 |
|
208 |
=head2 holdings_metadatas |
209 |
|
210 |
Type: has_many |
211 |
|
212 |
Related object: L<Koha::Schema::Result::HoldingsMetadata> |
213 |
|
214 |
=cut |
215 |
|
216 |
__PACKAGE__->has_many( |
217 |
"holdings_metadatas", |
218 |
"Koha::Schema::Result::HoldingsMetadata", |
219 |
{ "foreign.holding_id" => "self.holding_id" }, |
220 |
{ cascade_copy => 0, cascade_delete => 0 }, |
221 |
); |
222 |
|
223 |
=head2 items |
224 |
|
225 |
Type: has_many |
226 |
|
227 |
Related object: L<Koha::Schema::Result::Item> |
228 |
|
229 |
=cut |
230 |
|
231 |
__PACKAGE__->has_many( |
232 |
"items", |
233 |
"Koha::Schema::Result::Item", |
234 |
{ "foreign.holding_id" => "self.holding_id" }, |
235 |
{ cascade_copy => 0, cascade_delete => 0 }, |
236 |
); |
237 |
|
238 |
|
239 |
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2021-03-19 12:18:01 |
240 |
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Q9Pn2fbd7/xNx7heNn/n5Q |
241 |
|
242 |
=head2 metadata |
243 |
|
244 |
This relationship makes it possible to use metadata as a prefetch table: |
245 |
|
246 |
my $holdings = Koha::Holdings->search({}, {prefetch => 'metadata'}); |
247 |
my $metadata = $holdings->next()->metadata(); |
248 |
|
249 |
=cut |
250 |
|
251 |
__PACKAGE__->has_one( |
252 |
"metadata", |
253 |
"Koha::Schema::Result::HoldingsMetadata", |
254 |
{ "foreign.holding_id" => "self.holding_id" }, |
255 |
{ cascade_copy => 0, cascade_delete => 0 }, |
256 |
); |
257 |
|
258 |
__PACKAGE__->add_columns( |
259 |
'+suppress' => { is_boolean => 1 }, |
260 |
); |
261 |
|
262 |
1; |