Browse Source

Bug 16157: Move the selected flag from GetAuthorisedValues to the templates

From C4::Koha::GetAuthorisedValues

    # TODO: the "selected" feature should be replaced by a utility function
    # somewhere else, it doesn't belong in here. For starters it makes
    # caching much more complicated. Or just let the UI logic handle it, it's
    # what it's for.

Indeed, it's not a job for a subroutine, the template should take care of that.
Note that a perf gain could be won with this patch \o/

Test plan:
- Edit an itemtype and check the value of the "Search category" dropdown list
- Edit a patron attribute type and check the value of the "Class" dropdown list
- Detail for a catalogue record, the Status column should be correctly
  populated if items are damaged and/or lost
- Item details for a catalogue record, the lost, damaged and withdrawn
  value should be correctly displayed
- Edit a patron, the "street type" should be correctly selected
- Create a patron attribute type linked to an authorised value list.
- Edit a patron, set a value for this attribute, edit it again. The
  correct value should be selected.
- Search for subscriptions. The 'Location' dropdown list should behave
  correctly (select the entry you have choosen before, etc.)
- Edit a subscription, the location dropdown list should select the
  correct value.
- Edit and view a suggestion with a 'reason for suggestion' set (you
  should have at least 1 OPAC_SUG AV defined)

Followed test plan, works as expected
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
new_12478_elasticsearch
Jonathan Druart 6 years ago
committed by Brendan Gallagher
parent
commit
b64e6be1c4
  1. 26
      C4/Koha.pm
  2. 4
      Koha/Template/Plugin/AuthorisedValues.pm
  3. 2
      admin/itemtypes.pl
  4. 18
      admin/patron-attr-types.pl
  5. 4
      catalogue/detail.pl
  6. 6
      catalogue/moredetail.pl
  7. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc
  8. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc
  9. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc
  10. 6
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt
  11. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt
  12. 4
      koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
  13. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt
  14. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
  15. 3
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt
  16. 3
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt
  17. 38
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt
  18. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
  19. 20
      koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
  20. 4
      koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc
  21. 2
      members/memberentry.pl
  22. 2
      opac/opac-search.pl
  23. 12
      serials/serials-collection.pl
  24. 8
      serials/serials-edit.pl
  25. 2
      serials/serials-search.pl
  26. 2
      serials/subscription-add.pl
  27. 2
      suggestion/suggestion.pl
  28. 8
      t/db_dependent/Koha.t

26
C4/Koha.pm

@ -998,35 +998,25 @@ sub GetAuthValCodeFromField {
=head2 GetAuthorisedValues
$authvalues = GetAuthorisedValues([$category], [$selected]);
$authvalues = GetAuthorisedValues([$category]);
This function returns all authorised values from the'authorised_value' table in a reference to array of hashrefs.
C<$category> returns authorised values for just one category (optional).
C<$selected> adds a "selected => 1" entry to the hash if the
authorised_value matches it. B<NOTE:> this feature should be considered
deprecated as it may be removed in the future.
C<$opac> If set to a true value, displays OPAC descriptions rather than normal ones when they exist.
=cut
sub GetAuthorisedValues {
my ( $category, $selected, $opac ) = @_;
# TODO: the "selected" feature should be replaced by a utility function
# somewhere else, it doesn't belong in here. For starters it makes
# caching much more complicated. Or just let the UI logic handle it, it's
# what it's for.
my ( $category, $opac ) = @_;
# Is this cached already?
$opac = $opac ? 1 : 0; # normalise to be safe
my $branch_limit =
C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
my $selected_key = defined($selected) ? $selected : '';
my $cache_key =
"AuthorisedValues-$category-$selected_key-$opac-$branch_limit";
"AuthorisedValues-$category-$opac-$branch_limit";
my $cache = Koha::Cache->get_instance();
my $result = $cache->get_from_cache($cache_key);
return $result if $result;
@ -1063,13 +1053,6 @@ sub GetAuthorisedValues {
$sth->execute( @where_args );
while (my $data=$sth->fetchrow_hashref) {
if ( defined $selected and $selected eq $data->{authorised_value} ) {
$data->{selected} = 1;
}
else {
$data->{selected} = 0;
}
if ($opac && $data->{lib_opac}) {
$data->{lib} = $data->{lib_opac};
}
@ -1077,9 +1060,6 @@ sub GetAuthorisedValues {
}
$sth->finish;
# We can't cache for long because of that "selected" thing which
# makes it impossible to clear the cache without iterating through every
# value, which sucks. This'll cover this request, and not a whole lot more.
$cache->set_in_cache( $cache_key, \@results, { deepcopy => 1, expiry => 5 } );
return \@results;
}

4
Koha/Template/Plugin/AuthorisedValues.pm

@ -29,8 +29,8 @@ sub GetByCode {
}
sub Get {
my ( $self, $category, $selected, $opac ) = @_;
return GetAuthorisedValues( $category, $selected, $opac );
my ( $self, $category, $opac ) = @_;
return GetAuthorisedValues( $category, $opac );
}
sub GetAuthValueDropbox {

2
admin/itemtypes.pl

@ -59,7 +59,7 @@ undef($sip_media_type) if defined($sip_media_type) and $sip_media_type =~ /^\s*$
if ( $op eq 'add_form' ) {
my $itemtype = Koha::ItemTypes->find($itemtype_code);
my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
my $searchcategory = GetAuthorisedValues("ITEMTYPECAT", ( $itemtype ? $itemtype->searchcategory : '' ) );
my $searchcategory = GetAuthorisedValues("ITEMTYPECAT");
my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') );
$template->param(
itemtype => $itemtype,

18
admin/patron-attr-types.pl

@ -99,7 +99,7 @@ sub add_attribute_type_form {
branches_loop => \@branches_loop,
);
authorised_value_category_list($template);
pa_classes($template);
$template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS'));
}
sub error_add_attribute_type_form {
@ -255,7 +255,7 @@ sub edit_attribute_type_form {
$template->param(display_checkout_checked => 'checked="checked"');
}
authorised_value_category_list($template, $attr_type->authorised_value_category());
pa_classes( $template, $attr_type->class );
$template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS' ));
my $branches = GetBranches;
@ -271,8 +271,11 @@ sub edit_attribute_type_form {
}
$template->param( branches_loop => \@branches_loop );
$template->param ( category_code => $attr_type->category_code );
$template->param ( category_description => $attr_type->category_description );
$template->param(
category_code => $attr_type->category_code,
category_class => $attr_type->class,
category_description => $attr_type->category_description,
);
$template->param(
attribute_type_form => 1,
@ -325,10 +328,3 @@ sub authorised_value_category_list {
}
$template->param(authorised_value_categories => \@list);
}
sub pa_classes {
my $template = shift;
my $selected = @_ ? shift : '';
$template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS', $selected ) );
}

4
catalogue/detail.pl

@ -218,9 +218,9 @@ foreach my $item (@items) {
$item->{datedue} = format_sqldatetime($item->{datedue});
# item damaged, lost, withdrawn loops
$item->{itemlostloop} = GetAuthorisedValues($authvalcode_items_itemlost, $item->{itemlost}) if $authvalcode_items_itemlost;
$item->{itemlostloop} = GetAuthorisedValues($authvalcode_items_itemlost) if $authvalcode_items_itemlost;
if ($item->{damaged}) {
$item->{itemdamagedloop} = GetAuthorisedValues($authvalcode_items_damaged, $item->{damaged}) if $authvalcode_items_damaged;
$item->{itemdamagedloop} = GetAuthorisedValues($authvalcode_items_damaged) if $authvalcode_items_damaged;
}
#get shelf location and collection code description if they are authorised value.
# same thing for copy number

6
catalogue/moredetail.pl

@ -137,9 +137,9 @@ foreach ( keys %{$data} ) {
($itemnumber) and @items = (grep {$_->{'itemnumber'} == $itemnumber} @items);
foreach my $item (@items){
$item->{object} = Koha::Items->find( $item->{itemnumber} );
$item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw),$item->{itemlost}) if GetAuthValCode('items.itemlost',$fw);
$item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw),$item->{damaged}) if GetAuthValCode('items.damaged',$fw);
$item->{itemwithdrawnloop}= GetAuthorisedValues(GetAuthValCode('items.withdrawn',$fw),$item->{withdrawn}) if GetAuthValCode('items.withdrawn',$fw);
$item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw)) if GetAuthValCode('items.itemlost',$fw);
$item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw)) if GetAuthValCode('items.damaged',$fw);
$item->{itemwithdrawnloop}= GetAuthorisedValues(GetAuthValCode('items.withdrawn',$fw)) if GetAuthValCode('items.withdrawn',$fw);
$item->{'collection'} = $ccodes->{ $item->{ccode} } if ($ccodes);
$item->{'itype'} = $itemtypes->{ $item->{'itype'} }->{'translated_description'};
$item->{'replacementprice'} = sprintf( "%.2f", $item->{'replacementprice'} );

2
koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc

@ -6,6 +6,7 @@
default: the default authorised value to select
class: the CSS class of the select element
size: the size to use for the input (generated if the authorised value category does not exist).
all: add a "All" entry
%]
[% SET avs = AuthorisedValues.GetAuthValueDropbox( category, default ) %]
@ -16,6 +17,7 @@
[% IF avs %]
<select id="[% name %]" name="[% name %]" class="[% class %]" >
[% IF all %]<option value="All">All</option>[% END %]
[% FOR av IN avs %]
[% IF av.default %]
<option value="[% av.value %]" selected="selected">[% av.label | html_entity %]</option>

2
koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc

@ -12,7 +12,7 @@
<select name="streettype">
<option value=""></option>
[% FOR roadtype IN roadtypes %]
[% IF roadtype.selected %]
[% IF roadtype.authorised_value == streettype %]
<option value="[% roadtype.authorised_value %]" selected="selected">[% roadtype.lib %]</option>
[% ELSE %]
<option value="[% roadtype.authorised_value %]">[% roadtype.lib %]</option>

2
koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc

@ -24,7 +24,7 @@
<select name="streettype">
<option value=""></option>
[% FOR roadtype IN roadtypes %]
[% IF roadtype.selected %]
[% IF roadtype.authorised_value == streettype%]
<option value="[% roadtype.authorised_value %]" selected="selected">[% roadtype.lib %]</option>
[% ELSE %]
<option value="[% roadtype.authorised_value %]">[% roadtype.lib %]</option>

6
koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt

@ -149,7 +149,7 @@ Item types administration
<select id="searchcategory" name="searchcategory">
<option value="">None</option>
[% FOREACH cat IN searchcategory %]
[% IF cat.selected %]
[% IF cat.authorised_value == itemtype.searchcategory %]
<option value="[% cat.authorised_value %]" selected="selected">
[% cat.lib %]
</option>
@ -278,8 +278,8 @@ Item types administration
<label for="sip_media_type">SIP media type: </label>
<select id="sip_media_type" name="sip_media_type">
<option value=""></option>
[% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE', itemtype.sip_media_type ) %]
[% IF a.selected %]
[% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE') %]
[% IF a.authorised_value == itemtype.sip_media_type %]
<option value="[% a.authorised_value %]" selected="selected">[% a.lib %]</option>
[% ELSE %]
<option value="[% a.authorised_value %]">[% a.lib %]</option>

2
koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt

@ -220,7 +220,7 @@ function CheckAttributeTypeForm(f) {
<select name="class">
<option value="" />
[% FOREACH class IN classes_val_loop %]
[% IF ( class.selected ) %]
[% IF class.authorised_value == category_class %]
<option value="[% class.authorised_value %]" selected="selected">
[% class.lib %]
</option>

4
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt

@ -650,7 +650,7 @@ function verify_images() {
[% IF ( item.itemlost ) %]
[% IF ( item.itemlostloop ) %]
[% FOREACH itemlostloo IN item.itemlostloop %]
[% IF ( itemlostloo.selected ) %]
[% IF itemlostloo.authorised_value == item.itemlost %]
<span class="lost">[% itemlostloo.lib %]</span>
[% END %]
[% END %]
@ -666,7 +666,7 @@ function verify_images() {
[% IF ( item.damaged ) %]
[% IF ( item.itemdamagedloop ) %]
[% FOREACH itemdamagedloo IN item.itemdamagedloop %]
[% IF ( itemdamagedloo.selected ) %]
[% IF itemdamagedloo.authorised_value == item.damaged %]
<span class="dmg">[% itemdamagedloo.lib %]</span>
[% END %]
[% END %]

8
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt

@ -109,7 +109,7 @@
<select name="itemlost" >
<option value="">Choose</option>
[% FOREACH itemlostloo IN ITEM_DAT.itemlostloop %]
[% IF ( itemlostloo.selected ) %]
[% IF itemlostloo.authorised_value == ITEM_DAT.itemlost %]
<option value="[% itemlostloo.authorised_value %]" selected="selected">[% itemlostloo.lib %]</option>
[% ELSE %]
<option value="[% itemlostloo.authorised_value %]">[% itemlostloo.lib %]</option>
@ -142,7 +142,7 @@
<select name="damaged" >
<option value="">Choose</option>
[% FOREACH itemdamagedloo IN ITEM_DAT.itemdamagedloop %]
[% IF ( itemdamagedloo.selected ) %]
[% IF itemdamagedloo.authorised_value == ITEM_DAT.damaged %]
<option value="[% itemdamagedloo.authorised_value %]" selected="selected">[% itemdamagedloo.lib %]</option>
[% ELSE %]
<option value="[% itemdamagedloo.authorised_value %]">[% itemdamagedloo.lib %]</option>
@ -173,7 +173,7 @@
<select name="withdrawn" >
<option value="">Choose</option>
[% FOREACH itemwithdrawn IN ITEM_DAT.itemwithdrawnloop %]
[% IF ( itemwithdrawn.selected ) %]
[% IF itemwithdrawn.authorised_value == ITEM_DAT.withdrawn %]
<option value="[% itemwithdrawn.authorised_value %]" selected="selected">[% itemwithdrawn.lib %]</option>
[% ELSE %]
<option value="[% itemwithdrawn.authorised_value %]">[% itemwithdrawn.lib %]</option>
@ -185,7 +185,7 @@
<input type="submit" name="submit" class="submit" value="Set status" /></form>
[% ELSE %]
[% FOREACH itemwithdrawn IN ITEM_DAT.itemwithdrawnloop %]
[% IF ( itemwithdrawn.selected ) %]
[% IF itemwithdrawn.authorised_value == ITEM_DAT.withdrawn %]
[% itemwithdrawn.lib %]
[% END %]
[% END %]

2
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt

@ -1046,7 +1046,7 @@ function select_user(borrowernumber, borrower) {
<select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
<option value=""></option>
[% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
[% IF ( auth_val_loo.selected ) %]
[% IF auth_val_loo.authorised_value == patron_attribute.value %]
<option value="[% auth_val_loo.authorised_value %]" selected="selected">
[% auth_val_loo.lib %]
</option>

3
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt

@ -1,3 +1,4 @@
[% USE AuthorisedValues %]
[% USE Branches %]
[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
@ -94,7 +95,7 @@ $(document).ready(function() {
[% INCLUDE 'serials-toolbar.inc' %]
<h1>Serial collection information for <i>[% bibliotitle %]</i>
[% IF location %] ([% location %] ) [% END %]
[% IF location %] ([% AuthorisedValues.GetByCode( 'LOC', location ) %]) [% END %]
[% IF ( callnumber ) %]callnumber: [% callnumber %][% END %]</h1>
[% END %]

3
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt

@ -1,3 +1,4 @@
[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Serials &rsaquo; Serial edition [% bibliotitle %]</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -89,7 +90,7 @@ $(document).ready(function() {
<div class="yui-b">
<h1>Serial edition <i>[% bibliotitle %]</i>
[% IF location %] ( [% location %] ) [% END %]
[% IF location %] ([% AuthorisedValues.GetByCode('LOC', location) %])[% END %]
[% IF ( callnumber ) %] callnumber: [% callnumber %][% END %]</h1>
[% IF internalnotes %]<p>Nonpublic note: [% internalnotes %]</p>[% END %]
<form method="post" name="f" action="serials-edit.pl" id="serials_edit">

38
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt

@ -98,21 +98,10 @@
[% END %]
</select>
</li>
[% IF locations %]
<li>
<label for="location">Location:</label>
<select name="location_filter">
<option value="">All</option>
[% FOR loc IN locations %]
[% IF loc.selected %]
<option value="[% loc.authorised_value %]" selected="selected">[% loc.lib %]</option>
[% ELSE %]
<option value="[% loc.authorised_value %]">[% loc.lib %]</option>
[% END %]
[% END %]
</select>
</li>
[% END %]
<li>
<label for="location">Location:</label>
[% PROCESS 'av-build-dropbox.inc' name="location_filter", category="LOC", default=location_filter, all=1 %]
</li>
<li>
<label for="to">Expires before:</label>
<input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
@ -418,21 +407,10 @@
[% END %]
</select>
</li>
[% IF locations %]
<li>
<label for="location">Location:</label>
<select name="location_filter">
<option value="">All</option>
[% FOR loc IN locations %]
[% IF loc.selected %]
<option value="[% loc.authorised_value %]" selected="selected">[% loc.lib %]</option>
[% ELSE %]
<option value="[% loc.authorised_value %]">[% loc.lib %]</option>
[% END %]
[% END %]
</select>
</li>
[% END %]
<li>
<label for="location">Location:</label>
[% PROCESS 'av-build-dropbox.inc' name="location_filter", category="LOC", default=location_filter, all=1 %]
</li>
<li>
<label for="to">Expires before:</label>
<input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />

2
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt

@ -600,7 +600,7 @@ $(document).ready(function() {
<select name="location" id="location">
<option value="">None</option>
[% FOREACH locations_loo IN locations_loop %]
[% IF ( locations_loo.selected ) %]
[% IF locations_loo.authorised_value == location %]
<option value="[% locations_loo.authorised_value %]" selected="selected">[% locations_loo.lib %]</option>
[% ELSE %]
<option value="[% locations_loo.authorised_value %]">[% locations_loo.lib %]</option>

20
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt

@ -218,7 +218,7 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o
[% IF ( patron_reason_loop ) %]
<li><span class="label">Reason for suggestion: </span>
[% FOREACH patron_reason_loo IN patron_reason_loop %]
[% IF ( patron_reason_loo.selected ) %][% patron_reason_loo.lib %][% END %]
[% IF patron_reason_loo.authorised_value == patronreason %][% patron_reason_loo.lib %][% END %]
[% END %]
</li>
[% END %]
@ -336,9 +336,21 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o
<li><label for="itemtype">Document type:</label>
[% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
</li>
[% IF ( patron_reason_loop ) %]<li><label for="patronreason">Reason for suggestion: </label><select name="patronreason" id="patronreason"><option value=""> -- Choose -- </option>[% FOREACH patron_reason_loo IN patron_reason_loop %]
[% IF ( patron_reason_loo.selected ) %]<option value="[% patron_reason_loo.authorised_value %]" selected="selected">[% patron_reason_loo.lib %]</option>[% ELSE %]<option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>[% END %]
[% END %]</select></li>[% END %]
[% IF patron_reason_loop %]
<li>
<label for="patronreason">Reason for suggestion: </label>
<select name="patronreason" id="patronreason">
<option value=""> -- Choose -- </option>
[% FOREACH patron_reason_loo IN patron_reason_loop %]
[% IF patron_reason_loo.authorised_value == patronreason %]
<option value="[% patron_reason_loo.authorised_value %]" selected="selected">[% patron_reason_loo.lib %]</option>
[% ELSE %]
<option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>
[% END %]
[% END %]
</select>
</li>
[% END %]
<li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note %]</textarea></li>
</ol>
</fieldset>

4
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc

@ -53,8 +53,8 @@
<label for="ccode">Limit to:</label>
<select name="ccode" id="ccode">
<option value="">All collections</option>
[% FOREACH ccode IN AuthorisedValues.Get('CCODE', selected_ccode, 1) %]
[% IF ccode.selected %]
[% FOREACH ccode IN AuthorisedValues.Get('CCODE', 1) %]
[% IF ccode.authorised_value == selected_ccode %]
<option value="[% ccode.authorised_value %]" selected="selected">
[% ELSE %]
<option value="[% ccode.authorised_value %]">

2
members/memberentry.pl

@ -539,7 +539,7 @@ if($no_categories){ $no_add = 1; }
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE', $data{streettype} );
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
$template->param(
roadtypes => $roadtypes,
cities => $cities,

2
opac/opac-search.pl

@ -267,7 +267,7 @@ foreach my $advanced_srch_type (@advanced_search_types) {
push @advancedsearchesloop, \%search_code;
} else {
# covers all the other cases: non-itemtype authorized values
my $advsearchtypes = GetAuthorisedValues($advanced_srch_type, '', 'opac');
my $advsearchtypes = GetAuthorisedValues($advanced_srch_type, 'opac');
my @authvalueloop;
for my $thisitemtype (@$advsearchtypes) {
my $hiding_key = lc $thisitemtype->{category};

12
serials/serials-collection.pl

@ -119,7 +119,7 @@ if (@subscriptionid){
$subs->{'abouttoexpire'}=abouttoexpire($subs->{'subscriptionid'});
$subs->{'subscriptionexpired'}=HasSubscriptionExpired($subs->{'subscriptionid'});
$subs->{'subscriptionid'} = $subscriptionid; # FIXME - why was this lost ?
$location = GetAuthorisedValues('LOC', $subs->{'location'});
$location = $subs->{'location'};
$callnumber = $subs->{callnumber};
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subs->{periodicity});
my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
@ -148,14 +148,6 @@ foreach my $subscription (@$subscriptiondescs){
$biblionumber = $subscription->{'bibnum'} unless ($biblionumber);
}
# warn "title : $title yearmax : $yearmax nombre d'elements dans le tableau :".scalar(@$subscriptions);
# use Data::Dumper; warn Dumper($subscriptions);
my $locationlib;
foreach (@$location) {
$locationlib = $_->{'lib'} if $_->{'selected'};
}
chop $subscriptionidlist;
$template->param(
subscriptionidlist => $subscriptionidlist,
@ -170,7 +162,7 @@ $template->param(
routing => C4::Context->preference("RoutingSerials"),
subscr=>$query->param('subscriptionid'),
subscriptioncount => $subscriptioncount,
location => $locationlib,
location => $location,
callnumber => $callnumber,
uc(C4::Context->preference("marcflavour")) => 1,
serialsadditems => $subscriptiondescs->[0]{'serialsadditems'},

8
serials/serials-edit.pl

@ -398,11 +398,7 @@ if ( $op and $op eq 'serialchangestatus' ) {
print $query->redirect($redirect);
}
}
my $location = GetAuthorisedValues('LOC', $serialdatalist[0]->{'location'});
my $locationlib;
foreach (@$location) {
$locationlib = $_->{'lib'} if $_->{'selected'};
}
my $location = $serialdatalist[0]->{'location'};
my $default_bib_view = get_default_view();
$template->param(
@ -413,7 +409,7 @@ $template->param(
biblionumber => $serialdatalist[0]->{'biblionumber'},
serialslist => \@serialdatalist,
default_bib_view => $default_bib_view,
location => $locationlib,
location => $location,
(uc(C4::Context->preference("marcflavour"))) => 1
);

2
serials/serials-search.pl

@ -155,7 +155,7 @@ $template->param(
publisher_filter => $publisher,
bookseller_filter => $bookseller,
branch_filter => $branch,
locations => C4::Koha::GetAuthorisedValues('LOC', $location),
location_filter => $location,
expiration_date_filter => $expiration_date_dt,
branches_loop => \@branches_loop,
done_searched => $searched,

2
serials/subscription-add.pl

@ -146,7 +146,7 @@ for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{b
};
}
my $locations_loop = GetAuthorisedValues("LOC",$subs->{'location'});
my $locations_loop = GetAuthorisedValues("LOC");
$template->param(branchloop => $branchloop,
locations_loop=>$locations_loop,

2
suggestion/suggestion.pl

@ -326,7 +326,7 @@ $template->param( branchloop => \@branchloop,
$template->param( returnsuggestedby => $returnsuggestedby );
my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG",$$suggestion_ref{'patronreason'});
my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG");
$template->param(patron_reason_loop=>$patron_reason_loop);
#Budgets management

8
t/db_dependent/Koha.t

@ -106,7 +106,6 @@ subtest 'Authorized Values Tests' => sub {
id => ignore(),
category => 'BUG10656',
authorised_value => 'AAA',
selected => 0,
lib => 'A_STAFF',
lib_opac => 'Z_PUBLIC',
imageurl => '',
@ -115,7 +114,6 @@ subtest 'Authorized Values Tests' => sub {
id => ignore(),
category => 'BUG10656',
authorised_value => 'DDD',
selected => 0,
lib => 'D_STAFF',
lib_opac => undef,
imageurl => '',
@ -124,7 +122,6 @@ subtest 'Authorized Values Tests' => sub {
id => ignore(),
category => 'BUG10656',
authorised_value => 'ZZZ',
selected => 0,
lib => 'Z_STAFF',
lib_opac => 'A_PUBLIC',
imageurl => '',
@ -132,7 +129,7 @@ subtest 'Authorized Values Tests' => sub {
],
'list of authorised values in staff mode sorted by staff label (bug 10656)'
);
$authvals = GetAuthorisedValues('BUG10656', '', 1);
$authvals = GetAuthorisedValues('BUG10656', 1);
cmp_deeply(
$authvals,
[
@ -140,7 +137,6 @@ subtest 'Authorized Values Tests' => sub {
id => ignore(),
category => 'BUG10656',
authorised_value => 'ZZZ',
selected => 0,
lib => 'A_PUBLIC',
lib_opac => 'A_PUBLIC',
imageurl => '',
@ -149,7 +145,6 @@ subtest 'Authorized Values Tests' => sub {
id => ignore(),
category => 'BUG10656',
authorised_value => 'DDD',
selected => 0,
lib => 'D_STAFF',
lib_opac => undef,
imageurl => '',
@ -158,7 +153,6 @@ subtest 'Authorized Values Tests' => sub {
id => ignore(),
category => 'BUG10656',
authorised_value => 'AAA',
selected => 0,
lib => 'Z_PUBLIC',
lib_opac => 'Z_PUBLIC',
imageurl => '',

Loading…
Cancel
Save