From 59a7f9c5cf9a9b903c26bc233b9645f3acadccad Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 7 Jul 2022 15:55:28 +0100 Subject: [PATCH] Bug 31028: DBIC Schema --- Koha/Schema/Result/Biblio.pm | 19 ++- Koha/Schema/Result/Borrower.pm | 34 ++++- Koha/Schema/Result/CatalogConcern.pm | 195 +++++++++++++++++++++++++++ 3 files changed, 244 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/CatalogConcern.pm diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index f27ee62b08..fb134023ce 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -255,6 +255,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 catalog_concerns + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "catalog_concerns", + "Koha::Schema::Result::CatalogConcern", + { "foreign.biblio_id" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 club_holds Type: has_many @@ -556,8 +571,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-08 19:06:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QmW8BVyUx2F2MAp6ZG45mg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-08-16 12:51:38 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fN4HjHPivAcycZICptbfmg __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 81e45238a9..12afaa9df1 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1168,6 +1168,36 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 catalog_concerns_reporters + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "catalog_concerns_reporters", + "Koha::Schema::Result::CatalogConcern", + { "foreign.reporter_id" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 catalog_concerns_resolvers + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "catalog_concerns_resolvers", + "Koha::Schema::Result::CatalogConcern", + { "foreign.resolver_id" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 categorycode Type: belongs_to @@ -2019,8 +2049,8 @@ Composing rels: L -> permission __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-07 12:48:35 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iffysIl9TxAnXVzpWiUJuw +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-08-16 12:51:38 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1a63AwnEsVfSI+zjDVyXbg __PACKAGE__->has_many( "extended_attributes", diff --git a/Koha/Schema/Result/CatalogConcern.pm b/Koha/Schema/Result/CatalogConcern.pm new file mode 100644 index 0000000000..7e6d24df67 --- /dev/null +++ b/Koha/Schema/Result/CatalogConcern.pm @@ -0,0 +1,195 @@ +use utf8; +package Koha::Schema::Result::CatalogConcern; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::CatalogConcern + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("catalog_concerns"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +primary key + +=head2 biblio_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +id of biblio record the report concerns + +=head2 reporter_id + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +id of the patron who reported the concern + +=head2 reported_date + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +date and time this concern was reported + +=head2 message + + data_type: 'text' + is_nullable: 0 + +concern message content + +=head2 resolver_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +id of the user who resolved the concern + +=head2 resolved_date + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +date and time this concern was resolved + +=head2 resolution_message + + data_type: 'text' + is_nullable: 1 + +resolution message content + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "biblio_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "reporter_id", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, + "reported_date", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, + "message", + { data_type => "text", is_nullable => 0 }, + "resolver_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "resolved_date", + { + data_type => "datetime", + datetime_undef_if_invalid => 1, + is_nullable => 1, + }, + "resolution_message", + { data_type => "text", is_nullable => 1 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 biblio + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblio", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblio_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 reporter + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "reporter", + "Koha::Schema::Result::Borrower", + { borrowernumber => "reporter_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 resolver + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "resolver", + "Koha::Schema::Result::Borrower", + { borrowernumber => "resolver_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-08-16 12:51:38 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6J4cyyPvysbR2ZBd7o1hyw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.20.1