Bug 10493: Add renewal script
[koha.git] / Koha / Schema / Result / Item.pm
1 use utf8;
2 package Koha::Schema::Result::Item;
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::Item
10
11 =cut
12
13 use strict;
14 use warnings;
15
16 use base 'DBIx::Class::Core';
17
18 =head1 TABLE: C<items>
19
20 =cut
21
22 __PACKAGE__->table("items");
23
24 =head1 ACCESSORS
25
26 =head2 itemnumber
27
28   data_type: 'integer'
29   is_auto_increment: 1
30   is_nullable: 0
31
32 =head2 biblionumber
33
34   data_type: 'integer'
35   default_value: 0
36   is_nullable: 0
37
38 =head2 biblioitemnumber
39
40   data_type: 'integer'
41   default_value: 0
42   is_foreign_key: 1
43   is_nullable: 0
44
45 =head2 barcode
46
47   data_type: 'varchar'
48   is_nullable: 1
49   size: 20
50
51 =head2 dateaccessioned
52
53   data_type: 'date'
54   datetime_undef_if_invalid: 1
55   is_nullable: 1
56
57 =head2 booksellerid
58
59   data_type: 'mediumtext'
60   is_nullable: 1
61
62 =head2 homebranch
63
64   data_type: 'varchar'
65   is_foreign_key: 1
66   is_nullable: 1
67   size: 10
68
69 =head2 price
70
71   data_type: 'decimal'
72   is_nullable: 1
73   size: [8,2]
74
75 =head2 replacementprice
76
77   data_type: 'decimal'
78   is_nullable: 1
79   size: [8,2]
80
81 =head2 replacementpricedate
82
83   data_type: 'date'
84   datetime_undef_if_invalid: 1
85   is_nullable: 1
86
87 =head2 datelastborrowed
88
89   data_type: 'date'
90   datetime_undef_if_invalid: 1
91   is_nullable: 1
92
93 =head2 datelastseen
94
95   data_type: 'date'
96   datetime_undef_if_invalid: 1
97   is_nullable: 1
98
99 =head2 stack
100
101   data_type: 'tinyint'
102   is_nullable: 1
103
104 =head2 notforloan
105
106   data_type: 'tinyint'
107   default_value: 0
108   is_nullable: 0
109
110 =head2 damaged
111
112   data_type: 'tinyint'
113   default_value: 0
114   is_nullable: 0
115
116 =head2 itemlost
117
118   data_type: 'tinyint'
119   default_value: 0
120   is_nullable: 0
121
122 =head2 withdrawn
123
124   data_type: 'tinyint'
125   default_value: 0
126   is_nullable: 0
127
128 =head2 itemcallnumber
129
130   data_type: 'varchar'
131   is_nullable: 1
132   size: 255
133
134 =head2 coded_location_qualifier
135
136   data_type: 'varchar'
137   is_nullable: 1
138   size: 10
139
140 =head2 issues
141
142   data_type: 'smallint'
143   is_nullable: 1
144
145 =head2 renewals
146
147   data_type: 'smallint'
148   is_nullable: 1
149
150 =head2 reserves
151
152   data_type: 'smallint'
153   is_nullable: 1
154
155 =head2 restricted
156
157   data_type: 'tinyint'
158   is_nullable: 1
159
160 =head2 itemnotes
161
162   data_type: 'mediumtext'
163   is_nullable: 1
164
165 =head2 holdingbranch
166
167   data_type: 'varchar'
168   is_foreign_key: 1
169   is_nullable: 1
170   size: 10
171
172 =head2 paidfor
173
174   data_type: 'mediumtext'
175   is_nullable: 1
176
177 =head2 timestamp
178
179   data_type: 'timestamp'
180   datetime_undef_if_invalid: 1
181   default_value: current_timestamp
182   is_nullable: 0
183
184 =head2 location
185
186   data_type: 'varchar'
187   is_nullable: 1
188   size: 80
189
190 =head2 permanent_location
191
192   data_type: 'varchar'
193   is_nullable: 1
194   size: 80
195
196 =head2 onloan
197
198   data_type: 'date'
199   datetime_undef_if_invalid: 1
200   is_nullable: 1
201
202 =head2 cn_source
203
204   data_type: 'varchar'
205   is_nullable: 1
206   size: 10
207
208 =head2 cn_sort
209
210   data_type: 'varchar'
211   is_nullable: 1
212   size: 30
213
214 =head2 ccode
215
216   data_type: 'varchar'
217   is_nullable: 1
218   size: 10
219
220 =head2 materials
221
222   data_type: 'text'
223   is_nullable: 1
224
225 =head2 uri
226
227   data_type: 'varchar'
228   is_nullable: 1
229   size: 255
230
231 =head2 itype
232
233   data_type: 'varchar'
234   is_nullable: 1
235   size: 10
236
237 =head2 more_subfields_xml
238
239   data_type: 'longtext'
240   is_nullable: 1
241
242 =head2 enumchron
243
244   data_type: 'text'
245   is_nullable: 1
246
247 =head2 copynumber
248
249   data_type: 'varchar'
250   is_nullable: 1
251   size: 32
252
253 =head2 stocknumber
254
255   data_type: 'varchar'
256   is_nullable: 1
257   size: 32
258
259 =cut
260
261 __PACKAGE__->add_columns(
262   "itemnumber",
263   { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
264   "biblionumber",
265   { data_type => "integer", default_value => 0, is_nullable => 0 },
266   "biblioitemnumber",
267   {
268     data_type      => "integer",
269     default_value  => 0,
270     is_foreign_key => 1,
271     is_nullable    => 0,
272   },
273   "barcode",
274   { data_type => "varchar", is_nullable => 1, size => 20 },
275   "dateaccessioned",
276   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
277   "booksellerid",
278   { data_type => "mediumtext", is_nullable => 1 },
279   "homebranch",
280   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
281   "price",
282   { data_type => "decimal", is_nullable => 1, size => [8, 2] },
283   "replacementprice",
284   { data_type => "decimal", is_nullable => 1, size => [8, 2] },
285   "replacementpricedate",
286   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
287   "datelastborrowed",
288   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
289   "datelastseen",
290   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
291   "stack",
292   { data_type => "tinyint", is_nullable => 1 },
293   "notforloan",
294   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
295   "damaged",
296   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
297   "itemlost",
298   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
299   "withdrawn",
300   { data_type => "tinyint", default_value => 0, is_nullable => 0 },
301   "itemcallnumber",
302   { data_type => "varchar", is_nullable => 1, size => 255 },
303   "coded_location_qualifier",
304   { data_type => "varchar", is_nullable => 1, size => 10 },
305   "issues",
306   { data_type => "smallint", is_nullable => 1 },
307   "renewals",
308   { data_type => "smallint", is_nullable => 1 },
309   "reserves",
310   { data_type => "smallint", is_nullable => 1 },
311   "restricted",
312   { data_type => "tinyint", is_nullable => 1 },
313   "itemnotes",
314   { data_type => "mediumtext", is_nullable => 1 },
315   "holdingbranch",
316   { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
317   "paidfor",
318   { data_type => "mediumtext", is_nullable => 1 },
319   "timestamp",
320   {
321     data_type => "timestamp",
322     datetime_undef_if_invalid => 1,
323     default_value => \"current_timestamp",
324     is_nullable => 0,
325   },
326   "location",
327   { data_type => "varchar", is_nullable => 1, size => 80 },
328   "permanent_location",
329   { data_type => "varchar", is_nullable => 1, size => 80 },
330   "onloan",
331   { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
332   "cn_source",
333   { data_type => "varchar", is_nullable => 1, size => 10 },
334   "cn_sort",
335   { data_type => "varchar", is_nullable => 1, size => 30 },
336   "ccode",
337   { data_type => "varchar", is_nullable => 1, size => 10 },
338   "materials",
339   { data_type => "text", is_nullable => 1 },
340   "uri",
341   { data_type => "varchar", is_nullable => 1, size => 255 },
342   "itype",
343   { data_type => "varchar", is_nullable => 1, size => 10 },
344   "more_subfields_xml",
345   { data_type => "longtext", is_nullable => 1 },
346   "enumchron",
347   { data_type => "text", is_nullable => 1 },
348   "copynumber",
349   { data_type => "varchar", is_nullable => 1, size => 32 },
350   "stocknumber",
351   { data_type => "varchar", is_nullable => 1, size => 32 },
352 );
353
354 =head1 PRIMARY KEY
355
356 =over 4
357
358 =item * L</itemnumber>
359
360 =back
361
362 =cut
363
364 __PACKAGE__->set_primary_key("itemnumber");
365
366 =head1 UNIQUE CONSTRAINTS
367
368 =head2 C<itembarcodeidx>
369
370 =over 4
371
372 =item * L</barcode>
373
374 =back
375
376 =cut
377
378 __PACKAGE__->add_unique_constraint("itembarcodeidx", ["barcode"]);
379
380 =head1 RELATIONS
381
382 =head2 accountlines
383
384 Type: has_many
385
386 Related object: L<Koha::Schema::Result::Accountline>
387
388 =cut
389
390 __PACKAGE__->has_many(
391   "accountlines",
392   "Koha::Schema::Result::Accountline",
393   { "foreign.itemnumber" => "self.itemnumber" },
394   { cascade_copy => 0, cascade_delete => 0 },
395 );
396
397 =head2 biblioitemnumber
398
399 Type: belongs_to
400
401 Related object: L<Koha::Schema::Result::Biblioitem>
402
403 =cut
404
405 __PACKAGE__->belongs_to(
406   "biblioitemnumber",
407   "Koha::Schema::Result::Biblioitem",
408   { biblioitemnumber => "biblioitemnumber" },
409   { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
410 );
411
412 =head2 branchtransfers
413
414 Type: has_many
415
416 Related object: L<Koha::Schema::Result::Branchtransfer>
417
418 =cut
419
420 __PACKAGE__->has_many(
421   "branchtransfers",
422   "Koha::Schema::Result::Branchtransfer",
423   { "foreign.itemnumber" => "self.itemnumber" },
424   { cascade_copy => 0, cascade_delete => 0 },
425 );
426
427 =head2 course_item
428
429 Type: might_have
430
431 Related object: L<Koha::Schema::Result::CourseItem>
432
433 =cut
434
435 __PACKAGE__->might_have(
436   "course_item",
437   "Koha::Schema::Result::CourseItem",
438   { "foreign.itemnumber" => "self.itemnumber" },
439   { cascade_copy => 0, cascade_delete => 0 },
440 );
441
442 =head2 creator_batches
443
444 Type: has_many
445
446 Related object: L<Koha::Schema::Result::CreatorBatch>
447
448 =cut
449
450 __PACKAGE__->has_many(
451   "creator_batches",
452   "Koha::Schema::Result::CreatorBatch",
453   { "foreign.item_number" => "self.itemnumber" },
454   { cascade_copy => 0, cascade_delete => 0 },
455 );
456
457 =head2 hold_fill_target
458
459 Type: might_have
460
461 Related object: L<Koha::Schema::Result::HoldFillTarget>
462
463 =cut
464
465 __PACKAGE__->might_have(
466   "hold_fill_target",
467   "Koha::Schema::Result::HoldFillTarget",
468   { "foreign.itemnumber" => "self.itemnumber" },
469   { cascade_copy => 0, cascade_delete => 0 },
470 );
471
472 =head2 holdingbranch
473
474 Type: belongs_to
475
476 Related object: L<Koha::Schema::Result::Branch>
477
478 =cut
479
480 __PACKAGE__->belongs_to(
481   "holdingbranch",
482   "Koha::Schema::Result::Branch",
483   { branchcode => "holdingbranch" },
484   {
485     is_deferrable => 1,
486     join_type     => "LEFT",
487     on_delete     => "CASCADE",
488     on_update     => "CASCADE",
489   },
490 );
491
492 =head2 homebranch
493
494 Type: belongs_to
495
496 Related object: L<Koha::Schema::Result::Branch>
497
498 =cut
499
500 __PACKAGE__->belongs_to(
501   "homebranch",
502   "Koha::Schema::Result::Branch",
503   { branchcode => "homebranch" },
504   {
505     is_deferrable => 1,
506     join_type     => "LEFT",
507     on_delete     => "CASCADE",
508     on_update     => "CASCADE",
509   },
510 );
511
512 =head2 issues
513
514 Type: has_many
515
516 Related object: L<Koha::Schema::Result::Issue>
517
518 =cut
519
520 __PACKAGE__->has_many(
521   "issues",
522   "Koha::Schema::Result::Issue",
523   { "foreign.itemnumber" => "self.itemnumber" },
524   { cascade_copy => 0, cascade_delete => 0 },
525 );
526
527 =head2 old_issues
528
529 Type: has_many
530
531 Related object: L<Koha::Schema::Result::OldIssue>
532
533 =cut
534
535 __PACKAGE__->has_many(
536   "old_issues",
537   "Koha::Schema::Result::OldIssue",
538   { "foreign.itemnumber" => "self.itemnumber" },
539   { cascade_copy => 0, cascade_delete => 0 },
540 );
541
542 =head2 old_reserves
543
544 Type: has_many
545
546 Related object: L<Koha::Schema::Result::OldReserve>
547
548 =cut
549
550 __PACKAGE__->has_many(
551   "old_reserves",
552   "Koha::Schema::Result::OldReserve",
553   { "foreign.itemnumber" => "self.itemnumber" },
554   { cascade_copy => 0, cascade_delete => 0 },
555 );
556
557 =head2 reserves
558
559 Type: has_many
560
561 Related object: L<Koha::Schema::Result::Reserve>
562
563 =cut
564
565 __PACKAGE__->has_many(
566   "reserves",
567   "Koha::Schema::Result::Reserve",
568   { "foreign.itemnumber" => "self.itemnumber" },
569   { cascade_copy => 0, cascade_delete => 0 },
570 );
571
572 =head2 serialitem
573
574 Type: might_have
575
576 Related object: L<Koha::Schema::Result::Serialitem>
577
578 =cut
579
580 __PACKAGE__->might_have(
581   "serialitem",
582   "Koha::Schema::Result::Serialitem",
583   { "foreign.itemnumber" => "self.itemnumber" },
584   { cascade_copy => 0, cascade_delete => 0 },
585 );
586
587
588 # Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
589 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JV1Q/UVlKQ6QgVFMGBIZCw
590
591 __PACKAGE__->belongs_to(
592     "biblio",
593     "Koha::Schema::Result::Biblio",
594     { "foreign.biblionumber" => "self.biblionumber" }
595 );
596
597 1;