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 |
is_nullable: 1 |
89 |
|
90 |
Boolean indicating whether the record is suppressed in OPAC |
91 |
|
92 |
=head2 timestamp |
93 |
|
94 |
data_type: 'timestamp' |
95 |
datetime_undef_if_invalid: 1 |
96 |
default_value: current_timestamp |
97 |
is_nullable: 0 |
98 |
|
99 |
date and time this record was last touched |
100 |
|
101 |
=head2 datecreated |
102 |
|
103 |
data_type: 'date' |
104 |
datetime_undef_if_invalid: 1 |
105 |
is_nullable: 0 |
106 |
|
107 |
the date this record was added to Koha |
108 |
|
109 |
=head2 deleted_on |
110 |
|
111 |
data_type: 'datetime' |
112 |
datetime_undef_if_invalid: 1 |
113 |
is_nullable: 1 |
114 |
|
115 |
the date this record was deleted |
116 |
|
117 |
=cut |
118 |
|
119 |
__PACKAGE__->add_columns( |
120 |
"holding_id", |
121 |
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, |
122 |
"biblionumber", |
123 |
{ |
124 |
data_type => "integer", |
125 |
default_value => 0, |
126 |
is_foreign_key => 1, |
127 |
is_nullable => 0, |
128 |
}, |
129 |
"frameworkcode", |
130 |
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 4 }, |
131 |
"holdingbranch", |
132 |
{ data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, |
133 |
"location", |
134 |
{ data_type => "varchar", is_nullable => 1, size => 80 }, |
135 |
"ccode", |
136 |
{ data_type => "varchar", is_nullable => 1, size => 80 }, |
137 |
"callnumber", |
138 |
{ data_type => "varchar", is_nullable => 1, size => 255 }, |
139 |
"suppress", |
140 |
{ data_type => "tinyint", is_nullable => 1 }, |
141 |
"timestamp", |
142 |
{ |
143 |
data_type => "timestamp", |
144 |
datetime_undef_if_invalid => 1, |
145 |
default_value => \"current_timestamp", |
146 |
is_nullable => 0, |
147 |
}, |
148 |
"datecreated", |
149 |
{ data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 0 }, |
150 |
"deleted_on", |
151 |
{ |
152 |
data_type => "datetime", |
153 |
datetime_undef_if_invalid => 1, |
154 |
is_nullable => 1, |
155 |
}, |
156 |
); |
157 |
|
158 |
=head1 PRIMARY KEY |
159 |
|
160 |
=over 4 |
161 |
|
162 |
=item * L</holding_id> |
163 |
|
164 |
=back |
165 |
|
166 |
=cut |
167 |
|
168 |
__PACKAGE__->set_primary_key("holding_id"); |
169 |
|
170 |
=head1 RELATIONS |
171 |
|
172 |
=head2 biblionumber |
173 |
|
174 |
Type: belongs_to |
175 |
|
176 |
Related object: L<Koha::Schema::Result::Biblio> |
177 |
|
178 |
=cut |
179 |
|
180 |
__PACKAGE__->belongs_to( |
181 |
"biblionumber", |
182 |
"Koha::Schema::Result::Biblio", |
183 |
{ biblionumber => "biblionumber" }, |
184 |
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, |
185 |
); |
186 |
|
187 |
=head2 holdingbranch |
188 |
|
189 |
Type: belongs_to |
190 |
|
191 |
Related object: L<Koha::Schema::Result::Branch> |
192 |
|
193 |
=cut |
194 |
|
195 |
__PACKAGE__->belongs_to( |
196 |
"holdingbranch", |
197 |
"Koha::Schema::Result::Branch", |
198 |
{ branchcode => "holdingbranch" }, |
199 |
{ |
200 |
is_deferrable => 1, |
201 |
join_type => "LEFT", |
202 |
on_delete => "RESTRICT", |
203 |
on_update => "CASCADE", |
204 |
}, |
205 |
); |
206 |
|
207 |
=head2 holdings_metadatas |
208 |
|
209 |
Type: has_many |
210 |
|
211 |
Related object: L<Koha::Schema::Result::HoldingsMetadata> |
212 |
|
213 |
=cut |
214 |
|
215 |
__PACKAGE__->has_many( |
216 |
"holdings_metadatas", |
217 |
"Koha::Schema::Result::HoldingsMetadata", |
218 |
{ "foreign.holding_id" => "self.holding_id" }, |
219 |
{ cascade_copy => 0, cascade_delete => 0 }, |
220 |
); |
221 |
|
222 |
=head2 items |
223 |
|
224 |
Type: has_many |
225 |
|
226 |
Related object: L<Koha::Schema::Result::Item> |
227 |
|
228 |
=cut |
229 |
|
230 |
__PACKAGE__->has_many( |
231 |
"items", |
232 |
"Koha::Schema::Result::Item", |
233 |
{ "foreign.holding_id" => "self.holding_id" }, |
234 |
{ cascade_copy => 0, cascade_delete => 0 }, |
235 |
); |
236 |
|
237 |
|
238 |
# Created by DBIx::Class::Schema::Loader v0.07048 @ 2021-01-24 12:34:57 |
239 |
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cb9mVGJ6TJ+GqAuqMaNEQQ |
240 |
|
241 |
=head2 metadata |
242 |
|
243 |
This relationship makes it possible to use metadata as a prefetch table: |
244 |
|
245 |
my $holdings = Koha::Holdings->search({}, {prefetch => 'metadata'}); |
246 |
my $metadata = $holdings->next()->metadata(); |
247 |
|
248 |
=cut |
249 |
|
250 |
__PACKAGE__->has_one( |
251 |
"metadata", |
252 |
"Koha::Schema::Result::HoldingsMetadata", |
253 |
{ "foreign.holding_id" => "self.holding_id" }, |
254 |
{ cascade_copy => 0, cascade_delete => 0 }, |
255 |
); |
256 |
1; |