# 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 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.
+# 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, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
-use Carp;
-use C4::Koha;
+use C4::Koha qw( getitemtypeimagelocation );
use C4::Languages;
use Koha::Database;
-use Koha::IssuingRules;
+use Koha::CirculationRules;
use Koha::Localizations;
use base qw(Koha::Object Koha::Object::Limit::Library);
{ entity => 'itemtypes',
code => $self->itemtype,
}
- );
+ )->as_list;
return [ map {
{
lang => $_->lang,
my $itemtype = $self->itemtype;
my $category = $params->{categorycode};
- my $guess = Koha::IssuingRules->guess_article_requestable_itemtypes({
+ my $guess = Koha::CirculationRules->guess_article_requestable_itemtypes({
$category ? ( categorycode => $category ) : (),
});
return ( $guess->{ $itemtype // q{} } || $guess->{ '*' } ) ? 1 : q{};
};
}
+=head3 parent
+
+ Returns the ItemType object of the parent_type or undef.
+
+=cut
+
+sub parent {
+ my ( $self ) = @_;
+ my $parent_rs = $self->_result->parent_type;
+ return unless $parent_rs;
+ return Koha::ItemType->_new_from_dbic( $parent_rs );
+
+}
+
+=head3 children_with_localization
+
+ Returns the ItemType objects of the children of this type or undef.
+
+=cut
+
+sub children_with_localization {
+ my ( $self ) = @_;
+ return Koha::ItemTypes->search_with_localization({ parent_type => $self->itemtype });
+}
+
=head3 type
=cut