Bug 26922: Regression tests
[koha.git] / Koha / Schema / Result / Reserve.pm
blob491e200f1940c71de0dc9f8c0e72b96e8bfb99f3
1 use utf8;
2 package Koha::Schema::Result::Reserve;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
7 =head1 NAME
9 Koha::Schema::Result::Reserve
11 =cut
13 use strict;
14 use warnings;
16 use base 'DBIx::Class::Core';
18 =head1 TABLE: C<reserves>
20 =cut
22 __PACKAGE__->table("reserves");
24 =head1 ACCESSORS
26 =head2 reserve_id
28 data_type: 'integer'
29 is_auto_increment: 1
30 is_nullable: 0
32 =head2 borrowernumber
34 data_type: 'integer'
35 default_value: 0
36 is_foreign_key: 1
37 is_nullable: 0
39 =head2 reservedate
41 data_type: 'date'
42 datetime_undef_if_invalid: 1
43 is_nullable: 1
45 =head2 biblionumber
47 data_type: 'integer'
48 default_value: 0
49 is_foreign_key: 1
50 is_nullable: 0
52 =head2 branchcode
54 data_type: 'varchar'
55 is_foreign_key: 1
56 is_nullable: 1
57 size: 10
59 =head2 desk_id
61 data_type: 'integer'
62 is_foreign_key: 1
63 is_nullable: 1
65 =head2 notificationdate
67 data_type: 'date'
68 datetime_undef_if_invalid: 1
69 is_nullable: 1
71 =head2 reminderdate
73 data_type: 'date'
74 datetime_undef_if_invalid: 1
75 is_nullable: 1
77 =head2 cancellationdate
79 data_type: 'date'
80 datetime_undef_if_invalid: 1
81 is_nullable: 1
83 =head2 cancellation_reason
85 data_type: 'varchar'
86 is_nullable: 1
87 size: 80
89 =head2 reservenotes
91 data_type: 'longtext'
92 is_nullable: 1
94 =head2 priority
96 data_type: 'smallint'
97 default_value: 1
98 is_nullable: 0
100 =head2 found
102 data_type: 'varchar'
103 is_nullable: 1
104 size: 1
106 =head2 timestamp
108 data_type: 'timestamp'
109 datetime_undef_if_invalid: 1
110 default_value: current_timestamp
111 is_nullable: 0
113 =head2 itemnumber
115 data_type: 'integer'
116 is_foreign_key: 1
117 is_nullable: 1
119 =head2 waitingdate
121 data_type: 'date'
122 datetime_undef_if_invalid: 1
123 is_nullable: 1
125 =head2 expirationdate
127 data_type: 'date'
128 datetime_undef_if_invalid: 1
129 is_nullable: 1
131 =head2 lowestPriority
133 accessor: 'lowest_priority'
134 data_type: 'tinyint'
135 default_value: 0
136 is_nullable: 0
138 =head2 suspend
140 data_type: 'tinyint'
141 default_value: 0
142 is_nullable: 0
144 =head2 suspend_until
146 data_type: 'datetime'
147 datetime_undef_if_invalid: 1
148 is_nullable: 1
150 =head2 itemtype
152 data_type: 'varchar'
153 is_foreign_key: 1
154 is_nullable: 1
155 size: 10
157 =head2 item_level_hold
159 data_type: 'tinyint'
160 default_value: 0
161 is_nullable: 0
163 =head2 non_priority
165 data_type: 'tinyint'
166 default_value: 0
167 is_nullable: 0
169 =cut
171 __PACKAGE__->add_columns(
172 "reserve_id",
173 { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
174 "borrowernumber",
176 data_type => "integer",
177 default_value => 0,
178 is_foreign_key => 1,
179 is_nullable => 0,
181 "reservedate",
182 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
183 "biblionumber",
185 data_type => "integer",
186 default_value => 0,
187 is_foreign_key => 1,
188 is_nullable => 0,
190 "branchcode",
191 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
192 "desk_id",
193 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
194 "notificationdate",
195 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
196 "reminderdate",
197 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
198 "cancellationdate",
199 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
200 "cancellation_reason",
201 { data_type => "varchar", is_nullable => 1, size => 80 },
202 "reservenotes",
203 { data_type => "longtext", is_nullable => 1 },
204 "priority",
205 { data_type => "smallint", default_value => 1, is_nullable => 0 },
206 "found",
207 { data_type => "varchar", is_nullable => 1, size => 1 },
208 "timestamp",
210 data_type => "timestamp",
211 datetime_undef_if_invalid => 1,
212 default_value => \"current_timestamp",
213 is_nullable => 0,
215 "itemnumber",
216 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
217 "waitingdate",
218 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
219 "expirationdate",
220 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
221 "lowestPriority",
223 accessor => "lowest_priority",
224 data_type => "tinyint",
225 default_value => 0,
226 is_nullable => 0,
228 "suspend",
229 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
230 "suspend_until",
232 data_type => "datetime",
233 datetime_undef_if_invalid => 1,
234 is_nullable => 1,
236 "itemtype",
237 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
238 "item_level_hold",
239 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
240 "non_priority",
241 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
244 =head1 PRIMARY KEY
246 =over 4
248 =item * L</reserve_id>
250 =back
252 =cut
254 __PACKAGE__->set_primary_key("reserve_id");
256 =head1 RELATIONS
258 =head2 biblionumber
260 Type: belongs_to
262 Related object: L<Koha::Schema::Result::Biblio>
264 =cut
266 __PACKAGE__->belongs_to(
267 "biblionumber",
268 "Koha::Schema::Result::Biblio",
269 { biblionumber => "biblionumber" },
270 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
273 =head2 borrowernumber
275 Type: belongs_to
277 Related object: L<Koha::Schema::Result::Borrower>
279 =cut
281 __PACKAGE__->belongs_to(
282 "borrowernumber",
283 "Koha::Schema::Result::Borrower",
284 { borrowernumber => "borrowernumber" },
285 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
288 =head2 branchcode
290 Type: belongs_to
292 Related object: L<Koha::Schema::Result::Branch>
294 =cut
296 __PACKAGE__->belongs_to(
297 "branchcode",
298 "Koha::Schema::Result::Branch",
299 { branchcode => "branchcode" },
301 is_deferrable => 1,
302 join_type => "LEFT",
303 on_delete => "CASCADE",
304 on_update => "CASCADE",
308 =head2 club_holds_to_patron_holds
310 Type: has_many
312 Related object: L<Koha::Schema::Result::ClubHoldsToPatronHold>
314 =cut
316 __PACKAGE__->has_many(
317 "club_holds_to_patron_holds",
318 "Koha::Schema::Result::ClubHoldsToPatronHold",
319 { "foreign.hold_id" => "self.reserve_id" },
320 { cascade_copy => 0, cascade_delete => 0 },
323 =head2 desk
325 Type: belongs_to
327 Related object: L<Koha::Schema::Result::Desk>
329 =cut
331 __PACKAGE__->belongs_to(
332 "desk",
333 "Koha::Schema::Result::Desk",
334 { desk_id => "desk_id" },
336 is_deferrable => 1,
337 join_type => "LEFT",
338 on_delete => "SET NULL",
339 on_update => "CASCADE",
343 =head2 itemnumber
345 Type: belongs_to
347 Related object: L<Koha::Schema::Result::Item>
349 =cut
351 __PACKAGE__->belongs_to(
352 "itemnumber",
353 "Koha::Schema::Result::Item",
354 { itemnumber => "itemnumber" },
356 is_deferrable => 1,
357 join_type => "LEFT",
358 on_delete => "CASCADE",
359 on_update => "CASCADE",
363 =head2 itemtype
365 Type: belongs_to
367 Related object: L<Koha::Schema::Result::Itemtype>
369 =cut
371 __PACKAGE__->belongs_to(
372 "itemtype",
373 "Koha::Schema::Result::Itemtype",
374 { itemtype => "itemtype" },
376 is_deferrable => 1,
377 join_type => "LEFT",
378 on_delete => "CASCADE",
379 on_update => "CASCADE",
384 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-11-06 11:00:40
385 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ue2kNBP+lq8+9NthPiYrrw
387 __PACKAGE__->belongs_to(
388 "item",
389 "Koha::Schema::Result::Item",
390 { itemnumber => "itemnumber" },
392 is_deferrable => 1,
393 join_type => "LEFT",
394 on_delete => "CASCADE",
395 on_update => "CASCADE",
399 __PACKAGE__->belongs_to(
400 "biblio",
401 "Koha::Schema::Result::Biblio",
402 { biblionumber => "biblionumber" },
404 is_deferrable => 1,
405 join_type => "LEFT",
406 on_delete => "CASCADE",
407 on_update => "CASCADE",
411 __PACKAGE__->belongs_to(
412 "patron",
413 "Koha::Schema::Result::Borrower",
414 { "foreign.borrowernumber" => "self.borrowernumber" },
415 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
418 __PACKAGE__->add_columns(
419 '+item_level_hold' => { is_boolean => 1 },
420 '+lowestPriority' => { is_boolean => 1 },
421 '+suspend' => { is_boolean => 1 },
422 '+non_priority' => { is_boolean => 1 }
425 sub koha_object_class {
426 'Koha::Hold';
428 sub koha_objects_class {
429 'Koha::Holds';