From ef930a1922b316f112bc1dc86e479bc2f6f02f14 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 28 Mar 2022 22:10:40 +1300 Subject: [PATCH] Bug 30291: [DBIx] Updated schema files --- 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 | 138 +++++++++++++++++++++++++---------------- 5 files changed, 96 insertions(+), 66 deletions(-) diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 0efad30daaf..ddae29b0698 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 d2b5c6015fe..0f9a5a47f17 100644 --- a/Koha/Schema/Result/Borrower.pm +++ b/Koha/Schema/Result/Borrower.pm @@ -1570,7 +1570,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 }, ); @@ -1930,8 +1930,8 @@ Composing rels: L -> permission __PACKAGE__->many_to_many("permissions", "user_permissions", "permission"); -# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-03-15 06:51:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ozDOfb67H7/GHLI0o4DdyA +# Created by DBIx::Class::Schema::Loader v0.07046 @ 2022-03-28 22:07:59 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hlmn63m+ykDyLXm7cv2LvQ __PACKAGE__->has_many( "extended_attributes", diff --git a/Koha/Schema/Result/Branch.pm b/Koha/Schema/Result/Branch.pm index b924c94f98e..b2a59b2cbf3 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 8be4a775f92..ce96288737a 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 ce5ddcd51ed..345b391004e 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 @@ -23,55 +23,71 @@ __PACKAGE__->table("recalls"); =head1 ACCESSORS -=head2 recall_id +=head2 id data_type: 'integer' 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", + "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 }, ); @@ -201,17 +231,17 @@ __PACKAGE__->add_columns( =over 4 -=item * L +=item * L =back =cut -__PACKAGE__->set_primary_key("recall_id"); +__PACKAGE__->set_primary_key("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,8 +312,8 @@ __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.07046 @ 2022-03-28 22:08:00 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:SBbfNo3z9m7mEx0c5rJMJw __PACKAGE__->add_columns( '+old' => { is_boolean => 1 }, -- 2.11.0