Bug 20978: (follow-up) Another use case from C4::Circulation
[koha.git] / Koha / Schema / Result / Reserve.pm
blob1ba1c974f679823c86ed6b8912bb37d415a5b34e
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 notificationdate
61 data_type: 'date'
62 datetime_undef_if_invalid: 1
63 is_nullable: 1
65 =head2 reminderdate
67 data_type: 'date'
68 datetime_undef_if_invalid: 1
69 is_nullable: 1
71 =head2 cancellationdate
73 data_type: 'date'
74 datetime_undef_if_invalid: 1
75 is_nullable: 1
77 =head2 reservenotes
79 data_type: 'longtext'
80 is_nullable: 1
82 =head2 priority
84 data_type: 'smallint'
85 is_nullable: 1
87 =head2 found
89 data_type: 'varchar'
90 is_nullable: 1
91 size: 1
93 =head2 timestamp
95 data_type: 'timestamp'
96 datetime_undef_if_invalid: 1
97 default_value: current_timestamp
98 is_nullable: 0
100 =head2 itemnumber
102 data_type: 'integer'
103 is_foreign_key: 1
104 is_nullable: 1
106 =head2 waitingdate
108 data_type: 'date'
109 datetime_undef_if_invalid: 1
110 is_nullable: 1
112 =head2 expirationdate
114 data_type: 'date'
115 datetime_undef_if_invalid: 1
116 is_nullable: 1
118 =head2 lowestPriority
120 accessor: 'lowest_priority'
121 data_type: 'tinyint'
122 default_value: 0
123 is_nullable: 0
125 =head2 suspend
127 data_type: 'tinyint'
128 default_value: 0
129 is_nullable: 0
131 =head2 suspend_until
133 data_type: 'datetime'
134 datetime_undef_if_invalid: 1
135 is_nullable: 1
137 =head2 itemtype
139 data_type: 'varchar'
140 is_foreign_key: 1
141 is_nullable: 1
142 size: 10
144 =cut
146 __PACKAGE__->add_columns(
147 "reserve_id",
148 { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
149 "borrowernumber",
151 data_type => "integer",
152 default_value => 0,
153 is_foreign_key => 1,
154 is_nullable => 0,
156 "reservedate",
157 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
158 "biblionumber",
160 data_type => "integer",
161 default_value => 0,
162 is_foreign_key => 1,
163 is_nullable => 0,
165 "branchcode",
166 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
167 "notificationdate",
168 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
169 "reminderdate",
170 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
171 "cancellationdate",
172 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
173 "reservenotes",
174 { data_type => "longtext", is_nullable => 1 },
175 "priority",
176 { data_type => "smallint", is_nullable => 1 },
177 "found",
178 { data_type => "varchar", is_nullable => 1, size => 1 },
179 "timestamp",
181 data_type => "timestamp",
182 datetime_undef_if_invalid => 1,
183 default_value => \"current_timestamp",
184 is_nullable => 0,
186 "itemnumber",
187 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
188 "waitingdate",
189 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
190 "expirationdate",
191 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
192 "lowestPriority",
194 accessor => "lowest_priority",
195 data_type => "tinyint",
196 default_value => 0,
197 is_nullable => 0,
199 "suspend",
200 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
201 "suspend_until",
203 data_type => "datetime",
204 datetime_undef_if_invalid => 1,
205 is_nullable => 1,
207 "itemtype",
208 { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
211 =head1 PRIMARY KEY
213 =over 4
215 =item * L</reserve_id>
217 =back
219 =cut
221 __PACKAGE__->set_primary_key("reserve_id");
223 =head1 RELATIONS
225 =head2 biblionumber
227 Type: belongs_to
229 Related object: L<Koha::Schema::Result::Biblio>
231 =cut
233 __PACKAGE__->belongs_to(
234 "biblionumber",
235 "Koha::Schema::Result::Biblio",
236 { biblionumber => "biblionumber" },
237 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
240 =head2 borrowernumber
242 Type: belongs_to
244 Related object: L<Koha::Schema::Result::Borrower>
246 =cut
248 __PACKAGE__->belongs_to(
249 "borrowernumber",
250 "Koha::Schema::Result::Borrower",
251 { borrowernumber => "borrowernumber" },
252 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
255 =head2 branchcode
257 Type: belongs_to
259 Related object: L<Koha::Schema::Result::Branch>
261 =cut
263 __PACKAGE__->belongs_to(
264 "branchcode",
265 "Koha::Schema::Result::Branch",
266 { branchcode => "branchcode" },
268 is_deferrable => 1,
269 join_type => "LEFT",
270 on_delete => "CASCADE",
271 on_update => "CASCADE",
275 =head2 itemnumber
277 Type: belongs_to
279 Related object: L<Koha::Schema::Result::Item>
281 =cut
283 __PACKAGE__->belongs_to(
284 "itemnumber",
285 "Koha::Schema::Result::Item",
286 { itemnumber => "itemnumber" },
288 is_deferrable => 1,
289 join_type => "LEFT",
290 on_delete => "CASCADE",
291 on_update => "CASCADE",
295 =head2 itemtype
297 Type: belongs_to
299 Related object: L<Koha::Schema::Result::Itemtype>
301 =cut
303 __PACKAGE__->belongs_to(
304 "itemtype",
305 "Koha::Schema::Result::Itemtype",
306 { itemtype => "itemtype" },
308 is_deferrable => 1,
309 join_type => "LEFT",
310 on_delete => "CASCADE",
311 on_update => "CASCADE",
316 # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54
317 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2GCET9quFpUvzuN7MUWZNw
319 __PACKAGE__->belongs_to(
320 "item",
321 "Koha::Schema::Result::Item",
322 { itemnumber => "itemnumber" },
324 is_deferrable => 1,
325 join_type => "LEFT",
326 on_delete => "CASCADE",
327 on_update => "CASCADE",
331 __PACKAGE__->belongs_to(
332 "biblio",
333 "Koha::Schema::Result::Biblio",
334 { biblionumber => "biblionumber" },
336 is_deferrable => 1,
337 join_type => "LEFT",
338 on_delete => "CASCADE",
339 on_update => "CASCADE",
343 __PACKAGE__->add_columns(
344 '+lowestPriority' => { is_boolean => 1 },
345 '+suspend' => { is_boolean => 1 }