Bugzilla – Attachment 49825 Details for
Bug 16157
C4::Koha::GetAuthorisedValues should not handle the selected option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 16157: Move the selected flag from GetAuthorisedValues to the templates
PASSED-QA-Bug-16157-Move-the-selected-flag-from-Ge.patch (text/plain), 38.69 KB, created by
Katrin Fischer
on 2016-04-03 14:55:36 UTC
(
hide
)
Description:
[PASSED QA] Bug 16157: Move the selected flag from GetAuthorisedValues to the templates
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2016-04-03 14:55:36 UTC
Size:
38.69 KB
patch
obsolete
>From 78dbbc3fbe66cac911161999b626569d09a392bb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 29 Mar 2016 14:58:01 +0100 >Subject: [PATCH] [PASSED QA] Bug 16157: Move the selected flag from > GetAuthorisedValues to the templates >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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> >--- > C4/Koha.pm | 26 ++------------- > Koha/Template/Plugin/AuthorisedValues.pm | 4 +-- > admin/itemtypes.pl | 2 +- > admin/patron-attr-types.pl | 18 ++++------ > catalogue/detail.pl | 4 +-- > catalogue/moredetail.pl | 6 ++-- > .../prog/en/includes/av-build-dropbox.inc | 2 ++ > .../en/includes/member-main-address-style-de.inc | 2 +- > .../en/includes/member-main-address-style-us.inc | 2 +- > .../prog/en/modules/admin/itemtypes.tt | 6 ++-- > .../prog/en/modules/admin/patron-attr-types.tt | 2 +- > .../prog/en/modules/catalogue/detail.tt | 4 +-- > .../prog/en/modules/catalogue/moredetail.tt | 8 ++--- > .../prog/en/modules/members/memberentrygen.tt | 2 +- > .../prog/en/modules/serials/serials-collection.tt | 3 +- > .../prog/en/modules/serials/serials-edit.tt | 3 +- > .../prog/en/modules/serials/serials-search.tt | 38 +++++----------------- > .../prog/en/modules/serials/subscription-add.tt | 2 +- > .../prog/en/modules/suggestion/suggestion.tt | 20 +++++++++--- > .../bootstrap/en/includes/opac-topissues.inc | 4 +-- > members/memberentry.pl | 2 +- > opac/opac-search.pl | 2 +- > serials/serials-collection.pl | 12 ++----- > serials/serials-edit.pl | 8 ++--- > serials/serials-search.pl | 2 +- > serials/subscription-add.pl | 2 +- > suggestion/suggestion.pl | 2 +- > t/db_dependent/Koha.t | 8 +---- > 28 files changed, 74 insertions(+), 122 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 36e81da..7fe07f1 100644 >--- a/C4/Koha.pm >+++ b/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; > } >diff --git a/Koha/Template/Plugin/AuthorisedValues.pm b/Koha/Template/Plugin/AuthorisedValues.pm >index 36ddce1..62565e0 100644 >--- a/Koha/Template/Plugin/AuthorisedValues.pm >+++ b/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 { >diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl >index c762acc..c8c224e 100755 >--- a/admin/itemtypes.pl >+++ b/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, >diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl >index 8ccf927..b233854 100755 >--- a/admin/patron-attr-types.pl >+++ b/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 ) ); >-} >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index c4afb62..23d6d04 100755 >--- a/catalogue/detail.pl >+++ b/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 >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index aa23799..82044ed 100755 >--- a/catalogue/moredetail.pl >+++ b/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'} ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc >index 0853685..b2d754e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc >+++ b/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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc >index 39a979c..d047400 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc >+++ b/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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc >index 3211684..b7115c6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc >+++ b/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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >index 1c6908c..1e046d7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt >+++ b/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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >index 9401984..3ddb09c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt >+++ b/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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 703529c..232d93b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/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 %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >index d3caf16..cea9cae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/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 %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index aeb7f12..d54c29e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >index 10872951..ad60863 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >+++ b/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 %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >index 2121547..0ff89b2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt >@@ -1,3 +1,4 @@ >+[% USE AuthorisedValues %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › 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"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt >index be67cfa..ed2ac49 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt >+++ b/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" /> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index a3ea8ef..29ae21a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/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> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index 2332694..95c7c7f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/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> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc >index 7324e08..55b57a3 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc >+++ b/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 %]"> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index f14770b..a190740 100755 >--- a/members/memberentry.pl >+++ b/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, >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 72d054f..0e89100 100755 >--- a/opac/opac-search.pl >+++ b/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}; >diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl >index 0ee32de..ad8317e 100755 >--- a/serials/serials-collection.pl >+++ b/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'}, >diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl >index 309527e..2fcd2e3 100755 >--- a/serials/serials-edit.pl >+++ b/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 > > ); >diff --git a/serials/serials-search.pl b/serials/serials-search.pl >index 3e73c56..e5eb0dc 100755 >--- a/serials/serials-search.pl >+++ b/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, >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index 31a1e35..a910354 100755 >--- a/serials/subscription-add.pl >+++ b/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, >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 15c73a4..74e8ab3 100755 >--- a/suggestion/suggestion.pl >+++ b/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 >diff --git a/t/db_dependent/Koha.t b/t/db_dependent/Koha.t >index 74a2227..82fdc5e 100644 >--- a/t/db_dependent/Koha.t >+++ b/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 => '', >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16157
:
49641
|
49672
| 49825