Bug 20936: (follow-up) add biblio and item relation to old holds and set a limit...
[koha-ffzg.git] / Koha / Schema / Result / OldReserve.pm
1 use utf8;
2 package Koha::Schema::Result::OldReserve;
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::OldReserve
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<old_reserves>
19
20 =cut
21
22 __PACKAGE__->table("old_reserves");
23
24 =head1 ACCESSORS
25
26 =head2 reserve_id
27
28   data_type: 'integer'
29   is_nullable: 0
30
31 =head2 borrowernumber
32
33   data_type: 'integer'
34   is_foreign_key: 1
35   is_nullable: 1
36
37 =head2 reservedate
38
39   data_type: 'date'
40   datetime_undef_if_invalid: 1
41   is_nullable: 1
42
43 =head2 biblionumber
44
45   data_type: 'integer'
46   is_foreign_key: 1
47   is_nullable: 1
48
49 =head2 branchcode
50
51   data_type: 'varchar'
52   is_nullable: 1
53   size: 10
54
55 =head2 desk_id
56
57   data_type: 'integer'
58   is_nullable: 1
59
60 =head2 notificationdate
61
62   data_type: 'date'
63   datetime_undef_if_invalid: 1
64   is_nullable: 1
65
66 =head2 reminderdate
67
68   data_type: 'date'
69   datetime_undef_if_invalid: 1
70   is_nullable: 1
71
72 =head2 cancellationdate
73
74   data_type: 'date'
75   datetime_undef_if_invalid: 1
76   is_nullable: 1
77
78 =head2 cancellation_reason
79
80   data_type: 'varchar'
81   is_nullable: 1
82   size: 80
83
84 =head2 reservenotes
85
86   data_type: 'longtext'
87   is_nullable: 1
88
89 =head2 priority
90
91   data_type: 'smallint'
92   default_value: 1
93   is_nullable: 0
94
95 =head2 found
96
97   data_type: 'varchar'
98   is_nullable: 1
99   size: 1
100
101 =head2 timestamp
102
103   data_type: 'timestamp'
104   datetime_undef_if_invalid: 1
105   default_value: current_timestamp
106   is_nullable: 0
107
108 =head2 itemnumber
109
110   data_type: 'integer'
111   is_foreign_key: 1
112   is_nullable: 1
113
114 =head2 waitingdate
115
116   data_type: 'date'
117   datetime_undef_if_invalid: 1
118   is_nullable: 1
119
120 =head2 expirationdate
121
122   data_type: 'date'
123   datetime_undef_if_invalid: 1
124   is_nullable: 1
125
126 =head2 lowestPriority
127
128   accessor: 'lowest_priority'
129   data_type: 'tinyint'
130   default_value: 0
131   is_nullable: 0
132
133 =head2 suspend
134
135   data_type: 'tinyint'
136   default_value: 0
137   is_nullable: 0
138
139 =head2 suspend_until
140
141   data_type: 'datetime'
142   datetime_undef_if_invalid: 1
143   is_nullable: 1
144
145 =head2 itemtype
146
147   data_type: 'varchar'
148   is_foreign_key: 1
149   is_nullable: 1
150   size: 10
151
152 =head2 item_level_hold
153
154   data_type: 'tinyint'
155   default_value: 0
156   is_nullable: 0
157
158 =head2 non_priority
159
160   data_type: 'tinyint'
161   default_value: 0
162   is_nullable: 0
163
164 =cut
165
166 __PACKAGE__->add_columns(
167   "reserve_id",
168   { data_type => "integer", is_nullable => 0 },
169   "borrowernumber",
170   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
171   "reservedate",
172   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
173   "biblionumber",
174   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
175   "branchcode",
176   { data_type => "varchar", is_nullable => 1, size => 10 },
177   "desk_id",
178   { data_type => "integer", is_nullable => 1 },
179   "notificationdate",
180   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
181   "reminderdate",
182   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
183   "cancellationdate",
184   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
185   "cancellation_reason",
186   { data_type => "varchar", is_nullable => 1, size => 80 },
187   "reservenotes",
188   { data_type => "longtext", is_nullable => 1 },
189   "priority",
190   { data_type => "smallint", default_value => 1, is_nullable => 0 },
191   "found",
192   { data_type => "varchar", is_nullable => 1, size => 1 },
193   "timestamp",
194   {
195     data_type => "timestamp",
196     datetime_undef_if_invalid => 1,
197     default_value => \"current_timestamp",
198     is_nullable => 0,
199   },
200   "itemnumber",
201   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
202   "waitingdate",
203   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
204   "expirationdate",
205   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
206   "lowestPriority",
207   {
208     accessor      => "lowest_priority",
209     data_type     => "tinyint",
210     default_value => 0,
211     is_nullable   => 0,
212   },
213   "suspend",
214   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
215   "suspend_until",
216   {
217     data_type => "datetime",
218     datetime_undef_if_invalid => 1,
219     is_nullable => 1,
220   },
221   "itemtype",
222   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
223   "item_level_hold",
224   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
225   "non_priority",
226   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
227 );
228
229 =head1 PRIMARY KEY
230
231 =over 4
232
233 =item * L</reserve_id>
234
235 =back
236
237 =cut
238
239 __PACKAGE__->set_primary_key("reserve_id");
240
241 =head1 RELATIONS
242
243 =head2 biblionumber
244
245 Type: belongs_to
246
247 Related object: L<Koha::Schema::Result::Biblio>
248
249 =cut
250
251 __PACKAGE__->belongs_to(
252   "biblionumber",
253   "Koha::Schema::Result::Biblio",
254   { biblionumber => "biblionumber" },
255   {
256     is_deferrable => 1,
257     join_type     => "LEFT",
258     on_delete     => "SET NULL",
259     on_update     => "SET NULL",
260   },
261 );
262
263 =head2 borrowernumber
264
265 Type: belongs_to
266
267 Related object: L<Koha::Schema::Result::Borrower>
268
269 =cut
270
271 __PACKAGE__->belongs_to(
272   "borrowernumber",
273   "Koha::Schema::Result::Borrower",
274   { borrowernumber => "borrowernumber" },
275   {
276     is_deferrable => 1,
277     join_type     => "LEFT",
278     on_delete     => "SET NULL",
279     on_update     => "SET NULL",
280   },
281 );
282
283 =head2 itemnumber
284
285 Type: belongs_to
286
287 Related object: L<Koha::Schema::Result::Item>
288
289 =cut
290
291 __PACKAGE__->belongs_to(
292   "itemnumber",
293   "Koha::Schema::Result::Item",
294   { itemnumber => "itemnumber" },
295   {
296     is_deferrable => 1,
297     join_type     => "LEFT",
298     on_delete     => "SET NULL",
299     on_update     => "SET NULL",
300   },
301 );
302
303 =head2 itemtype
304
305 Type: belongs_to
306
307 Related object: L<Koha::Schema::Result::Itemtype>
308
309 =cut
310
311 __PACKAGE__->belongs_to(
312   "itemtype",
313   "Koha::Schema::Result::Itemtype",
314   { itemtype => "itemtype" },
315   {
316     is_deferrable => 1,
317     join_type     => "LEFT",
318     on_delete     => "SET NULL",
319     on_update     => "SET NULL",
320   },
321 );
322
323
324 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-11-06 11:00:40
325 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7weIpuc0RpZ/MxFn94E8dg
326
327 __PACKAGE__->belongs_to(
328   "item",
329   "Koha::Schema::Result::Item",
330   { itemnumber => "itemnumber" },
331   {
332     is_deferrable => 1,
333     join_type     => "LEFT",
334     on_delete     => "CASCADE",
335     on_update     => "CASCADE",
336   },
337 );
338
339 __PACKAGE__->belongs_to(
340   "biblio",
341   "Koha::Schema::Result::Biblio",
342   { biblionumber => "biblionumber" },
343   {
344     is_deferrable => 1,
345     join_type     => "LEFT",
346     on_delete     => "CASCADE",
347     on_update     => "CASCADE",
348   },
349 );
350
351 __PACKAGE__->add_columns(
352     '+item_level_hold' => { is_boolean => 1 },
353     '+lowestPriority'  => { is_boolean => 1 },
354     '+suspend'         => { is_boolean => 1 },
355     '+non_priority'    => { is_boolean => 1 }
356 );
357
358 sub koha_object_class {
359     'Koha::Old::Hold';
360 }
361 sub koha_objects_class {
362     'Koha::Old::Holds';
363 }
364
365 1;