From 8ce10cf57ff6c06b3bff2d543ae62f67ff1967c4 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 21 Apr 2020 17:44:10 -0300 Subject: [PATCH] Bug 25260: Schema updates [DO NOT PUSH] Sponsored-by: ByWater Solutions Sponsored-by: Theke Solutions --- Koha/Schema/Result/AuthorisedValue.pm | 4 +- Koha/Schema/Result/AuthorisedValueCategory.pm | 4 +- Koha/Schema/Result/Biblio.pm | 37 +--- Koha/Schema/Result/Borrower.pm | 65 +++--- Koha/Schema/Result/BorrowerAttributeType.pm | 4 +- Koha/Schema/Result/Branch.pm | 34 +-- Koha/Schema/Result/Category.pm | 4 +- Koha/Schema/Result/ClubHoldsToPatronHold.pm | 10 +- Koha/Schema/Result/Currency.pm | 4 +- Koha/Schema/Result/Deletedbiblio.pm | 4 +- Koha/Schema/Result/Issue.pm | 4 +- Koha/Schema/Result/Item.pm | 49 ++--- Koha/Schema/Result/Itemtype.pm | 37 +--- Koha/Schema/Result/OldReserve.pm | 143 ++---------- Koha/Schema/Result/Overduerule.pm | 4 +- Koha/Schema/Result/Reserve.pm | 205 ++---------------- 16 files changed, 135 insertions(+), 477 deletions(-) diff --git a/Koha/Schema/Result/AuthorisedValue.pm b/Koha/Schema/Result/AuthorisedValue.pm index 90d754e595..5e8c4d9abd 100644 --- a/Koha/Schema/Result/AuthorisedValue.pm +++ b/Koha/Schema/Result/AuthorisedValue.pm @@ -161,8 +161,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07048 @ 2020-04-07 11:23:19 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6MjWlDqdpIOwsJlyjQawAg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-19 13:02:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OQ+CBmiY+03gjFyILECgkg # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/AuthorisedValueCategory.pm b/Koha/Schema/Result/AuthorisedValueCategory.pm index fcbb25a832..1c0082b197 100644 --- a/Koha/Schema/Result/AuthorisedValueCategory.pm +++ b/Koha/Schema/Result/AuthorisedValueCategory.pm @@ -97,8 +97,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-08-30 11:59:31 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6vToj9pUcIv8Jio38rNE4g +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-19 13:02:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+hJjiFy4+OTbGZe9FeOSJg sub koha_objects_class { 'Koha::AuthorisedValueCategories'; diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 806faf87ad..539614f9ed 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -270,32 +270,32 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 items +=head2 holds Type: has_many -Related object: L +Related object: L =cut __PACKAGE__->has_many( - "items", - "Koha::Schema::Result::Item", - { "foreign.biblionumber" => "self.biblionumber" }, + "holds", + "Koha::Schema::Result::Hold", + { "foreign.biblio_id" => "self.biblionumber" }, { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 old_reserves +=head2 items Type: has_many -Related object: L +Related object: L =cut __PACKAGE__->has_many( - "old_reserves", - "Koha::Schema::Result::OldReserve", + "items", + "Koha::Schema::Result::Item", { "foreign.biblionumber" => "self.biblionumber" }, { cascade_copy => 0, cascade_delete => 0 }, ); @@ -315,21 +315,6 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 reserves - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "reserves", - "Koha::Schema::Result::Reserve", - { "foreign.biblionumber" => "self.biblionumber" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - =head2 reviews Type: has_many @@ -451,8 +436,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-17 09:15:51 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:p2SIq565zPyE3ZUkSuXyBA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-22 19:21:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:N40arh8lmwliRuTIf0ji7g __PACKAGE__->has_one( diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index b3c8a01dd0..206713520e 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -712,7 +712,7 @@ __PACKAGE__->add_unique_constraint("userid", ["userid"]); =head1 RELATIONS -=head2 accountlines +=head2 accountlines_borrowernumbers Type: has_many @@ -721,7 +721,7 @@ Related object: L =cut __PACKAGE__->has_many( - "accountlines", + "accountlines_borrowernumbers", "Koha::Schema::Result::Accountline", { "foreign.borrowernumber" => "self.borrowernumber" }, { cascade_copy => 0, cascade_delete => 0 }, @@ -1057,6 +1057,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 holds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "holds", + "Koha::Schema::Result::Hold", + { "foreign.patron_id" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 housebound_profile Type: might_have @@ -1192,7 +1207,7 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 messages +=head2 messages_borrowernumbers Type: has_many @@ -1201,13 +1216,13 @@ Related object: L =cut __PACKAGE__->has_many( - "messages", + "messages_borrowernumbers", "Koha::Schema::Result::Message", - { "foreign.manager_id" => "self.borrowernumber" }, + { "foreign.borrowernumber" => "self.borrowernumber" }, { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 messages_borrowernumbers +=head2 messages_managers Type: has_many @@ -1216,9 +1231,9 @@ Related object: L =cut __PACKAGE__->has_many( - "messages_borrowernumbers", + "messages_managers", "Koha::Schema::Result::Message", - { "foreign.borrowernumber" => "self.borrowernumber" }, + { "foreign.manager_id" => "self.borrowernumber" }, { cascade_copy => 0, cascade_delete => 0 }, ); @@ -1237,21 +1252,6 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 old_reserves - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "old_reserves", - "Koha::Schema::Result::OldReserve", - { "foreign.borrowernumber" => "self.borrowernumber" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - =head2 opac_news Type: has_many @@ -1357,21 +1357,6 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 reserves - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "reserves", - "Koha::Schema::Result::Reserve", - { "foreign.borrowernumber" => "self.borrowernumber" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - =head2 return_claims_borrowernumbers Type: has_many @@ -1688,8 +1673,8 @@ Composing rels: L -> ordernumber __PACKAGE__->many_to_many("ordernumbers", "aqorder_users", "ordernumber"); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-01 09:42:50 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1G8678sy3UnvmJffzcU/Hg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-22 19:21:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:eeA+LaMzH/BGaVIEXfv91A __PACKAGE__->add_columns( '+anonymized' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/BorrowerAttributeType.pm b/Koha/Schema/Result/BorrowerAttributeType.pm index 46a86f07bc..9c55e40385 100644 --- a/Koha/Schema/Result/BorrowerAttributeType.pm +++ b/Koha/Schema/Result/BorrowerAttributeType.pm @@ -162,8 +162,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-10-25 20:32:12 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gsPR8PuUUZHFUkr3MIbTpw +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-19 13:02:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iBALyOv0WYIIIyiKh+Qtlw sub koha_object_class { 'Koha::Patron::Attribute::Type'; diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index 478c06fc0e..545e2cc1d8 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -578,6 +578,21 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); +=head2 holds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "holds", + "Koha::Schema::Result::Hold", + { "foreign.pickup_library_id" => "self.branchcode" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 illrequests Type: has_many @@ -698,21 +713,6 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 reserves - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "reserves", - "Koha::Schema::Result::Reserve", - { "foreign.branchcode" => "self.branchcode" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - =head2 special_holidays Type: has_many @@ -789,8 +789,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-29 16:09:25 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9f0Crr57ffdoe8syXgawng +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-22 19:21:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QCorqKahrCQBDE1G6A5o+Q __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 } diff --git a/Koha/Schema/Result/Category.pm b/Koha/Schema/Result/Category.pm index cfe788ce6f..1b31af7a38 100644 --- a/Koha/Schema/Result/Category.pm +++ b/Koha/Schema/Result/Category.pm @@ -266,8 +266,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2019-04-12 02:43:58 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7rwTH9HuxcdRCBP/bj0d/A +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-19 13:02:42 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IJa+UUdr5UUiwK9vcnzVtQ sub koha_object_class { 'Koha::Patron::Category'; diff --git a/Koha/Schema/Result/ClubHoldsToPatronHold.pm b/Koha/Schema/Result/ClubHoldsToPatronHold.pm index 59ffca0daf..6345691891 100644 --- a/Koha/Schema/Result/ClubHoldsToPatronHold.pm +++ b/Koha/Schema/Result/ClubHoldsToPatronHold.pm @@ -127,14 +127,14 @@ __PACKAGE__->belongs_to( Type: belongs_to -Related object: L +Related object: L =cut __PACKAGE__->belongs_to( "hold", - "Koha::Schema::Result::Reserve", - { reserve_id => "hold_id" }, + "Koha::Schema::Result::Hold", + { id => "hold_id" }, { is_deferrable => 1, join_type => "LEFT", @@ -159,8 +159,8 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-01 07:08:47 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/T626DfqUi7SnXOyieUzYw +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-19 13:02:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5z4rQioemKHFmPWtIw+HSw sub koha_objects_class { 'Koha::Club::Hold::PatronHolds'; diff --git a/Koha/Schema/Result/Currency.pm b/Koha/Schema/Result/Currency.pm index 720fa5ac59..76d0d55e00 100644 --- a/Koha/Schema/Result/Currency.pm +++ b/Koha/Schema/Result/Currency.pm @@ -158,8 +158,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-01 14:23:58 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PnJEcCgrM1Edf99phWFdyQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-19 13:02:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GZu4ECid8a0ON+Vqv2TY4g sub koha_object_class { diff --git a/Koha/Schema/Result/Deletedbiblio.pm b/Koha/Schema/Result/Deletedbiblio.pm index 5d02066493..d6f9f6dd2f 100644 --- a/Koha/Schema/Result/Deletedbiblio.pm +++ b/Koha/Schema/Result/Deletedbiblio.pm @@ -181,8 +181,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:FQaznWmkfR2Ge5NG8lDmSw +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-19 13:02:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:cmMAwEbKNSiFaYVexqQHbQ sub koha_objects_class { 'Koha::Old::Biblios'; diff --git a/Koha/Schema/Result/Issue.pm b/Koha/Schema/Result/Issue.pm index 8bb16b6b92..8970f5bfdc 100644 --- a/Koha/Schema/Result/Issue.pm +++ b/Koha/Schema/Result/Issue.pm @@ -264,8 +264,8 @@ __PACKAGE__->might_have( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-31 12:18:38 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QVmFa5b0Pe5OhUI92n9kzQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-19 13:02:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oMVidyJ8jFrABeMsWQ0Gkw __PACKAGE__->add_columns( '+auto_renew' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index cb77d96ee0..5b09fc0d2b 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -591,6 +591,21 @@ __PACKAGE__->belongs_to( }, ); +=head2 holds + +Type: has_many + +Related object: L + +=cut + +__PACKAGE__->has_many( + "holds", + "Koha::Schema::Result::Hold", + { "foreign.item_id" => "self.itemnumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); + =head2 homebranch Type: belongs_to @@ -656,36 +671,6 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 old_reserves - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "old_reserves", - "Koha::Schema::Result::OldReserve", - { "foreign.itemnumber" => "self.itemnumber" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - -=head2 reserves - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "reserves", - "Koha::Schema::Result::Reserve", - { "foreign.itemnumber" => "self.itemnumber" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - =head2 return_claims Type: has_many @@ -747,8 +732,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-27 10:38:13 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IpI7wRweeZCbCeU1LhZbRQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-22 19:21:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0gYj48OTmEd79BoFTb2EiQ __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); diff --git a/Koha/Schema/Result/Itemtype.pm b/Koha/Schema/Result/Itemtype.pm index b180a90c49..06fc495982 100644 --- a/Koha/Schema/Result/Itemtype.pm +++ b/Koha/Schema/Result/Itemtype.pm @@ -197,54 +197,39 @@ __PACKAGE__->has_many( { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 itemtypes_branches - -Type: has_many - -Related object: L - -=cut - -__PACKAGE__->has_many( - "itemtypes_branches", - "Koha::Schema::Result::ItemtypesBranch", - { "foreign.itemtype" => "self.itemtype" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - -=head2 old_reserves +=head2 holds Type: has_many -Related object: L +Related object: L =cut __PACKAGE__->has_many( - "old_reserves", - "Koha::Schema::Result::OldReserve", - { "foreign.itemtype" => "self.itemtype" }, + "holds", + "Koha::Schema::Result::Hold", + { "foreign.item_type" => "self.itemtype" }, { cascade_copy => 0, cascade_delete => 0 }, ); -=head2 reserves +=head2 itemtypes_branches Type: has_many -Related object: L +Related object: L =cut __PACKAGE__->has_many( - "reserves", - "Koha::Schema::Result::Reserve", + "itemtypes_branches", + "Koha::Schema::Result::ItemtypesBranch", { "foreign.itemtype" => "self.itemtype" }, { cascade_copy => 0, cascade_delete => 0 }, ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-09 17:13:18 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7ojvTzsDvdHPAJMwJrAZ7A +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-22 19:21:03 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SK+5YpGrmEVIio1N0y1Ixw __PACKAGE__->add_columns( '+rentalcharge_hourly_calendar' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/OldReserve.pm b/Koha/Schema/Result/OldReserve.pm index 3df98cc4e5..37c2fa6f7d 100644 --- a/Koha/Schema/Result/OldReserve.pm +++ b/Koha/Schema/Result/OldReserve.pm @@ -6,7 +6,7 @@ package Koha::Schema::Result::OldReserve; =head1 NAME -Koha::Schema::Result::OldReserve +Koha::Schema::Result::OldReserve - VIEW =cut @@ -14,25 +14,28 @@ use strict; use warnings; use base 'DBIx::Class::Core'; +__PACKAGE__->table_class("DBIx::Class::ResultSource::View"); =head1 TABLE: C =cut __PACKAGE__->table("old_reserves"); +__PACKAGE__->result_source_instance->view_definition("select `dbic`.`holds`.`id` AS `reserve_id`,`dbic`.`holds`.`patron_id` AS `borrowernumber`,`dbic`.`holds`.`placing_date` AS `reservedate`,`dbic`.`holds`.`biblio_id` AS `biblionumber`,`dbic`.`holds`.`pickup_library_id` AS `branchcode`,(case when (`dbic`.`holds`.`status` = 'cancelled') then `dbic`.`holds`.`completion_date` else NULL end) AS `cancellationdate`,`dbic`.`holds`.`notes` AS `reservenotes`,`dbic`.`holds`.`priority` AS `priority`,(case when (`dbic`.`holds`.`status` = 'fulfilled') then 'F' else NULL end) AS `found`,`dbic`.`holds`.`timestamp` AS `timestamp`,`dbic`.`holds`.`item_id` AS `itemnumber`,`dbic`.`holds`.`waiting_date` AS `waitingdate`,`dbic`.`holds`.`expiration_date` AS `expirationdate`,`dbic`.`holds`.`lowest_priority` AS `lowestPriority`,`dbic`.`holds`.`suspended` AS `suspend`,`dbic`.`holds`.`suspended_until_date` AS `suspend_until`,`dbic`.`holds`.`item_type` AS `itemtype`,`dbic`.`holds`.`item_level` AS `item_level_hold` from `dbic`.`holds` where (`dbic`.`holds`.`completed` = 1)"); =head1 ACCESSORS =head2 reserve_id data_type: 'integer' + default_value: 0 is_nullable: 0 =head2 borrowernumber data_type: 'integer' - is_foreign_key: 1 - is_nullable: 1 + default_value: 0 + is_nullable: 0 =head2 reservedate @@ -43,8 +46,8 @@ __PACKAGE__->table("old_reserves"); =head2 biblionumber data_type: 'integer' - is_foreign_key: 1 - is_nullable: 1 + default_value: 0 + is_nullable: 0 =head2 branchcode @@ -52,18 +55,6 @@ __PACKAGE__->table("old_reserves"); is_nullable: 1 size: 10 -=head2 notificationdate - - data_type: 'date' - datetime_undef_if_invalid: 1 - is_nullable: 1 - -=head2 reminderdate - - data_type: 'date' - datetime_undef_if_invalid: 1 - is_nullable: 1 - =head2 cancellationdate data_type: 'date' @@ -91,13 +82,12 @@ __PACKAGE__->table("old_reserves"); data_type: 'timestamp' datetime_undef_if_invalid: 1 - default_value: current_timestamp + default_value: '0000-00-00 00:00:00' is_nullable: 0 =head2 itemnumber data_type: 'integer' - is_foreign_key: 1 is_nullable: 1 =head2 waitingdate @@ -134,7 +124,6 @@ __PACKAGE__->table("old_reserves"); =head2 itemtype data_type: 'varchar' - is_foreign_key: 1 is_nullable: 1 size: 10 @@ -148,19 +137,15 @@ __PACKAGE__->table("old_reserves"); __PACKAGE__->add_columns( "reserve_id", - { data_type => "integer", is_nullable => 0 }, + { data_type => "integer", default_value => 0, is_nullable => 0 }, "borrowernumber", - { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + { data_type => "integer", default_value => 0, is_nullable => 0 }, "reservedate", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "biblionumber", - { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + { data_type => "integer", default_value => 0, is_nullable => 0 }, "branchcode", { data_type => "varchar", is_nullable => 1, size => 10 }, - "notificationdate", - { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, - "reminderdate", - { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "cancellationdate", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "reservenotes", @@ -173,11 +158,11 @@ __PACKAGE__->add_columns( { data_type => "timestamp", datetime_undef_if_invalid => 1, - default_value => \"current_timestamp", + default_value => "0000-00-00 00:00:00", is_nullable => 0, }, "itemnumber", - { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + { data_type => "integer", is_nullable => 1 }, "waitingdate", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "expirationdate", @@ -198,108 +183,14 @@ __PACKAGE__->add_columns( is_nullable => 1, }, "itemtype", - { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, + { data_type => "varchar", is_nullable => 1, size => 10 }, "item_level_hold", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, ); -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("reserve_id"); - -=head1 RELATIONS - -=head2 biblionumber - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "biblionumber", - "Koha::Schema::Result::Biblio", - { biblionumber => "biblionumber" }, - { - is_deferrable => 1, - join_type => "LEFT", - on_delete => "SET NULL", - on_update => "SET NULL", - }, -); - -=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 => "SET NULL", - }, -); - -=head2 itemnumber - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "itemnumber", - "Koha::Schema::Result::Item", - { itemnumber => "itemnumber" }, - { - is_deferrable => 1, - join_type => "LEFT", - on_delete => "SET NULL", - on_update => "SET NULL", - }, -); - -=head2 itemtype - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "itemtype", - "Koha::Schema::Result::Itemtype", - { itemtype => "itemtype" }, - { - is_deferrable => 1, - join_type => "LEFT", - on_delete => "SET NULL", - on_update => "SET NULL", - }, -); - -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-18 12:43:15 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4vMUC/1kSr3vgQ7n0Pmuug +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-22 19:21:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j84bBLVB23oDE0csBcI8+A __PACKAGE__->add_columns( '+item_level_hold' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Overduerule.pm b/Koha/Schema/Result/Overduerule.pm index 1d248ed394..acf81ed7fa 100644 --- a/Koha/Schema/Result/Overduerule.pm +++ b/Koha/Schema/Result/Overduerule.pm @@ -171,8 +171,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07042 @ 2016-01-06 12:00:28 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Opfa1YZ3IeQRRbyrbKAkNQ +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-19 13:02:43 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KxNZfxE1nimQWpvHx8VQxA # You can replace this text with custom content, and it will be preserved on regeneration diff --git a/Koha/Schema/Result/Reserve.pm b/Koha/Schema/Result/Reserve.pm index c5460e34da..8925d233c0 100644 --- a/Koha/Schema/Result/Reserve.pm +++ b/Koha/Schema/Result/Reserve.pm @@ -6,7 +6,7 @@ package Koha::Schema::Result::Reserve; =head1 NAME -Koha::Schema::Result::Reserve +Koha::Schema::Result::Reserve - VIEW =cut @@ -14,26 +14,27 @@ use strict; use warnings; use base 'DBIx::Class::Core'; +__PACKAGE__->table_class("DBIx::Class::ResultSource::View"); =head1 TABLE: C =cut __PACKAGE__->table("reserves"); +__PACKAGE__->result_source_instance->view_definition("select `dbic`.`holds`.`id` AS `reserve_id`,`dbic`.`holds`.`patron_id` AS `borrowernumber`,`dbic`.`holds`.`placing_date` AS `reservedate`,`dbic`.`holds`.`biblio_id` AS `biblionumber`,`dbic`.`holds`.`pickup_library_id` AS `branchcode`,NULL AS `cancellationdate`,`dbic`.`holds`.`notes` AS `reservenotes`,`dbic`.`holds`.`priority` AS `priority`,(case when (`dbic`.`holds`.`status` = 'waiting') then 'W' when (`dbic`.`holds`.`status` = 'in_transit') then 'T' else NULL end) AS `found`,`dbic`.`holds`.`timestamp` AS `timestamp`,`dbic`.`holds`.`item_id` AS `itemnumber`,`dbic`.`holds`.`waiting_date` AS `waitingdate`,`dbic`.`holds`.`expiration_date` AS `expirationdate`,`dbic`.`holds`.`lowest_priority` AS `lowestPriority`,`dbic`.`holds`.`suspended` AS `suspend`,`dbic`.`holds`.`suspended_until_date` AS `suspend_until`,`dbic`.`holds`.`item_type` AS `itemtype`,`dbic`.`holds`.`item_level` AS `item_level_hold` from `dbic`.`holds` where (`dbic`.`holds`.`completed` = 0)"); =head1 ACCESSORS =head2 reserve_id data_type: 'integer' - is_auto_increment: 1 + default_value: 0 is_nullable: 0 =head2 borrowernumber data_type: 'integer' default_value: 0 - is_foreign_key: 1 is_nullable: 0 =head2 reservedate @@ -46,32 +47,17 @@ __PACKAGE__->table("reserves"); data_type: 'integer' default_value: 0 - is_foreign_key: 1 is_nullable: 0 =head2 branchcode data_type: 'varchar' - is_foreign_key: 1 is_nullable: 1 size: 10 -=head2 notificationdate - - data_type: 'date' - datetime_undef_if_invalid: 1 - is_nullable: 1 - -=head2 reminderdate - - data_type: 'date' - datetime_undef_if_invalid: 1 - is_nullable: 1 - =head2 cancellationdate - data_type: 'date' - datetime_undef_if_invalid: 1 + data_type: 'binary' is_nullable: 1 =head2 reservenotes @@ -95,13 +81,12 @@ __PACKAGE__->table("reserves"); data_type: 'timestamp' datetime_undef_if_invalid: 1 - default_value: current_timestamp + default_value: '0000-00-00 00:00:00' is_nullable: 0 =head2 itemnumber data_type: 'integer' - is_foreign_key: 1 is_nullable: 1 =head2 waitingdate @@ -138,7 +123,6 @@ __PACKAGE__->table("reserves"); =head2 itemtype data_type: 'varchar' - is_foreign_key: 1 is_nullable: 1 size: 10 @@ -152,31 +136,17 @@ __PACKAGE__->table("reserves"); __PACKAGE__->add_columns( "reserve_id", - { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, + { data_type => "integer", default_value => 0, is_nullable => 0 }, "borrowernumber", - { - data_type => "integer", - default_value => 0, - is_foreign_key => 1, - is_nullable => 0, - }, + { data_type => "integer", default_value => 0, is_nullable => 0 }, "reservedate", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "biblionumber", - { - data_type => "integer", - default_value => 0, - is_foreign_key => 1, - is_nullable => 0, - }, + { data_type => "integer", default_value => 0, is_nullable => 0 }, "branchcode", - { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, - "notificationdate", - { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, - "reminderdate", - { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, + { data_type => "varchar", is_nullable => 1, size => 10 }, "cancellationdate", - { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, + { data_type => "binary", is_nullable => 1 }, "reservenotes", { data_type => "longtext", is_nullable => 1 }, "priority", @@ -187,11 +157,11 @@ __PACKAGE__->add_columns( { data_type => "timestamp", datetime_undef_if_invalid => 1, - default_value => \"current_timestamp", + default_value => "0000-00-00 00:00:00", is_nullable => 0, }, "itemnumber", - { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, + { data_type => "integer", is_nullable => 1 }, "waitingdate", { data_type => "date", datetime_undef_if_invalid => 1, is_nullable => 1 }, "expirationdate", @@ -212,157 +182,14 @@ __PACKAGE__->add_columns( is_nullable => 1, }, "itemtype", - { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, + { data_type => "varchar", is_nullable => 1, size => 10 }, "item_level_hold", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, ); -=head1 PRIMARY KEY - -=over 4 - -=item * L - -=back - -=cut - -__PACKAGE__->set_primary_key("reserve_id"); - -=head1 RELATIONS - -=head2 biblionumber - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "biblionumber", - "Koha::Schema::Result::Biblio", - { biblionumber => "biblionumber" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); - -=head2 borrowernumber - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "borrowernumber", - "Koha::Schema::Result::Borrower", - { borrowernumber => "borrowernumber" }, - { is_deferrable => 1, 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, - join_type => "LEFT", - 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.hold_id" => "self.reserve_id" }, - { cascade_copy => 0, cascade_delete => 0 }, -); - -=head2 itemnumber - -Type: belongs_to - -Related object: L - -=cut -__PACKAGE__->belongs_to( - "itemnumber", - "Koha::Schema::Result::Item", - { itemnumber => "itemnumber" }, - { - is_deferrable => 1, - join_type => "LEFT", - on_delete => "CASCADE", - on_update => "CASCADE", - }, -); - -=head2 itemtype - -Type: belongs_to - -Related object: L - -=cut - -__PACKAGE__->belongs_to( - "itemtype", - "Koha::Schema::Result::Itemtype", - { itemtype => "itemtype" }, - { - is_deferrable => 1, - join_type => "LEFT", - on_delete => "CASCADE", - on_update => "CASCADE", - }, -); - - -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-03-18 12:43:15 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VH7h5kYo9WhlGobXb3N3Jg - -__PACKAGE__->belongs_to( - "item", - "Koha::Schema::Result::Item", - { itemnumber => "itemnumber" }, - { - is_deferrable => 1, - join_type => "LEFT", - on_delete => "CASCADE", - on_update => "CASCADE", - }, -); - -__PACKAGE__->belongs_to( - "biblio", - "Koha::Schema::Result::Biblio", - { biblionumber => "biblionumber" }, - { - is_deferrable => 1, - join_type => "LEFT", - on_delete => "CASCADE", - on_update => "CASCADE", - }, -); +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-04-22 19:21:04 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5rN+zc7MxGkvUsCfihsq2Q __PACKAGE__->add_columns( '+item_level_hold' => { is_boolean => 1 }, -- 2.25.0