From 7166f881131b7c455884954923a49afa340c567a Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 22 Mar 2023 12:37:57 +0000 Subject: [PATCH] Bug 29099: Add Koha objects for item bundle(s) Content-Type: text/plain; charset=utf-8 --- Koha/Item/Bundle.pm | 63 ++++++++++++++++++++++++++++++++++++++++++++ Koha/Item/Bundles.pm | 50 +++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 Koha/Item/Bundle.pm create mode 100644 Koha/Item/Bundles.pm diff --git a/Koha/Item/Bundle.pm b/Koha/Item/Bundle.pm new file mode 100644 index 0000000000..ef077796aa --- /dev/null +++ b/Koha/Item/Bundle.pm @@ -0,0 +1,63 @@ +package Koha::Item::Bundle; + +# Copyright Koha Development Team 2023 +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; +use Koha::Item; + +use base qw(Koha::Object); + +=head1 NAME + +Koha::Item::Bundle - Koha item bundle object + +=head1 METHODS + +=head2 item_object + + $item_bundle->item_object; + +=cut + +sub item_object { # name chosen different from column 'item' + my ( $self ) = @_; + return Koha::Item->_new_from_dbic( $self->_result->item ); +} + +=head2 host_item + + $item_bundle->host_item.barcode; + +=cut + +sub host_item { + my ( $self ) = @_; + return Koha::Item->_new_from_dbic( $self->_result->host ); +} + +=head1 INTERNAL METHODS + +=head2 _type + +=cut + +sub _type { + return 'ItemBundle'; +} + +1; diff --git a/Koha/Item/Bundles.pm b/Koha/Item/Bundles.pm new file mode 100644 index 0000000000..9d542fe800 --- /dev/null +++ b/Koha/Item/Bundles.pm @@ -0,0 +1,50 @@ +package Koha::Item::Bundles; + +# Copyright Koha Development Team 2023 +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use Koha::Item::Bundle; + +use base qw(Koha::Objects); + +=head1 NAME + +Koha::Item::Bundles - Koha item bundles object + +=head1 INTERNAL METHODS + +=cut + +=head2 _type + +=cut + +sub _type { + return 'ItemBundle'; +} + +=head3 object_class + +=cut + +sub object_class { + return 'Koha::Item::Bundle'; +} + +1; -- 2.30.2