2 package Koha::Schema::Result::Subscription;
4 # Created by DBIx::Class::Schema::Loader
5 # DO NOT MODIFY THE FIRST PART OF THIS FILE
9 Koha::Schema::Result::Subscription
16 use base 'DBIx::Class::Core';
18 =head1 TABLE: C<subscription>
22 __PACKAGE__->table("subscription");
32 foreign key for biblio.biblionumber that this subscription is attached to
40 unique key for this subscription
45 default_value: (empty string)
49 the librarian's username from borrowers.userid
54 datetime_undef_if_invalid: 1
57 start date for this subscription
65 foreign key for aqbooksellers.id to link to the vendor
85 subscription length in weeks (will not be filled in if monthlength or numberlength is set)
93 subscription length in weeks (will not be filled in if weeklength or numberlength is set)
101 subscription length in weeks (will not be filled in if monthlength or weeklength is set)
109 frequency type links to subscription_frequencies.id
111 =head2 countissuesperunit
119 data_type: 'longtext'
127 default_value: (empty string)
131 status of this subscription
166 =head2 firstacquidate
169 datetime_undef_if_invalid: 1
172 first issue received date
180 yes or no to managing the history manually
184 data_type: 'mediumtext'
187 any irregularities in the subscription
189 =head2 skip_serialseq
207 the numbering pattern used links to subscription_numberpatterns.id
215 for foreign language subscriptions to display months, seasons, etc correctly
219 data_type: 'mediumtext'
224 data_type: 'longtext'
229 data_type: 'mediumtext'
237 default_value: (empty string)
241 default shelving location (items.location)
246 default_value: (empty string)
250 default branches (items.homebranch)
258 =head2 serialsadditems
264 does receiving this serial create an item record
266 =head2 staffdisplaycount
271 how many issues to show to the staff
273 =head2 opacdisplaycount
278 how many issues to show to the public
291 datetime_undef_if_invalid: 1
294 subscription end date
302 yes / no if the subscription is closed
307 datetime_undef_if_invalid: 1
310 date of last renewal for the subscription
318 =head2 previousitemtype
335 collection code to assign to serial items
339 __PACKAGE__->add_columns(
341 { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
343 { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
345 { data_type => "varchar", default_value => "", is_nullable => 1, size => 100 },
347 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
349 { data_type => "integer", default_value => 0, is_nullable => 1 },
351 { data_type => "integer", default_value => 0, is_nullable => 1 },
353 { data_type => "integer", default_value => 0, is_nullable => 1 },
355 { data_type => "integer", default_value => 0, is_nullable => 1 },
357 { data_type => "integer", default_value => 0, is_nullable => 1 },
359 { data_type => "integer", default_value => 0, is_nullable => 1 },
361 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
362 "countissuesperunit",
363 { data_type => "integer", default_value => 1, is_nullable => 0 },
365 { data_type => "longtext", is_nullable => 1 },
367 { data_type => "varchar", default_value => "", is_nullable => 0, size => 100 },
369 { data_type => "integer", is_nullable => 1 },
371 { data_type => "integer", default_value => 0, is_nullable => 1 },
373 { data_type => "integer", is_nullable => 1 },
375 { data_type => "integer", default_value => 0, is_nullable => 1 },
377 { data_type => "integer", is_nullable => 1 },
379 { data_type => "integer", default_value => 0, is_nullable => 1 },
381 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
383 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
385 { data_type => "mediumtext", is_nullable => 1 },
387 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
389 { data_type => "varchar", is_nullable => 1, size => 20 },
391 { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
393 { data_type => "varchar", is_nullable => 1, size => 80 },
395 { data_type => "mediumtext", is_nullable => 1 },
397 { data_type => "longtext", is_nullable => 1 },
399 { data_type => "mediumtext", is_nullable => 1 },
401 { data_type => "varchar", default_value => "", is_nullable => 1, size => 80 },
403 { data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
405 { data_type => "varchar", is_nullable => 1, size => 10 },
407 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
409 { data_type => "integer", is_nullable => 1 },
411 { data_type => "integer", is_nullable => 1 },
413 { data_type => "integer", default_value => 0, is_nullable => 0 },
415 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
417 { data_type => "tinyint", default_value => 0, is_nullable => 0 },
419 { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 },
421 { data_type => "varchar", is_nullable => 1, size => 10 },
423 { data_type => "varchar", is_nullable => 1, size => 10 },
425 { data_type => "integer", is_nullable => 1 },
427 { data_type => "varchar", is_nullable => 1, size => 80 },
434 =item * L</subscriptionid>
440 __PACKAGE__->set_primary_key("subscriptionid");
448 Related object: L<Koha::Schema::Result::Aqorder>
452 __PACKAGE__->has_many(
454 "Koha::Schema::Result::Aqorder",
455 { "foreign.subscriptionid" => "self.subscriptionid" },
456 { cascade_copy => 0, cascade_delete => 0 },
463 Related object: L<Koha::Schema::Result::Biblio>
467 __PACKAGE__->belongs_to(
469 "Koha::Schema::Result::Biblio",
470 { biblionumber => "biblionumber" },
471 { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
478 Related object: L<Koha::Schema::Result::SubscriptionNumberpattern>
482 __PACKAGE__->belongs_to(
484 "Koha::Schema::Result::SubscriptionNumberpattern",
485 { id => "numberpattern" },
489 on_delete => "SET NULL",
490 on_update => "CASCADE",
498 Related object: L<Koha::Schema::Result::SubscriptionFrequency>
502 __PACKAGE__->belongs_to(
504 "Koha::Schema::Result::SubscriptionFrequency",
505 { id => "periodicity" },
509 on_delete => "SET NULL",
510 on_update => "CASCADE",
518 Related object: L<Koha::Schema::Result::Serial>
522 __PACKAGE__->has_many(
524 "Koha::Schema::Result::Serial",
525 { "foreign.subscriptionid" => "self.subscriptionid" },
526 { cascade_copy => 0, cascade_delete => 0 },
529 =head2 subscriptionhistory
533 Related object: L<Koha::Schema::Result::Subscriptionhistory>
537 __PACKAGE__->might_have(
538 "subscriptionhistory",
539 "Koha::Schema::Result::Subscriptionhistory",
540 { "foreign.subscriptionid" => "self.subscriptionid" },
541 { cascade_copy => 0, cascade_delete => 0 },
544 =head2 subscriptionroutinglists
548 Related object: L<Koha::Schema::Result::Subscriptionroutinglist>
552 __PACKAGE__->has_many(
553 "subscriptionroutinglists",
554 "Koha::Schema::Result::Subscriptionroutinglist",
555 { "foreign.subscriptionid" => "self.subscriptionid" },
556 { cascade_copy => 0, cascade_delete => 0 },
560 # Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-07-05 17:45:12
561 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MFOz3AKUVSPuQv6kMb1EbA
563 __PACKAGE__->has_many(
564 "additional_field_values",
565 "Koha::Schema::Result::AdditionalFieldValue",
570 "$args->{foreign_alias}.record_id" => { -ident => "$args->{self_alias}.subscriptionid" },
572 "$args->{foreign_alias}.field_id" =>
573 { -in => \'(SELECT id FROM additional_fields WHERE tablename = "subscription")' },
576 { cascade_copy => 0, cascade_delete => 0 },
579 __PACKAGE__->add_columns(
580 '+closed' => { is_boolean => 1 },
581 '+skip_serialseq' => { is_boolean => 1 },
584 # You can replace this text with custom content, and it will be preserved on regeneration