diff --git a/C4/Koha.pm b/C4/Koha.pm index a63a3a551a..d10c52e4f5 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -57,6 +57,7 @@ BEGIN { &GetAuthorisedValueCategories &GetKohaAuthorisedValues &GetKohaAuthorisedValuesFromField + &GetKohaAuthorisedValueLib &GetAuthValCode &GetNormalizedUPC &GetNormalizedISBN @@ -1214,6 +1215,27 @@ sub xml_escape { return $str; } +=head2 GetKohaAuthorisedValueLib + +Takes $category, $authorised_value as parameters. + +If $opac parameter is set to a true value, displays OPAC descriptions rather than normal ones when they exist. + +Returns authorised value description + +=cut + +sub GetKohaAuthorisedValueLib { + my ($category,$authorised_value,$opac) = @_; + my $value; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("select lib, lib_opac from authorised_values where category=? and authorised_value=?"); + $sth->execute($category,$authorised_value); + my $data = $sth->fetchrow_hashref; + $value = ($opac && $$data{'lib_opac'}) ? $$data{'lib_opac'} : $$data{'lib'}; + return $value; +} + =head2 display_marc_indicators my $display_form = C4::Koha::display_marc_indicators($field); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl index 5a665de350..ae4932e368 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl @@ -1007,7 +1007,10 @@ $(document).ready(function() {
  • - " size="30" /> +
  • diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index 143cf88d89..72eee22417 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -130,8 +130,12 @@ for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{b branchname => $branches->{$thisbranch}->{'branchname'}, }; } + +my $locations_loop = GetAuthorisedValues("LOC",$subs->{'location'}); + $template->param(branchloop => $branchloop, DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), + locations_loop=>$locations_loop, ); # prepare template variables common to all $op conditions: $template->param( 'dateformat_' . C4::Context->preference('dateformat') => 1 ); diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl index 7324d59842..4233d9fa72 100755 --- a/serials/subscription-detail.pl +++ b/serials/subscription-detail.pl @@ -103,8 +103,8 @@ my ($user, $sessionID, $flags); for my $date qw(startdate enddate firstacquidate histstartdate histenddate){ $$subs{$date} = format_date($$subs{$date}) if $date && $$subs{$date}; } +$subs->{location} = GetKohaAuthorisedValueLib("LOC",$subs->{location}); $subs->{abouttoexpire} = abouttoexpire($subs->{subscriptionid}); - $template->param($subs); $template->param(biblionumber_for_new_subscription => $subs->{bibnum}); my @irregular_issues = split /,/, $subs->{irregularity};