From 408b59f330bcd4f21d9f8b762c75bbf6a6942537 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 12 May 2023 17:11:24 +0000 Subject: [PATCH] Bug 30719: dbic specific, DONT PUSH --- Koha/Schema/Result/Borrower.pm | 19 ++- Koha/Schema/Result/Branch.pm | 19 ++- Koha/Schema/Result/Illbatch.pm | 190 +++++++++++++++++++++++++++ Koha/Schema/Result/IllbatchStatus.pm | 111 ++++++++++++++++ Koha/Schema/Result/Illrequest.pm | 34 ++++- 5 files changed, 367 insertions(+), 6 deletions(-) create mode 100644 Koha/Schema/Result/Illbatch.pm create mode 100644 Koha/Schema/Result/IllbatchStatus.pm diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 5576e8fcd2..075cef0c7f 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1402,6 +1402,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 illbatches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illbatches", + "Koha::Schema::Result::Illbatch", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 illcomments Type: has_many @@ -2103,8 +2118,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-04-28 11:24:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:RUWvcq9kgQvACo14H/u9jQ __PACKAGE__->has_many( "restrictions", diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index c86ca6736f..7d0cbaffaf 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -692,6 +692,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 illbatches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illbatches", + "Koha::Schema::Result::Illbatch", + { "foreign.branchcode" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 illrequests Type: has_many @@ -918,8 +933,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-08 17:35:26 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QPqXuEigMeIBb9NKMSkrNw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-28 11:24:21 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GGYhqyTVMmaFo9hAY4Jy5w __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Illbatch.pm b/Koha/Schema/Result/Illbatch.pm new file mode 100644 index 0000000000..9090f9d870 --- /dev/null +++ b/Koha/Schema/Result/Illbatch.pm @@ -0,0 +1,190 @@ +use utf8; +package Koha::Schema::Result::Illbatch; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Illbatch + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("illbatches"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 name + + data_type: 'varchar' + is_nullable: 0 + size: 100 + +=head2 backend + + data_type: 'varchar' + is_nullable: 0 + size: 20 + +=head2 borrowernumber + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 branchcode + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 50 + +=head2 statuscode + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 20 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "name", + { data_type => "varchar", is_nullable => 0, size => 100 }, + "backend", + { data_type => "varchar", is_nullable => 0, size => 20 }, + "borrowernumber", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "branchcode", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 50 }, + "statuscode", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 20 }, +); + +=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("u_illbatches__name", ["name"]); + +=head1 RELATIONS + +=head2 borrowernumber + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "borrowernumber", + "Koha::Schema::Result::Borrower", + { borrowernumber => "borrowernumber" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + 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, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + +=head2 illrequests + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illrequests", + "Koha::Schema::Result::Illrequest", + { "foreign.batch_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 statuscode + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "statuscode", + "Koha::Schema::Result::IllbatchStatus", + { code => "statuscode" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-28 11:24:22 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j4UhTuwaQnwWhjSd9j35tg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/IllbatchStatus.pm b/Koha/Schema/Result/IllbatchStatus.pm new file mode 100644 index 0000000000..8f86ea430b --- /dev/null +++ b/Koha/Schema/Result/IllbatchStatus.pm @@ -0,0 +1,111 @@ +use utf8; +package Koha::Schema::Result::IllbatchStatus; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::IllbatchStatus + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("illbatch_statuses"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 name + + data_type: 'varchar' + is_nullable: 0 + size: 100 + +=head2 code + + data_type: 'varchar' + is_nullable: 0 + size: 20 + +=head2 is_system + + data_type: 'integer' + is_nullable: 1 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "name", + { data_type => "varchar", is_nullable => 0, size => 100 }, + "code", + { data_type => "varchar", is_nullable => 0, size => 20 }, + "is_system", + { data_type => "integer", is_nullable => 1 }, +); + +=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("u_illbatchstatuses__code", ["code"]); + +=head1 RELATIONS + +=head2 illbatches + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illbatches", + "Koha::Schema::Result::Illbatch", + { "foreign.statuscode" => "self.code" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-28 11:24:22 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LUHcLxj5W4tParGOEkVCdg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/Illrequest.pm b/Koha/Schema/Result/Illrequest.pm index 3c55a2a357..ff971e8b05 100644 --- a/Koha/Schema/Result/Illrequest.pm +++ b/Koha/Schema/Result/Illrequest.pm @@ -175,6 +175,14 @@ Backend id attached to request The backend used to create request +=head2 batch_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +Optional ID of batch that this request belongs to + =cut __PACKAGE__->add_columns( @@ -230,6 +238,8 @@ __PACKAGE__->add_columns( { data_type => "varchar", is_nullable => 1, size => 50 }, "backend", { data_type => "varchar", is_nullable => 1, size => 20 }, + "batch_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, ); =head1 PRIMARY KEY @@ -246,6 +256,26 @@ __PACKAGE__->set_primary_key("illrequest_id"); =head1 RELATIONS +=head2 batch + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "batch", + "Koha::Schema::Result::Illbatch", + { id => "batch_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "SET NULL", + on_update => "CASCADE", + }, +); + =head2 biblio Type: belongs_to @@ -352,8 +382,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-05-05 12:10:10 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1VhNc8tMnvCpBYaj90YOiQ +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-04-28 11:24:22 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:i7xURQ9tMmQfW7wg1lAaEA __PACKAGE__->has_many( "comments", -- 2.30.2