From bb0db61863c989727787393fa8cfdc813e68e3b9 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Thu, 5 Sep 2019 14:13:34 -0300 Subject: [PATCH] Bug 19618: [DO NOT PUSH] (follow-up) Schema structure --- Koha/Schema/Result/Biblio.pm | 19 ++- Koha/Schema/Result/Borrower.pm | 19 ++- Koha/Schema/Result/Club.pm | 19 ++- Koha/Schema/Result/ClubHold.pm | 162 +++++++++++++++++++ Koha/Schema/Result/ClubHoldsToPatronHold.pm | 167 ++++++++++++++++++++ Koha/Schema/Result/Item.pm | 19 ++- Koha/Schema/Result/Reserve.pm | 19 ++- 7 files changed, 414 insertions(+), 10 deletions(-) create mode 100644 Koha/Schema/Result/ClubHold.pm create mode 100644 Koha/Schema/Result/ClubHoldsToPatronHold.pm diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 9674b56fe6..48eb9d29b7 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -240,6 +240,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 club_holds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "club_holds", + "Koha::Schema::Result::ClubHold", + { "foreign.biblio_id" => "self.biblionumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 hold_fill_targets Type: has_many @@ -391,8 +406,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-08-05 13:53:34 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AzvuQItPPs5WeC4tdtS/NQ +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-09-02 18:36:27 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:A9jQbYCqjD6G4EoCFlJGyQ __PACKAGE__->has_one( diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 8693d15ea9..e3bcf79f6b 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -951,6 +951,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 club_holds_to_patron_holds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "club_holds_to_patron_holds", + "Koha::Schema::Result::ClubHoldsToPatronHold", + { "foreign.patron_id" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 course_instructors Type: has_many @@ -1552,8 +1567,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-17 12:11:31 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:rb0wEXHaSvYum10aZjbAOA +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-09-02 18:36:27 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KqqxD3z3T/gIP9zwm8PrmA __PACKAGE__->add_columns( '+anonymized' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Club.pm b/Koha/Schema/Result/Club.pm index 7011cd54e6..99d0b08fe4 100644 --- a/Koha/Schema/Result/Club.pm +++ b/Koha/Schema/Result/Club.pm @@ -173,6 +173,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 club_holds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "club_holds", + "Koha::Schema::Result::ClubHold", + { "foreign.club_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 club_template Type: belongs_to @@ -189,8 +204,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6EB6FURHN+brOhDoPZVeGQ +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-09-02 18:36:27 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AoRSMv2RBjjxSG9j/N8sBQ # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/ClubHold.pm b/Koha/Schema/Result/ClubHold.pm new file mode 100644 index 0000000000..7c2eba8551 --- /dev/null +++ b/Koha/Schema/Result/ClubHold.pm @@ -0,0 +1,162 @@ +use utf8; +package Koha::Schema::Result::ClubHold; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::ClubHold + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("club_holds"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 club_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 biblio_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 item_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 date_created + + data_type: 'timestamp' + datetime_undef_if_invalid: 1 + default_value: current_timestamp + is_nullable: 0 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "club_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "biblio_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "item_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "date_created", + { + data_type => "timestamp", + datetime_undef_if_invalid => 1, + default_value => \"current_timestamp", + is_nullable => 0, + }, +); + +=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 club + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "club", + "Koha::Schema::Result::Club", + { id => "club_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 club_holds_to_patron_holds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "club_holds_to_patron_holds", + "Koha::Schema::Result::ClubHoldsToPatronHold", + { "foreign.club_hold_id" => "self.id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + +=head2 item + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "item", + "Koha::Schema::Result::Item", + { itemnumber => "item_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-09-02 18:36:27 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fC2qYBhwy6SPoF9NKl2y3g + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/ClubHoldsToPatronHold.pm b/Koha/Schema/Result/ClubHoldsToPatronHold.pm new file mode 100644 index 0000000000..ee7fb3956a --- /dev/null +++ b/Koha/Schema/Result/ClubHoldsToPatronHold.pm @@ -0,0 +1,167 @@ +use utf8; +package Koha::Schema::Result::ClubHoldsToPatronHold; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +=head1 NAME + +Koha::Schema::Result::ClubHoldsToPatronHold + +=cut + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; + +=head1 TABLE: C + +=cut + +__PACKAGE__->table("club_holds_to_patron_holds"); + +=head1 ACCESSORS + +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + +=head2 club_hold_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 patron_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 0 + +=head2 hold_id + + data_type: 'integer' + is_foreign_key: 1 + is_nullable: 1 + +=head2 error_code + + data_type: 'enum' + extra: {list => ["damaged","ageRestricted","itemAlreadyOnHold","tooManyHoldsForThisRecord","tooManyReservesToday","tooManyReserves","notReservable","cannotReserveFromOtherBranches","libraryNotFound","libraryNotPickupLocation","cannotBeTransferred"]} + is_nullable: 1 + +=head2 error_message + + data_type: 'varchar' + is_nullable: 1 + size: 100 + +=cut + +__PACKAGE__->add_columns( + "id", + { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + "club_hold_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "patron_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, + "hold_id", + { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + "error_code", + { + data_type => "enum", + extra => { + list => [ + "damaged", + "ageRestricted", + "itemAlreadyOnHold", + "tooManyHoldsForThisRecord", + "tooManyReservesToday", + "tooManyReserves", + "notReservable", + "cannotReserveFromOtherBranches", + "libraryNotFound", + "libraryNotPickupLocation", + "cannotBeTransferred", + ], + }, + is_nullable => 1, + }, + "error_message", + { data_type => "varchar", is_nullable => 1, size => 100 }, +); + +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + +=head1 RELATIONS + +=head2 club_hold + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "club_hold", + "Koha::Schema::Result::ClubHold", + { id => "club_hold_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + +=head2 hold + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "hold", + "Koha::Schema::Result::Reserve", + { reserve_id => "hold_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 patron + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "patron", + "Koha::Schema::Result::Borrower", + { borrowernumber => "patron_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-09-02 19:29:15 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LO55zd7JbFvLxc1f9gWXew + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index 9d5743f5c2..a99ddbc474 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -511,6 +511,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 club_holds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "club_holds", + "Koha::Schema::Result::ClubHold", + { "foreign.item_id" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 course_item Type: might_have @@ -717,8 +732,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-14 18:14:09 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:wDXcErUYqg0aoQkzz3P5vg +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-09-02 18:36:28 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1gxw0D0XeEZi+GUNCVGmyQ __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm index 086b621f5f..7cd443a0b0 100644 --- a/Koha/Schema/Result/Reserve.pm +++ b/Koha/Schema/Result/Reserve.pm @@ -280,6 +280,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 club_holds_to_patron_holds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "club_holds_to_patron_holds", + "Koha::Schema::Result::ClubHoldsToPatronHold", + { "foreign.hold_id" => "self.reserve_id" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 itemnumber Type: belongs_to @@ -321,8 +336,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-06-17 07:24:39 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OMFqEWyKqFTcYj7vAFXy/g +# Created by DBIx::Class::Schema::Loader v0.07048 @ 2019-09-02 18:36:28 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0QgNmfC7B4UNHidAtIiIFA __PACKAGE__->belongs_to( "item", -- 2.17.1