From dbd44b387b5cfe880156caed6bb9bbbf0a58339a Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Wed, 1 Apr 2020 16:01:37 +0000 Subject: [PATCH] Bug 25037: Schema changes --- Koha/Schema/Result/AuthorisedValue.pm | 34 ++++++++++++++++++++++-- Koha/Schema/Result/Issue.pm | 38 ++++++++++++++++++++------- Koha/Schema/Result/OldIssue.pm | 38 ++++++++++++++++++++------- 3 files changed, 90 insertions(+), 20 deletions(-) diff --git a/Koha/Schema/Result/AuthorisedValue.pm b/Koha/Schema/Result/AuthorisedValue.pm index 1a65d388c9..76d19c6067 100644 --- a/Koha/Schema/Result/AuthorisedValue.pm +++ b/Koha/Schema/Result/AuthorisedValue.pm @@ -144,9 +144,39 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 issues -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-02-22 14:32:48 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hDlebhEn+f+thqwBo/LOqQ +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "issues", + "Koha::Schema::Result::Issue", + { "foreign.checkout_type" => "self.authorised_value" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 old_issues + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "old_issues", + "Koha::Schema::Result::OldIssue", + { "foreign.checkout_type" => "self.authorised_value" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-04-01 16:24:27 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3/nSpPKD664Mmv6ce/Y1pA # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm index 8bb16b6b92..e77d1192f9 100644 --- a/Koha/Schema/Result/Issue.pm +++ b/Koha/Schema/Result/Issue.pm @@ -96,11 +96,12 @@ __PACKAGE__->table("issues"); datetime_undef_if_invalid: 1 is_nullable: 1 -=head2 onsite_checkout +=head2 checkout_type - data_type: 'integer' - default_value: 0 - is_nullable: 0 + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 80 =head2 note @@ -166,8 +167,8 @@ __PACKAGE__->add_columns( datetime_undef_if_invalid => 1, is_nullable => 1, }, - "onsite_checkout", - { data_type => "integer", default_value => 0, is_nullable => 0 }, + "checkout_type", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 80 }, "note", { data_type => "longtext", is_nullable => 1 }, "notedate", @@ -228,6 +229,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 checkout_type + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "checkout_type", + "Koha::Schema::Result::AuthorisedValue", + { authorised_value => "checkout_type" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 itemnumber Type: belongs_to @@ -264,12 +285,11 @@ __PACKAGE__->might_have( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-31 12:18:38 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QVmFa5b0Pe5OhUI92n9kzQ +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-04-01 16:24:27 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:la6YkyDEDwCzfscXmq5R5Q __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 }, - '+onsite_checkout' => { is_boolean => 1 } ); __PACKAGE__->belongs_to( diff --git a/Koha/Schema/Result/OldIssue.pm b/Koha/Schema/Result/OldIssue.pm index f1ff5c2fa6..ec79252ff8 100644 --- a/Koha/Schema/Result/OldIssue.pm +++ b/Koha/Schema/Result/OldIssue.pm @@ -95,11 +95,12 @@ __PACKAGE__->table("old_issues"); datetime_undef_if_invalid: 1 is_nullable: 1 -=head2 onsite_checkout +=head2 checkout_type - data_type: 'integer' - default_value: 0 - is_nullable: 0 + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 80 =head2 note @@ -165,8 +166,8 @@ __PACKAGE__->add_columns( datetime_undef_if_invalid => 1, is_nullable => 1, }, - "onsite_checkout", - { data_type => "integer", default_value => 0, is_nullable => 0 }, + "checkout_type", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 80 }, "note", { data_type => "longtext", is_nullable => 1 }, "notedate", @@ -213,6 +214,26 @@ __PACKAGE__->belongs_to( }, ); +=head2 checkout_type + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "checkout_type", + "Koha::Schema::Result::AuthorisedValue", + { authorised_value => "checkout_type" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 itemnumber Type: belongs_to @@ -234,12 +255,11 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-10 19:55:44 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:E2N2paWcCHg916100ry+2A +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-04-01 16:24:27 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LQNWHEvYKH767RYxYfYPHw __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 }, - '+onsite_checkout' => { is_boolean => 1 } ); __PACKAGE__->belongs_to( -- 2.17.1