View | Details | Raw Unified | Return to bug 16157
Collapse All | Expand All

(-)a/C4/Koha.pm (-23 / +3 lines)
Lines 998-1032 sub GetAuthValCodeFromField { Link Here
998
998
999
=head2 GetAuthorisedValues
999
=head2 GetAuthorisedValues
1000
1000
1001
  $authvalues = GetAuthorisedValues([$category], [$selected]);
1001
  $authvalues = GetAuthorisedValues([$category]);
1002
1002
1003
This function returns all authorised values from the'authorised_value' table in a reference to array of hashrefs.
1003
This function returns all authorised values from the'authorised_value' table in a reference to array of hashrefs.
1004
1004
1005
C<$category> returns authorised values for just one category (optional).
1005
C<$category> returns authorised values for just one category (optional).
1006
1006
1007
C<$selected> adds a "selected => 1" entry to the hash if the
1008
authorised_value matches it. B<NOTE:> this feature should be considered
1009
deprecated as it may be removed in the future.
1010
1011
C<$opac> If set to a true value, displays OPAC descriptions rather than normal ones when they exist.
1007
C<$opac> If set to a true value, displays OPAC descriptions rather than normal ones when they exist.
1012
1008
1013
=cut
1009
=cut
1014
1010
1015
sub GetAuthorisedValues {
1011
sub GetAuthorisedValues {
1016
    my ( $category, $selected, $opac ) = @_;
1012
    my ( $category, $opac ) = @_;
1017
1018
    # TODO: the "selected" feature should be replaced by a utility function
1019
    # somewhere else, it doesn't belong in here. For starters it makes
1020
    # caching much more complicated. Or just let the UI logic handle it, it's
1021
    # what it's for.
1022
1013
1023
    # Is this cached already?
1014
    # Is this cached already?
1024
    $opac = $opac ? 1 : 0;    # normalise to be safe
1015
    $opac = $opac ? 1 : 0;    # normalise to be safe
1025
    my $branch_limit =
1016
    my $branch_limit =
1026
      C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
1017
      C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
1027
    my $selected_key = defined($selected) ? $selected : '';
1028
    my $cache_key =
1018
    my $cache_key =
1029
      "AuthorisedValues-$category-$selected_key-$opac-$branch_limit";
1019
      "AuthorisedValues-$category-$opac-$branch_limit";
1030
    my $cache  = Koha::Cache->get_instance();
1020
    my $cache  = Koha::Cache->get_instance();
1031
    my $result = $cache->get_from_cache($cache_key);
1021
    my $result = $cache->get_from_cache($cache_key);
1032
    return $result if $result;
1022
    return $result if $result;
Lines 1063-1075 sub GetAuthorisedValues { Link Here
1063
1053
1064
    $sth->execute( @where_args );
1054
    $sth->execute( @where_args );
1065
    while (my $data=$sth->fetchrow_hashref) {
1055
    while (my $data=$sth->fetchrow_hashref) {
1066
        if ( defined $selected and $selected eq $data->{authorised_value} ) {
1067
            $data->{selected} = 1;
1068
        }
1069
        else {
1070
            $data->{selected} = 0;
1071
        }
1072
1073
        if ($opac && $data->{lib_opac}) {
1056
        if ($opac && $data->{lib_opac}) {
1074
            $data->{lib} = $data->{lib_opac};
1057
            $data->{lib} = $data->{lib_opac};
1075
        }
1058
        }
Lines 1077-1085 sub GetAuthorisedValues { Link Here
1077
    }
1060
    }
1078
    $sth->finish;
1061
    $sth->finish;
1079
1062
1080
    # We can't cache for long because of that "selected" thing which
1081
    # makes it impossible to clear the cache without iterating through every
1082
    # value, which sucks. This'll cover this request, and not a whole lot more.
1083
    $cache->set_in_cache( $cache_key, \@results, { deepcopy => 1, expiry => 5 } );
1063
    $cache->set_in_cache( $cache_key, \@results, { deepcopy => 1, expiry => 5 } );
1084
    return \@results;
1064
    return \@results;
1085
}
1065
}
(-)a/Koha/Template/Plugin/AuthorisedValues.pm (-2 / +2 lines)
Lines 29-36 sub GetByCode { Link Here
29
}
29
}
30
30
31
sub Get {
31
sub Get {
32
    my ( $self, $category, $selected, $opac ) = @_;
32
    my ( $self, $category, $opac ) = @_;
33
    return GetAuthorisedValues( $category, $selected, $opac );
33
    return GetAuthorisedValues( $category, $opac );
34
}
34
}
35
35
36
sub GetAuthValueDropbox {
36
sub GetAuthValueDropbox {
(-)a/admin/itemtypes.pl (-1 / +1 lines)
Lines 59-65 undef($sip_media_type) if defined($sip_media_type) and $sip_media_type =~ /^\s*$ Link Here
59
if ( $op eq 'add_form' ) {
59
if ( $op eq 'add_form' ) {
60
    my $itemtype = Koha::ItemTypes->find($itemtype_code);
60
    my $itemtype = Koha::ItemTypes->find($itemtype_code);
61
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
61
    my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) );
62
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT", ( $itemtype ? $itemtype->searchcategory : '' ) );
62
    my $searchcategory = GetAuthorisedValues("ITEMTYPECAT");
63
    my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') );
63
    my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') );
64
    $template->param(
64
    $template->param(
65
        itemtype  => $itemtype,
65
        itemtype  => $itemtype,
(-)a/admin/patron-attr-types.pl (-11 / +7 lines)
Lines 99-105 sub add_attribute_type_form { Link Here
99
        branches_loop => \@branches_loop,
99
        branches_loop => \@branches_loop,
100
    );
100
    );
101
    authorised_value_category_list($template);
101
    authorised_value_category_list($template);
102
    pa_classes($template);
102
    $template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS'));
103
}
103
}
104
104
105
sub error_add_attribute_type_form {
105
sub error_add_attribute_type_form {
Lines 255-261 sub edit_attribute_type_form { Link Here
255
        $template->param(display_checkout_checked => 'checked="checked"');
255
        $template->param(display_checkout_checked => 'checked="checked"');
256
    }
256
    }
257
    authorised_value_category_list($template, $attr_type->authorised_value_category());
257
    authorised_value_category_list($template, $attr_type->authorised_value_category());
258
    pa_classes( $template, $attr_type->class );
258
    $template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS' ));
259
259
260
260
261
    my $branches = GetBranches;
261
    my $branches = GetBranches;
Lines 271-278 sub edit_attribute_type_form { Link Here
271
    }
271
    }
272
    $template->param( branches_loop => \@branches_loop );
272
    $template->param( branches_loop => \@branches_loop );
273
273
274
    $template->param ( category_code => $attr_type->category_code );
274
    $template->param(
275
    $template->param ( category_description => $attr_type->category_description );
275
        category_code        => $attr_type->category_code,
276
        category_class       => $attr_type->class,
277
        category_description => $attr_type->category_description,
278
    );
276
279
277
    $template->param(
280
    $template->param(
278
        attribute_type_form => 1,
281
        attribute_type_form => 1,
Lines 325-334 sub authorised_value_category_list { Link Here
325
    }
328
    }
326
    $template->param(authorised_value_categories => \@list);
329
    $template->param(authorised_value_categories => \@list);
327
}
330
}
328
329
sub pa_classes {
330
    my $template = shift;
331
    my $selected = @_ ? shift : '';
332
333
    $template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS', $selected ) );
334
}
(-)a/catalogue/detail.pl (-2 / +2 lines)
Lines 218-226 foreach my $item (@items) { Link Here
218
218
219
    $item->{datedue} = format_sqldatetime($item->{datedue});
219
    $item->{datedue} = format_sqldatetime($item->{datedue});
220
    # item damaged, lost, withdrawn loops
220
    # item damaged, lost, withdrawn loops
221
    $item->{itemlostloop} = GetAuthorisedValues($authvalcode_items_itemlost, $item->{itemlost}) if $authvalcode_items_itemlost;
221
    $item->{itemlostloop} = GetAuthorisedValues($authvalcode_items_itemlost) if $authvalcode_items_itemlost;
222
    if ($item->{damaged}) {
222
    if ($item->{damaged}) {
223
        $item->{itemdamagedloop} = GetAuthorisedValues($authvalcode_items_damaged, $item->{damaged}) if $authvalcode_items_damaged;
223
        $item->{itemdamagedloop} = GetAuthorisedValues($authvalcode_items_damaged) if $authvalcode_items_damaged;
224
    }
224
    }
225
    #get shelf location and collection code description if they are authorised value.
225
    #get shelf location and collection code description if they are authorised value.
226
    # same thing for copy number
226
    # same thing for copy number
(-)a/catalogue/moredetail.pl (-3 / +3 lines)
Lines 137-145 foreach ( keys %{$data} ) { Link Here
137
($itemnumber) and @items = (grep {$_->{'itemnumber'} == $itemnumber} @items);
137
($itemnumber) and @items = (grep {$_->{'itemnumber'} == $itemnumber} @items);
138
foreach my $item (@items){
138
foreach my $item (@items){
139
    $item->{object} = Koha::Items->find( $item->{itemnumber} );
139
    $item->{object} = Koha::Items->find( $item->{itemnumber} );
140
    $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw),$item->{itemlost}) if GetAuthValCode('items.itemlost',$fw);
140
    $item->{itemlostloop}= GetAuthorisedValues(GetAuthValCode('items.itemlost',$fw)) if GetAuthValCode('items.itemlost',$fw);
141
    $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw),$item->{damaged}) if GetAuthValCode('items.damaged',$fw);
141
    $item->{itemdamagedloop}= GetAuthorisedValues(GetAuthValCode('items.damaged',$fw)) if GetAuthValCode('items.damaged',$fw);
142
    $item->{itemwithdrawnloop}= GetAuthorisedValues(GetAuthValCode('items.withdrawn',$fw),$item->{withdrawn}) if GetAuthValCode('items.withdrawn',$fw);
142
    $item->{itemwithdrawnloop}= GetAuthorisedValues(GetAuthValCode('items.withdrawn',$fw)) if GetAuthValCode('items.withdrawn',$fw);
143
    $item->{'collection'}              = $ccodes->{ $item->{ccode} } if ($ccodes);
143
    $item->{'collection'}              = $ccodes->{ $item->{ccode} } if ($ccodes);
144
    $item->{'itype'}                   = $itemtypes->{ $item->{'itype'} }->{'translated_description'};
144
    $item->{'itype'}                   = $itemtypes->{ $item->{'itype'} }->{'translated_description'};
145
    $item->{'replacementprice'}        = sprintf( "%.2f", $item->{'replacementprice'} );
145
    $item->{'replacementprice'}        = sprintf( "%.2f", $item->{'replacementprice'} );
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/av-build-dropbox.inc (+2 lines)
Lines 6-11 Link Here
6
    default: the default authorised value to select
6
    default: the default authorised value to select
7
    class: the CSS class of the select element
7
    class: the CSS class of the select element
8
    size: the size to use for the input (generated if the authorised value category does not exist).
8
    size: the size to use for the input (generated if the authorised value category does not exist).
9
    all: add a "All" entry
9
%]
10
%]
10
11
11
[% SET avs = AuthorisedValues.GetAuthValueDropbox( category, default ) %]
12
[% SET avs = AuthorisedValues.GetAuthValueDropbox( category, default ) %]
Lines 16-21 Link Here
16
17
17
[% IF avs %]
18
[% IF avs %]
18
  <select id="[% name %]" name="[% name %]" class="[% class %]" >
19
  <select id="[% name %]" name="[% name %]" class="[% class %]" >
20
  [% IF all %]<option value="All">All</option>[% END %]
19
  [% FOR av IN avs %]
21
  [% FOR av IN avs %]
20
    [% IF av.default %]
22
    [% IF av.default %]
21
      <option value="[% av.value %]" selected="selected">[% av.label | html_entity %]</option>
23
      <option value="[% av.value %]" selected="selected">[% av.label | html_entity %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-de.inc (-1 / +1 lines)
Lines 12-18 Link Here
12
      <select name="streettype">
12
      <select name="streettype">
13
        <option value=""></option>
13
        <option value=""></option>
14
        [% FOR roadtype IN roadtypes %]
14
        [% FOR roadtype IN roadtypes %]
15
          [% IF roadtype.selected %]
15
          [% IF roadtype.authorised_value == streettype %]
16
            <option value="[% roadtype.authorised_value %]" selected="selected">[% roadtype.lib %]</option>
16
            <option value="[% roadtype.authorised_value %]" selected="selected">[% roadtype.lib %]</option>
17
          [% ELSE %]
17
          [% ELSE %]
18
            <option value="[% roadtype.authorised_value %]">[% roadtype.lib %]</option>
18
            <option value="[% roadtype.authorised_value %]">[% roadtype.lib %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/member-main-address-style-us.inc (-1 / +1 lines)
Lines 24-30 Link Here
24
      <select name="streettype">
24
      <select name="streettype">
25
        <option value=""></option>
25
        <option value=""></option>
26
        [% FOR roadtype IN roadtypes %]
26
        [% FOR roadtype IN roadtypes %]
27
          [% IF roadtype.selected %]
27
          [% IF roadtype.authorised_value == streettype%]
28
            <option value="[% roadtype.authorised_value %]" selected="selected">[% roadtype.lib %]</option>
28
            <option value="[% roadtype.authorised_value %]" selected="selected">[% roadtype.lib %]</option>
29
          [% ELSE %]
29
          [% ELSE %]
30
            <option value="[% roadtype.authorised_value %]">[% roadtype.lib %]</option>
30
            <option value="[% roadtype.authorised_value %]">[% roadtype.lib %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tt (-3 / +3 lines)
Lines 149-155 Item types administration Link Here
149
                    <select id="searchcategory" name="searchcategory">
149
                    <select id="searchcategory" name="searchcategory">
150
                    <option value="">None</option>
150
                    <option value="">None</option>
151
                        [% FOREACH cat IN searchcategory %]
151
                        [% FOREACH cat IN searchcategory %]
152
                            [% IF cat.selected %]
152
                            [% IF cat.authorised_value == itemtype.searchcategory %]
153
                                <option value="[% cat.authorised_value %]" selected="selected">
153
                                <option value="[% cat.authorised_value %]" selected="selected">
154
                                    [% cat.lib %]
154
                                    [% cat.lib %]
155
                                </option>
155
                                </option>
Lines 278-285 Item types administration Link Here
278
                    <label for="sip_media_type">SIP media type: </label>
278
                    <label for="sip_media_type">SIP media type: </label>
279
                    <select id="sip_media_type" name="sip_media_type">
279
                    <select id="sip_media_type" name="sip_media_type">
280
                        <option value=""></option>
280
                        <option value=""></option>
281
                        [% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE', itemtype.sip_media_type ) %]
281
                        [% FOREACH a IN AuthorisedValues.Get('SIP_MEDIA_TYPE') %]
282
                            [% IF a.selected %]
282
                            [% IF a.authorised_value == itemtype.sip_media_type %]
283
                                <option value="[% a.authorised_value %]" selected="selected">[% a.lib %]</option>
283
                                <option value="[% a.authorised_value %]" selected="selected">[% a.lib %]</option>
284
                            [% ELSE %]
284
                            [% ELSE %]
285
                                <option value="[% a.authorised_value %]">[% a.lib %]</option>
285
                                <option value="[% a.authorised_value %]">[% a.lib %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt (-1 / +1 lines)
Lines 220-226 function CheckAttributeTypeForm(f) { Link Here
220
            <select name="class">
220
            <select name="class">
221
                <option value="" />
221
                <option value="" />
222
                [% FOREACH class IN classes_val_loop %]
222
                [% FOREACH class IN classes_val_loop %]
223
                    [% IF ( class.selected ) %]
223
                    [% IF class.authorised_value == category_class %]
224
                        <option value="[% class.authorised_value %]" selected="selected">
224
                        <option value="[% class.authorised_value %]" selected="selected">
225
                            [% class.lib %]
225
                            [% class.lib %]
226
                        </option>
226
                        </option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-2 / +2 lines)
Lines 650-656 function verify_images() { Link Here
650
                        [% IF ( item.itemlost ) %]
650
                        [% IF ( item.itemlost ) %]
651
                            [% IF ( item.itemlostloop ) %]
651
                            [% IF ( item.itemlostloop ) %]
652
                                [% FOREACH itemlostloo IN item.itemlostloop %]
652
                                [% FOREACH itemlostloo IN item.itemlostloop %]
653
                                    [% IF ( itemlostloo.selected ) %]
653
                                    [% IF itemlostloo.authorised_value == item.itemlost %]
654
                                        <span class="lost">[% itemlostloo.lib %]</span>
654
                                        <span class="lost">[% itemlostloo.lib %]</span>
655
                                    [% END %]
655
                                    [% END %]
656
                                [% END %]
656
                                [% END %]
Lines 666-672 function verify_images() { Link Here
666
                        [% IF ( item.damaged ) %]
666
                        [% IF ( item.damaged ) %]
667
                            [% IF ( item.itemdamagedloop ) %]
667
                            [% IF ( item.itemdamagedloop ) %]
668
                                [% FOREACH itemdamagedloo IN item.itemdamagedloop %]
668
                                [% FOREACH itemdamagedloo IN item.itemdamagedloop %]
669
                                    [% IF ( itemdamagedloo.selected ) %]
669
                                    [% IF itemdamagedloo.authorised_value == item.damaged %]
670
                                        <span class="dmg">[% itemdamagedloo.lib %]</span>
670
                                        <span class="dmg">[% itemdamagedloo.lib %]</span>
671
                                    [% END %]
671
                                    [% END %]
672
                                [% END %]
672
                                [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt (-4 / +4 lines)
Lines 109-115 Link Here
109
                        <select name="itemlost" >
109
                        <select name="itemlost" >
110
                                    <option value="">Choose</option>
110
                                    <option value="">Choose</option>
111
                        [% FOREACH itemlostloo IN ITEM_DAT.itemlostloop %]
111
                        [% FOREACH itemlostloo IN ITEM_DAT.itemlostloop %]
112
                            [% IF ( itemlostloo.selected ) %]
112
                            [% IF itemlostloo.authorised_value == ITEM_DAT.itemlost %]
113
                                    <option value="[% itemlostloo.authorised_value %]" selected="selected">[% itemlostloo.lib %]</option>
113
                                    <option value="[% itemlostloo.authorised_value %]" selected="selected">[% itemlostloo.lib %]</option>
114
                            [% ELSE %]
114
                            [% ELSE %]
115
                                    <option value="[% itemlostloo.authorised_value %]">[% itemlostloo.lib %]</option>
115
                                    <option value="[% itemlostloo.authorised_value %]">[% itemlostloo.lib %]</option>
Lines 142-148 Link Here
142
                    <select name="damaged" >
142
                    <select name="damaged" >
143
                    <option value="">Choose</option>
143
                    <option value="">Choose</option>
144
            [% FOREACH itemdamagedloo IN ITEM_DAT.itemdamagedloop %]
144
            [% FOREACH itemdamagedloo IN ITEM_DAT.itemdamagedloop %]
145
                [% IF ( itemdamagedloo.selected ) %]
145
                [% IF itemdamagedloo.authorised_value == ITEM_DAT.damaged %]
146
                    <option value="[% itemdamagedloo.authorised_value %]" selected="selected">[% itemdamagedloo.lib %]</option>
146
                    <option value="[% itemdamagedloo.authorised_value %]" selected="selected">[% itemdamagedloo.lib %]</option>
147
                [% ELSE %]
147
                [% ELSE %]
148
                    <option value="[% itemdamagedloo.authorised_value %]">[% itemdamagedloo.lib %]</option>
148
                    <option value="[% itemdamagedloo.authorised_value %]">[% itemdamagedloo.lib %]</option>
Lines 173-179 Link Here
173
                            <select name="withdrawn" >
173
                            <select name="withdrawn" >
174
                                <option value="">Choose</option>
174
                                <option value="">Choose</option>
175
                                [% FOREACH itemwithdrawn IN ITEM_DAT.itemwithdrawnloop %]
175
                                [% FOREACH itemwithdrawn IN ITEM_DAT.itemwithdrawnloop %]
176
                                    [% IF ( itemwithdrawn.selected ) %]
176
                                    [% IF itemwithdrawn.authorised_value == ITEM_DAT.withdrawn %]
177
                                        <option value="[% itemwithdrawn.authorised_value %]" selected="selected">[% itemwithdrawn.lib %]</option>
177
                                        <option value="[% itemwithdrawn.authorised_value %]" selected="selected">[% itemwithdrawn.lib %]</option>
178
                                    [% ELSE %]
178
                                    [% ELSE %]
179
                                        <option value="[% itemwithdrawn.authorised_value %]">[% itemwithdrawn.lib %]</option>
179
                                        <option value="[% itemwithdrawn.authorised_value %]">[% itemwithdrawn.lib %]</option>
Lines 185-191 Link Here
185
                            <input type="submit" name="submit" class="submit" value="Set status" /></form>
185
                            <input type="submit" name="submit" class="submit" value="Set status" /></form>
186
                    [% ELSE %]
186
                    [% ELSE %]
187
                        [% FOREACH itemwithdrawn IN ITEM_DAT.itemwithdrawnloop %]
187
                        [% FOREACH itemwithdrawn IN ITEM_DAT.itemwithdrawnloop %]
188
                            [% IF ( itemwithdrawn.selected ) %]
188
                            [% IF itemwithdrawn.authorised_value == ITEM_DAT.withdrawn %]
189
                                [% itemwithdrawn.lib %]
189
                                [% itemwithdrawn.lib %]
190
                            [% END %]
190
                            [% END %]
191
                        [% END %]
191
                        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +1 lines)
Lines 1046-1052 function select_user(borrowernumber, borrower) { Link Here
1046
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1046
                            <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]">
1047
                                <option value=""></option>
1047
                                <option value=""></option>
1048
                                [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
1048
                                [% FOREACH auth_val_loo IN patron_attribute.auth_val_loop %]
1049
                                    [% IF ( auth_val_loo.selected ) %]
1049
                                    [% IF auth_val_loo.authorised_value == patron_attribute.value %]
1050
                                        <option value="[% auth_val_loo.authorised_value %]" selected="selected">
1050
                                        <option value="[% auth_val_loo.authorised_value %]" selected="selected">
1051
                                            [% auth_val_loo.lib %]
1051
                                            [% auth_val_loo.lib %]
1052
                                        </option>
1052
                                        </option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (-1 / +2 lines)
Lines 1-3 Link Here
1
[% USE AuthorisedValues %]
1
[% USE Branches %]
2
[% USE Branches %]
2
[% USE KohaDates %]
3
[% USE KohaDates %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
Lines 94-100 $(document).ready(function() { Link Here
94
	[% INCLUDE 'serials-toolbar.inc' %]
95
	[% INCLUDE 'serials-toolbar.inc' %]
95
96
96
	<h1>Serial collection information for  <i>[% bibliotitle %]</i>
97
	<h1>Serial collection information for  <i>[% bibliotitle %]</i>
97
        [% IF location %] ([% location %] ) [% END %]
98
        [% IF location %] ([% AuthorisedValues.GetByCode( 'LOC', location ) %]) [% END %]
98
		[% IF ( callnumber ) %]callnumber: [% callnumber %][% END %]</h1>
99
		[% IF ( callnumber ) %]callnumber: [% callnumber %][% END %]</h1>
99
[% END %]
100
[% END %]
100
101
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (-1 / +2 lines)
Lines 1-3 Link Here
1
[% USE AuthorisedValues %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Serials &rsaquo; Serial edition [% bibliotitle %]</title>
3
<title>Koha &rsaquo; Serials &rsaquo; Serial edition [% bibliotitle %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 89-95 $(document).ready(function() { Link Here
89
	<div class="yui-b">
90
	<div class="yui-b">
90
91
91
<h1>Serial edition <i>[% bibliotitle %]</i>
92
<h1>Serial edition <i>[% bibliotitle %]</i>
92
	[% IF location %] ( [% location %] ) [% END %]
93
    [% IF location %] ([% AuthorisedValues.GetByCode('LOC', location) %])[% END %]
93
    [% IF ( callnumber ) %] callnumber: [% callnumber %][% END %]</h1>
94
    [% IF ( callnumber ) %] callnumber: [% callnumber %][% END %]</h1>
94
[% IF internalnotes %]<p>Nonpublic note: [% internalnotes %]</p>[% END %]
95
[% IF internalnotes %]<p>Nonpublic note: [% internalnotes %]</p>[% END %]
95
<form method="post" name="f" action="serials-edit.pl" id="serials_edit">
96
<form method="post" name="f" action="serials-edit.pl" id="serials_edit">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt (-30 / +8 lines)
Lines 98-118 Link Here
98
                    [% END %]
98
                    [% END %]
99
                  </select>
99
                  </select>
100
                </li>
100
                </li>
101
                [% IF locations %]
101
                <li>
102
                  <li>
102
                  <label for="location">Location:</label>
103
                    <label for="location">Location:</label>
103
                  [% PROCESS 'av-build-dropbox.inc' name="location_filter", category="LOC", default=location_filter, all=1 %]
104
                    <select name="location_filter">
104
                </li>
105
                      <option value="">All</option>
106
                      [% FOR loc IN locations %]
107
                        [% IF loc.selected %]
108
                          <option value="[% loc.authorised_value %]" selected="selected">[% loc.lib %]</option>
109
                        [% ELSE %]
110
                          <option value="[% loc.authorised_value %]">[% loc.lib %]</option>
111
                        [% END %]
112
                      [% END %]
113
                    </select>
114
                  </li>
115
                [% END %]
116
                <li>
105
                <li>
117
                  <label for="to">Expires before:</label>
106
                  <label for="to">Expires before:</label>
118
                  <input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
107
                  <input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
Lines 418-438 Link Here
418
                    [% END %]
407
                    [% END %]
419
                  </select>
408
                  </select>
420
                </li>
409
                </li>
421
                [% IF locations %]
410
                <li>
422
                  <li>
411
                  <label for="location">Location:</label>
423
                    <label for="location">Location:</label>
412
                  [% PROCESS 'av-build-dropbox.inc' name="location_filter", category="LOC", default=location_filter, all=1 %]
424
                    <select name="location_filter">
413
                </li>
425
                      <option value="">All</option>
426
                      [% FOR loc IN locations %]
427
                        [% IF loc.selected %]
428
                          <option value="[% loc.authorised_value %]" selected="selected">[% loc.lib %]</option>
429
                        [% ELSE %]
430
                          <option value="[% loc.authorised_value %]">[% loc.lib %]</option>
431
                        [% END %]
432
                      [% END %]
433
                    </select>
434
                  </li>
435
                [% END %]
436
                <li>
414
                <li>
437
                  <label for="to">Expires before:</label>
415
                  <label for="to">Expires before:</label>
438
                  <input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
416
                  <input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-1 / +1 lines)
Lines 600-606 $(document).ready(function() { Link Here
600
                                    <select name="location" id="location">
600
                                    <select name="location" id="location">
601
                                        <option value="">None</option>
601
                                        <option value="">None</option>
602
                                        [% FOREACH locations_loo IN locations_loop %]
602
                                        [% FOREACH locations_loo IN locations_loop %]
603
                                            [% IF ( locations_loo.selected ) %]
603
                                            [% IF locations_loo.authorised_value == location %]
604
                                                <option value="[% locations_loo.authorised_value %]" selected="selected">[% locations_loo.lib %]</option>
604
                                                <option value="[% locations_loo.authorised_value %]" selected="selected">[% locations_loo.lib %]</option>
605
                                            [% ELSE %]
605
                                            [% ELSE %]
606
                                                <option value="[% locations_loo.authorised_value %]">[% locations_loo.lib %]</option>
606
                                                <option value="[% locations_loo.authorised_value %]">[% locations_loo.lib %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt (-4 / +16 lines)
Lines 218-224 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
218
        [% IF ( patron_reason_loop ) %]
218
        [% IF ( patron_reason_loop ) %]
219
          <li><span class="label">Reason for suggestion: </span>
219
          <li><span class="label">Reason for suggestion: </span>
220
            [% FOREACH patron_reason_loo IN patron_reason_loop %]
220
            [% FOREACH patron_reason_loo IN patron_reason_loop %]
221
              [% IF ( patron_reason_loo.selected ) %][% patron_reason_loo.lib %][% END %]
221
              [% IF patron_reason_loo.authorised_value == patronreason %][% patron_reason_loo.lib %][% END %]
222
            [% END %]
222
            [% END %]
223
          </li>
223
          </li>
224
        [% END %]
224
        [% END %]
Lines 336-344 h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o Link Here
336
        <li><label for="itemtype">Document type:</label>
336
        <li><label for="itemtype">Document type:</label>
337
            [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
337
            [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
338
        </li>
338
        </li>
339
        [% 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 %]
339
        [% IF patron_reason_loop %]
340
                [% 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 %]
340
            <li>
341
           [% END %]</select></li>[% END %]
341
                <label for="patronreason">Reason for suggestion: </label>
342
                <select name="patronreason" id="patronreason">
343
                    <option value=""> -- Choose -- </option>
344
                    [% FOREACH patron_reason_loo IN patron_reason_loop %]
345
                        [% IF patron_reason_loo.authorised_value == patronreason %]
346
                            <option value="[% patron_reason_loo.authorised_value %]" selected="selected">[% patron_reason_loo.lib %]</option>
347
                        [% ELSE %]
348
                            <option value="[% patron_reason_loo.authorised_value %]">[% patron_reason_loo.lib %]</option>
349
                        [% END %]
350
                    [% END %]
351
                </select>
352
            </li>
353
        [% END %]
342
        <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note %]</textarea></li>
354
        <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note %]</textarea></li>
343
        </ol>
355
        </ol>
344
    </fieldset>
356
    </fieldset>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc (-2 / +2 lines)
Lines 53-60 Link Here
53
                        <label for="ccode">Limit to:</label>
53
                        <label for="ccode">Limit to:</label>
54
                        <select name="ccode" id="ccode">
54
                        <select name="ccode" id="ccode">
55
                            <option value="">All collections</option>
55
                            <option value="">All collections</option>
56
                            [% FOREACH ccode IN AuthorisedValues.Get('CCODE', selected_ccode, 1) %]
56
                            [% FOREACH ccode IN AuthorisedValues.Get('CCODE', 1) %]
57
                                [% IF ccode.selected %]
57
                                [% IF ccode.authorised_value == selected_ccode %]
58
                                    <option value="[% ccode.authorised_value %]" selected="selected">
58
                                    <option value="[% ccode.authorised_value %]" selected="selected">
59
                                [% ELSE %]
59
                                [% ELSE %]
60
                                    <option value="[% ccode.authorised_value %]">
60
                                    <option value="[% ccode.authorised_value %]">
(-)a/members/memberentry.pl (-1 / +1 lines)
Lines 539-545 if($no_categories){ $no_add = 1; } Link Here
539
539
540
540
541
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
541
my $cities = Koha::Cities->search( {}, { order_by => 'city_name' } );
542
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE', $data{streettype} );
542
my $roadtypes = C4::Koha::GetAuthorisedValues( 'ROADTYPE' );
543
$template->param(
543
$template->param(
544
    roadtypes => $roadtypes,
544
    roadtypes => $roadtypes,
545
    cities    => $cities,
545
    cities    => $cities,
(-)a/opac/opac-search.pl (-1 / +1 lines)
Lines 267-273 foreach my $advanced_srch_type (@advanced_search_types) { Link Here
267
        push @advancedsearchesloop, \%search_code;
267
        push @advancedsearchesloop, \%search_code;
268
    } else {
268
    } else {
269
    # covers all the other cases: non-itemtype authorized values
269
    # covers all the other cases: non-itemtype authorized values
270
       my $advsearchtypes = GetAuthorisedValues($advanced_srch_type, '', 'opac');
270
       my $advsearchtypes = GetAuthorisedValues($advanced_srch_type, 'opac');
271
        my @authvalueloop;
271
        my @authvalueloop;
272
	for my $thisitemtype (@$advsearchtypes) {
272
	for my $thisitemtype (@$advsearchtypes) {
273
            my $hiding_key = lc $thisitemtype->{category};
273
            my $hiding_key = lc $thisitemtype->{category};
(-)a/serials/serials-collection.pl (-10 / +2 lines)
Lines 119-125 if (@subscriptionid){ Link Here
119
    $subs->{'abouttoexpire'}=abouttoexpire($subs->{'subscriptionid'});
119
    $subs->{'abouttoexpire'}=abouttoexpire($subs->{'subscriptionid'});
120
    $subs->{'subscriptionexpired'}=HasSubscriptionExpired($subs->{'subscriptionid'});
120
    $subs->{'subscriptionexpired'}=HasSubscriptionExpired($subs->{'subscriptionid'});
121
    $subs->{'subscriptionid'} = $subscriptionid;  # FIXME - why was this lost ?
121
    $subs->{'subscriptionid'} = $subscriptionid;  # FIXME - why was this lost ?
122
	$location = GetAuthorisedValues('LOC', $subs->{'location'});
122
    $location = $subs->{'location'};
123
	$callnumber = $subs->{callnumber};
123
	$callnumber = $subs->{callnumber};
124
    my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subs->{periodicity});
124
    my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subs->{periodicity});
125
    my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
125
    my $numberpattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subs->{numberpattern});
Lines 148-161 foreach my $subscription (@$subscriptiondescs){ Link Here
148
  $biblionumber = $subscription->{'bibnum'} unless ($biblionumber);
148
  $biblionumber = $subscription->{'bibnum'} unless ($biblionumber);
149
}
149
}
150
150
151
# warn "title : $title yearmax : $yearmax nombre d'elements dans le tableau :".scalar(@$subscriptions);
152
#  use Data::Dumper; warn Dumper($subscriptions);
153
my $locationlib;
154
foreach (@$location) {
155
    $locationlib = $_->{'lib'} if $_->{'selected'};
156
}
157
158
159
chop $subscriptionidlist;
151
chop $subscriptionidlist;
160
$template->param(
152
$template->param(
161
          subscriptionidlist => $subscriptionidlist,
153
          subscriptionidlist => $subscriptionidlist,
Lines 170-176 $template->param( Link Here
170
          routing => C4::Context->preference("RoutingSerials"),
162
          routing => C4::Context->preference("RoutingSerials"),
171
          subscr=>$query->param('subscriptionid'),
163
          subscr=>$query->param('subscriptionid'),
172
          subscriptioncount => $subscriptioncount,
164
          subscriptioncount => $subscriptioncount,
173
          location	       => $locationlib,
165
          location => $location,
174
          callnumber	       => $callnumber,
166
          callnumber	       => $callnumber,
175
          uc(C4::Context->preference("marcflavour")) => 1,
167
          uc(C4::Context->preference("marcflavour")) => 1,
176
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
168
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
(-)a/serials/serials-edit.pl (-6 / +2 lines)
Lines 398-408 if ( $op and $op eq 'serialchangestatus' ) { Link Here
398
        print $query->redirect($redirect);
398
        print $query->redirect($redirect);
399
    }
399
    }
400
}
400
}
401
my $location = GetAuthorisedValues('LOC', $serialdatalist[0]->{'location'});
401
my $location = $serialdatalist[0]->{'location'};
402
my $locationlib;
403
foreach (@$location) {
404
    $locationlib = $_->{'lib'} if $_->{'selected'};
405
}
406
my $default_bib_view = get_default_view();
402
my $default_bib_view = get_default_view();
407
403
408
$template->param(
404
$template->param(
Lines 413-419 $template->param( Link Here
413
    biblionumber    => $serialdatalist[0]->{'biblionumber'},
409
    biblionumber    => $serialdatalist[0]->{'biblionumber'},
414
    serialslist     => \@serialdatalist,
410
    serialslist     => \@serialdatalist,
415
    default_bib_view => $default_bib_view,
411
    default_bib_view => $default_bib_view,
416
    location         => $locationlib,
412
    location         => $location,
417
    (uc(C4::Context->preference("marcflavour"))) => 1
413
    (uc(C4::Context->preference("marcflavour"))) => 1
418
414
419
);
415
);
(-)a/serials/serials-search.pl (-1 / +1 lines)
Lines 155-161 $template->param( Link Here
155
    publisher_filter => $publisher,
155
    publisher_filter => $publisher,
156
    bookseller_filter  => $bookseller,
156
    bookseller_filter  => $bookseller,
157
    branch_filter => $branch,
157
    branch_filter => $branch,
158
    locations     => C4::Koha::GetAuthorisedValues('LOC', $location),
158
    location_filter => $location,
159
    expiration_date_filter => $expiration_date_dt,
159
    expiration_date_filter => $expiration_date_dt,
160
    branches_loop => \@branches_loop,
160
    branches_loop => \@branches_loop,
161
    done_searched => $searched,
161
    done_searched => $searched,
(-)a/serials/subscription-add.pl (-1 / +1 lines)
Lines 146-152 for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{b Link Here
146
    };
146
    };
147
}
147
}
148
148
149
my $locations_loop = GetAuthorisedValues("LOC",$subs->{'location'});
149
my $locations_loop = GetAuthorisedValues("LOC");
150
150
151
$template->param(branchloop => $branchloop,
151
$template->param(branchloop => $branchloop,
152
    locations_loop=>$locations_loop,
152
    locations_loop=>$locations_loop,
(-)a/suggestion/suggestion.pl (-1 / +1 lines)
Lines 326-332 $template->param( branchloop => \@branchloop, Link Here
326
326
327
$template->param( returnsuggestedby => $returnsuggestedby );
327
$template->param( returnsuggestedby => $returnsuggestedby );
328
328
329
my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG",$$suggestion_ref{'patronreason'});
329
my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG");
330
$template->param(patron_reason_loop=>$patron_reason_loop);
330
$template->param(patron_reason_loop=>$patron_reason_loop);
331
331
332
#Budgets management
332
#Budgets management
(-)a/t/db_dependent/Koha.t (-8 / +1 lines)
Lines 106-112 subtest 'Authorized Values Tests' => sub { Link Here
106
                    id => ignore(),
106
                    id => ignore(),
107
                    category => 'BUG10656',
107
                    category => 'BUG10656',
108
                    authorised_value => 'AAA',
108
                    authorised_value => 'AAA',
109
                    selected => 0,
110
                    lib => 'A_STAFF',
109
                    lib => 'A_STAFF',
111
                    lib_opac => 'Z_PUBLIC',
110
                    lib_opac => 'Z_PUBLIC',
112
                    imageurl => '',
111
                    imageurl => '',
Lines 115-121 subtest 'Authorized Values Tests' => sub { Link Here
115
                    id => ignore(),
114
                    id => ignore(),
116
                    category => 'BUG10656',
115
                    category => 'BUG10656',
117
                    authorised_value => 'DDD',
116
                    authorised_value => 'DDD',
118
                    selected => 0,
119
                    lib => 'D_STAFF',
117
                    lib => 'D_STAFF',
120
                    lib_opac => undef,
118
                    lib_opac => undef,
121
                    imageurl => '',
119
                    imageurl => '',
Lines 124-130 subtest 'Authorized Values Tests' => sub { Link Here
124
                    id => ignore(),
122
                    id => ignore(),
125
                    category => 'BUG10656',
123
                    category => 'BUG10656',
126
                    authorised_value => 'ZZZ',
124
                    authorised_value => 'ZZZ',
127
                    selected => 0,
128
                    lib => 'Z_STAFF',
125
                    lib => 'Z_STAFF',
129
                    lib_opac => 'A_PUBLIC',
126
                    lib_opac => 'A_PUBLIC',
130
                    imageurl => '',
127
                    imageurl => '',
Lines 132-138 subtest 'Authorized Values Tests' => sub { Link Here
132
            ],
129
            ],
133
            'list of authorised values in staff mode sorted by staff label (bug 10656)'
130
            'list of authorised values in staff mode sorted by staff label (bug 10656)'
134
        );
131
        );
135
        $authvals = GetAuthorisedValues('BUG10656', '', 1);
132
        $authvals = GetAuthorisedValues('BUG10656', 1);
136
        cmp_deeply(
133
        cmp_deeply(
137
            $authvals,
134
            $authvals,
138
            [
135
            [
Lines 140-146 subtest 'Authorized Values Tests' => sub { Link Here
140
                    id => ignore(),
137
                    id => ignore(),
141
                    category => 'BUG10656',
138
                    category => 'BUG10656',
142
                    authorised_value => 'ZZZ',
139
                    authorised_value => 'ZZZ',
143
                    selected => 0,
144
                    lib => 'A_PUBLIC',
140
                    lib => 'A_PUBLIC',
145
                    lib_opac => 'A_PUBLIC',
141
                    lib_opac => 'A_PUBLIC',
146
                    imageurl => '',
142
                    imageurl => '',
Lines 149-155 subtest 'Authorized Values Tests' => sub { Link Here
149
                    id => ignore(),
145
                    id => ignore(),
150
                    category => 'BUG10656',
146
                    category => 'BUG10656',
151
                    authorised_value => 'DDD',
147
                    authorised_value => 'DDD',
152
                    selected => 0,
153
                    lib => 'D_STAFF',
148
                    lib => 'D_STAFF',
154
                    lib_opac => undef,
149
                    lib_opac => undef,
155
                    imageurl => '',
150
                    imageurl => '',
Lines 158-164 subtest 'Authorized Values Tests' => sub { Link Here
158
                    id => ignore(),
153
                    id => ignore(),
159
                    category => 'BUG10656',
154
                    category => 'BUG10656',
160
                    authorised_value => 'AAA',
155
                    authorised_value => 'AAA',
161
                    selected => 0,
162
                    lib => 'Z_PUBLIC',
156
                    lib => 'Z_PUBLIC',
163
                    lib_opac => 'Z_PUBLIC',
157
                    lib_opac => 'Z_PUBLIC',
164
                    imageurl => '',
158
                    imageurl => '',
165
- 

Return to bug 16157