From 0cbdead5622362ea9284a4d5bc3a8c33c627a4b9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 27 Jun 2022 13:59:51 +0200 Subject: [PATCH] Bug 30650: DBIC --- Koha/Schema/Result/Borrower.pm | 34 ++- Koha/Schema/Result/Branch.pm | 34 ++- Koha/Schema/Result/CurbsidePickup.pm | 211 ++++++++++++++++++ Koha/Schema/Result/CurbsidePickupIssue.pm | 96 ++++++++ .../Result/CurbsidePickupOpeningSlot.pm | 117 ++++++++++ Koha/Schema/Result/CurbsidePickupPolicy.pm | 152 +++++++++++++ 6 files changed, 640 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/CurbsidePickup.pm create mode 100644 Koha/Schema/Result/CurbsidePickupIssue.pm create mode 100644 Koha/Schema/Result/CurbsidePickupOpeningSlot.pm create mode 100644 Koha/Schema/Result/CurbsidePickupPolicy.pm diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 56559256af8..ec07368a3a0 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1243,6 +1243,36 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 curbside_pickups_borrowernumbers + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "curbside_pickups_borrowernumbers", + "Koha::Schema::Result::CurbsidePickup", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 curbside_pickups_staged_by + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "curbside_pickups_staged_by", + "Koha::Schema::Result::CurbsidePickup", + { "foreign.staged_by" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 discharges Type: has_many @@ -1974,8 +2004,8 @@ Composing rels: L -> permission __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-24 15:30:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8f/ch5BjQ1LL9jrEvegkmA +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-27 11:58:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:anBIcDVLYymrl5F9qfTfuA __PACKAGE__->has_many( "extended_attributes", diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index b2a59b2cbf3..3ff052eea8f 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -611,6 +611,36 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 curbside_pickup_policy + +Type: might_have + +Related object: L + +=cut + +__PACKAGE__->might_have( + "curbside_pickup_policy", + "Koha::Schema::Result::CurbsidePickupPolicy", + { "foreign.branchcode" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 curbside_pickups + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "curbside_pickups", + "Koha::Schema::Result::CurbsidePickup", + { "foreign.branchcode" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 desks Type: has_many @@ -882,8 +912,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-03-28 22:07:59 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Kpv55lV6FRGoxxu5nufXhg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-27 11:58:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1m1v0sml/1gBHxAkQl8BaA __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/CurbsidePickup.pm b/Koha/Schema/Result/CurbsidePickup.pm new file mode 100644 index 00000000000..23ab0360436 --- /dev/null +++ b/Koha/Schema/Result/CurbsidePickup.pm @@ -0,0 +1,211 @@ +use utf8; +package Koha::Schema::Result::CurbsidePickup; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::CurbsidePickup + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("curbside_pickups"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 borrowernumber + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 branchcode + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 0 + size: 10 + +=head2 scheduled_pickup_datetime + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 0 + +=head2 staged_datetime + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 staged_by + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 arrival_datetime + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 delivered_datetime + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 delivered_by + + data_type: 'integer' + is_nullable: 1 + +=head2 notes + + data_type: 'text' + is_nullable: 1 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "borrowernumber", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "branchcode", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, + "scheduled_pickup_datetime", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 0, + }, + "staged_datetime", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "staged_by", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "arrival_datetime", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "delivered_datetime", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "delivered_by", + { data_type => "integer", is_nullable => 1 }, + "notes", + { data_type => "text", is_nullable => 1 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 borrowernumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "borrowernumber", + "Koha::Schema::Result::Borrower", + { borrowernumber => "borrowernumber" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 branchcode + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "branchcode", + "Koha::Schema::Result::Branch", + { branchcode => "branchcode" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 curbside_pickup_issues + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "curbside_pickup_issues", + "Koha::Schema::Result::CurbsidePickupIssue", + { "foreign.curbside_pickup_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 staged_by + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "staged_by", + "Koha::Schema::Result::Borrower", + { borrowernumber => "staged_by" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-27 11:58:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8gt7Vqurdid0rwmBMPI5yg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/CurbsidePickupIssue.pm b/Koha/Schema/Result/CurbsidePickupIssue.pm new file mode 100644 index 00000000000..4c029eb2558 --- /dev/null +++ b/Koha/Schema/Result/CurbsidePickupIssue.pm @@ -0,0 +1,96 @@ +use utf8; +package Koha::Schema::Result::CurbsidePickupIssue; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::CurbsidePickupIssue + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("curbside_pickup_issues"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 curbside_pickup_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 issue_id + + data_type: 'integer' + is_nullable: 0 + +=head2 reserve_id + + data_type: 'integer' + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "curbside_pickup_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "issue_id", + { data_type => "integer", is_nullable => 0 }, + "reserve_id", + { data_type => "integer", is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 curbside_pickup + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "curbside_pickup", + "Koha::Schema::Result::CurbsidePickup", + { id => "curbside_pickup_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-27 11:58:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:U8r/RLbAi1yGXexYWUYjtQ + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/CurbsidePickupOpeningSlot.pm b/Koha/Schema/Result/CurbsidePickupOpeningSlot.pm new file mode 100644 index 00000000000..052379db29a --- /dev/null +++ b/Koha/Schema/Result/CurbsidePickupOpeningSlot.pm @@ -0,0 +1,117 @@ +use utf8; +package Koha::Schema::Result::CurbsidePickupOpeningSlot; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::CurbsidePickupOpeningSlot + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("curbside_pickup_opening_slots"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 curbside_pickup_policy_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 day + + data_type: 'tinyint' + is_nullable: 0 + +=head2 start_hour + + data_type: 'integer' + is_nullable: 0 + +=head2 start_minute + + data_type: 'integer' + is_nullable: 0 + +=head2 end_hour + + data_type: 'integer' + is_nullable: 0 + +=head2 end_minute + + data_type: 'integer' + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "curbside_pickup_policy_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "day", + { data_type => "tinyint", is_nullable => 0 }, + "start_hour", + { data_type => "integer", is_nullable => 0 }, + "start_minute", + { data_type => "integer", is_nullable => 0 }, + "end_hour", + { data_type => "integer", is_nullable => 0 }, + "end_minute", + { data_type => "integer", is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 curbside_pickup_policy + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "curbside_pickup_policy", + "Koha::Schema::Result::CurbsidePickupPolicy", + { id => "curbside_pickup_policy_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-27 11:58:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5kzC0AAB9LL0gR+FFnmYgw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/CurbsidePickupPolicy.pm b/Koha/Schema/Result/CurbsidePickupPolicy.pm new file mode 100644 index 00000000000..1cca912ce8b --- /dev/null +++ b/Koha/Schema/Result/CurbsidePickupPolicy.pm @@ -0,0 +1,152 @@ +use utf8; +package Koha::Schema::Result::CurbsidePickupPolicy; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::CurbsidePickupPolicy + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("curbside_pickup_policy"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 branchcode + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 0 + size: 10 + +=head2 enabled + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=head2 enable_waiting_holds_only + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=head2 pickup_interval + + data_type: 'integer' + default_value: 0 + is_nullable: 0 + +=head2 patrons_per_interval + + data_type: 'integer' + default_value: 0 + is_nullable: 0 + +=head2 patron_scheduled_pickup + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "branchcode", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 }, + "enabled", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "enable_waiting_holds_only", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "pickup_interval", + { data_type => "integer", default_value => 0, is_nullable => 0 }, + "patrons_per_interval", + { data_type => "integer", default_value => 0, is_nullable => 0 }, + "patron_scheduled_pickup", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 UNIQUE CONSTRAINTS + +=head2 C + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->add_unique_constraint("branchcode", ["branchcode"]); + +=head1 RELATIONS + +=head2 branchcode + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "branchcode", + "Koha::Schema::Result::Branch", + { branchcode => "branchcode" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 curbside_pickup_opening_slots + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "curbside_pickup_opening_slots", + "Koha::Schema::Result::CurbsidePickupOpeningSlot", + { "foreign.curbside_pickup_policy_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-06-27 11:58:44 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RyZGROB1+g3kb2bo6mwrUQ + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.25.1