&getitemtypeimagelocation
&GetAuthorisedValues
&GetAuthorisedValueCategories
- &GetKohaAuthorisedValues
&GetNormalizedUPC
&GetNormalizedISBN
&GetNormalizedEAN
return \@results;
}
-=head2 GetKohaAuthorisedValues
-
-Takes $kohafield, $fwcode as parameters.
-
-If $opac parameter is set to a true value, displays OPAC descriptions rather than normal ones when they exist.
-
-Returns hashref of Code => description
-
-Returns undef if no authorised value category is defined for the kohafield.
-
-=cut
-
-sub GetKohaAuthorisedValues {
- my ( $kohafield, $fwcode, $opac ) = @_;
- $fwcode = '' unless $fwcode;
- my %values;
- my $dbh = C4::Context->dbh;
-
- my $avs = Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $fwcode, kohafield => $kohafield } );
- return {} unless $avs->count;
- my $values;
- while ( my $av = $avs->next ) {
- $values->{ $av->authorised_value } = $opac ? $av->opac_description : $av->lib;
- }
- return $values;
-}
-
=head2 xml_escape
my $escaped_string = C4::Koha::xml_escape($string);
# FIXME - We build an authorised values hash here, using the default framework
# though it is possible to have different authvals for different fws.
- my $shelflocations =GetKohaAuthorisedValues('items.location','');
+ my $shelflocations =
+ { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.location' } ) };
# get notforloan authorised value list (see $shelflocations FIXME)
my $av = Koha::MarcSubfieldStructures->search({ frameworkcode => '', kohafield => 'items.notforloan', authorised_value => { not => undef } });
use C4::Biblio;
use C4::Circulation;
use C4::Reserves;
+use Koha::AuthorisedValues;
use Koha::XSLT_Handler;
use Koha::Libraries;
@items = grep { !$hi{$_->{itemnumber}} } @items;
}
- my $shelflocations = GetKohaAuthorisedValues('items.location',GetFrameworkCode($biblionumber), 'opac');
- my $ccodes = GetKohaAuthorisedValues('items.ccode',GetFrameworkCode($biblionumber), 'opac');
+ my $shelflocations =
+ { map { $_->authorised_value => $_->opac_description } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => GetFrameworkCode($biblionumber), kohafield => 'items.location' } ) };
+ my $ccodes =
+ { map { $_->authorised_value => $_->opac_description } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => GetFrameworkCode($biblionumber), kohafield => 'items.ccode' } ) };
my %branches = map { $_->branchcode => $_->branchname } Koha::Libraries->search({}, { order_by => 'branchname' });
use CGI qw ( -utf8 );
use C4::Context;
-use C4::Koha; # GetKohaAuthorisedValues GetItemTypes
+use C4::Koha; # GetItemTypes
use C4::Acquisition;
use C4::Auth;
use C4::Output;
use C4::Auth;
use C4::Output;
+use Koha::AuthorisedValues;
use Koha::CsvProfiles;
my $query = new CGI;
$hasauthors = 1;
}
- my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'});
- my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'});
+ my $shelflocations =
+ { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.location' } ) };
for my $itm (@items) {
if ($itm->{'location'}){
$dat->{'showncount'} = scalar @items + @hostitems;
$dat->{'hiddencount'} = scalar @all_items + @hostitems - scalar @items;
-my $shelflocations = GetKohaAuthorisedValues('items.location', $fw);
-my $collections = GetKohaAuthorisedValues('items.ccode' , $fw);
-my $copynumbers = GetKohaAuthorisedValues('items.copynumber', $fw);
+my $shelflocations =
+ { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $fw, kohafield => 'items.location' } ) };
+my $collections =
+ { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $fw, kohafield => 'items.ccode' } ) };
+my $copynumbers =
+ { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
my (@itemloop, @otheritemloop, %itemfields);
my $norequests = 1;
$data->{'showncount'}=$showncount;
$data->{'hiddencount'}=$hiddencount; # can be zero
-my $ccodes= GetKohaAuthorisedValues('items.ccode',$fw);
-my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$fw);
+my $ccodes =
+ { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $fw, kohafield => 'items.ccode' } ) };
+my $copynumbers =
+ { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
my $itemtypes = GetItemTypes;
$data->{'itemtypename'} = $itemtypes->{$data->{'itemtype'}}->{'translated_description'};
my $returned_counter = ( C4::Context->preference('numReturnedItemsToShow') ) ? C4::Context->preference('numReturnedItemsToShow') : 8;
my $count = 0;
my @riloop;
-my $shelflocations = GetKohaAuthorisedValues('items.location','');
+my $shelflocations =
+ { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.location' } ) };
foreach ( sort { $a <=> $b } keys %returneditems ) {
my %ri;
if ( $count++ < $returned_counter ) {
use C4::Output;
use Koha::RecordProcessor;
+use Koha::AuthorisedValues;
+
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
if($dat->{'author'} || @$marcauthorsarray) {
$hasauthors = 1;
}
- my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
- my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
+ my $collections =
+ { map { $_->authorised_value => $_->opac_description } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.ccode' } ) };
+ my $shelflocations =
+ { map { $_->authorised_value => $_->opac_description } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.location' } ) };
# COinS format FIXME: for books Only
my $coins_format;
use C4::HTML5Media;
use C4::CourseReserves qw(GetItemCourseReservesInfo);
use Koha::RecordProcessor;
+use Koha::AuthorisedValues;
use Koha::Virtualshelves;
use Koha::Ratings;
use Koha::Reviews;
$dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
$dat->{'description'} = $itemtypes->{$itemtype}->{translated_description};
}
-my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
-my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
-my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$dat->{'frameworkcode'}, 'opac');
+
+my $shelflocations =
+ { map { $_->authorised_value => $_->opac_description } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.location' } ) };
+my $collections =
+ { map { $_->authorised_value => $_->opac_description } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.ccode' } ) };
+my $copynumbers =
+ { map { $_->authorised_value => $_->opac_description } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.copynumber' } ) };
#coping with subscriptions
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
use C4::Circulation;
use C4::Biblio qw/GetMarcSubfieldStructureFromKohaField/;
+use Koha::AuthorisedValues;
use Koha::DateUtils;
=head1 NAME
my $itemtypes = GetItemTypes( style => 'array' );
- my $authvals = GetKohaAuthorisedValues("items.ccode");
- my @authvals;
- foreach ( sort { $authvals->{$a} cmp $authvals->{$b} || $a cmp $b } keys %$authvals ) {
- push @authvals, { code => $_, description => $authvals->{$_} };
- }
-
- my $locations = GetKohaAuthorisedValues("items.location");
- my @locations;
- foreach ( sort keys %$locations ) {
- push @locations, { code => $_, description => "$_ - " . $locations->{$_} };
- }
+ my @authvals = map { { code => $_->authorised_value, description => $_->lib } } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } );
+ my @locations = map { { code => $_->authorised_value, description => $_->lib } } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } );
foreach my $kohafield (qw(items.notforloan items.materials)) {
my $subfield_structure = GetMarcSubfieldStructureFromKohaField($kohafield);
} else {
$sth->execute();
}
- my $rowauthvals = GetKohaAuthorisedValues($origline);
+ my $rowauthvals = { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => $origline } ) };
while ( my ($celvalue) = $sth->fetchrow ) {
my %cell;
if (defined $celvalue and $celvalue ne '') {
} else {
$sth2->execute();
}
- my $colauthvals = GetKohaAuthorisedValues($origcolumn);
+ my $colauthvals = { map { $_->authorised_value => $_->lib } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => $origcolumn } ) };
while ( my ($celvalue) = $sth2->fetchrow ) {
my %cell;
if (defined $celvalue and $celvalue ne '') {
use C4::Circulation;
use C4::Reports;
use C4::Members;
+
+use Koha::AuthorisedValues;
use Koha::DateUtils;
=head1 NAME
our $itemtypes = GetItemTypes();
our @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
-our $ccodes = GetKohaAuthorisedValues("items.ccode");
-our $locations = GetKohaAuthorisedValues("items.location");
+my $locations = { map { ( $_->authorised_value => $_->lib ) } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
+my $ccodes = { map { ( $_->authorised_value => $_->lib ) } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
our $Bsort1 = GetAuthorisedValues("Bsort1");
our $Bsort2 = GetAuthorisedValues("Bsort2");
use C4::Output;
use C4::Reports;
use C4::Members;
+use Koha::AuthorisedValues;
use Koha::DateUtils;
use Koha::Libraries;
use Koha::Patron::Categories;
my $itemtypes = GetItemTypes();
my @patron_categories = Koha::Patron::Categories->search_limited({}, {order_by => ['description']});
-my $ccodes = GetKohaAuthorisedValues("items.ccode");
-my $locations = GetKohaAuthorisedValues("items.location");
-my $authvalue = GetKohaAuthorisedValues("items.authvalue");
+my $locations = { map { ( $_->authorised_value => $_->lib ) } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
+my $ccodes = { map { ( $_->authorised_value => $_->lib ) } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
my $Bsort1 = GetAuthorisedValues("Bsort1");
my $Bsort2 = GetAuthorisedValues("Bsort2");
}
sub display_value {
my ( $crit, $value ) = @_;
- my $ccodes = GetKohaAuthorisedValues("items.ccode");
- my $locations = GetKohaAuthorisedValues("items.location");
+ my $locations = { map { ( $_->authorised_value => $_->lib ) } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } ) };
+ my $ccodes = { map { ( $_->authorised_value => $_->lib ) } Koha::AuthorisedValues->search_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } ) };
my $itemtypes = GetItemTypes();
- my $authvalue = GetKohaAuthorisedValues("items.authvalue");
my $Bsort1 = GetAuthorisedValues("Bsort1");
my $Bsort2 = GetAuthorisedValues("Bsort2");
my $display_value =