2 package Koha
::Schema
::Result
::Item
;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
9 Koha::Schema::Result::Item
16 use base
'DBIx::Class::Core';
18 =head1 TABLE: C<items>
22 __PACKAGE__
->table("items");
39 =head2 biblioitemnumber
52 =head2 dateaccessioned
55 datetime_undef_if_invalid: 1
76 =head2 replacementprice
82 =head2 replacementpricedate
85 datetime_undef_if_invalid: 1
88 =head2 datelastborrowed
91 datetime_undef_if_invalid: 1
97 datetime_undef_if_invalid: 1
119 data_type: 'datetime'
120 datetime_undef_if_invalid: 1
131 data_type: 'datetime'
132 datetime_undef_if_invalid: 1
143 data_type: 'datetime'
144 datetime_undef_if_invalid: 1
147 =head2 itemcallnumber
153 =head2 coded_location_qualifier
161 data_type: 'smallint'
166 data_type: 'smallint'
171 data_type: 'smallint'
181 data_type: 'longtext'
184 =head2 itemnotes_nonpublic
186 data_type: 'longtext'
198 data_type: 'longtext'
203 data_type: 'timestamp'
204 datetime_undef_if_invalid: 1
205 default_value: current_timestamp
214 =head2 permanent_location
223 datetime_undef_if_invalid: 1
246 data_type: 'mediumtext'
251 data_type: 'mediumtext'
260 =head2 more_subfields_xml
262 data_type: 'longtext'
267 data_type: 'mediumtext'
290 __PACKAGE__
->add_columns(
292 { data_type
=> "integer", is_auto_increment
=> 1, is_nullable
=> 0 },
295 data_type
=> "integer",
302 data_type
=> "integer",
308 { data_type
=> "varchar", is_nullable
=> 1, size
=> 20 },
310 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
312 { data_type
=> "longtext", is_nullable
=> 1 },
314 { data_type
=> "varchar", is_foreign_key
=> 1, is_nullable
=> 1, size
=> 10 },
316 { data_type
=> "decimal", is_nullable
=> 1, size
=> [8, 2] },
318 { data_type
=> "decimal", is_nullable
=> 1, size
=> [8, 2] },
319 "replacementpricedate",
320 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
322 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
324 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
326 { data_type
=> "tinyint", is_nullable
=> 1 },
328 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
330 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
333 data_type
=> "datetime",
334 datetime_undef_if_invalid
=> 1,
338 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
341 data_type
=> "datetime",
342 datetime_undef_if_invalid
=> 1,
346 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
349 data_type
=> "datetime",
350 datetime_undef_if_invalid
=> 1,
354 { data_type
=> "varchar", is_nullable
=> 1, size
=> 255 },
355 "coded_location_qualifier",
356 { data_type
=> "varchar", is_nullable
=> 1, size
=> 10 },
358 { data_type
=> "smallint", is_nullable
=> 1 },
360 { data_type
=> "smallint", is_nullable
=> 1 },
362 { data_type
=> "smallint", is_nullable
=> 1 },
364 { data_type
=> "tinyint", is_nullable
=> 1 },
366 { data_type
=> "longtext", is_nullable
=> 1 },
367 "itemnotes_nonpublic",
368 { data_type
=> "longtext", is_nullable
=> 1 },
370 { data_type
=> "varchar", is_foreign_key
=> 1, is_nullable
=> 1, size
=> 10 },
372 { data_type
=> "longtext", is_nullable
=> 1 },
375 data_type
=> "timestamp",
376 datetime_undef_if_invalid
=> 1,
377 default_value
=> \"current_timestamp
",
381 { data_type => "varchar
", is_nullable => 1, size => 80 },
382 "permanent_location
",
383 { data_type => "varchar
", is_nullable => 1, size => 80 },
385 { data_type => "date
", datetime_undef_if_invalid => 1, is_nullable => 1 },
387 { data_type => "varchar
", is_nullable => 1, size => 10 },
389 { data_type => "varchar
", is_nullable => 1, size => 255 },
391 { data_type => "varchar
", is_nullable => 1, size => 80 },
393 { data_type => "mediumtext
", is_nullable => 1 },
395 { data_type => "mediumtext
", is_nullable => 1 },
397 { data_type => "varchar
", is_nullable => 1, size => 10 },
398 "more_subfields_xml
",
399 { data_type => "longtext
", is_nullable => 1 },
401 { data_type => "mediumtext
", is_nullable => 1 },
403 { data_type => "varchar
", is_nullable => 1, size => 32 },
405 { data_type => "varchar
", is_nullable => 1, size => 32 },
407 { data_type => "varchar
", is_nullable => 1, size => 32 },
414 =item * L</itemnumber>
420 __PACKAGE__->set_primary_key("itemnumber
");
422 =head1 UNIQUE CONSTRAINTS
424 =head2 C<itembarcodeidx>
434 __PACKAGE__->add_unique_constraint("itembarcodeidx
", ["barcode
"]);
442 Related object: L<Koha::Schema::Result::Accountline>
446 __PACKAGE__->has_many(
448 "Koha
::Schema
::Result
::Accountline
",
449 { "foreign
.itemnumber
" => "self
.itemnumber
" },
450 { cascade_copy => 0, cascade_delete => 0 },
453 =head2 article_requests
457 Related object: L<Koha::Schema::Result::ArticleRequest>
461 __PACKAGE__->has_many(
463 "Koha
::Schema
::Result
::ArticleRequest
",
464 { "foreign
.itemnumber
" => "self
.itemnumber
" },
465 { cascade_copy => 0, cascade_delete => 0 },
468 =head2 biblioitemnumber
472 Related object: L<Koha::Schema::Result::Biblioitem>
476 __PACKAGE__->belongs_to(
478 "Koha
::Schema
::Result
::Biblioitem
",
479 { biblioitemnumber => "biblioitemnumber
" },
480 { is_deferrable => 1, on_delete => "CASCADE
", on_update => "CASCADE
" },
487 Related object: L<Koha::Schema::Result::Biblio>
491 __PACKAGE__->belongs_to(
493 "Koha
::Schema
::Result
::Biblio
",
494 { biblionumber => "biblionumber
" },
495 { is_deferrable => 1, on_delete => "CASCADE
", on_update => "CASCADE
" },
498 =head2 branchtransfers
502 Related object: L<Koha::Schema::Result::Branchtransfer>
506 __PACKAGE__->has_many(
508 "Koha
::Schema
::Result
::Branchtransfer
",
509 { "foreign
.itemnumber
" => "self
.itemnumber
" },
510 { cascade_copy => 0, cascade_delete => 0 },
517 Related object: L<Koha::Schema::Result::ClubHold>
521 __PACKAGE__->has_many(
523 "Koha
::Schema
::Result
::ClubHold
",
524 { "foreign
.item_id
" => "self
.itemnumber
" },
525 { cascade_copy => 0, cascade_delete => 0 },
532 Related object: L<Koha::Schema::Result::CourseItem>
536 __PACKAGE__->might_have(
538 "Koha
::Schema
::Result
::CourseItem
",
539 { "foreign
.itemnumber
" => "self
.itemnumber
" },
540 { cascade_copy => 0, cascade_delete => 0 },
543 =head2 creator_batches
547 Related object: L<Koha::Schema::Result::CreatorBatch>
551 __PACKAGE__->has_many(
553 "Koha
::Schema
::Result
::CreatorBatch
",
554 { "foreign
.item_number
" => "self
.itemnumber
" },
555 { cascade_copy => 0, cascade_delete => 0 },
558 =head2 hold_fill_target
562 Related object: L<Koha::Schema::Result::HoldFillTarget>
566 __PACKAGE__->might_have(
568 "Koha
::Schema
::Result
::HoldFillTarget
",
569 { "foreign
.itemnumber
" => "self
.itemnumber
" },
570 { cascade_copy => 0, cascade_delete => 0 },
577 Related object: L<Koha::Schema::Result::Branch>
581 __PACKAGE__->belongs_to(
583 "Koha
::Schema
::Result
::Branch
",
584 { branchcode => "holdingbranch
" },
588 on_delete => "RESTRICT
",
589 on_update => "CASCADE
",
597 Related object: L<Koha::Schema::Result::Branch>
601 __PACKAGE__->belongs_to(
603 "Koha
::Schema
::Result
::Branch
",
604 { branchcode => "homebranch
" },
608 on_delete => "RESTRICT
",
609 on_update => "CASCADE
",
617 Related object: L<Koha::Schema::Result::Issue>
621 __PACKAGE__->might_have(
623 "Koha
::Schema
::Result
::Issue
",
624 { "foreign
.itemnumber
" => "self
.itemnumber
" },
625 { cascade_copy => 0, cascade_delete => 0 },
628 =head2 items_last_borrower
632 Related object: L<Koha::Schema::Result::ItemsLastBorrower>
636 __PACKAGE__->might_have(
637 "items_last_borrower
",
638 "Koha
::Schema
::Result
::ItemsLastBorrower
",
639 { "foreign
.itemnumber
" => "self
.itemnumber
" },
640 { cascade_copy => 0, cascade_delete => 0 },
647 Related object: L<Koha::Schema::Result::OldIssue>
651 __PACKAGE__->has_many(
653 "Koha
::Schema
::Result
::OldIssue
",
654 { "foreign
.itemnumber
" => "self
.itemnumber
" },
655 { cascade_copy => 0, cascade_delete => 0 },
662 Related object: L<Koha::Schema::Result::OldReserve>
666 __PACKAGE__->has_many(
668 "Koha
::Schema
::Result
::OldReserve
",
669 { "foreign
.itemnumber
" => "self
.itemnumber
" },
670 { cascade_copy => 0, cascade_delete => 0 },
677 Related object: L<Koha::Schema::Result::Reserve>
681 __PACKAGE__->has_many(
683 "Koha
::Schema
::Result
::Reserve
",
684 { "foreign
.itemnumber
" => "self
.itemnumber
" },
685 { cascade_copy => 0, cascade_delete => 0 },
692 Related object: L<Koha::Schema::Result::ReturnClaim>
696 __PACKAGE__->has_many(
698 "Koha
::Schema
::Result
::ReturnClaim
",
699 { "foreign
.itemnumber
" => "self
.itemnumber
" },
700 { cascade_copy => 0, cascade_delete => 0 },
707 Related object: L<Koha::Schema::Result::Serialitem>
711 __PACKAGE__->might_have(
713 "Koha
::Schema
::Result
::Serialitem
",
714 { "foreign
.itemnumber
" => "self
.itemnumber
" },
715 { cascade_copy => 0, cascade_delete => 0 },
718 =head2 stockrotationitem
722 Related object: L<Koha::Schema::Result::Stockrotationitem>
726 __PACKAGE__->might_have(
728 "Koha
::Schema
::Result
::Stockrotationitem
",
729 { "foreign
.itemnumber_id
" => "self
.itemnumber
" },
730 { cascade_copy => 0, cascade_delete => 0 },
733 =head2 tmp_holdsqueues
737 Related object: L<Koha::Schema::Result::TmpHoldsqueue>
741 __PACKAGE__->has_many(
743 "Koha
::Schema
::Result
::TmpHoldsqueue
",
744 { "foreign
.itemnumber
" => "self
.itemnumber
" },
745 { cascade_copy => 0, cascade_delete => 0 },
749 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-17 10:42:24
750 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CcrMhgq+PQ1MHV6jZEN8wA
752 __PACKAGE__->belongs_to( biblioitem => "Koha
::Schema
::Result
::Biblioitem
", "biblioitemnumber
" );
754 __PACKAGE__->belongs_to(
756 "Koha
::Schema
::Result
::Biblio
",
757 { biblionumber => "biblionumber
" },
758 { is_deferrable => 1, on_delete => "CASCADE
", on_update => "CASCADE
" },
762 sub effective_itemtype {
765 my $pref = C4::Context->preference('item-level_itypes');
766 if ( $pref && $self->itype() ) {
767 return $self->itype();
769 warn "item
-level_itypes set but
no itemtype set
for item
(".$self->itemnumber.")"
771 return $self->biblioitemnumber()->itemtype();