From 8b36722b1651bfe13d1261f03ece7cd34ecafcbf Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Tue, 10 Mar 2020 15:21:04 -0300 Subject: [PATCH] Bug 20936: Add koha_object_class and koha_objects_class methods to Schema classes --- Koha/Schema/Result/Biblio.pm | 20 ++++++++ Koha/Schema/Result/Item.pm | 27 +++++++++++ Koha/Schema/Result/OldReserve.pm | 79 ++++++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) diff --git a/Koha/Schema/Result/Biblio.pm b/Koha/Schema/Result/Biblio.pm index 7c66b1dc03..b6ef833bec 100644 --- a/Koha/Schema/Result/Biblio.pm +++ b/Koha/Schema/Result/Biblio.pm @@ -428,4 +428,24 @@ __PACKAGE__->add_columns( "+serial" => { is_boolean => 1 } ); +=head2 koha_objects_class + +Returns related Koha::Objects class name + +=cut + +sub koha_objects_class { + 'Koha::Biblios'; +} + +=head2 koha_object_class + +Returns related Koha::Object class name + +=cut + +sub koha_object_class { + 'Koha::Biblio'; +} + 1; diff --git a/Koha/Schema/Result/Item.pm b/Koha/Schema/Result/Item.pm index 58cddf4502..798cd08a2f 100644 --- a/Koha/Schema/Result/Item.pm +++ b/Koha/Schema/Result/Item.pm @@ -759,6 +759,13 @@ __PACKAGE__->belongs_to( ); use C4::Context; + +=head2 effective_itemtype + +Returns item's effective itemtype + +=cut + sub effective_itemtype { my ( $self ) = @_; @@ -772,4 +779,24 @@ sub effective_itemtype { } } +=head2 koha_objects_class + +Returns related Koha::Objects class name + +=cut + +sub koha_objects_class { + 'Koha::Items'; +} + +=head2 koha_object_class + +Returns related Koha::Object class name + +=cut + +sub koha_object_class { + 'Koha::Item'; +} + 1; diff --git a/Koha/Schema/Result/OldReserve.pm b/Koha/Schema/Result/OldReserve.pm index de9fc6cb27..42d98fcb43 100644 --- a/Koha/Schema/Result/OldReserve.pm +++ b/Koha/Schema/Result/OldReserve.pm @@ -300,9 +300,88 @@ __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:ZgGAW7ODBby3hGNJ41eeMA +=head2 item + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "item", + "Koha::Schema::Result::Item", + { itemnumber => "itemnumber" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 branch + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "branch", + "Koha::Schema::Result::Branch", + { branchcode => "branchcode" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +=head2 biblio + +Type: belongs_to + +Related object: L + +=cut + +__PACKAGE__->belongs_to( + "biblio", + "Koha::Schema::Result::Biblio", + { biblionumber => "biblionumber" }, + { + is_deferrable => 1, + join_type => "LEFT", + on_delete => "CASCADE", + on_update => "CASCADE", + }, +); + +__PACKAGE__->add_columns( + '+item_level_hold' => { is_boolean => 1 }, + '+lowestPriority' => { is_boolean => 1 }, + '+suspend' => { is_boolean => 1 } +); + +=head2 koha_object_class + +Returns related Koha::Object class name + +=cut + sub koha_object_class { 'Koha::Old::Hold'; } + +=head2 koha_objects_class + +Returns related Koha::Objects class name + +=cut + sub koha_objects_class { 'Koha::Old::Holds'; } -- 2.25.0