From 09874bdaa420f7b4c1c84dbf56df05759a811ea8 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 4 Nov 2025 08:56:05 +0000 Subject: [PATCH] Bug 34198: [DO NOT PUSH] Update DBIC schema --- Koha/Schema/Result/AuthorisedValue.pm | 49 +++++++++++++++++- Koha/Schema/Result/AuthorisedValueCategory.pm | 50 ++++++++++++++++++- 2 files changed, 95 insertions(+), 4 deletions(-) diff --git a/Koha/Schema/Result/AuthorisedValue.pm b/Koha/Schema/Result/AuthorisedValue.pm index 874c166b02a..e74846383a2 100644 --- a/Koha/Schema/Result/AuthorisedValue.pm +++ b/Koha/Schema/Result/AuthorisedValue.pm @@ -50,6 +50,14 @@ key used to identify the authorized value category code use to identify the authorized value +=head2 parent_authorised_value_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +id of parent authorised value + =head2 lib data_type: 'varchar' @@ -89,6 +97,8 @@ __PACKAGE__->add_columns( }, "authorised_value", { data_type => "varchar", default_value => "", is_nullable => 0, size => 80 }, + "parent_authorised_value_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "lib", { data_type => "varchar", is_nullable => 1, size => 200 }, "lib_opac", @@ -127,6 +137,21 @@ __PACKAGE__->add_unique_constraint("av_uniq", ["category", "authorised_value"]); =head1 RELATIONS +=head2 authorised_values + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "authorised_values", + "Koha::Schema::Result::AuthorisedValue", + { "foreign.parent_authorised_value_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 authorised_values_branches Type: has_many @@ -172,9 +197,29 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 parent_authorised_value -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 13:39:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LH9dpEEzlVVsjNVv/jnONg +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "parent_authorised_value", + "Koha::Schema::Result::AuthorisedValue", + { id => "parent_authorised_value_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07052 @ 2025-10-30 11:59:08 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pF2KR2JI+ugIGxyuSC1e4A # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/AuthorisedValueCategory.pm b/Koha/Schema/Result/AuthorisedValueCategory.pm index e2a40326afe..ec7cc189622 100644 --- a/Koha/Schema/Result/AuthorisedValueCategory.pm +++ b/Koha/Schema/Result/AuthorisedValueCategory.pm @@ -30,6 +30,15 @@ __PACKAGE__->table("authorised_value_categories"); is_nullable: 0 size: 32 +=head2 parent_category_name + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 32 + +Name (primary key) of parent authorised value category + =head2 is_system data_type: 'tinyint' @@ -47,6 +56,8 @@ __PACKAGE__->table("authorised_value_categories"); __PACKAGE__->add_columns( "category_name", { data_type => "varchar", default_value => "", is_nullable => 0, size => 32 }, + "parent_category_name", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 32 }, "is_system", { data_type => "tinyint", default_value => 0, is_nullable => 1 }, "is_integer_only", @@ -67,6 +78,21 @@ __PACKAGE__->set_primary_key("category_name"); =head1 RELATIONS +=head2 authorised_value_categories + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "authorised_value_categories", + "Koha::Schema::Result::AuthorisedValueCategory", + { "foreign.parent_category_name" => "self.category_name" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 authorised_values Type: has_many @@ -112,9 +138,29 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 parent_category_name -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-05-17 07:33:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sDV5yk91mmU5Huaa5QNo6A +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "parent_category_name", + "Koha::Schema::Result::AuthorisedValueCategory", + { category_name => "parent_category_name" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07052 @ 2025-10-30 11:59:08 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Wn2hJ5CmKi9z+LluFC0ewA __PACKAGE__->add_columns( '+is_system' => { is_boolean => 1 }, -- 2.39.5