From 6fbd76a844cd30a2c06239ec1cf9393cd5fd4c7b Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Mon, 18 Aug 2025 15:40:44 +0000 Subject: [PATCH] [DO NOT PUSH] Bug 40665: DBIC --- Koha/Schema/Result/Booking.pm | 34 ++++++++++++++++++++++++++++++++-- Koha/Schema/Result/Issue.pm | 34 ++++++++++++++++++++++++++++++++-- Koha/Schema/Result/OldIssue.pm | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 96 insertions(+), 6 deletions(-) diff --git a/Koha/Schema/Result/Booking.pm b/Koha/Schema/Result/Booking.pm index 2231dbf19a3..c970b2b7951 100644 --- a/Koha/Schema/Result/Booking.pm +++ b/Koha/Schema/Result/Booking.pm @@ -206,6 +206,21 @@ __PACKAGE__->belongs_to( { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); +=head2 issues + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "issues", + "Koha::Schema::Result::Issue", + { "foreign.booking_id" => "self.booking_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 item Type: belongs_to @@ -226,6 +241,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 old_issues + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "old_issues", + "Koha::Schema::Result::OldIssue", + { "foreign.booking_id" => "self.booking_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 patron Type: belongs_to @@ -257,8 +287,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2024-10-24 16:23:05 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kTR2kwiwY2PnjU1E0P+CMQ +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-18 12:37:32 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uIijqCqLZybCZwvedr+hgg # 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 f71dd508826..dd836252cce 100644 --- a/Koha/Schema/Result/Issue.pm +++ b/Koha/Schema/Result/Issue.pm @@ -55,6 +55,14 @@ foreign key, linking this to the borrowers table for the user who checked out th foreign key, linking this to the items table for the item that was checked out +=head2 booking_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +foreign key linking this checkout to the booking it fulfills + =head2 date_due data_type: 'datetime' @@ -185,6 +193,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "itemnumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "booking_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "date_due", { data_type => "datetime", @@ -285,6 +295,26 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 booking + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "booking", + "Koha::Schema::Result::Booking", + { booking_id => "booking_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 borrowernumber Type: belongs_to @@ -336,8 +366,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-05-06 16:22:12 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sCGlwnT9B7Mn1k80Gme6hw +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-18 12:37:32 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jConlZUBDEOqoZxF/KXTtg __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/OldIssue.pm b/Koha/Schema/Result/OldIssue.pm index 870922d86f6..2d046ed4f6b 100644 --- a/Koha/Schema/Result/OldIssue.pm +++ b/Koha/Schema/Result/OldIssue.pm @@ -54,6 +54,14 @@ foreign key, linking this to the borrowers table for the user who checked out th foreign key, linking this to the items table for the item that was checked out +=head2 booking_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +foreign key linking this checkout to the booking it fulfilled + =head2 date_due data_type: 'datetime' @@ -184,6 +192,8 @@ __PACKAGE__->add_columns( { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "itemnumber", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "booking_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "date_due", { data_type => "datetime", @@ -270,6 +280,26 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 booking + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "booking", + "Koha::Schema::Result::Booking", + { booking_id => "booking_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 borrowernumber Type: belongs_to @@ -331,8 +361,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-05-06 16:22:12 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bO+nRkR4QDXrb5wmEOz9mw +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-18 12:37:32 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0bxRaYxSPgxrcbVn6+F6Tg __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 }, -- 2.39.5