Bug 24412: DBIC schema changes
[koha-ffzg.git] / Koha / Schema / Result / Reserve.pm
1 use utf8;
2 package Koha::Schema::Result::Reserve;
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::Reserve
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<reserves>
19
20 =cut
21
22 __PACKAGE__->table("reserves");
23
24 =head1 ACCESSORS
25
26 =head2 reserve_id
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 borrowernumber
33
34   data_type: 'integer'
35   default_value: 0
36   is_foreign_key: 1
37   is_nullable: 0
38
39 =head2 reservedate
40
41   data_type: 'date'
42   datetime_undef_if_invalid: 1
43   is_nullable: 1
44
45 =head2 biblionumber
46
47   data_type: 'integer'
48   default_value: 0
49   is_foreign_key: 1
50   is_nullable: 0
51
52 =head2 branchcode
53
54   data_type: 'varchar'
55   is_foreign_key: 1
56   is_nullable: 1
57   size: 10
58
59 =head2 desk_id
60
61   data_type: 'integer'
62   is_foreign_key: 1
63   is_nullable: 1
64
65 =head2 notificationdate
66
67   data_type: 'date'
68   datetime_undef_if_invalid: 1
69   is_nullable: 1
70
71 =head2 reminderdate
72
73   data_type: 'date'
74   datetime_undef_if_invalid: 1
75   is_nullable: 1
76
77 =head2 cancellationdate
78
79   data_type: 'date'
80   datetime_undef_if_invalid: 1
81   is_nullable: 1
82
83 =head2 cancellation_reason
84
85   data_type: 'varchar'
86   is_nullable: 1
87   size: 80
88
89 =head2 reservenotes
90
91   data_type: 'longtext'
92   is_nullable: 1
93
94 =head2 priority
95
96   data_type: 'smallint'
97   default_value: 1
98   is_nullable: 0
99
100 =head2 found
101
102   data_type: 'varchar'
103   is_nullable: 1
104   size: 1
105
106 =head2 timestamp
107
108   data_type: 'timestamp'
109   datetime_undef_if_invalid: 1
110   default_value: current_timestamp
111   is_nullable: 0
112
113 =head2 itemnumber
114
115   data_type: 'integer'
116   is_foreign_key: 1
117   is_nullable: 1
118
119 =head2 waitingdate
120
121   data_type: 'date'
122   datetime_undef_if_invalid: 1
123   is_nullable: 1
124
125 =head2 expirationdate
126
127   data_type: 'date'
128   datetime_undef_if_invalid: 1
129   is_nullable: 1
130
131 =head2 lowestPriority
132
133   accessor: 'lowest_priority'
134   data_type: 'tinyint'
135   default_value: 0
136   is_nullable: 0
137
138 =head2 suspend
139
140   data_type: 'tinyint'
141   default_value: 0
142   is_nullable: 0
143
144 =head2 suspend_until
145
146   data_type: 'datetime'
147   datetime_undef_if_invalid: 1
148   is_nullable: 1
149
150 =head2 itemtype
151
152   data_type: 'varchar'
153   is_foreign_key: 1
154   is_nullable: 1
155   size: 10
156
157 =head2 item_level_hold
158
159   data_type: 'tinyint'
160   default_value: 0
161   is_nullable: 0
162
163 =head2 non_priority
164
165   data_type: 'tinyint'
166   default_value: 0
167   is_nullable: 0
168
169 =cut
170
171 __PACKAGE__->add_columns(
172   "reserve_id",
173   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
174   "borrowernumber",
175   {
176     data_type      => "integer",
177     default_value  => 0,
178     is_foreign_key => 1,
179     is_nullable    => 0,
180   },
181   "reservedate",
182   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
183   "biblionumber",
184   {
185     data_type      => "integer",
186     default_value  => 0,
187     is_foreign_key => 1,
188     is_nullable    => 0,
189   },
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",
209   {
210     data_type => "timestamp",
211     datetime_undef_if_invalid => 1,
212     default_value => \"current_timestamp",
213     is_nullable => 0,
214   },
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",
222   {
223     accessor      => "lowest_priority",
224     data_type     => "tinyint",
225     default_value => 0,
226     is_nullable   => 0,
227   },
228   "suspend",
229   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
230   "suspend_until",
231   {
232     data_type => "datetime",
233     datetime_undef_if_invalid => 1,
234     is_nullable => 1,
235   },
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 },
242 );
243
244 =head1 PRIMARY KEY
245
246 =over 4
247
248 =item * L</reserve_id>
249
250 =back
251
252 =cut
253
254 __PACKAGE__->set_primary_key("reserve_id");
255
256 =head1 RELATIONS
257
258 =head2 biblionumber
259
260 Type: belongs_to
261
262 Related object: L<Koha::Schema::Result::Biblio>
263
264 =cut
265
266 __PACKAGE__->belongs_to(
267   "biblionumber",
268   "Koha::Schema::Result::Biblio",
269   { biblionumber => "biblionumber" },
270   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
271 );
272
273 =head2 borrowernumber
274
275 Type: belongs_to
276
277 Related object: L<Koha::Schema::Result::Borrower>
278
279 =cut
280
281 __PACKAGE__->belongs_to(
282   "borrowernumber",
283   "Koha::Schema::Result::Borrower",
284   { borrowernumber => "borrowernumber" },
285   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
286 );
287
288 =head2 branchcode
289
290 Type: belongs_to
291
292 Related object: L<Koha::Schema::Result::Branch>
293
294 =cut
295
296 __PACKAGE__->belongs_to(
297   "branchcode",
298   "Koha::Schema::Result::Branch",
299   { branchcode => "branchcode" },
300   {
301     is_deferrable => 1,
302     join_type     => "LEFT",
303     on_delete     => "CASCADE",
304     on_update     => "CASCADE",
305   },
306 );
307
308 =head2 club_holds_to_patron_holds
309
310 Type: has_many
311
312 Related object: L<Koha::Schema::Result::ClubHoldsToPatronHold>
313
314 =cut
315
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 },
321 );
322
323 =head2 desk
324
325 Type: belongs_to
326
327 Related object: L<Koha::Schema::Result::Desk>
328
329 =cut
330
331 __PACKAGE__->belongs_to(
332   "desk",
333   "Koha::Schema::Result::Desk",
334   { desk_id => "desk_id" },
335   {
336     is_deferrable => 1,
337     join_type     => "LEFT",
338     on_delete     => "SET NULL",
339     on_update     => "CASCADE",
340   },
341 );
342
343 =head2 itemnumber
344
345 Type: belongs_to
346
347 Related object: L<Koha::Schema::Result::Item>
348
349 =cut
350
351 __PACKAGE__->belongs_to(
352   "itemnumber",
353   "Koha::Schema::Result::Item",
354   { itemnumber => "itemnumber" },
355   {
356     is_deferrable => 1,
357     join_type     => "LEFT",
358     on_delete     => "CASCADE",
359     on_update     => "CASCADE",
360   },
361 );
362
363 =head2 itemtype
364
365 Type: belongs_to
366
367 Related object: L<Koha::Schema::Result::Itemtype>
368
369 =cut
370
371 __PACKAGE__->belongs_to(
372   "itemtype",
373   "Koha::Schema::Result::Itemtype",
374   { itemtype => "itemtype" },
375   {
376     is_deferrable => 1,
377     join_type     => "LEFT",
378     on_delete     => "CASCADE",
379     on_update     => "CASCADE",
380   },
381 );
382
383
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
386
387 __PACKAGE__->belongs_to(
388   "item",
389   "Koha::Schema::Result::Item",
390   { itemnumber => "itemnumber" },
391   {
392     is_deferrable => 1,
393     join_type     => "LEFT",
394     on_delete     => "CASCADE",
395     on_update     => "CASCADE",
396   },
397 );
398
399 __PACKAGE__->belongs_to(
400   "biblio",
401   "Koha::Schema::Result::Biblio",
402   { biblionumber => "biblionumber" },
403   {
404     is_deferrable => 1,
405     join_type     => "LEFT",
406     on_delete     => "CASCADE",
407     on_update     => "CASCADE",
408   },
409 );
410
411 __PACKAGE__->add_columns(
412     '+item_level_hold' => { is_boolean => 1 },
413     '+lowestPriority'  => { is_boolean => 1 },
414     '+suspend'         => { is_boolean => 1 },
415     '+non_priority'    => { is_boolean => 1 }
416 );
417
418 sub koha_object_class {
419     'Koha::Hold';
420 }
421 sub koha_objects_class {
422     'Koha::Holds';
423 }
424
425 1;