From 45d369aa81cfb0fabb7e9aaa7a575adacf4c7392 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 12 May 2023 17:11:24 +0000 Subject: [PATCH] Bug 30719: DBIC schema Signed-off-by: Edith Speller Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- Koha/Schema/Result/Borrower.pm | 19 ++- Koha/Schema/Result/Branch.pm | 19 ++- Koha/Schema/Result/Illbatch.pm | 200 +++++++++++++++++++++++++++ Koha/Schema/Result/IllbatchStatus.pm | 117 ++++++++++++++++ Koha/Schema/Result/Illrequest.pm | 34 ++++- 5 files changed, 383 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..0f5b414494 --- /dev/null +++ b/Koha/Schema/Result/Illbatch.pm @@ -0,0 +1,200 @@ +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 + +Batch ID + +=head2 name + + data_type: 'varchar' + is_nullable: 0 + size: 100 + +Unique name of batch + +=head2 backend + + data_type: 'varchar' + is_nullable: 0 + size: 20 + +Name of batch backend + +=head2 borrowernumber + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +Patron associated with batch + +=head2 branchcode + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 50 + +Branch associated with batch + +=head2 statuscode + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 1 + size: 20 + +Status of batch + +=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-09-08 13:49:29 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YKxQxJMKxdBP9X4+i0Rfzw + +1; diff --git a/Koha/Schema/Result/IllbatchStatus.pm b/Koha/Schema/Result/IllbatchStatus.pm new file mode 100644 index 0000000000..1f0b86025e --- /dev/null +++ b/Koha/Schema/Result/IllbatchStatus.pm @@ -0,0 +1,117 @@ +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 + +Status ID + +=head2 name + + data_type: 'varchar' + is_nullable: 0 + size: 100 + +Name of status + +=head2 code + + data_type: 'varchar' + is_nullable: 0 + size: 20 + +Unique, immutable code for status + +=head2 is_system + + data_type: 'tinyint' + is_nullable: 1 + +Is this status required for system operation + +=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 => "tinyint", 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-09-08 13:49:29 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yo60FJ+kyRj8QuEMac8CFA + +1; diff --git a/Koha/Schema/Result/Illrequest.pm b/Koha/Schema/Result/Illrequest.pm index 29ba8acf74..d7c646b975 100644 --- a/Koha/Schema/Result/Illrequest.pm +++ b/Koha/Schema/Result/Illrequest.pm @@ -182,6 +182,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( @@ -239,6 +247,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 @@ -255,6 +265,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 @@ -361,8 +391,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-06-05 16:11:04 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6b58Mo/KzvheZCurYvKu7A +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-09-08 13:51:09 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QS3E1jO/d797B0ADcjT0yQ __PACKAGE__->has_many( "comments", -- 2.39.5