Bug 30275: (QA follow-up) Rename columns to match API
[koha.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 primary key for issues table
33
34 =head2 borrowernumber
35
36   data_type: 'integer'
37   is_foreign_key: 1
38   is_nullable: 1
39
40 foreign key, linking this to the borrowers table for the patron this item was checked out to
41
42 =head2 issuer_id
43
44   data_type: 'integer'
45   is_foreign_key: 1
46   is_nullable: 1
47
48 foreign key, linking this to the borrowers table for the user who checked out this item
49
50 =head2 itemnumber
51
52   data_type: 'integer'
53   is_foreign_key: 1
54   is_nullable: 1
55
56 foreign key, linking this to the items table for the item that was checked out
57
58 =head2 date_due
59
60   data_type: 'datetime'
61   datetime_undef_if_invalid: 1
62   is_nullable: 1
63
64 datetime the item is due (yyyy-mm-dd hh:mm::ss)
65
66 =head2 branchcode
67
68   data_type: 'varchar'
69   is_nullable: 1
70   size: 10
71
72 foreign key, linking to the branches table for the location the item was checked out
73
74 =head2 returndate
75
76   data_type: 'datetime'
77   datetime_undef_if_invalid: 1
78   is_nullable: 1
79
80 date the item was returned, will be NULL until moved to old_issues
81
82 =head2 lastreneweddate
83
84   data_type: 'datetime'
85   datetime_undef_if_invalid: 1
86   is_nullable: 1
87
88 date the item was last renewed
89
90 =head2 renewals_count
91
92   data_type: 'tinyint'
93   default_value: 0
94   is_nullable: 0
95
96 lists the number of times the item was renewed
97
98 =head2 unseen_renewals
99
100   data_type: 'tinyint'
101   default_value: 0
102   is_nullable: 0
103
104 lists the number of consecutive times the item was renewed without being seen
105
106 =head2 auto_renew
107
108   data_type: 'tinyint'
109   default_value: 0
110   is_nullable: 1
111
112 automatic renewal
113
114 =head2 auto_renew_error
115
116   data_type: 'varchar'
117   is_nullable: 1
118   size: 32
119
120 automatic renewal error
121
122 =head2 timestamp
123
124   data_type: 'timestamp'
125   datetime_undef_if_invalid: 1
126   default_value: current_timestamp
127   is_nullable: 0
128
129 the date and time this record was last touched
130
131 =head2 issuedate
132
133   data_type: 'datetime'
134   datetime_undef_if_invalid: 1
135   is_nullable: 1
136
137 date the item was checked out or issued
138
139 =head2 onsite_checkout
140
141   data_type: 'integer'
142   default_value: 0
143   is_nullable: 0
144
145 in house use flag
146
147 =head2 note
148
149   data_type: 'longtext'
150   is_nullable: 1
151
152 issue note text
153
154 =head2 notedate
155
156   data_type: 'datetime'
157   datetime_undef_if_invalid: 1
158   is_nullable: 1
159
160 datetime of issue note (yyyy-mm-dd hh:mm::ss)
161
162 =head2 noteseen
163
164   data_type: 'integer'
165   is_nullable: 1
166
167 describes whether checkout note has been seen 1, not been seen 0 or doesn't exist null
168
169 =cut
170
171 __PACKAGE__->add_columns(
172   "issue_id",
173   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
174   "borrowernumber",
175   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
176   "issuer_id",
177   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
178   "itemnumber",
179   { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
180   "date_due",
181   {
182     data_type => "datetime",
183     datetime_undef_if_invalid => 1,
184     is_nullable => 1,
185   },
186   "branchcode",
187   { data_type => "varchar", is_nullable => 1, size => 10 },
188   "returndate",
189   {
190     data_type => "datetime",
191     datetime_undef_if_invalid => 1,
192     is_nullable => 1,
193   },
194   "lastreneweddate",
195   {
196     data_type => "datetime",
197     datetime_undef_if_invalid => 1,
198     is_nullable => 1,
199   },
200   "renewals_count",
201   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
202   "unseen_renewals",
203   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
204   "auto_renew",
205   { data_type => "tinyint", default_value => 0, is_nullable => 1 },
206   "auto_renew_error",
207   { data_type => "varchar", is_nullable => 1, size => 32 },
208   "timestamp",
209   {
210     data_type => "timestamp",
211     datetime_undef_if_invalid => 1,
212     default_value => \"current_timestamp",
213     is_nullable => 0,
214   },
215   "issuedate",
216   {
217     data_type => "datetime",
218     datetime_undef_if_invalid => 1,
219     is_nullable => 1,
220   },
221   "onsite_checkout",
222   { data_type => "integer", default_value => 0, is_nullable => 0 },
223   "note",
224   { data_type => "longtext", is_nullable => 1 },
225   "notedate",
226   {
227     data_type => "datetime",
228     datetime_undef_if_invalid => 1,
229     is_nullable => 1,
230   },
231   "noteseen",
232   { data_type => "integer", is_nullable => 1 },
233 );
234
235 =head1 PRIMARY KEY
236
237 =over 4
238
239 =item * L</issue_id>
240
241 =back
242
243 =cut
244
245 __PACKAGE__->set_primary_key("issue_id");
246
247 =head1 UNIQUE CONSTRAINTS
248
249 =head2 C<itemnumber>
250
251 =over 4
252
253 =item * L</itemnumber>
254
255 =back
256
257 =cut
258
259 __PACKAGE__->add_unique_constraint("itemnumber", ["itemnumber"]);
260
261 =head1 RELATIONS
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     => "RESTRICT",
279     on_update     => "CASCADE",
280   },
281 );
282
283 =head2 issuer
284
285 Type: belongs_to
286
287 Related object: L<Koha::Schema::Result::Borrower>
288
289 =cut
290
291 __PACKAGE__->belongs_to(
292   "issuer",
293   "Koha::Schema::Result::Borrower",
294   { borrowernumber => "issuer_id" },
295   {
296     is_deferrable => 1,
297     join_type     => "LEFT",
298     on_delete     => "SET NULL",
299     on_update     => "CASCADE",
300   },
301 );
302
303 =head2 itemnumber
304
305 Type: belongs_to
306
307 Related object: L<Koha::Schema::Result::Item>
308
309 =cut
310
311 __PACKAGE__->belongs_to(
312   "itemnumber",
313   "Koha::Schema::Result::Item",
314   { itemnumber => "itemnumber" },
315   {
316     is_deferrable => 1,
317     join_type     => "LEFT",
318     on_delete     => "RESTRICT",
319     on_update     => "CASCADE",
320   },
321 );
322
323
324 # Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-03-11 15:10:14
325 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:TERiBbm+B4jMEuNM2dVbfQ
326
327 __PACKAGE__->add_columns(
328     '+auto_renew'      => { is_boolean => 1 },
329     '+noteseen'        => { is_boolean => 1 },
330     '+onsite_checkout' => { is_boolean => 1 }
331 );
332
333 __PACKAGE__->belongs_to(
334     "patron",
335     "Koha::Schema::Result::Borrower",
336     { borrowernumber => "borrowernumber" },
337     { join_type => "LEFT", on_delete => "CASCADE", on_update => "CASCADE" },
338 );
339
340 __PACKAGE__->belongs_to(
341   "item",
342   "Koha::Schema::Result::Item",
343   { itemnumber => "itemnumber" },
344   {
345     is_deferrable => 1,
346     join_type     => "LEFT",
347     on_delete     => "CASCADE",
348     on_update     => "CASCADE",
349   },
350 );
351
352 __PACKAGE__->belongs_to(
353   "branch",
354   "Koha::Schema::Result::Branch",
355   { branchcode => "branchcode" },
356   {
357     is_deferrable => 1,
358     join_type     => "LEFT",
359     on_delete     => "CASCADE",
360     on_update     => "CASCADE",
361   },
362 );
363
364 __PACKAGE__->belongs_to(
365   "library",
366   "Koha::Schema::Result::Branch",
367   { "foreign.branchcode" => "self.branchcode" },
368   {
369     is_deferrable => 1,
370     join_type     => "LEFT",
371     on_delete     => "CASCADE",
372     on_update     => "CASCADE",
373   },
374 );
375
376 =head2 renewals
377
378 Type: has_many
379
380 Related object: L<Koha::Schema::Result::CheckoutRenewal>
381
382 =cut
383
384 __PACKAGE__->has_many(
385     "renewals",
386     "Koha::Schema::Result::CheckoutRenewal",
387     { "foreign.checkout_id" => "self.issue_id" },
388     { cascade_copy       => 0, cascade_delete => 0 },
389 );
390
391 =head2 return_claim
392
393 Type: might_have
394
395 Related object: L<Koha::Schema::Result::ReturnClaim>
396
397 =cut
398
399 __PACKAGE__->might_have(
400     "return_claim",
401     "Koha::Schema::Result::ReturnClaim",
402     { "foreign.issue_id" => "self.issue_id" },
403     { cascade_copy       => 0, cascade_delete => 0 },
404 );
405
406 sub koha_object_class {
407     'Koha::Checkout';
408 }
409 sub koha_objects_class {
410     'Koha::Checkouts';
411 }
412
413 1;