Bug 31086: DBIC update
[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 primary key
33
34 =head2 borrowernumber
35
36   data_type: 'integer'
37   default_value: 0
38   is_foreign_key: 1
39   is_nullable: 0
40
41 foreign key from the borrowers table defining which patron this hold is for
42
43 =head2 reservedate
44
45   data_type: 'date'
46   datetime_undef_if_invalid: 1
47   is_nullable: 1
48
49 the date the hold was placed
50
51 =head2 biblionumber
52
53   data_type: 'integer'
54   default_value: 0
55   is_foreign_key: 1
56   is_nullable: 0
57
58 foreign key from the biblio table defining which bib record this hold is on
59
60 =head2 branchcode
61
62   data_type: 'varchar'
63   is_foreign_key: 1
64   is_nullable: 0
65   size: 10
66
67 foreign key from the branches table defining which branch the patron wishes to pick this hold up at
68
69 =head2 desk_id
70
71   data_type: 'integer'
72   is_foreign_key: 1
73   is_nullable: 1
74
75 foreign key from the desks table defining which desk the patron should pick this hold up at
76
77 =head2 notificationdate
78
79   data_type: 'date'
80   datetime_undef_if_invalid: 1
81   is_nullable: 1
82
83 currently unused
84
85 =head2 reminderdate
86
87   data_type: 'date'
88   datetime_undef_if_invalid: 1
89   is_nullable: 1
90
91 currently unused
92
93 =head2 cancellationdate
94
95   data_type: 'date'
96   datetime_undef_if_invalid: 1
97   is_nullable: 1
98
99 the date this hold was cancelled
100
101 =head2 cancellation_reason
102
103   data_type: 'varchar'
104   is_nullable: 1
105   size: 80
106
107 optional authorised value CANCELLATION_REASON
108
109 =head2 reservenotes
110
111   data_type: 'longtext'
112   is_nullable: 1
113
114 notes related to this hold
115
116 =head2 priority
117
118   data_type: 'smallint'
119   default_value: 1
120   is_nullable: 0
121
122 where in the queue the patron sits
123
124 =head2 found
125
126   data_type: 'varchar'
127   is_nullable: 1
128   size: 1
129
130 a one letter code defining what the status is of the hold is after it has been confirmed
131
132 =head2 timestamp
133
134   data_type: 'timestamp'
135   datetime_undef_if_invalid: 1
136   default_value: current_timestamp
137   is_nullable: 0
138
139 the date and time this hold was last updated
140
141 =head2 itemnumber
142
143   data_type: 'integer'
144   is_foreign_key: 1
145   is_nullable: 1
146
147 foreign key from the items table defining the specific item the patron has placed on hold or the item this hold was filled with
148
149 =head2 waitingdate
150
151   data_type: 'date'
152   datetime_undef_if_invalid: 1
153   is_nullable: 1
154
155 the date the item was marked as waiting for the patron at the library
156
157 =head2 expirationdate
158
159   data_type: 'date'
160   datetime_undef_if_invalid: 1
161   is_nullable: 1
162
163 the date the hold expires (calculated value)
164
165 =head2 patron_expiration_date
166
167   data_type: 'date'
168   datetime_undef_if_invalid: 1
169   is_nullable: 1
170
171 the date the hold expires - usually the date entered by the patron to say they don't need the hold after a certain date
172
173 =head2 lowestPriority
174
175   accessor: 'lowest_priority'
176   data_type: 'tinyint'
177   default_value: 0
178   is_nullable: 0
179
180 =head2 suspend
181
182   data_type: 'tinyint'
183   default_value: 0
184   is_nullable: 0
185
186 =head2 suspend_until
187
188   data_type: 'datetime'
189   datetime_undef_if_invalid: 1
190   is_nullable: 1
191
192 =head2 itemtype
193
194   data_type: 'varchar'
195   is_foreign_key: 1
196   is_nullable: 1
197   size: 10
198
199 If record level hold, the optional itemtype of the item the patron is requesting
200
201 =head2 item_level_hold
202
203   data_type: 'tinyint'
204   default_value: 0
205   is_nullable: 0
206
207 Is the hpld placed at item level
208
209 =head2 non_priority
210
211   data_type: 'tinyint'
212   default_value: 0
213   is_nullable: 0
214
215 Is this a non priority hold
216
217 =cut
218
219 __PACKAGE__->add_columns(
220   "reserve_id",
221   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
222   "borrowernumber",
223   {
224     data_type      => "integer",
225     default_value  => 0,
226     is_foreign_key => 1,
227     is_nullable    => 0,
228   },
229   "reservedate",
230   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
231   "biblionumber",
232   {
233     data_type      => "integer",
234     default_value  => 0,
235     is_foreign_key => 1,
236     is_nullable    => 0,
237   },
238   "branchcode",
239   { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
240   "desk_id",
241   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
242   "notificationdate",
243   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
244   "reminderdate",
245   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
246   "cancellationdate",
247   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
248   "cancellation_reason",
249   { data_type => "varchar", is_nullable => 1, size => 80 },
250   "reservenotes",
251   { data_type => "longtext", is_nullable => 1 },
252   "priority",
253   { data_type => "smallint", default_value => 1, is_nullable => 0 },
254   "found",
255   { data_type => "varchar", is_nullable => 1, size => 1 },
256   "timestamp",
257   {
258     data_type => "timestamp",
259     datetime_undef_if_invalid => 1,
260     default_value => \"current_timestamp",
261     is_nullable => 0,
262   },
263   "itemnumber",
264   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
265   "waitingdate",
266   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
267   "expirationdate",
268   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
269   "patron_expiration_date",
270   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
271   "lowestPriority",
272   {
273     accessor      => "lowest_priority",
274     data_type     => "tinyint",
275     default_value => 0,
276     is_nullable   => 0,
277   },
278   "suspend",
279   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
280   "suspend_until",
281   {
282     data_type => "datetime",
283     datetime_undef_if_invalid => 1,
284     is_nullable => 1,
285   },
286   "itemtype",
287   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
288   "item_level_hold",
289   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
290   "non_priority",
291   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
292 );
293
294 =head1 PRIMARY KEY
295
296 =over 4
297
298 =item * L</reserve_id>
299
300 =back
301
302 =cut
303
304 __PACKAGE__->set_primary_key("reserve_id");
305
306 =head1 RELATIONS
307
308 =head2 biblionumber
309
310 Type: belongs_to
311
312 Related object: L<Koha::Schema::Result::Biblio>
313
314 =cut
315
316 __PACKAGE__->belongs_to(
317   "biblionumber",
318   "Koha::Schema::Result::Biblio",
319   { biblionumber => "biblionumber" },
320   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
321 );
322
323 =head2 borrowernumber
324
325 Type: belongs_to
326
327 Related object: L<Koha::Schema::Result::Borrower>
328
329 =cut
330
331 __PACKAGE__->belongs_to(
332   "borrowernumber",
333   "Koha::Schema::Result::Borrower",
334   { borrowernumber => "borrowernumber" },
335   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
336 );
337
338 =head2 branchcode
339
340 Type: belongs_to
341
342 Related object: L<Koha::Schema::Result::Branch>
343
344 =cut
345
346 __PACKAGE__->belongs_to(
347   "branchcode",
348   "Koha::Schema::Result::Branch",
349   { branchcode => "branchcode" },
350   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
351 );
352
353 =head2 club_holds_to_patron_holds
354
355 Type: has_many
356
357 Related object: L<Koha::Schema::Result::ClubHoldsToPatronHold>
358
359 =cut
360
361 __PACKAGE__->has_many(
362   "club_holds_to_patron_holds",
363   "Koha::Schema::Result::ClubHoldsToPatronHold",
364   { "foreign.hold_id" => "self.reserve_id" },
365   { cascade_copy => 0, cascade_delete => 0 },
366 );
367
368 =head2 desk
369
370 Type: belongs_to
371
372 Related object: L<Koha::Schema::Result::Desk>
373
374 =cut
375
376 __PACKAGE__->belongs_to(
377   "desk",
378   "Koha::Schema::Result::Desk",
379   { desk_id => "desk_id" },
380   {
381     is_deferrable => 1,
382     join_type     => "LEFT",
383     on_delete     => "SET NULL",
384     on_update     => "CASCADE",
385   },
386 );
387
388 =head2 itemnumber
389
390 Type: belongs_to
391
392 Related object: L<Koha::Schema::Result::Item>
393
394 =cut
395
396 __PACKAGE__->belongs_to(
397   "itemnumber",
398   "Koha::Schema::Result::Item",
399   { itemnumber => "itemnumber" },
400   {
401     is_deferrable => 1,
402     join_type     => "LEFT",
403     on_delete     => "CASCADE",
404     on_update     => "CASCADE",
405   },
406 );
407
408 =head2 itemtype
409
410 Type: belongs_to
411
412 Related object: L<Koha::Schema::Result::Itemtype>
413
414 =cut
415
416 __PACKAGE__->belongs_to(
417   "itemtype",
418   "Koha::Schema::Result::Itemtype",
419   { itemtype => "itemtype" },
420   {
421     is_deferrable => 1,
422     join_type     => "LEFT",
423     on_delete     => "CASCADE",
424     on_update     => "CASCADE",
425   },
426 );
427
428
429 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-22 17:37:42
430 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kYRPPeoVo0WMk1gH+qmi/w
431
432 __PACKAGE__->belongs_to(
433   "item",
434   "Koha::Schema::Result::Item",
435   { itemnumber => "itemnumber" },
436   {
437     is_deferrable => 1,
438     join_type     => "LEFT",
439     on_delete     => "CASCADE",
440     on_update     => "CASCADE",
441   },
442 );
443
444 __PACKAGE__->belongs_to(
445   "biblio",
446   "Koha::Schema::Result::Biblio",
447   { biblionumber => "biblionumber" },
448   {
449     is_deferrable => 1,
450     join_type     => "LEFT",
451     on_delete     => "CASCADE",
452     on_update     => "CASCADE",
453   },
454 );
455
456 __PACKAGE__->belongs_to(
457   "patron",
458   "Koha::Schema::Result::Borrower",
459   { "foreign.borrowernumber" => "self.borrowernumber" },
460   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
461 );
462
463 __PACKAGE__->add_columns(
464     '+item_level_hold' => { is_boolean => 1 },
465     '+lowestPriority'  => { is_boolean => 1 },
466     '+suspend'         => { is_boolean => 1 },
467     '+non_priority'    => { is_boolean => 1 }
468 );
469
470 sub koha_object_class {
471     'Koha::Hold';
472 }
473 sub koha_objects_class {
474     'Koha::Holds';
475 }
476
477 __PACKAGE__->belongs_to(
478   "itembib",
479   "Koha::Schema::Result::Item",
480   { biblionumber => "biblionumber" },
481   {
482     is_deferrable => 1,
483     join_type     => "LEFT",
484     on_delete     => "CASCADE",
485     on_update     => "CASCADE",
486   },
487 );
488
489 1;