From dd88680cbec5d044e604e567cb65bffab091e618 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 9 Nov 2017 12:16:59 -0300 Subject: [PATCH] Bug 7317: DBIC Schema changes Signed-off-by: Jonathan Druart --- Koha/Schema/Result/Borrower.pm | 19 +- Koha/Schema/Result/Branch.pm | 19 +- Koha/Schema/Result/Illrequest.pm | 239 ++++++++++++++++++++++ Koha/Schema/Result/Illrequestattribute.pm | 97 +++++++++ 4 files changed, 370 insertions(+), 4 deletions(-) create mode 100644 Koha/Schema/Result/Illrequest.pm create mode 100644 Koha/Schema/Result/Illrequestattribute.pm diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index c84418bd94..e90dd783d5 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1010,6 +1010,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 illrequests + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illrequests", + "Koha::Schema::Result::Illrequest", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 issues Type: has_many @@ -1371,8 +1386,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-10-27 13:24:06 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vWgO9UIYOpDt7Pp09KFcYA +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-11-09 11:42:45 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:UitEC1xK/a76Ff4ZCS2BKA __PACKAGE__->belongs_to( "guarantor", diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 58e11210c2..aea24e7382 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -503,6 +503,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 illrequests + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illrequests", + "Koha::Schema::Result::Illrequest", + { "foreign.branchcode" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 items_holdingbranches Type: has_many @@ -604,8 +619,8 @@ Composing rels: L -> categorycode __PACKAGE__->many_to_many("categorycodes", "branchrelations", "categorycode"); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-06-03 21:53:00 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:S44besPbFRnPJpyHRK+aSQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-11-09 11:42:45 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LmN2FlbKiZTRX+egCHuDjQ # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Illrequest.pm b/Koha/Schema/Result/Illrequest.pm new file mode 100644 index 0000000000..d965012c9d --- /dev/null +++ b/Koha/Schema/Result/Illrequest.pm @@ -0,0 +1,239 @@ +use utf8; +package Koha::Schema::Result::Illrequest; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Illrequest + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("illrequests"); + +=head1 ACCESSORS + +=head2 illrequest_id + + data_type: 'bigint' + extra: {unsigned => 1} + is_auto_increment: 1 + is_nullable: 0 + +=head2 borrowernumber + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 biblio_id + + data_type: 'integer' + is_nullable: 1 + +=head2 branchcode + + data_type: 'varchar' + is_foreign_key: 1 + is_nullable: 0 + size: 50 + +=head2 status + + data_type: 'varchar' + is_nullable: 1 + size: 50 + +=head2 placed + + data_type: 'date' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 replied + + data_type: 'date' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 updated + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +=head2 completed + + data_type: 'date' + datetime_undef_if_invalid: 1 + is_nullable: 1 + +=head2 medium + + data_type: 'varchar' + is_nullable: 1 + size: 30 + +=head2 accessurl + + data_type: 'varchar' + is_nullable: 1 + size: 500 + +=head2 cost + + data_type: 'varchar' + is_nullable: 1 + size: 20 + +=head2 notesopac + + data_type: 'text' + is_nullable: 1 + +=head2 notesstaff + + data_type: 'text' + is_nullable: 1 + +=head2 orderid + + data_type: 'varchar' + is_nullable: 1 + size: 50 + +=head2 backend + + data_type: 'varchar' + is_nullable: 1 + size: 20 + +=cut + +__PACKAGE__->add_columns( + "illrequest_id", + { + data_type => "bigint", + extra => { unsigned => 1 }, + is_auto_increment => 1, + is_nullable => 0, + }, + "borrowernumber", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "biblio_id", + { data_type => "integer", is_nullable => 1 }, + "branchcode", + { data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 50 }, + "status", + { data_type => "varchar", is_nullable => 1, size => 50 }, + "placed", + { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, + "replied", + { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, + "updated", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, + "completed", + { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, + "medium", + { data_type => "varchar", is_nullable => 1, size => 30 }, + "accessurl", + { data_type => "varchar", is_nullable => 1, size => 500 }, + "cost", + { data_type => "varchar", is_nullable => 1, size => 20 }, + "notesopac", + { data_type => "text", is_nullable => 1 }, + "notesstaff", + { data_type => "text", is_nullable => 1 }, + "orderid", + { data_type => "varchar", is_nullable => 1, size => 50 }, + "backend", + { data_type => "varchar", is_nullable => 1, size => 20 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("illrequest_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, + join_type => "LEFT", + 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 illrequestattributes + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "illrequestattributes", + "Koha::Schema::Result::Illrequestattribute", + { "foreign.illrequest_id" => "self.illrequest_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-11-09 11:42:45 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Iirysr/XU9b8Scssd4A0OQ + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/Illrequestattribute.pm b/Koha/Schema/Result/Illrequestattribute.pm new file mode 100644 index 0000000000..2be7984802 --- /dev/null +++ b/Koha/Schema/Result/Illrequestattribute.pm @@ -0,0 +1,97 @@ +use utf8; +package Koha::Schema::Result::Illrequestattribute; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::Illrequestattribute + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("illrequestattributes"); + +=head1 ACCESSORS + +=head2 illrequest_id + + data_type: 'bigint' + extra: {unsigned => 1} + is_foreign_key: 1 + is_nullable: 0 + +=head2 type + + data_type: 'varchar' + is_nullable: 0 + size: 200 + +=head2 value + + data_type: 'text' + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "illrequest_id", + { + data_type => "bigint", + extra => { unsigned => 1 }, + is_foreign_key => 1, + is_nullable => 0, + }, + "type", + { data_type => "varchar", is_nullable => 0, size => 200 }, + "value", + { data_type => "text", is_nullable => 0 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("illrequest_id", "type"); + +=head1 RELATIONS + +=head2 illrequest + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "illrequest", + "Koha::Schema::Result::Illrequest", + { illrequest_id => "illrequest_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-11-09 11:42:45 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:COXHn3Q7RglF6Cl7kKHqLA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; -- 2.39.5