From d821750b7cceb962801563cb3b3b073301f19326 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 28 Mar 2022 22:10:40 +1300 Subject: [PATCH] Bug 30291: Update DBIC schema Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Fridolin Somers --- Koha/Schema/Result/Biblio.pm | 6 +- Koha/Schema/Result/Borrower.pm | 6 +- Koha/Schema/Result/Branch.pm | 6 +- Koha/Schema/Result/Item.pm | 6 +- Koha/Schema/Result/Recall.pm | 158 +++++++++++++++++---------------- 5 files changed, 93 insertions(+), 89 deletions(-) diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 0efad30daa..ddae29b069 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -386,7 +386,7 @@ Related object: L __PACKAGE__->has_many( "recalls", "Koha::Schema::Result::Recall", - { "foreign.biblionumber" => "self.biblionumber" }, + { "foreign.biblio_id" => "self.biblionumber" }, { cascade_copy => 0, cascade_delete => 0 }, ); @@ -541,8 +541,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2021-10-14 15:07:03 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6YO2t5VoWcG/tM+8uOP/wg +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-03-28 22:07:59 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sh8waM4ivuiNao0VV5403Q __PACKAGE__->has_many( "biblioitem", diff --git a/Koha/Schema/Result/Borrower.pm b/Koha/Schema/Result/Borrower.pm index 175710d0f5..39ef4fe02d 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1595,7 +1595,7 @@ Related object: L __PACKAGE__->has_many( "recalls", "Koha::Schema::Result::Recall", - { "foreign.borrowernumber" => "self.borrowernumber" }, + { "foreign.patron_id" => "self.borrowernumber" }, { cascade_copy => 0, cascade_delete => 0 }, ); @@ -1955,8 +1955,8 @@ Composing rels: L -> permission __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-03-24 10:20:07 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:srYT5wjg7Jhy5CpmDjWv/g +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-04-29 11:09:16 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pQqp6+XsKkDrnO57fQ9dmg __PACKAGE__->has_many( "extended_attributes", diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index b924c94f98..b2a59b2cbf 100644 --- a/Koha/Schema/Result/Branch.pm +++ b/Koha/Schema/Result/Branch.pm @@ -772,7 +772,7 @@ Related object: L __PACKAGE__->has_many( "recalls", "Koha::Schema::Result::Recall", - { "foreign.branchcode" => "self.branchcode" }, + { "foreign.pickup_library_id" => "self.branchcode" }, { cascade_copy => 0, cascade_delete => 0 }, ); @@ -882,8 +882,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-02-15 02:16:34 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PR2GOpldAnNtyB2DRLsE9g +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-03-28 22:07:59 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Kpv55lV6FRGoxxu5nufXhg __PACKAGE__->add_columns( '+pickup_location' => { is_boolean => 1 }, diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index 8be4a775f9..ce96288737 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -800,7 +800,7 @@ Related object: L __PACKAGE__->has_many( "recalls", "Koha::Schema::Result::Recall", - { "foreign.itemnumber" => "self.itemnumber" }, + { "foreign.item_id" => "self.itemnumber" }, { cascade_copy => 0, cascade_delete => 0 }, ); @@ -880,8 +880,8 @@ __PACKAGE__->has_many( ); -# Created by DBIx::Class::Schema::Loader v0.07046 @ 2021-10-14 15:07:03 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yRbholcHil9qRF5t+83jdA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-03-28 22:07:59 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:28f9/7z3Nq5C4qzBMyceiQ __PACKAGE__->belongs_to( biblioitem => "Koha::Schema::Result::Biblioitem", "biblioitemnumber" ); diff --git a/Koha/Schema/Result/Recall.pm b/Koha/Schema/Result/Recall.pm index e3415e77c2..8d3bd14005 100644 --- a/Koha/Schema/Result/Recall.pm +++ b/Koha/Schema/Result/Recall.pm @@ -6,7 +6,7 @@ package Koha::Schema::Result::Recall; =head1 NAME -Koha::Schema::Result::Recall +Koha::Schema::Result::Recall - Information related to recalls in Koha =cut @@ -29,49 +29,65 @@ __PACKAGE__->table("recalls"); is_auto_increment: 1 is_nullable: 0 -=head2 borrowernumber +Unique identifier for this recall + +=head2 patron_id data_type: 'integer' default_value: 0 is_foreign_key: 1 is_nullable: 0 -=head2 recalldate +Identifier for patron who requested recall + +=head2 created_date data_type: 'datetime' datetime_undef_if_invalid: 1 is_nullable: 1 -=head2 biblionumber +Date the recall was requested + +=head2 biblio_id data_type: 'integer' default_value: 0 is_foreign_key: 1 is_nullable: 0 -=head2 branchcode +Identifier for bibliographic record that has been recalled + +=head2 pickup_library_id data_type: 'varchar' is_foreign_key: 1 is_nullable: 1 size: 10 -=head2 cancellationdate +Identifier for recall pickup library + +=head2 completed_date data_type: 'datetime' datetime_undef_if_invalid: 1 is_nullable: 1 -=head2 recallnotes +Date the recall is completed (fulfilled, cancelled or expired) + +=head2 notes data_type: 'mediumtext' is_nullable: 1 +Notes related to the recall + =head2 priority data_type: 'smallint' is_nullable: 1 +Where in the queue the patron sits + =head2 status data_type: 'enum' @@ -79,6 +95,8 @@ __PACKAGE__->table("recalls"); extra: {list => ["requested","overdue","waiting","in_transit","cancelled","expired","fulfilled"]} is_nullable: 1 +Status of recall + =head2 timestamp data_type: 'timestamp' @@ -86,70 +104,82 @@ __PACKAGE__->table("recalls"); default_value: current_timestamp is_nullable: 0 -=head2 itemnumber +Date and time the recall was last updated + +=head2 item_id data_type: 'integer' is_foreign_key: 1 is_nullable: 1 -=head2 waitingdate +Identifier for item record that was recalled, if an item-level recall + +=head2 waiting_date data_type: 'datetime' datetime_undef_if_invalid: 1 is_nullable: 1 -=head2 expirationdate +Date an item was marked as waiting for the patron at the library + +=head2 expiration_date data_type: 'datetime' datetime_undef_if_invalid: 1 is_nullable: 1 -=head2 old +Date recall is no longer required, or date recall will expire after waiting on shelf for pickup + +=head2 completed data_type: 'tinyint' default_value: 0 is_nullable: 0 -=head2 item_level_recall +Flag if recall is old and no longer active, i.e. expired, cancelled or completed + +=head2 item_level data_type: 'tinyint' default_value: 0 is_nullable: 0 +Flag if recall is for a specific item + =cut __PACKAGE__->add_columns( "recall_id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, - "borrowernumber", + "patron_id", { data_type => "integer", default_value => 0, is_foreign_key => 1, is_nullable => 0, }, - "recalldate", + "created_date", { data_type => "datetime", datetime_undef_if_invalid => 1, is_nullable => 1, }, - "biblionumber", + "biblio_id", { data_type => "integer", default_value => 0, is_foreign_key => 1, is_nullable => 0, }, - "branchcode", + "pickup_library_id", { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 }, - "cancellationdate", + "completed_date", { data_type => "datetime", datetime_undef_if_invalid => 1, is_nullable => 1, }, - "recallnotes", + "notes", { data_type => "mediumtext", is_nullable => 1 }, "priority", { data_type => "smallint", is_nullable => 1 }, @@ -177,23 +207,23 @@ __PACKAGE__->add_columns( default_value => \"current_timestamp", is_nullable => 0, }, - "itemnumber", + "item_id", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, - "waitingdate", + "waiting_date", { data_type => "datetime", datetime_undef_if_invalid => 1, is_nullable => 1, }, - "expirationdate", + "expiration_date", { data_type => "datetime", datetime_undef_if_invalid => 1, is_nullable => 1, }, - "old", + "completed", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, - "item_level_recall", + "item_level", { data_type => "tinyint", default_value => 0, is_nullable => 0 }, ); @@ -211,7 +241,7 @@ __PACKAGE__->set_primary_key("recall_id"); =head1 RELATIONS -=head2 biblionumber +=head2 biblio Type: belongs_to @@ -220,59 +250,59 @@ Related object: L =cut __PACKAGE__->belongs_to( - "biblionumber", + "biblio", "Koha::Schema::Result::Biblio", - { biblionumber => "biblionumber" }, + { biblionumber => "biblio_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); -=head2 borrowernumber +=head2 item Type: belongs_to -Related object: L +Related object: L =cut __PACKAGE__->belongs_to( - "borrowernumber", - "Koha::Schema::Result::Borrower", - { borrowernumber => "borrowernumber" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, + "item", + "Koha::Schema::Result::Item", + { itemnumber => "item_id" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, ); -=head2 branchcode +=head2 patron Type: belongs_to -Related object: L +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", - }, + "patron", + "Koha::Schema::Result::Borrower", + { borrowernumber => "patron_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, ); -=head2 itemnumber +=head2 pickup_library Type: belongs_to -Related object: L +Related object: L =cut __PACKAGE__->belongs_to( - "itemnumber", - "Koha::Schema::Result::Item", - { itemnumber => "itemnumber" }, + "pickup_library", + "Koha::Schema::Result::Branch", + { branchcode => "pickup_library_id" }, { is_deferrable => 1, join_type => "LEFT", @@ -282,44 +312,18 @@ __PACKAGE__->belongs_to( ); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-03-23 19:53:39 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6DbEjtt5g6QY6VuCqrMleg +# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-04-29 11:14:14 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lUgwwMxaStiOS7pHL0UGJA __PACKAGE__->add_columns( '+completed' => { is_boolean => 1 }, '+item_level' => { is_boolean => 1 }, ); -__PACKAGE__->belongs_to( - "biblio", - "Koha::Schema::Result::Biblio", - { biblionumber => "biblionumber" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); - -__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( - "patron", - "Koha::Schema::Result::Borrower", - { borrowernumber => "borrowernumber" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); - __PACKAGE__->belongs_to( "library", "Koha::Schema::Result::Branch", - { branchcode => "branchcode" }, + { branchcode => "pickup_library_id" }, { is_deferrable => 1, join_type => "LEFT", -- 2.39.5