@@ -, +, @@
---
C4/Items.pm | 9 +++++----
C4/Search.pm | 4 +++-
C4/XSLT.pm | 3 ++-
Koha/Template/Plugin/ItemTypes.pm | 5 ++---
acqui/basketgroup.pl | 4 ++--
acqui/orderreceive.pl | 1 -
admin/smart-rules.pl | 5 ++---
authorities/authorities.pl | 9 +++++----
catalogue/detail.pl | 5 +++--
catalogue/moredetail.pl | 3 ++-
catalogue/search.pl | 7 ++++---
cataloguing/addbiblio.pl | 9 +++++----
cataloguing/additem.pl | 9 +++++----
circ/view_holdsqueue.pl | 13 +++++++------
course_reserves/add_items.pl | 5 ++++-
.../prog/en/modules/reports/bor_issues_top.tt | 4 ++--
.../prog/en/modules/reports/cat_issues_top.tt | 4 ++--
.../prog/en/modules/reports/catalogue_out.tt | 4 ++--
.../prog/en/modules/reports/issues_stats.tt | 4 ++--
.../prog/en/modules/reports/itemslost.tt | 7 ++-----
.../intranet-tmpl/prog/en/modules/tools/export.tt | 8 ++------
labels/label-item-search.pl | 13 ++++++++-----
opac/opac-ISBDdetail.pl | 3 ++-
opac/opac-detail.pl | 5 +++--
opac/opac-readingrecord.pl | 4 +++-
opac/opac-reserve.pl | 13 +++++++------
opac/opac-search.pl | 2 --
opac/opac-topissues.pl | 2 --
opac/opac-user.pl | 3 ++-
reports/acquisitions_stats.pl | 6 +++---
reports/bor_issues_top.pl | 14 +++-----------
reports/cat_issues_top.pl | 12 +++---------
reports/catalogue_out.pl | 19 ++-----------------
reports/catalogue_stats.pl | 3 ++-
reports/issues_avg_stats.pl | 3 ++-
reports/issues_stats.pl | 9 +++------
reports/itemslost.pl | 13 ++-----------
reports/reserves_stats.pl | 13 ++++---------
reserve/request.pl | 3 ++-
serials/subscription-add.pl | 4 +++-
serials/subscription-bib-search.pl | 5 ++++-
suggestion/suggestion.pl | 1 -
svc/bib_profile | 3 ++-
tools/batchMod.pl | 10 ++++++----
tools/export.pl | 14 +++-----------
45 files changed, 132 insertions(+), 167 deletions(-)
--- a/C4/Items.pm
+++ a/C4/Items.pm
@@ -41,6 +41,7 @@ use Koha::Database;
use Koha::Biblioitems;
use Koha::Items;
+use Koha::ItemTypes;
use Koha::SearchEngine;
use Koha::SearchEngine::Search;
use Koha::Libraries;
@@ -2998,12 +2999,12 @@ sub PrepareItemrecordDisplay {
#----- itemtypes
} elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
- my $itemtypes = GetItemTypes( style => 'array' );
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
push @authorised_values, ""
unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
- for my $itemtype ( @$itemtypes ) {
- push @authorised_values, $itemtype->{itemtype};
- $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
+ while ( my $itemtype = $itemtypes->next ) {
+ push @authorised_values, $itemtype->itemtype;
+ $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
}
if ($defaultvalues && $defaultvalues->{'itemtype'}) {
$defaultvalue = $defaultvalues->{'itemtype'};
--- a/C4/Search.pm
+++ a/C4/Search.pm
@@ -31,6 +31,7 @@ use C4::Reserves; # GetReserveStatus
use C4::Debug;
use C4::Charset;
use Koha::AuthorisedValues;
+use Koha::ItemTypes;
use Koha::Libraries;
use Koha::Patrons;
use YAML;
@@ -1866,7 +1867,8 @@ sub searchResults {
my $notforloan_authorised_value = $av->count ? $av->next->authorised_value : undef;
#Get itemtype hash
- my %itemtypes = %{ GetItemTypes() };
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
+ my %itemtypes = map { $_->{itemtype} => $_ } @{ $itemtypes->unblessed };
#search item field code
my ($itemtag, undef) = &GetMarcFromKohaField( "items.itemnumber", "" );
--- a/C4/XSLT.pm
+++ a/C4/XSLT.pm
@@ -30,6 +30,7 @@ use C4::Biblio;
use C4::Circulation;
use C4::Reserves;
use Koha::AuthorisedValues;
+use Koha::ItemTypes;
use Koha::XSLT_Handler;
use Koha::Libraries;
@@ -280,7 +281,7 @@ sub buildKohaItemsNamespace {
my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
- my $itemtypes = GetItemTypes();
+ my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
my $location = "";
my $ccode = "";
my $xml = '';
--- a/Koha/Template/Plugin/ItemTypes.pm
+++ a/Koha/Template/Plugin/ItemTypes.pm
@@ -23,6 +23,7 @@ use Template::Plugin;
use base qw( Template::Plugin );
use C4::Koha;
+use Koha::ItemTypes;
sub GetDescription {
my ( $self, $itemtype ) = @_;
@@ -33,9 +34,7 @@ sub GetDescription {
}
sub Get {
- my @itemtypes = @{ GetItemTypes(style => 'array') };
- @itemtypes = sort { $a->{description} cmp $b->{description} } @itemtypes;
- return \@itemtypes;
+ return Koha::ItemTypes->search_with_localization->unblessed;
}
1;
--- a/acqui/basketgroup.pl
+++ a/acqui/basketgroup.pl
@@ -56,6 +56,7 @@ use C4::Members qw/GetMember/;
use Koha::EDI qw/create_edi_order get_edifact_ean/;
use Koha::Acquisition::Booksellers;
+use Koha::ItemTypes;
our $input=new CGI;
@@ -174,7 +175,6 @@ sub printbasketgrouppdf{
$ord->{total_tax_excluded} = $ord->{ecost_tax_excluded} * $ord->{quantity};
my $bib = GetBiblioData($ord->{biblionumber});
- my $itemtypes = GetItemTypes();
#FIXME DELETE ME
# 0 1 2 3 4 5 6 7 8 9
@@ -195,7 +195,7 @@ sub printbasketgrouppdf{
}
}
- $ord->{itemtype} = ( $ord->{itemtype} and $bib->{itemtype} ) ? $itemtypes->{$bib->{itemtype}}->{description} : undef;
+ $ord->{itemtype} = ( $ord->{itemtype} and $bib->{itemtype} ) ? Koha::ItemTypes->find( $bib->{itemtype} )->description : undef;
$ord->{en} = $en ? $en : undef;
$ord->{edition} = $edition ? $edition : undef;
--- a/acqui/orderreceive.pl
+++ a/acqui/orderreceive.pl
@@ -63,7 +63,6 @@ use warnings;
use CGI qw ( -utf8 );
use C4::Context;
-use C4::Koha; # GetItemTypes
use C4::Acquisition;
use C4::Auth;
use C4::Output;
--- a/admin/smart-rules.pl
+++ a/admin/smart-rules.pl
@@ -468,8 +468,7 @@ $template->param(
my $patron_categories = Koha::Patron::Categories->search({}, { order_by => ['description'] });
my @row_loop;
-my @itemtypes = @{ GetItemTypes( style => 'array' ) };
-@itemtypes = sort { lc $a->{translated_description} cmp lc $b->{translated_description} } @itemtypes;
+my $itemtypes = Koha::ItemTypes->search_with_localization;
my $sth2 = $dbh->prepare("
SELECT issuingrules.*,
@@ -616,7 +615,7 @@ $template->param(default_rules => ($defaults ? 1 : 0));
$template->param(
patron_categories => $patron_categories,
- itemtypeloop => \@itemtypes,
+ itemtypeloop => $itemtypes,
rules => \@sorted_row_loop,
humanbranch => ($branch ne '*' ? $branch : ''),
current_branch => $branch,
--- a/authorities/authorities.pl
+++ a/authorities/authorities.pl
@@ -32,6 +32,7 @@ use MARC::File::USMARC;
use MARC::File::XML;
use C4::Biblio;
use Koha::Authority::Types;
+use Koha::ItemTypes;
use vars qw( $tagslib);
use vars qw( $authorised_values_sth);
use vars qw( $is_a_modif );
@@ -91,10 +92,10 @@ sub build_authorized_values_list {
&& ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
my $itemtype;
- my $itemtypes = GetItemTypes( style => 'array' );
- for my $itemtype ( @$itemtypes ) {
- push @authorised_values, $itemtype->{itemtype};
- $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
+ while ( $itemtype = $itemtypes->next ) {
+ push @authorised_values, $itemtype->itemtype;
+ $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
}
$value = $itemtype unless ($value);
--- a/catalogue/detail.pl
+++ a/catalogue/detail.pl
@@ -42,6 +42,7 @@ use C4::HTML5Media;
use C4::CourseReserves qw(GetItemCourseReservesInfo);
use C4::Acquisition qw(GetOrdersByBiblionumber);
use Koha::AuthorisedValues;
+use Koha::ItemTypes;
use Koha::Patrons;
use Koha::Virtualshelves;
@@ -127,8 +128,8 @@ my $marcurlsarray = GetMarcUrls ($record,$marcflavour);
my $marchostsarray = GetMarcHosts($record,$marcflavour);
my $subtitle = GetRecordValue('subtitle', $record, $fw);
-# Get Branches, Itemtypes and Locations
-my $itemtypes = GetItemTypes();
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
+
my $dbh = C4::Context->dbh;
my @all_items = GetItemsInfo( $biblionumber );
--- a/catalogue/moredetail.pl
+++ a/catalogue/moredetail.pl
@@ -124,7 +124,8 @@ my $ccodes =
{ map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.ccode' } ) };
my $copynumbers =
{ map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
-my $itemtypes = GetItemTypes;
+
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
$data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'translated_description'};
$data->{'rentalcharge'} = sprintf( "%.2f", $data->{'rentalcharge'} );
--- a/catalogue/search.pl
+++ a/catalogue/search.pl
@@ -151,6 +151,7 @@ use URI::Escape;
use POSIX qw(ceil floor);
use C4::Search::History;
+use Koha::ItemTypes;
use Koha::LibraryCategories;
use Koha::Virtualshelves;
use Koha::SearchEngine::Search;
@@ -221,7 +222,7 @@ $template->param(
);
# load the Type stuff
-my $itemtypes = GetItemTypes;
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
# the index parameter is different for item-level itemtypes
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
my @advancedsearchesloop;
@@ -515,7 +516,7 @@ my $facets; # this object stores the faceted results that display on the left-ha
my $results_hashref;
eval {
- my $itemtypes = GetItemTypes;
+ my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
( $error, $results_hashref, $facets ) = $searcher->search_compat(
$query, $simple_query, \@sort_by, \@servers,
$results_per_page, $offset, $expanded_facet, undef,
@@ -780,7 +781,7 @@ sub prepare_adv_search_types {
# the index parameter is different for item-level itemtypes
my $itype_or_itemtype =
( C4::Context->preference("item-level_itypes") ) ? 'itype' : 'itemtype';
- my $itemtypes = GetItemTypes;
+ my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
my ( $cnt, @result );
foreach my $advanced_srch_type (@advanced_search_types) {
--- a/cataloguing/addbiblio.pl
+++ a/cataloguing/addbiblio.pl
@@ -37,6 +37,7 @@ use C4::Charset;
use Koha::BiblioFrameworks;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Libraries;
use Koha::BiblioFrameworks;
@@ -188,10 +189,10 @@ sub build_authorized_values_list {
&& ( $value || $tagslib->{$tag}->{$subfield}->{defaultvalue} ) );
my $itemtype;
- my $itemtypes = GetItemTypes( style => 'array' );
- for my $itemtype ( @$itemtypes ) {
- push @authorised_values, $itemtype->{itemtype};
- $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
+ while ( $itemtype = $itemtypes->next ) {
+ push @authorised_values, $itemtype->itemtype;
+ $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
}
$value = $itemtype unless ($value);
}
--- a/cataloguing/additem.pl
+++ a/cataloguing/additem.pl
@@ -31,6 +31,7 @@ use C4::Circulation;
use C4::Koha;
use C4::ClassSource;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Libraries;
use List::MoreUtils qw/any/;
use C4::Search;
@@ -182,10 +183,10 @@ sub generate_subfield_form {
}
elsif ( $subfieldlib->{authorised_value} eq "itemtypes" ) {
push @authorised_values, "" unless ( $subfieldlib->{mandatory} );
- my $itemtypes = GetItemTypes( style => 'array' );
- for my $itemtype ( @$itemtypes ) {
- push @authorised_values, $itemtype->{itemtype};
- $authorised_lib{$itemtype->{itemtype}} = $itemtype->{translated_description};
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
+ while ( my $itemtype = $itemtypes->next ) {
+ push @authorised_values, $itemtype->itemtype;
+ $authorised_lib{$itemtype->itemtype} = $itemtype->translated_description;
}
unless ( $value ) {
--- a/circ/view_holdsqueue.pl
+++ a/circ/view_holdsqueue.pl
@@ -29,9 +29,10 @@ use C4::Auth;
use C4::Output;
use C4::Biblio;
use C4::Items;
-use C4::Koha; # GetItemTypes
use C4::HoldsQueue qw(GetHoldsQueueItems);
+use Koha::ItemTypes;
+
my $query = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
@@ -61,16 +62,16 @@ if ( $run_report ) {
}
# getting all itemtypes
-my $itemtypes = &GetItemTypes();
+my $itemtypes = Koha::ItemTypes->search({}, {order_by => 'itemtype'});;
my @itemtypesloop;
-foreach my $thisitemtype ( sort keys %$itemtypes ) {
+while ( my $itemtype = $itemtypes->next ) {
push @itemtypesloop, {
- value => $thisitemtype,
- description => $itemtypes->{$thisitemtype}->{'description'},
+ value => $itemtype->itemtype,
+ description => $itemtypes->description, # FIXME Don't we want the translated_description here?
};
}
-$template->param(
+$template->param( # FIXME Could be improved passing the $itemtypes iterator directly to the template
itemtypeloop => \@itemtypesloop,
);
--- a/course_reserves/add_items.pl
+++ a/course_reserves/add_items.pl
@@ -29,6 +29,8 @@ use C4::Biblio;
use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem ModCourseReserve);
+use Koha::ItemTypes;
+
my $cgi = new CGI;
my $action = $cgi->param('action') || '';
@@ -64,6 +66,7 @@ if ( $action eq 'lookup' ) {
)
: undef;
+ my $itemtypes = Koha::ItemTypes->search;
$template->param(
item => $item,
course_item => $course_item,
@@ -71,7 +74,7 @@ if ( $action eq 'lookup' ) {
ccodes => GetAuthorisedValues('CCODE'),
locations => GetAuthorisedValues('LOC'),
- itypes => GetItemTypes( style => 'array' ),
+ itypes => $itemtypes, # FIXME We certainly want to display the translated_description in the template
return => $return,
);
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/bor_issues_top.tt
@@ -147,8 +147,8 @@ function Dopop(link) {
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt
@@ -120,8 +120,8 @@
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt
@@ -97,8 +97,8 @@
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/issues_stats.tt
@@ -167,8 +167,8 @@
|
|
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/itemslost.tt
@@ -106,11 +106,8 @@
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt
@@ -80,12 +80,8 @@ $(document).ready(function() {
--- a/labels/label-item-search.pl
+++ a/labels/label-item-search.pl
@@ -31,11 +31,11 @@ use C4::Context;
use C4::Search qw(SimpleSearch);
use C4::Biblio qw(TransformMarcToKoha);
use C4::Items qw(GetItemInfosOf get_itemnumbers_of);
-use C4::Koha qw(GetItemTypes);
use C4::Creators::Lib qw(html_table);
use C4::Debug;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::SearchEngine::Search;
BEGIN {
@@ -251,12 +251,15 @@ else {
debug => 1,
}
);
- my $itemtypes = GetItemTypes;
+ my $itemtypes = Koha::ItemTypes->search;
my @itemtypeloop;
- foreach my $thisitemtype ( keys %$itemtypes ) {
+ while ( my $itemtype = $itemtypes->next ) {
+ # FIXME This must be improved:
+ # - pass the iterator to the template
+ # - display the translated_description
my %row = (
- value => $thisitemtype,
- description => $itemtypes->{$thisitemtype}->{'description'},
+ value => $itemtype->itemtype,
+ description => $itemtype->description,
);
push @itemtypeloop, \%row;
}
--- a/opac/opac-ISBDdetail.pl
+++ a/opac/opac-ISBDdetail.pl
@@ -53,6 +53,7 @@ use C4::Acquisition;
use C4::Serials; # uses getsubscriptionfrom biblionumber
use C4::Koha;
use C4::Members; # GetMember
+use Koha::ItemTypes;
use Koha::RecordProcessor;
@@ -162,7 +163,7 @@ my $res = GetISBDView({
'framework' => $framework
});
-my $itemtypes = GetItemTypes();
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
my $borrower = GetMember( 'borrowernumber' => $loggedinuser );
for my $itm (@items) {
$norequests = 0
--- a/opac/opac-detail.pl
+++ a/opac/opac-detail.pl
@@ -49,6 +49,7 @@ use C4::HTML5Media;
use C4::CourseReserves qw(GetItemCourseReservesInfo);
use Koha::RecordProcessor;
use Koha::AuthorisedValues;
+use Koha::ItemTypes;
use Koha::Virtualshelves;
use Koha::Ratings;
use Koha::Reviews;
@@ -205,7 +206,7 @@ if ($session->param('busc')) {
my ($arrParamsBusc, $offset, $results_per_page) = @_;
my $expanded_facet = $arrParamsBusc->{'expand'};
- my $itemtypes = GetItemTypes;
+ my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
my @servers;
@servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
@servers = ("biblioserver") unless (@servers);
@@ -537,7 +538,7 @@ my $HideMARC = $record_processor->filters->[0]->should_hide_marc(
interface => 'opac',
} );
-my $itemtypes = GetItemTypes();
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
# imageurl:
my $itemtype = $dat->{'itemtype'};
if ( $itemtype ) {
--- a/opac/opac-readingrecord.pl
+++ a/opac/opac-readingrecord.pl
@@ -32,6 +32,8 @@ use MARC::Record;
use C4::Output;
use C4::Charset qw(StripNonXmlChars);
+use Koha::ItemTypes;
+
my $query = new CGI;
# if opacreadinghistory is disabled, leave immediately
@@ -55,7 +57,7 @@ my ( $borr ) = GetMember( borrowernumber => $borrowernumber );
$template->param(%{$borr});
-my $itemtypes = GetItemTypes();
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
# get the record
my $order = $query->param('order') || '';
--- a/opac/opac-reserve.pl
+++ a/opac/opac-reserve.pl
@@ -33,6 +33,7 @@ use C4::Members;
use C4::Overdues;
use C4::Debug;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Libraries;
use Koha::Patrons;
use Date::Calc qw/Today Date_to_Days/;
@@ -90,7 +91,7 @@ if ( $reservefee > 0){
$template->param( RESERVE_CHARGE => sprintf("%.2f",$reservefee));
}
-my $itemTypes = GetItemTypes();
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
# There are two ways of calling this script, with a single biblio num
# or multiple biblio nums.
@@ -399,14 +400,14 @@ foreach my $biblioNum (@biblionumbers) {
$biblioLoopIter{mandatorynotes}=0; #FIXME: For future use
if (!$itemLevelTypes && $biblioData->{itemtype}) {
- $biblioLoopIter{translated_description} = $itemTypes->{$biblioData->{itemtype}}{translated_description};
- $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemTypes->{$biblioData->{itemtype}}{imageurl};
+ $biblioLoopIter{translated_description} = $itemtypes->{$biblioData->{itemtype}}{translated_description};
+ $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$biblioData->{itemtype}}{imageurl};
}
foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
if ($itemLevelTypes && $itemInfo->{itype}) {
- $itemInfo->{translated_description} = $itemTypes->{$itemInfo->{itype}}{translated_description};
- $itemInfo->{imageurl} = getitemtypeimagesrc() . "/". $itemTypes->{$itemInfo->{itype}}{imageurl};
+ $itemInfo->{translated_description} = $itemtypes->{$itemInfo->{itype}}{translated_description};
+ $itemInfo->{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$itemInfo->{itype}}{imageurl};
}
if (!$itemInfo->{'notforloan'} && !($itemInfo->{'itemnotforloan'} > 0)) {
@@ -522,7 +523,7 @@ foreach my $biblioNum (@biblionumbers) {
$numCopiesAvailable++;
}
- $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemTypes->{ $itemInfo->{itype} }{imageurl} );
+ $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itemInfo->{itype} }{imageurl} );
# Show serial enumeration when needed
if ($itemLoopIter->{enumchron}) {
--- a/opac/opac-search.pl
+++ a/opac/opac-search.pl
@@ -229,8 +229,6 @@ foreach my $itemtype ( keys %{$itemtypes} ) {
$itemtypes->{$itemtype}->{translated_description} =
( $translated_description ) ? $translated_description : $itemtypes->{$itemtype}->{description};
}
-# Load the Type stuff without search categories for facets
-my $itemtypes_nocategory = GetItemTypes;
# the index parameter is different for item-level itemtypes
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
my @advancedsearchesloop;
--- a/opac/opac-topissues.pl
+++ a/opac/opac-topissues.pl
@@ -48,8 +48,6 @@ if ( ! C4::Context->preference('OpacTopissue') ) {
exit;
}
-my $itemtypes = GetItemTypes();
-
my ($template, $borrowernumber, $cookie) = get_template_and_user(
{
template_name => 'opac-topissues.tt',
--- a/opac/opac-user.pl
+++ a/opac/opac-user.pl
@@ -36,6 +36,7 @@ use C4::Letters;
use Koha::DateUtils;
use Koha::Holds;
use Koha::Database;
+use Koha::ItemTypes;
use Koha::Patron::Messages;
use Koha::Patron::Discharge;
use Koha::Patrons;
@@ -174,7 +175,7 @@ my $count = 0;
my $overdues_count = 0;
my @overdues;
my @issuedat;
-my $itemtypes = GetItemTypes();
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
my $issues = GetPendingIssues($borrowernumber);
if ($issues){
foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
--- a/reports/acquisitions_stats.pl
+++ a/reports/acquisitions_stats.pl
@@ -27,6 +27,7 @@ use C4::Output;
use C4::Koha;
use C4::Circulation;
use C4::Biblio;
+use Koha::ItemTypes;
use Koha::DateUtils;
use Koha::Libraries;
@@ -124,8 +125,6 @@ else {
$req->execute;
my $booksellers = $req->fetchall_arrayref({});
- my $itemtypes = GetItemTypes( style => 'array' );
-
$req = $dbh->prepare("SELECT DISTINCTROW budget_code, budget_name FROM aqbudgets ORDER BY budget_name");
$req->execute;
my @bselect;
@@ -195,9 +194,10 @@ else {
$ccode_avlist = GetAuthorisedValues($ccode_subfield_structure->{authorised_value});
}
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
$template->param(
booksellers => $booksellers,
- itemtypes => $itemtypes,
+ itemtypes => $itemtypes, # FIXME Should use the TT plugin instead
Budgets => $Budgets,
hassort1 => $hassort1,
hassort2 => $hassort2,
--- a/reports/bor_issues_top.pl
+++ a/reports/bor_issues_top.pl
@@ -30,6 +30,7 @@ use C4::Reports;
use C4::Debug;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Patron::Categories;
=head1 NAME
@@ -110,21 +111,12 @@ my @values;
my @mime = ( map { {type =>$_} } (split /[;:]/, 'CSV') ); # FIXME translation
my $delims = GetDelimiterChoices;
-my $itemtypes = GetItemTypes;
-my @itemtypeloop;
-foreach (sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes) {
- my %row = (value => $_,
- translated_description => $itemtypes->{$_}->{translated_description},
- );
- push @itemtypeloop, \%row;
-}
-
my $patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['categorycode']});
-
+my $itemtypes = Koha::ItemTypes->search_with_localization;
$template->param(
mimeloop => \@mime,
CGIseplist => $delims,
- itemtypeloop => \@itemtypeloop,
+ itemtypes => $itemtypes,
patron_categories => $patron_categories,
);
output_html_with_http_headers $input, $cookie, $template->output;
--- a/reports/cat_issues_top.pl
+++ a/reports/cat_issues_top.pl
@@ -29,6 +29,7 @@ use C4::Circulation;
use C4::Reports;
use C4::Members;
use Koha::DateUtils;
+use Koha::ItemTypes;
=head1 NAME
@@ -118,14 +119,7 @@ if ($do_it) {
my $CGIsepChoice=GetDelimiterChoices;
#doctype
- my $itemtypes = GetItemTypes;
- my @itemtypeloop;
- foreach my $thisitemtype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys %$itemtypes) {
- my %row =(value => $thisitemtype,
- description => $itemtypes->{$thisitemtype}->{translated_description},
- );
- push @itemtypeloop, \%row;
- }
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
#ccode
my $ccodes = GetAuthorisedValues('CCODE');
@@ -156,7 +150,7 @@ if ($do_it) {
$template->param(
CGIextChoice => $CGIextChoice,
CGIsepChoice => $CGIsepChoice,
- itemtypeloop =>\@itemtypeloop,
+ itemtypes => $itemtypes,
ccodeloop =>\@ccodeloop,
shelvinglocloop =>\@shelvinglocloop,
patron_categories => $patron_categories,
--- a/reports/catalogue_out.pl
+++ a/reports/catalogue_out.pl
@@ -25,7 +25,6 @@ use C4::Auth;
use C4::Context;
use C4::Debug;
use C4::Output;
-use C4::Koha; # GetItemTypes
# use Date::Manip; # TODO: add not borrowed since date X criteria
use Data::Dumper;
@@ -60,23 +59,9 @@ if ($do_it) {
exit; # in either case, exit after do_it
}
-# Displaying choices (i.e., not do_it)
-my $itemtypes = GetItemTypes();
-my @itemtypeloop;
-foreach (
- sort { $itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description} }
- keys %$itemtypes
- )
-{
- push @itemtypeloop,
- {
- value => $_,
- description => $itemtypes->{$_}->{translated_description},
- };
-}
-
+my $itemtypes = Koha::ItemTypes->search_with_localization;
$template->param(
- itemtypeloop => \@itemtypeloop,
+ itemtypes => $itemtypes,
);
output_html_with_http_headers $input, $cookie, $template->output;
--- a/reports/catalogue_stats.pl
+++ a/reports/catalogue_stats.pl
@@ -31,6 +31,7 @@ use C4::Biblio qw/GetMarcSubfieldStructureFromKohaField/;
use Koha::AuthorisedValues;
use Koha::DateUtils;
+use Koha::ItemTypes;
=head1 NAME
@@ -120,7 +121,7 @@ if ($do_it) {
my $req;
my @select;
- my $itemtypes = GetItemTypes( style => 'array' );
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
my @authvals = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } );
my @locations = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } );
--- a/reports/issues_avg_stats.pl
+++ a/reports/issues_avg_stats.pl
@@ -28,6 +28,7 @@ use C4::Koha;
use C4::Circulation;
use C4::Reports;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Patron::Categories;
use Date::Calc qw(Delta_Days);
@@ -119,7 +120,7 @@ if ($do_it) {
} else {
my $patron_categories = Koha::Patron::Categories->search({}, {order_by => ['description']});
- my $itemtypes = GetItemTypes( style => 'array' );
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
my $dbh = C4::Context->dbh;
my $req = $dbh->prepare("select distinctrow sort1 from borrowers where sort1 is not null order by sort1");
--- a/reports/issues_stats.pl
+++ a/reports/issues_stats.pl
@@ -34,6 +34,7 @@ use C4::Members;
use Koha::AuthorisedValues;
use Koha::DateUtils;
+use Koha::ItemTypes;
use C4::Members::AttributeTypes;
=head1 NAME
@@ -87,7 +88,6 @@ $sep = "\t" if ($sep eq 'tabulation');
$template->param(do_it => $do_it,
);
-our $itemtypes = GetItemTypes();
our @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
our $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
@@ -146,10 +146,7 @@ my %labels;
my %select;
# create itemtype arrayref for