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'
261 =head2 more_subfields_xml
263 data_type: 'longtext'
268 data_type: 'mediumtext'
291 __PACKAGE__
->add_columns(
293 { data_type
=> "integer", is_auto_increment
=> 1, is_nullable
=> 0 },
296 data_type
=> "integer",
303 data_type
=> "integer",
309 { data_type
=> "varchar", is_nullable
=> 1, size
=> 20 },
311 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
313 { data_type
=> "longtext", is_nullable
=> 1 },
315 { data_type
=> "varchar", is_foreign_key
=> 1, is_nullable
=> 1, size
=> 10 },
317 { data_type
=> "decimal", is_nullable
=> 1, size
=> [8, 2] },
319 { data_type
=> "decimal", is_nullable
=> 1, size
=> [8, 2] },
320 "replacementpricedate",
321 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
323 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
325 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
327 { data_type
=> "tinyint", is_nullable
=> 1 },
329 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
331 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
334 data_type
=> "datetime",
335 datetime_undef_if_invalid
=> 1,
339 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
342 data_type
=> "datetime",
343 datetime_undef_if_invalid
=> 1,
347 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
350 data_type
=> "datetime",
351 datetime_undef_if_invalid
=> 1,
355 { data_type
=> "varchar", is_nullable
=> 1, size
=> 255 },
356 "coded_location_qualifier",
357 { data_type
=> "varchar", is_nullable
=> 1, size
=> 10 },
359 { data_type
=> "smallint", is_nullable
=> 1 },
361 { data_type
=> "smallint", is_nullable
=> 1 },
363 { data_type
=> "smallint", is_nullable
=> 1 },
365 { data_type
=> "tinyint", is_nullable
=> 1 },
367 { data_type
=> "longtext", is_nullable
=> 1 },
368 "itemnotes_nonpublic",
369 { data_type
=> "longtext", is_nullable
=> 1 },
371 { data_type
=> "varchar", is_foreign_key
=> 1, is_nullable
=> 1, size
=> 10 },
373 { data_type
=> "longtext", is_nullable
=> 1 },
376 data_type
=> "timestamp",
377 datetime_undef_if_invalid
=> 1,
378 default_value
=> \"current_timestamp
",
382 { data_type => "varchar
", is_nullable => 1, size => 80 },
383 "permanent_location
",
384 { data_type => "varchar
", is_nullable => 1, size => 80 },
386 { data_type => "date
", datetime_undef_if_invalid => 1, is_nullable => 1 },
388 { data_type => "varchar
", is_nullable => 1, size => 10 },
390 { data_type => "varchar
", is_nullable => 1, size => 255 },
392 { data_type => "varchar
", is_nullable => 1, size => 80 },
394 { data_type => "mediumtext
", is_nullable => 1 },
396 { data_type => "varchar
", is_nullable => 1, size => 255 },
398 { data_type => "varchar
", is_nullable => 1, size => 10 },
399 "more_subfields_xml
",
400 { data_type => "longtext
", is_nullable => 1 },
402 { data_type => "mediumtext
", is_nullable => 1 },
404 { data_type => "varchar
", is_nullable => 1, size => 32 },
406 { data_type => "varchar
", is_nullable => 1, size => 32 },
408 { data_type => "varchar
", is_nullable => 1, size => 32 },
415 =item * L</itemnumber>
421 __PACKAGE__->set_primary_key("itemnumber
");
423 =head1 UNIQUE CONSTRAINTS
425 =head2 C<itembarcodeidx>
435 __PACKAGE__->add_unique_constraint("itembarcodeidx
", ["barcode
"]);
443 Related object: L<Koha::Schema::Result::Accountline>
447 __PACKAGE__->has_many(
449 "Koha
::Schema
::Result
::Accountline
",
450 { "foreign
.itemnumber
" => "self
.itemnumber
" },
451 { cascade_copy => 0, cascade_delete => 0 },
454 =head2 article_requests
458 Related object: L<Koha::Schema::Result::ArticleRequest>
462 __PACKAGE__->has_many(
464 "Koha
::Schema
::Result
::ArticleRequest
",
465 { "foreign
.itemnumber
" => "self
.itemnumber
" },
466 { cascade_copy => 0, cascade_delete => 0 },
469 =head2 biblioitemnumber
473 Related object: L<Koha::Schema::Result::Biblioitem>
477 __PACKAGE__->belongs_to(
479 "Koha
::Schema
::Result
::Biblioitem
",
480 { biblioitemnumber => "biblioitemnumber
" },
481 { is_deferrable => 1, on_delete => "CASCADE
", on_update => "CASCADE
" },
488 Related object: L<Koha::Schema::Result::Biblio>
492 __PACKAGE__->belongs_to(
494 "Koha
::Schema
::Result
::Biblio
",
495 { biblionumber => "biblionumber
" },
496 { is_deferrable => 1, on_delete => "CASCADE
", on_update => "CASCADE
" },
499 =head2 branchtransfers
503 Related object: L<Koha::Schema::Result::Branchtransfer>
507 __PACKAGE__->has_many(
509 "Koha
::Schema
::Result
::Branchtransfer
",
510 { "foreign
.itemnumber
" => "self
.itemnumber
" },
511 { cascade_copy => 0, cascade_delete => 0 },
518 Related object: L<Koha::Schema::Result::ClubHold>
522 __PACKAGE__->has_many(
524 "Koha
::Schema
::Result
::ClubHold
",
525 { "foreign
.item_id
" => "self
.itemnumber
" },
526 { cascade_copy => 0, cascade_delete => 0 },
533 Related object: L<Koha::Schema::Result::CourseItem>
537 __PACKAGE__->might_have(
539 "Koha
::Schema
::Result
::CourseItem
",
540 { "foreign
.itemnumber
" => "self
.itemnumber
" },
541 { cascade_copy => 0, cascade_delete => 0 },
544 =head2 creator_batches
548 Related object: L<Koha::Schema::Result::CreatorBatch>
552 __PACKAGE__->has_many(
554 "Koha
::Schema
::Result
::CreatorBatch
",
555 { "foreign
.item_number
" => "self
.itemnumber
" },
556 { cascade_copy => 0, cascade_delete => 0 },
559 =head2 hold_fill_target
563 Related object: L<Koha::Schema::Result::HoldFillTarget>
567 __PACKAGE__->might_have(
569 "Koha
::Schema
::Result
::HoldFillTarget
",
570 { "foreign
.itemnumber
" => "self
.itemnumber
" },
571 { cascade_copy => 0, cascade_delete => 0 },
578 Related object: L<Koha::Schema::Result::Branch>
582 __PACKAGE__->belongs_to(
584 "Koha
::Schema
::Result
::Branch
",
585 { branchcode => "holdingbranch
" },
589 on_delete => "RESTRICT
",
590 on_update => "CASCADE
",
598 Related object: L<Koha::Schema::Result::Branch>
602 __PACKAGE__->belongs_to(
604 "Koha
::Schema
::Result
::Branch
",
605 { branchcode => "homebranch
" },
609 on_delete => "RESTRICT
",
610 on_update => "CASCADE
",
618 Related object: L<Koha::Schema::Result::Issue>
622 __PACKAGE__->might_have(
624 "Koha
::Schema
::Result
::Issue
",
625 { "foreign
.itemnumber
" => "self
.itemnumber
" },
626 { cascade_copy => 0, cascade_delete => 0 },
629 =head2 items_last_borrower
633 Related object: L<Koha::Schema::Result::ItemsLastBorrower>
637 __PACKAGE__->might_have(
638 "items_last_borrower
",
639 "Koha
::Schema
::Result
::ItemsLastBorrower
",
640 { "foreign
.itemnumber
" => "self
.itemnumber
" },
641 { cascade_copy => 0, cascade_delete => 0 },
648 Related object: L<Koha::Schema::Result::OldIssue>
652 __PACKAGE__->has_many(
654 "Koha
::Schema
::Result
::OldIssue
",
655 { "foreign
.itemnumber
" => "self
.itemnumber
" },
656 { cascade_copy => 0, cascade_delete => 0 },
663 Related object: L<Koha::Schema::Result::OldReserve>
667 __PACKAGE__->has_many(
669 "Koha
::Schema
::Result
::OldReserve
",
670 { "foreign
.itemnumber
" => "self
.itemnumber
" },
671 { cascade_copy => 0, cascade_delete => 0 },
678 Related object: L<Koha::Schema::Result::Reserve>
682 __PACKAGE__->has_many(
684 "Koha
::Schema
::Result
::Reserve
",
685 { "foreign
.itemnumber
" => "self
.itemnumber
" },
686 { cascade_copy => 0, cascade_delete => 0 },
693 Related object: L<Koha::Schema::Result::ReturnClaim>
697 __PACKAGE__->has_many(
699 "Koha
::Schema
::Result
::ReturnClaim
",
700 { "foreign
.itemnumber
" => "self
.itemnumber
" },
701 { cascade_copy => 0, cascade_delete => 0 },
708 Related object: L<Koha::Schema::Result::Serialitem>
712 __PACKAGE__->might_have(
714 "Koha
::Schema
::Result
::Serialitem
",
715 { "foreign
.itemnumber
" => "self
.itemnumber
" },
716 { cascade_copy => 0, cascade_delete => 0 },
719 =head2 stockrotationitem
723 Related object: L<Koha::Schema::Result::Stockrotationitem>
727 __PACKAGE__->might_have(
729 "Koha
::Schema
::Result
::Stockrotationitem
",
730 { "foreign
.itemnumber_id
" => "self
.itemnumber
" },
731 { cascade_copy => 0, cascade_delete => 0 },
734 =head2 tmp_holdsqueues
738 Related object: L<Koha::Schema::Result::TmpHoldsqueue>
742 __PACKAGE__->has_many(
744 "Koha
::Schema
::Result
::TmpHoldsqueue
",
745 { "foreign
.itemnumber
" => "self
.itemnumber
" },
746 { cascade_copy => 0, cascade_delete => 0 },
750 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-10 14:31:00
751 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dqUjo9pJysKKBhF8PM5KnA
753 __PACKAGE__->belongs_to( biblioitem => "Koha
::Schema
::Result
::Biblioitem
", "biblioitemnumber
" );
755 __PACKAGE__->belongs_to(
757 "Koha
::Schema
::Result
::Biblio
",
758 { biblionumber => "biblionumber
" },
759 { is_deferrable => 1, on_delete => "CASCADE
", on_update => "CASCADE
" },
763 sub effective_itemtype {
766 my $pref = C4::Context->preference('item-level_itypes');
767 if ( $pref && $self->itype() ) {
768 return $self->itype();
770 warn "item
-level_itypes set but
no itemtype set
for item
(".$self->itemnumber.")"
772 return $self->biblioitemnumber()->itemtype();