use Koha::Biblioitems;
use Koha::Items;
+use Koha::ItemTypes;
use Koha::SearchEngine;
use Koha::SearchEngine::Search;
use Koha::Libraries;
#----- 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'};
use C4::Debug;
use C4::Charset;
use Koha::AuthorisedValues;
+use Koha::ItemTypes;
use Koha::Libraries;
use Koha::Patrons;
use YAML;
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", "" );
use C4::Circulation;
use C4::Reserves;
use Koha::AuthorisedValues;
+use Koha::ItemTypes;
use Koha::XSLT_Handler;
use Koha::Libraries;
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 = '';
use base qw( Template::Plugin );
use C4::Koha;
+use Koha::ItemTypes;
sub GetDescription {
my ( $self, $itemtype ) = @_;
}
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;
use Koha::EDI qw/create_edi_order get_edifact_ean/;
use Koha::Acquisition::Booksellers;
+use Koha::ItemTypes;
our $input=new CGI;
$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
}
}
- $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;
use CGI qw ( -utf8 );
use C4::Context;
-use C4::Koha; # GetItemTypes
use C4::Acquisition;
use C4::Auth;
use C4::Output;
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.*,
$template->param(
patron_categories => $patron_categories,
- itemtypeloop => \@itemtypes,
+ itemtypeloop => $itemtypes,
rules => \@sorted_row_loop,
humanbranch => ($branch ne '*' ? $branch : ''),
current_branch => $branch,
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 );
&& ( $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);
use Koha::AuthorisedValues;
use Koha::Biblios;
use Koha::Items;
+use Koha::ItemTypes;
use Koha::Patrons;
use Koha::Virtualshelves;
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 );
{ 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'} );
use POSIX qw(ceil floor);
use C4::Search::History;
+use Koha::ItemTypes;
use Koha::LibraryCategories;
use Koha::Virtualshelves;
use Koha::SearchEngine::Search;
);
# 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;
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,
# 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) {
use Koha::BiblioFrameworks;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Libraries;
use Koha::BiblioFrameworks;
&& ( $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);
}
use C4::Koha;
use C4::ClassSource;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Libraries;
use List::MoreUtils qw/any/;
use C4::Search;
}
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 ) {
use C4::Output;
use C4::Biblio;
use C4::Items;
-use C4::Koha; # GetItemTypes
use C4::HoldsQueue qw(GetHoldsQueueItems);
use Koha::BiblioFrameworks;
+use Koha::ItemTypes;
+
my $query = new CGI;
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
{
}
# 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,
);
use C4::CourseReserves qw(GetCourse GetCourseItem GetCourseReserve ModCourseItem ModCourseReserve);
+use Koha::ItemTypes;
+
my $cgi = new CGI;
my $action = $cgi->param('action') || '';
)
: undef;
+ my $itemtypes = Koha::ItemTypes->search;
$template->param(
item => $item,
title => $title,
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,
);
</select> </li>
<li>
<label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
- [% FOREACH itemtypeloo IN itemtypeloop %]
- <option value="[% itemtypeloo.value %]" >[% itemtypeloo.translated_description %] </option>
+ [% FOREACH itemtype IN itemtypes %]
+ <option value="[% itemtype.itemtype %]" >[% itemtype.translated_description %] </option>
[% END %]
</select>
</li>
</li>
<li>
<label for="documenttype">Item type: </label><select name="Filter" id="documenttype"><option value="" > Any item type</option>
- [% FOREACH itemtypeloo IN itemtypeloop %]
- <option value="[% itemtypeloo.value %]" >[% itemtypeloo.description %] </option>
+ [% FOREACH itemtype IN itemtypes %]
+ <option value="[% itemtype.itemtype %]" >[% itemtype.translated_description %] </option>
[% END %]
</select>
</li>
<li>
<label for="documenttype">Item type: </label><select name="Filter" id="documenttype">
<option value="">Any item type</option>
- [% FOREACH itemtypeloo IN itemtypeloop %]
- <option value="[% itemtypeloo.value %]">[% itemtypeloo.description %]</option>
+ [% FOREACH itemtype IN itemtypes %]
+ <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
[% END %]
</select>
</li>
<td><input type="radio" name="Column" value="itemtype" /></td>
<td><select name="Filter" id="itemtype">
<option value=""> </option>
- [% FOREACH itemtypeloo IN itemtypeloop %]
- <option value="[% itemtypeloo.code %]">[% itemtypeloo.description %]</option>
+ [% FOREACH itemtype IN itemtypes %]
+ <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
[% END %]
</select>
</td>
</select></li>
<li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
<option value="">All</option>
- [% FOREACH itemtypeloo IN itemtypeloop %]
- [% IF ( itemtypeloo.selected ) %]<option value="[% itemtypeloo.value %]" selected="selected">[% itemtypeloo.description %]</option>
- [% ELSE %]
- <option value="[% itemtypeloo.value %]">[% itemtypeloo.description %]</option>
- [% END %]
+ [% FOREACH itemtype IN itemtypes %]
+ <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
[% END %]
</select></li>
<label for="itemtype">Item type: </label>
<select name="itemtype" id="itemtype">
<option value="">-- All --</option>
- [% FOREACH itemtypeloo IN itemtypeloop %]
- [% IF ( itemtypeloo.selected ) %]
- <option value="[% itemtypeloo.value %]" selected="selected">[% itemtypeloo.description %]</option>
-[% ELSE %]
- <option value="[% itemtypeloo.value %]">[% itemtypeloo.description %]</option>
-[% END %]
+ [% FOREACH itemtype IN itemtypes %]
+ <option value="[% itemtype.itemtype %]">[% itemtype.translated_description %]</option>
[% END %]
</select>
</li>
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 {
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;
}
use C4::Serials; # uses getsubscriptionfrom biblionumber
use C4::Koha;
use C4::Members; # GetMember
+use Koha::ItemTypes;
use Koha::RecordProcessor;
'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
use Koha::RecordProcessor;
use Koha::AuthorisedValues;
use Koha::Biblios;
+use Koha::ItemTypes;
use Koha::Virtualshelves;
use Koha::Ratings;
use Koha::Reviews;
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);
interface => 'opac',
} );
-my $itemtypes = GetItemTypes();
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
# imageurl:
my $itemtype = $dat->{'itemtype'};
if ( $itemtype ) {
use C4::Output;
use C4::Charset qw(StripNonXmlChars);
+use Koha::ItemTypes;
+
my $query = new CGI;
# if opacreadinghistory is disabled, leave immediately
$template->param(%{$borr});
-my $itemtypes = GetItemTypes();
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
# get the record
my $order = $query->param('order') || '';
use Koha::AuthorisedValues;
use Koha::DateUtils;
use Koha::Items;
+use Koha::ItemTypes;
use Koha::Libraries;
use Koha::Patrons;
use Date::Calc qw/Today Date_to_Days/;
$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.
$biblioLoopIter{reqholdnotes}=0; #TODO: 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)) {
}
}
- $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemTypes->{ $itemInfo->{itype} }{imageurl} );
+ $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itemInfo->{itype} }{imageurl} );
# Show serial enumeration when needed
if ($itemLoopIter->{enumchron}) {
$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;
exit;
}
-my $itemtypes = GetItemTypes();
-
my ($template, $borrowernumber, $cookie) = get_template_and_user(
{
template_name => 'opac-topissues.tt',
use Koha::DateUtils;
use Koha::Holds;
use Koha::Database;
+use Koha::ItemTypes;
use Koha::Patron::Attribute::Types;
use Koha::Patron::Messages;
use Koha::Patron::Discharge;
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} ) {
use C4::Koha;
use C4::Circulation;
use C4::Biblio;
+use Koha::ItemTypes;
use Koha::DateUtils;
use Koha::Libraries;
$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;
$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,
use C4::Debug;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Patron::Categories;
=head1 NAME
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;
use C4::Reports;
use C4::Members;
use Koha::DateUtils;
+use Koha::ItemTypes;
=head1 NAME
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');
$template->param(
CGIextChoice => $CGIextChoice,
CGIsepChoice => $CGIsepChoice,
- itemtypeloop =>\@itemtypeloop,
+ itemtypes => $itemtypes,
ccodeloop =>\@ccodeloop,
shelvinglocloop =>\@shelvinglocloop,
patron_categories => $patron_categories,
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;
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;
use Koha::AuthorisedValues;
use Koha::DateUtils;
+use Koha::ItemTypes;
=head1 NAME
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'] } );
use C4::Circulation;
use C4::Reports;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Patron::Categories;
use Date::Calc qw(Delta_Days);
} 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");
use Koha::AuthorisedValues;
use Koha::DateUtils;
+use Koha::ItemTypes;
use C4::Members::AttributeTypes;
=head1 NAME
$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'] } ) };
my %select;
# create itemtype arrayref for <select>.
-my @itemtypeloop;
-for my $itype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys(%$itemtypes)) {
- push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{translated_description} } ;
-}
+our $itemtypes = Koha::ItemTypes->search_with_localization;
# location list
my @locations;
$template->param(
categoryloop => \@patron_categories,
- itemtypeloop => \@itemtypeloop,
+ itemtypes => $itemtypes,
locationloop => \@locations,
ccodeloop => \@ccodes,
hassort1 => $hassort1,
use C4::Output;
use C4::Biblio;
use C4::Items;
-use C4::Koha; # GetItemTypes
use Koha::DateUtils;
my $query = new CGI;
}
# getting all itemtypes
-my $itemtypes = &GetItemTypes();
-my @itemtypesloop;
-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 @itemtypesloop, \%row;
-}
+my $itemtypes = Koha::ItemTypes->search_with_localization;
# get lost statuses
my $lost_status_loop = C4::Koha::GetAuthorisedValues( 'LOST' );
$template->param(
- itemtypeloop => \@itemtypesloop,
+ itemtypes => $itemtypes,
loststatusloop => $lost_status_loop,
);
use C4::Members;
use Koha::AuthorisedValues;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Koha::Libraries;
use Koha::Patron::Categories;
use List::MoreUtils qw/any/;
$template->param(do_it => $do_it,
);
-my $itemtypes = GetItemTypes();
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
my %labels;
my %select;
-# create itemtype arrayref for <select>.
-my @itemtypeloop;
-for my $itype ( sort {$itemtypes->{$a}->{translated_description} cmp $itemtypes->{$b}->{translated_description}} keys(%$itemtypes)) {
- push @itemtypeloop, { code => $itype , description => $itemtypes->{$itype}->{translated_description} } ;
-}
+my $itemtypes = Koha::ItemTypes->search_with_localization;
# location list
my @locations;
$template->param(
categoryloop => \@patron_categories,
- itemtypeloop => \@itemtypeloop,
+ itemtypes => $itemtypes,
locationloop => \@locations,
ccodeloop => \@ccodes,
hassort1=> $hassort1,
my ( $crit, $value ) = @_;
my $locations = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
my $ccodes = { map { ( $_->{authorised_value} => $_->{lib} ) } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
- my $itemtypes = GetItemTypes();
my $Bsort1 = GetAuthorisedValues("Bsort1");
my $Bsort2 = GetAuthorisedValues("Bsort2");
my $display_value =
( $crit =~ /ccode/ ) ? $ccodes->{$value}
: ( $crit =~ /location/ ) ? $locations->{$value}
- : ( $crit =~ /itemtype/ ) ? $itemtypes->{$value}->{description}
+ : ( $crit =~ /itemtype/ ) ? Koha::ItemTypes->find( $value )->translated_description
: ( $crit =~ /branch/ ) ? Koha::Libraries->find($value)->branchname
: ( $crit =~ /reservestatus/ ) ? reservestatushuman($value)
: $value; # default fallback
use Koha::DateUtils;
use Koha::Holds;
use Koha::Items;
+use Koha::ItemTypes;
use Koha::Libraries;
use Koha::Patrons;
$template->param(multi_hold => $multihold);
my $showallitems = $input->param('showallitems');
-my $itemtypes = GetItemTypes();
+my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
# Select borrowers infos
my $findborrower = $input->param('findborrower');
use C4::Letters;
use Koha::AdditionalField;
use Koha::DateUtils;
+use Koha::ItemTypes;
use Carp;
#use Smart::Comments;
}
$template->param( additional_fields_for_subscription => $additional_fields );
-my $typeloop = GetItemTypes();
+my $typeloop = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
+# FIXME We should use the translated_description for item types
my @typearg =
map { { code => $_, value => $typeloop->{$_}{'description'}, selected => ( ( $subs->{itemtype} and $_ eq $subs->{itemtype} ) ? "selected=\"selected\"" : "" ), } } sort keys %{$typeloop};
my @previoustypearg =
use C4::Biblio;
use C4::Debug;
+use Koha::ItemTypes;
use Koha::SearchEngine;
use Koha::SearchEngine::Search;
);
# load the itemtypes
- my $itemtypes = GetItemTypes();
+ my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
my @itemtypesloop;
+ # FIXME This is uselessly complex, the iterator should be send to the template
+ # FIXME The translated_description should be used
foreach my $thisitemtype (
sort {
$itemtypes->{$a}->{'description'}
use C4::Auth; # get_template_and_user
use C4::Output;
use C4::Suggestions;
-use C4::Koha; #GetItemTypes
use C4::Budgets;
use C4::Search;
use C4::Members;
use C4::Auth qw/check_api_auth/;
use C4::Context;
use C4::Koha;
+use Koha::ItemTypes;
use XML::Simple;
my $query = new CGI;
sub _get_biblioitem_itemtypes {
my $result = shift;
- my $itemtypes = GetItemTypes;
+ my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
my $sth = $dbh->prepare_cached("SELECT tagfield, tagsubfield
FROM marc_subfield_structure
WHERE frameworkcode = ''
use Koha::Biblios;
use Koha::DateUtils;
+use Koha::ItemTypes;
my $input = new CGI;
my $dbh = C4::Context->dbh;
}
elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
push @authorised_values, "";
- 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;
}
$value = "";
use MARC::File::XML;
use List::MoreUtils qw(uniq);
use C4::Auth;
-use C4::Koha; # GetItemTypes
use C4::Output;
use Koha::Authority::Types;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Exporter::Record;
+use Koha::ItemTypes;
use Koha::Libraries;
my $query = new CGI;
else {
- my $itemtypes = GetItemTypes;
- my @itemtypesloop;
- foreach my $thisitemtype ( sort keys %$itemtypes ) {
- my %row = (
- value => $thisitemtype,
- description => $itemtypes->{$thisitemtype}->{translated_description},
- );
- push @itemtypesloop, \%row;
- }
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
$template->param(
libraries => $libraries,
- itemtypeloop => \@itemtypesloop,
+ itemtypes => $itemtypes,
authority_types => $authority_types,
export_remove_fields => C4::Context->preference("ExportRemoveFields"),
csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],