From 987b2fe758f638f973e35ca3d199cbefc8f94130 Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Mon, 18 Aug 2025 15:40:44 +0000 Subject: [PATCH] Bug 40665: DBIC Signed-off-by: Martin Renvoize --- Koha/Schema/Result/Booking.pm | 34 +++++++++++++++++++++++++++++++-- Koha/Schema/Result/Issue.pm | 34 +++++++++++++++++++++++++++++++-- Koha/Schema/Result/Itemtype.pm | 24 +++++++++++------------ Koha/Schema/Result/OldIssue.pm | 34 +++++++++++++++++++++++++++++++-- Koha/Schema/Result/Statistic.pm | 6 ++---- 5 files changed, 110 insertions(+), 22 deletions(-) diff --git a/Koha/Schema/Result/Booking.pm b/Koha/Schema/Result/Booking.pm index 2231dbf19a3..4d6801c59a3 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-29 09:57:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FEyrrb36hjJj6j8BKKA7gQ # 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..9414e2dda2b 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-29 09:57:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4NoLuAW2nJWH/n19NVt72g __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Itemtype.pm b/Koha/Schema/Result/Itemtype.pm index 3d3c97ccb47..11ca6672c97 100644 --- a/Koha/Schema/Result/Itemtype.pm +++ b/Koha/Schema/Result/Itemtype.pm @@ -176,14 +176,6 @@ Group this item type with others with the same value on OPAC search options If automatic checkin is enabled for items of this type -=head2 bookable - - data_type: 'tinyint' - default_value: 0 - is_nullable: 0 - -Activate bookable feature for items related to this item type - =head2 checkprevcheckout data_type: 'enum' @@ -193,6 +185,14 @@ Activate bookable feature for items related to this item type produce a warning for a patron if a item of this type has previously been checked out to the same patron if 'yes', not if 'no', defer to category setting if 'inherit'. +=head2 bookable + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +Activate bookable feature for items related to this item type + =cut __PACKAGE__->add_columns( @@ -239,8 +239,6 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 80 }, "automatic_checkin", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, - "bookable", - { data_type => "tinyint", default_value => 0, is_nullable => 0 }, "checkprevcheckout", { data_type => "enum", @@ -248,6 +246,8 @@ __PACKAGE__->add_columns( extra => { list => ["yes", "no", "inherit"] }, is_nullable => 0, }, + "bookable", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, ); =head1 PRIMARY KEY @@ -360,8 +360,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-20 19:06:37 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T/3QdCb353e+qBkN4as7Bg +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-29 09:57:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GlyegvJnPS5lYmtZRH20KQ __PACKAGE__->add_columns( '+automatic_checkin' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/OldIssue.pm b/Koha/Schema/Result/OldIssue.pm index 870922d86f6..c496b3c4e68 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-29 09:57:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LNRlWzUjwNnp7tWmtgO9OQ __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Statistic.pm b/Koha/Schema/Result/Statistic.pm index 32ed8334a39..bdfc7b0562f 100644 --- a/Koha/Schema/Result/Statistic.pm +++ b/Koha/Schema/Result/Statistic.pm @@ -67,8 +67,6 @@ used by SIP data_type: 'integer' is_nullable: 1 -foreign key from the illrequests table, links transaction to a specific illrequest - =head2 itemnumber data_type: 'integer' @@ -159,8 +157,8 @@ __PACKAGE__->add_columns( ); -# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-20 19:38:05 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RthuhgFIXWLLDyprEtdx3g +# Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-08-29 09:57:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8ypTJrAAiw2Oq0X04+NdHA # You can replace this text with custom content, and it will be preserved on regeneration -- 2.51.0