From f17a174e416f1d8ffb44cf9c098c4740afe37e15 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 25 Oct 2022 13:04:33 +0100 Subject: [PATCH] Bug 31028: DBIC Schema update Signed-off-by: David Nind Signed-off-by: Helen Oliver --- Koha/Schema/Result/Biblio.pm | 19 ++- Koha/Schema/Result/Borrower.pm | 45 ++++++ Koha/Schema/Result/Ticket.pm | 215 +++++++++++++++++++++++++++++ Koha/Schema/Result/TicketUpdate.pm | 152 ++++++++++++++++++++ 4 files changed, 429 insertions(+), 2 deletions(-) create mode 100644 Koha/Schema/Result/Ticket.pm create mode 100644 Koha/Schema/Result/TicketUpdate.pm diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 2d9abfb7e02..baa2ebb7a4e 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -540,6 +540,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 tickets + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "tickets", + "Koha::Schema::Result::Ticket", + { "foreign.biblio_id" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 tmp_holdsqueues Type: has_many @@ -571,8 +586,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-07-13 12:25:59 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:C1RZYgDcw6WrZ5laTaKV6w +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-09 09:18:58 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:joWQt2obRJMmiTLIvatB5Q __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index c8f4f32dd2f..2c65b7b6f79 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1932,6 +1932,51 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 ticket_updates + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "ticket_updates", + "Koha::Schema::Result::TicketUpdate", + { "foreign.user_id" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 tickets_reporters + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "tickets_reporters", + "Koha::Schema::Result::Ticket", + { "foreign.reporter_id" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 tickets_resolvers + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "tickets_resolvers", + "Koha::Schema::Result::Ticket", + { "foreign.resolver_id" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 tmp_holdsqueues Type: has_many diff --git a/Koha/Schema/Result/Ticket.pm b/Koha/Schema/Result/Ticket.pm new file mode 100644 index 00000000000..d45e542d441 --- /dev/null +++ b/Koha/Schema/Result/Ticket.pm @@ -0,0 +1,215 @@ +use utf8; +package Koha::Schema::Result::Ticket; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Ticket + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("tickets"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +primary key + +=head2 reporter_id + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +id of the patron who reported the ticket + +=head2 reported_date + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +date and time this ticket was reported + +=head2 title + + data_type: 'text' + is_nullable: 0 + +ticket title + +=head2 body + + data_type: 'text' + is_nullable: 0 + +ticket details + +=head2 resolver_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +id of the user who resolved the ticket + +=head2 resolved_date + + data_type: 'datetime' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +date and time this ticket was resolved + +=head2 biblio_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +id of biblio linked + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 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, + }, + "title", + { data_type => "text", is_nullable => 0 }, + "body", + { 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, + }, + "biblio_id", + { data_type => "integer", is_foreign_key => 1, 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, + join_type => "LEFT", + 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", + }, +); + +=head2 ticket_updates + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "ticket_updates", + "Koha::Schema::Result::TicketUpdate", + { "foreign.ticket_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-10-24 21:15:34 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0Nm+y1BHJicrpeq3kuU1VA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/TicketUpdate.pm b/Koha/Schema/Result/TicketUpdate.pm new file mode 100644 index 00000000000..edbc984ee42 --- /dev/null +++ b/Koha/Schema/Result/TicketUpdate.pm @@ -0,0 +1,152 @@ +use utf8; +package Koha::Schema::Result::TicketUpdate; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::TicketUpdate + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("ticket_updates"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +primary key + +=head2 ticket_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +id of catalog ticket the update relates to + +=head2 user_id + + data_type: 'integer' + default_value: 0 + is_foreign_key: 1 + is_nullable: 0 + +id of the user who logged the update + +=head2 public + + data_type: 'tinyint' + default_value: 0 + is_nullable: 0 + +boolean flag to denote whether this update is public + +=head2 date + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +date and time this update was logged + +=head2 message + + data_type: 'text' + is_nullable: 0 + +update message content + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "ticket_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "user_id", + { + data_type => "integer", + default_value => 0, + is_foreign_key => 1, + is_nullable => 0, + }, + "public", + { data_type => "tinyint", default_value => 0, is_nullable => 0 }, + "date", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, + "message", + { data_type => "text", is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 ticket + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "ticket", + "Koha::Schema::Result::Ticket", + { id => "ticket_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 user + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "user", + "Koha::Schema::Result::Borrower", + { borrowernumber => "user_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-10-24 18:31:28 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8YG3jhlqbHWptc28pvBmrg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.39.1