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