From 749cc43365a49f8792ac0641fda7f758a3aa9eac Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 23 Oct 2025 13:02:14 +0000 Subject: [PATCH] Bug 40529: [DONT PUSH] dbic --- Koha/Schema/Result/HoldGroup.pm | 19 ++- Koha/Schema/Result/HoldGroupTargetHold.pm | 135 ++++++++++++++++++++++ Koha/Schema/Result/Reserve.pm | 19 ++- 3 files changed, 169 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/HoldGroupTargetHold.pm diff --git a/Koha/Schema/Result/HoldGroup.pm b/Koha/Schema/Result/HoldGroup.pm index 7977cd45c03..2e8e6bcac67 100644 --- a/Koha/Schema/Result/HoldGroup.pm +++ b/Koha/Schema/Result/HoldGroup.pm @@ -95,6 +95,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 hold_group_target_hold + +Type: might_have + +Related object: L + +=cut + +__PACKAGE__->might_have( + "hold_group_target_hold", + "Koha::Schema::Result::HoldGroupTargetHold", + { "foreign.hold_group_id" => "self.hold_group_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 old_reserves Type: has_many @@ -126,8 +141,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-16 08:38:47 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:K942uOr52EEdt/f3Sm6i5Q +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-23 13:01:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nck+/QslyOmG+mRDGtzd6w # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/HoldGroupTargetHold.pm b/Koha/Schema/Result/HoldGroupTargetHold.pm new file mode 100644 index 00000000000..1a919e4a4ff --- /dev/null +++ b/Koha/Schema/Result/HoldGroupTargetHold.pm @@ -0,0 +1,135 @@ +use utf8; +package Koha::Schema::Result::HoldGroupTargetHold; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::HoldGroupTargetHold + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("hold_group_target_holds"); + +=head1 ACCESSORS + +=head2 hold_group_id + + data_type: 'integer' + extra: {unsigned => 1} + is_foreign_key: 1 + is_nullable: 0 + +foreign key, linking this to the hold_groups table + +=head2 reserve_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +foreign key, linking this to the reserves table + +=cut + +__PACKAGE__->add_columns( + "hold_group_id", + { + data_type => "integer", + extra => { unsigned => 1 }, + is_foreign_key => 1, + is_nullable => 0, + }, + "reserve_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("hold_group_id", "reserve_id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("hold_group_id", ["hold_group_id"]); + +=head2 C + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("reserve_id", ["reserve_id"]); + +=head1 RELATIONS + +=head2 hold_group + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "hold_group", + "Koha::Schema::Result::HoldGroup", + { hold_group_id => "hold_group_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" }, +); + +=head2 reserve + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "reserve", + "Koha::Schema::Result::Reserve", + { reserve_id => "reserve_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "RESTRICT" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-23 13:01:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NtAC7d08ku24na/QpXzS1g + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm index 3e65b00f67c..78608cc6a7a 100644 --- a/Koha/Schema/Result/Reserve.pm +++ b/Koha/Schema/Result/Reserve.pm @@ -440,6 +440,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 hold_group_target_hold + +Type: might_have + +Related object: L + +=cut + +__PACKAGE__->might_have( + "hold_group_target_hold", + "Koha::Schema::Result::HoldGroupTargetHold", + { "foreign.reserve_id" => "self.reserve_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 item_group Type: belongs_to @@ -501,8 +516,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-09-03 17:08:22 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:57Fw53HngTXhDU7kVEjqYw +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-10-23 13:01:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gThGGm5pjnkd2qyr8GWdCw __PACKAGE__->belongs_to( "item", -- 2.39.5