Bug 23152: Implement koha_object[s]_class when needed
[koha-equinox.git] / Koha / Schema / Result / Issue.pm
1 use utf8;
2 package Koha::Schema::Result::Issue;
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::Issue
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<issues>
19
20 =cut
21
22 __PACKAGE__->table("issues");
23
24 =head1 ACCESSORS
25
26 =head2 issue_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   is_foreign_key: 1
36   is_nullable: 1
37
38 =head2 itemnumber
39
40   data_type: 'integer'
41   is_foreign_key: 1
42   is_nullable: 1
43
44 =head2 date_due
45
46   data_type: 'datetime'
47   datetime_undef_if_invalid: 1
48   is_nullable: 1
49
50 =head2 branchcode
51
52   data_type: 'varchar'
53   is_nullable: 1
54   size: 10
55
56 =head2 returndate
57
58   data_type: 'datetime'
59   datetime_undef_if_invalid: 1
60   is_nullable: 1
61
62 =head2 lastreneweddate
63
64   data_type: 'datetime'
65   datetime_undef_if_invalid: 1
66   is_nullable: 1
67
68 =head2 renewals
69
70   data_type: 'tinyint'
71   default_value: 0
72   is_nullable: 0
73
74 =head2 auto_renew
75
76   data_type: 'tinyint'
77   default_value: 0
78   is_nullable: 1
79
80 =head2 auto_renew_error
81
82   data_type: 'varchar'
83   is_nullable: 1
84   size: 32
85
86 =head2 timestamp
87
88   data_type: 'timestamp'
89   datetime_undef_if_invalid: 1
90   default_value: current_timestamp
91   is_nullable: 0
92
93 =head2 issuedate
94
95   data_type: 'datetime'
96   datetime_undef_if_invalid: 1
97   is_nullable: 1
98
99 =head2 onsite_checkout
100
101   data_type: 'integer'
102   default_value: 0
103   is_nullable: 0
104
105 =head2 note
106
107   data_type: 'longtext'
108   is_nullable: 1
109
110 =head2 notedate
111
112   data_type: 'datetime'
113   datetime_undef_if_invalid: 1
114   is_nullable: 1
115
116 =head2 noteseen
117
118   data_type: 'integer'
119   is_nullable: 1
120
121 =cut
122
123 __PACKAGE__->add_columns(
124   "issue_id",
125   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
126   "borrowernumber",
127   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
128   "itemnumber",
129   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
130   "date_due",
131   {
132     data_type => "datetime",
133     datetime_undef_if_invalid => 1,
134     is_nullable => 1,
135   },
136   "branchcode",
137   { data_type => "varchar", is_nullable => 1, size => 10 },
138   "returndate",
139   {
140     data_type => "datetime",
141     datetime_undef_if_invalid => 1,
142     is_nullable => 1,
143   },
144   "lastreneweddate",
145   {
146     data_type => "datetime",
147     datetime_undef_if_invalid => 1,
148     is_nullable => 1,
149   },
150   "renewals",
151   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
152   "auto_renew",
153   { data_type => "tinyint", default_value => 0, is_nullable => 1 },
154   "auto_renew_error",
155   { data_type => "varchar", is_nullable => 1, size => 32 },
156   "timestamp",
157   {
158     data_type => "timestamp",
159     datetime_undef_if_invalid => 1,
160     default_value => \"current_timestamp",
161     is_nullable => 0,
162   },
163   "issuedate",
164   {
165     data_type => "datetime",
166     datetime_undef_if_invalid => 1,
167     is_nullable => 1,
168   },
169   "onsite_checkout",
170   { data_type => "integer", default_value => 0, is_nullable => 0 },
171   "note",
172   { data_type => "longtext", is_nullable => 1 },
173   "notedate",
174   {
175     data_type => "datetime",
176     datetime_undef_if_invalid => 1,
177     is_nullable => 1,
178   },
179   "noteseen",
180   { data_type => "integer", is_nullable => 1 },
181 );
182
183 =head1 PRIMARY KEY
184
185 =over 4
186
187 =item * L</issue_id>
188
189 =back
190
191 =cut
192
193 __PACKAGE__->set_primary_key("issue_id");
194
195 =head1 UNIQUE CONSTRAINTS
196
197 =head2 C<itemnumber>
198
199 =over 4
200
201 =item * L</itemnumber>
202
203 =back
204
205 =cut
206
207 __PACKAGE__->add_unique_constraint("itemnumber", ["itemnumber"]);
208
209 =head1 RELATIONS
210
211 =head2 borrowernumber
212
213 Type: belongs_to
214
215 Related object: L<Koha::Schema::Result::Borrower>
216
217 =cut
218
219 __PACKAGE__->belongs_to(
220   "borrowernumber",
221   "Koha::Schema::Result::Borrower",
222   { borrowernumber => "borrowernumber" },
223   {
224     is_deferrable => 1,
225     join_type     => "LEFT",
226     on_delete     => "RESTRICT",
227     on_update     => "CASCADE",
228   },
229 );
230
231 =head2 itemnumber
232
233 Type: belongs_to
234
235 Related object: L<Koha::Schema::Result::Item>
236
237 =cut
238
239 __PACKAGE__->belongs_to(
240   "itemnumber",
241   "Koha::Schema::Result::Item",
242   { itemnumber => "itemnumber" },
243   {
244     is_deferrable => 1,
245     join_type     => "LEFT",
246     on_delete     => "RESTRICT",
247     on_update     => "CASCADE",
248   },
249 );
250
251
252 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-10 19:55:44
253 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PUF5X7X9K44BC0d43Rat7w
254
255 __PACKAGE__->add_columns(
256     '+auto_renew'      => { is_boolean => 1 },
257     '+onsite_checkout' => { is_boolean => 1 }
258 );
259
260 __PACKAGE__->belongs_to(
261     "borrower",
262     "Koha::Schema::Result::Borrower",
263     { borrowernumber => "borrowernumber" },
264     { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
265 );
266
267 __PACKAGE__->belongs_to(
268   "item",
269   "Koha::Schema::Result::Item",
270   { itemnumber => "itemnumber" },
271   {
272     is_deferrable => 1,
273     join_type     => "LEFT",
274     on_delete     => "CASCADE",
275     on_update     => "CASCADE",
276   },
277 );
278
279 __PACKAGE__->belongs_to(
280   "branch",
281   "Koha::Schema::Result::Branch",
282   { branchcode => "branchcode" },
283   {
284     is_deferrable => 1,
285     join_type     => "LEFT",
286     on_delete     => "CASCADE",
287     on_update     => "CASCADE",
288   },
289 );
290
291 sub koha_object_class {
292     'Koha::Checkout';
293 }
294 sub koha_objects_class {
295     'Koha::Checkouts';
296 }
297
298 1;