From 12539a577e0bd4b0eacbff862d129de7681cc1da Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 5 May 2023 09:10:31 -0300 Subject: [PATCH] Bug 22440: DBIC schema Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 6a35d9fbedfcc144ec12ac458577e984c8db933c) Signed-off-by: Martin Renvoize --- Koha/Schema/Result/Biblio.pm | 19 +++++++++++++++++-- Koha/Schema/Result/Borrower.pm | 4 ++-- Koha/Schema/Result/Illrequest.pm | 27 ++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 2d9abfb7e0..f7dd7a39d0 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -330,6 +330,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 illrequests + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illrequests", + "Koha::Schema::Result::Illrequest", + { "foreign.biblio_id" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 item_groups Type: has_many @@ -571,8 +586,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-13 12:25:59 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:C1RZYgDcw6WrZ5laTaKV6w +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-05-12 07:24:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SpddykztHBO6DzVLDX+2Pw __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 92eba9fbf6..2dc8c07f2c 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -2058,8 +2058,8 @@ Composing rels: L -> permission __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-06 15:46:57 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:f6omVb7EtiysdaWTX3IRzg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-05-12 07:24:19 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:q+ykAzV16DQlg/wdmihsmQ __PACKAGE__->has_many( "restrictions", diff --git a/Koha/Schema/Result/Illrequest.pm b/Koha/Schema/Result/Illrequest.pm index 5f1b0230dd..3c55a2a357 100644 --- a/Koha/Schema/Result/Illrequest.pm +++ b/Koha/Schema/Result/Illrequest.pm @@ -43,6 +43,7 @@ Patron associated with request =head2 biblio_id data_type: 'integer' + is_foreign_key: 1 is_nullable: 1 Potential bib linked to request @@ -187,7 +188,7 @@ __PACKAGE__->add_columns( "borrowernumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "biblio_id", - { data_type => "integer", is_nullable => 1 }, + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "due_date", { data_type => "datetime", @@ -245,6 +246,26 @@ __PACKAGE__->set_primary_key("illrequest_id"); =head1 RELATIONS +=head2 biblio + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblio", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblio_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 borrowernumber Type: belongs_to @@ -331,8 +352,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-23 18:44:13 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:on9OCRON/U0uR+m9aPIKPg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-05-05 12:10:10 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1VhNc8tMnvCpBYaj90YOiQ __PACKAGE__->has_many( "comments", -- 2.39.5