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");
38 =head2 biblioitemnumber
51 =head2 dateaccessioned
54 datetime_undef_if_invalid: 1
59 data_type: 'mediumtext'
75 =head2 replacementprice
81 =head2 replacementpricedate
84 datetime_undef_if_invalid: 1
87 =head2 datelastborrowed
90 datetime_undef_if_invalid: 1
96 datetime_undef_if_invalid: 1
124 data_type: 'datetime'
125 datetime_undef_if_invalid: 1
136 data_type: 'datetime'
137 datetime_undef_if_invalid: 1
140 =head2 itemcallnumber
146 =head2 coded_location_qualifier
154 data_type: 'smallint'
159 data_type: 'smallint'
164 data_type: 'smallint'
174 data_type: 'mediumtext'
177 =head2 itemnotes_nonpublic
179 data_type: 'mediumtext'
191 data_type: 'mediumtext'
196 data_type: 'timestamp'
197 datetime_undef_if_invalid: 1
198 default_value: current_timestamp
207 =head2 permanent_location
216 datetime_undef_if_invalid: 1
254 =head2 more_subfields_xml
256 data_type: 'longtext'
278 __PACKAGE__
->add_columns(
280 { data_type
=> "integer", is_auto_increment
=> 1, is_nullable
=> 0 },
282 { data_type
=> "integer", default_value
=> 0, is_nullable
=> 0 },
285 data_type
=> "integer",
291 { data_type
=> "varchar", is_nullable
=> 1, size
=> 20 },
293 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
295 { data_type
=> "mediumtext", is_nullable
=> 1 },
297 { data_type
=> "varchar", is_foreign_key
=> 1, is_nullable
=> 1, size
=> 10 },
299 { data_type
=> "decimal", is_nullable
=> 1, size
=> [8, 2] },
301 { data_type
=> "decimal", is_nullable
=> 1, size
=> [8, 2] },
302 "replacementpricedate",
303 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
305 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
307 { data_type
=> "date", datetime_undef_if_invalid
=> 1, is_nullable
=> 1 },
309 { data_type
=> "tinyint", is_nullable
=> 1 },
311 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
313 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
315 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
318 data_type
=> "datetime",
319 datetime_undef_if_invalid
=> 1,
323 { data_type
=> "tinyint", default_value
=> 0, is_nullable
=> 0 },
326 data_type
=> "datetime",
327 datetime_undef_if_invalid
=> 1,
331 { data_type
=> "varchar", is_nullable
=> 1, size
=> 255 },
332 "coded_location_qualifier",
333 { data_type
=> "varchar", is_nullable
=> 1, size
=> 10 },
335 { data_type
=> "smallint", is_nullable
=> 1 },
337 { data_type
=> "smallint", is_nullable
=> 1 },
339 { data_type
=> "smallint", is_nullable
=> 1 },
341 { data_type
=> "tinyint", is_nullable
=> 1 },
343 { data_type
=> "mediumtext", is_nullable
=> 1 },
344 "itemnotes_nonpublic",
345 { data_type
=> "mediumtext", is_nullable
=> 1 },
347 { data_type
=> "varchar", is_foreign_key
=> 1, is_nullable
=> 1, size
=> 10 },
349 { data_type
=> "mediumtext", is_nullable
=> 1 },
352 data_type
=> "timestamp",
353 datetime_undef_if_invalid
=> 1,
354 default_value
=> \"current_timestamp
",
358 { data_type => "varchar
", is_nullable => 1, size => 80 },
359 "permanent_location
",
360 { data_type => "varchar
", is_nullable => 1, size => 80 },
362 { data_type => "date
", datetime_undef_if_invalid => 1, is_nullable => 1 },
364 { data_type => "varchar
", is_nullable => 1, size => 10 },
366 { data_type => "varchar
", is_nullable => 1, size => 255 },
368 { data_type => "varchar
", is_nullable => 1, size => 10 },
370 { data_type => "text
", is_nullable => 1 },
372 { data_type => "varchar
", is_nullable => 1, size => 255 },
374 { data_type => "varchar
", is_nullable => 1, size => 10 },
375 "more_subfields_xml
",
376 { data_type => "longtext
", is_nullable => 1 },
378 { data_type => "text
", is_nullable => 1 },
380 { data_type => "varchar
", is_nullable => 1, size => 32 },
382 { data_type => "varchar
", is_nullable => 1, size => 32 },
389 =item * L</itemnumber>
395 __PACKAGE__->set_primary_key("itemnumber
");
397 =head1 UNIQUE CONSTRAINTS
399 =head2 C<itembarcodeidx>
409 __PACKAGE__->add_unique_constraint("itembarcodeidx
", ["barcode
"]);
417 Related object: L<Koha::Schema::Result::Accountline>
421 __PACKAGE__->has_many(
423 "Koha
::Schema
::Result
::Accountline
",
424 { "foreign
.itemnumber
" => "self
.itemnumber
" },
425 { cascade_copy => 0, cascade_delete => 0 },
428 =head2 biblioitemnumber
432 Related object: L<Koha::Schema::Result::Biblioitem>
436 __PACKAGE__->belongs_to(
438 "Koha
::Schema
::Result
::Biblioitem
",
439 { biblioitemnumber => "biblioitemnumber
" },
440 { is_deferrable => 1, on_delete => "CASCADE
", on_update => "CASCADE
" },
443 =head2 branchtransfers
447 Related object: L<Koha::Schema::Result::Branchtransfer>
451 __PACKAGE__->has_many(
453 "Koha
::Schema
::Result
::Branchtransfer
",
454 { "foreign
.itemnumber
" => "self
.itemnumber
" },
455 { cascade_copy => 0, cascade_delete => 0 },
462 Related object: L<Koha::Schema::Result::CourseItem>
466 __PACKAGE__->might_have(
468 "Koha
::Schema
::Result
::CourseItem
",
469 { "foreign
.itemnumber
" => "self
.itemnumber
" },
470 { cascade_copy => 0, cascade_delete => 0 },
473 =head2 creator_batches
477 Related object: L<Koha::Schema::Result::CreatorBatch>
481 __PACKAGE__->has_many(
483 "Koha
::Schema
::Result
::CreatorBatch
",
484 { "foreign
.item_number
" => "self
.itemnumber
" },
485 { cascade_copy => 0, cascade_delete => 0 },
488 =head2 hold_fill_target
492 Related object: L<Koha::Schema::Result::HoldFillTarget>
496 __PACKAGE__->might_have(
498 "Koha
::Schema
::Result
::HoldFillTarget
",
499 { "foreign
.itemnumber
" => "self
.itemnumber
" },
500 { cascade_copy => 0, cascade_delete => 0 },
507 Related object: L<Koha::Schema::Result::Branch>
511 __PACKAGE__->belongs_to(
513 "Koha
::Schema
::Result
::Branch
",
514 { branchcode => "holdingbranch
" },
518 on_delete => "RESTRICT
",
519 on_update => "CASCADE
",
527 Related object: L<Koha::Schema::Result::Branch>
531 __PACKAGE__->belongs_to(
533 "Koha
::Schema
::Result
::Branch
",
534 { branchcode => "homebranch
" },
538 on_delete => "RESTRICT
",
539 on_update => "CASCADE
",
547 Related object: L<Koha::Schema::Result::Issue>
551 __PACKAGE__->has_many(
553 "Koha
::Schema
::Result
::Issue
",
554 { "foreign
.itemnumber
" => "self
.itemnumber
" },
555 { cascade_copy => 0, cascade_delete => 0 },
562 Related object: L<Koha::Schema::Result::OldIssue>
566 __PACKAGE__->has_many(
568 "Koha
::Schema
::Result
::OldIssue
",
569 { "foreign
.itemnumber
" => "self
.itemnumber
" },
570 { cascade_copy => 0, cascade_delete => 0 },
577 Related object: L<Koha::Schema::Result::OldReserve>
581 __PACKAGE__->has_many(
583 "Koha
::Schema
::Result
::OldReserve
",
584 { "foreign
.itemnumber
" => "self
.itemnumber
" },
585 { cascade_copy => 0, cascade_delete => 0 },
592 Related object: L<Koha::Schema::Result::Reserve>
596 __PACKAGE__->has_many(
598 "Koha
::Schema
::Result
::Reserve
",
599 { "foreign
.itemnumber
" => "self
.itemnumber
" },
600 { cascade_copy => 0, cascade_delete => 0 },
607 Related object: L<Koha::Schema::Result::Serialitem>
611 __PACKAGE__->might_have(
613 "Koha
::Schema
::Result
::Serialitem
",
614 { "foreign
.itemnumber
" => "self
.itemnumber
" },
615 { cascade_copy => 0, cascade_delete => 0 },
619 # Created by DBIx::Class::Schema::Loader v0.07039 @ 2015-04-23 12:42:12
620 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:urSpNt7LBda4T5Plhi6cPw
622 sub effective_itemtype {
625 my $pref = $self->result_source->schema->resultset('Systempreference')->find('item-level_itypes');
626 if ( $pref->value() ) {
627 return $self->itype();
629 return $self->biblioitemnumber()->itemtype();