From 68a25a74bc54790a9feab62e0302b94f08854dfc Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 18 Apr 2022 13:08:19 -0300 Subject: [PATCH] Bug 22456: DBIC update --- Koha/Schema/Result/Borrower.pm | 34 ++- Koha/Schema/Result/HoldCancellationRequest.pm | 211 ++++++++++++++++++ Koha/Schema/Result/Reserve.pm | 4 +- 3 files changed, 245 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/HoldCancellationRequest.pm diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 5d0cac62c4..87a392323b 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1249,6 +1249,36 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 hold_cancellation_requests_requesters + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "hold_cancellation_requests_requesters", + "Koha::Schema::Result::HoldCancellationRequest", + { "foreign.requester_id" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 hold_cancellation_requests_resolvers + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "hold_cancellation_requests_resolvers", + "Koha::Schema::Result::HoldCancellationRequest", + { "foreign.resolver_id" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 hold_fill_targets Type: has_many @@ -1965,8 +1995,8 @@ Composing rels: L -> permission __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-05-06 19:32:13 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lGlRQ4XvRdsrqTye6sDpYg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-05-16 18:18:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WK9kGNgMgN3hH/ZRf7SH1g __PACKAGE__->has_many( "extended_attributes", diff --git a/Koha/Schema/Result/HoldCancellationRequest.pm b/Koha/Schema/Result/HoldCancellationRequest.pm new file mode 100644 index 0000000000..f724c3eb9f --- /dev/null +++ b/Koha/Schema/Result/HoldCancellationRequest.pm @@ -0,0 +1,211 @@ +use utf8; +package Koha::Schema::Result::HoldCancellationRequest; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::HoldCancellationRequest + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("hold_cancellation_requests"); + +=head1 ACCESSORS + +=head2 hold_cancellation_request_id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +Unique ID of the cancellation request + +=head2 hold_id + + data_type: 'integer' + is_nullable: 0 + +ID of the hold + +=head2 requester_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +ID of the user that made the cancellation request + +=head2 creation_date + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +Time and date the cancellation request was created + +=head2 source + + data_type: 'enum' + default_value: 'owner' + extra: {list => ["owner"]} + is_nullable: 0 + +The source for the cancellation request + +=head2 status + + data_type: 'enum' + default_value: 'requested' + extra: {list => ["requested","accepted","rejected"]} + is_nullable: 1 + +request status + +=head2 resolution_date + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +Time and date cancellation request was resolved + +=head2 resolver_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +ID of the staff member that resolved the request + +=cut + +__PACKAGE__->add_columns( + "hold_cancellation_request_id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "hold_id", + { data_type => "integer", is_nullable => 0 }, + "requester_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "creation_date", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "source", + { + data_type => "enum", + default_value => "owner", + extra => { list => ["owner"] }, + is_nullable => 0, + }, + "status", + { + data_type => "enum", + default_value => "requested", + extra => { list => ["requested", "accepted", "rejected"] }, + is_nullable => 1, + }, + "resolution_date", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "resolver_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("hold_cancellation_request_id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("hold_requester_uniq", ["hold_id", "requester_id"]); + +=head1 RELATIONS + +=head2 requester + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "requester", + "Koha::Schema::Result::Borrower", + { borrowernumber => "requester_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 resolver + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "resolver", + "Koha::Schema::Result::Borrower", + { borrowernumber => "resolver_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-05-18 17:36:48 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LQw6vNCU3DspZ7UOdgHvjg + +sub koha_object_class { + 'Koha::Hold::CancellationRequest'; +} +sub koha_objects_class { + 'Koha::Hold::CancellationRequests'; +} + +1; diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm index 04b81a1960..08818830ca 100644 --- a/Koha/Schema/Result/Reserve.pm +++ b/Koha/Schema/Result/Reserve.pm @@ -431,8 +431,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-01-28 20:08:09 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7Q8/GFCOkXdn+jg69HZ0GQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-04-19 15:00:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nlwpni0zHBZZ5sODq9eF8w __PACKAGE__->belongs_to( "item", -- 2.34.1