&getitemtypeimagesrc
&getitemtypeimagelocation
&GetAuthorisedValues
- &GetAuthorisedValueCategories
&GetNormalizedUPC
&GetNormalizedISBN
&GetNormalizedEAN
return \@results;
}
-=head2 GetAuthorisedValueCategories
-
- $auth_categories = GetAuthorisedValueCategories();
-
-Return an arrayref of all of the available authorised
-value categories.
-
-=cut
-
-sub GetAuthorisedValueCategories {
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("SELECT DISTINCT category FROM authorised_values ORDER BY category");
- $sth->execute;
- my @results;
- while (defined (my $category = $sth->fetchrow_array) ) {
- push @results, $category;
- }
- return \@results;
-}
-
=head2 xml_escape
my $escaped_string = C4::Koha::xml_escape($string);
use base qw( Template::Plugin );
use C4::Koha;
+use Koha::AuthorisedValues;
sub GetByCode {
my ( $self, $category, $code, $opac ) = @_;
return C4::Koha::GetAuthvalueDropbox($category, $default);
}
+sub GetCategories {
+ my ( $self, $params ) = @_;
+ my $selected = $params->{selected};
+ my @categories = Koha::AuthorisedValues->new->categories;
+ return [
+ map {
+ {
+ category => $_,
+ ( ( $selected and $selected eq $_ ) ? ( selected => 1 ) : () ),
+ }
+ } @categories
+ ];
+}
+
1;
=head1 NAME
}
$budget_parent = GetBudget($budget_parent_id);
- # populates the YUI planning button
- my $categories = GetAuthorisedValueCategories();
- my @auth_cats_loop1 = ();
- foreach my $category (@$categories) {
- my $entry = { category => $category,
- selected => ( $budget and $budget->{sort1_authcat} eq $category ? 1 : 0 ),
- };
- push @auth_cats_loop1, $entry;
- }
- my @auth_cats_loop2 = ();
- foreach my $category (@$categories) {
- my $entry = { category => $category,
- selected => ( $budget and $budget->{sort2_authcat} eq $category ? 1 : 0 ),
- };
- push @auth_cats_loop2, $entry;
- }
- $template->param(authorised_value_categories1 => \@auth_cats_loop1);
- $template->param(authorised_value_categories2 => \@auth_cats_loop2);
+ # populates the planning button
+ $template->param(
+ sort1_auth => $budget->{sort1_authcat},
+ sort2_auth => $budget->{sort2_authcat},
+ );
if($budget->{'budget_permission'}){
my $budget_permission = "budget_perm_".$budget->{'budget_permission'};
use C4::Koha;
use Koha::Authority::Types;
+use Koha::AuthorisedValues;
use List::MoreUtils qw( uniq );
push @kohafields, "auth_header.".$field;
}
- # build authorised value list
- my $authorised_values = C4::Koha::GetAuthorisedValueCategories;
- unshift @$authorised_values, '';
- push @$authorised_values, 'branches';
- push @$authorised_values, 'itemtypes';
+ # build authorised value category list
+ my @authorised_value_categories = Koha::AuthorisedValues->new->categories;
+ unshift @authorised_value_categories, '';
+ push @authorised_value_categories, 'branches';
+ push @authorised_value_categories, 'itemtypes';
# build thesaurus categories list
my @authtypes = uniq( "", map { $_->authtypecode } Koha::Authority::Types->search );
$row_data{seealso} = $data->{'seealso'};
$row_data{kohafields} = \@kohafields;
$row_data{kohafield} = $data->{'kohafield'};
- $row_data{authorised_values} = $authorised_values;
+ $row_data{authorised_values} = \@authorised_value_categories;
$row_data{authorised_value} = $data->{'authorised_value'};
$row_data{frameworkcodes} = \@authtypes;
$row_data{frameworkcode} = $data->{'frameworkcode'};
$row_data{mandatory} = 0;
$row_data{isurl} = 0;
$row_data{kohafields} = \@kohafields,
- $row_data{authorised_values} = $authorised_values;
+ $row_data{authorised_values} = \@authorised_value_categories;
$row_data{frameworkcodes} = \@authtypes;
$row_data{value_builders} = \@value_builder;
$row_data{row} = $i;
my @tab = $input->multi_param('tab');
my @seealso = $input->multi_param('seealso');
my @ohidden = $input->multi_param('ohidden');
- my @authorised_values = $input->multi_param('authorised_value');
+ my @authorised_value_categories = $input->multi_param('authorised_value');
my $authtypecode = $input->param('authtypecode');
my @frameworkcodes = $input->multi_param('frameworkcode');
my @value_builder =$input->multi_param('value_builder');
my $kohafield =$kohafield[$i];
my $tab =$tab[$i];
my $seealso =$seealso[$i];
- my $authorised_value =$authorised_values[$i];
+ my $authorised_value = $authorised_value_categories[$i];
my $frameworkcode =$frameworkcodes[$i];
my $value_builder=$value_builder[$i];
my $defaultvalue = $defaultvalue[$i];
$data=$sth->fetchrow_hashref;
}
- my @authorised_values = @{C4::Koha::GetAuthorisedValueCategories()}; # function returns array ref, dereferencing
- unshift @authorised_values, ""; # put empty value first
- my $authorised_value = {
- values => \@authorised_values,
- default => $data->{'authorised_value'},
- };
-
if ($searchfield) {
$template->param('searchfield' => $searchfield);
$template->param('heading_modify_tag_p' => 1);
libopac => $data->{'libopac'},
repeatable => "".$data->{'repeatable'},
mandatory => "".$data->{'mandatory'},
- authorised_value => $authorised_value,
+ authorised_value => $data->{authorised_value},
authtypecode => $authtypecode,
);
# END $OP eq ADD_FORM
use C4::Auth;
use C4::Output;
-use C4::Koha;
use Koha::Item::Search::Field qw(GetItemSearchField ModItemSearchField);
}
my $field = GetItemSearchField($name);
-my $authorised_values_categories = C4::Koha::GetAuthorisedValueCategories();
$template->param(
field => $field,
- authorised_values_categories => $authorised_values_categories,
);
output_html_with_http_headers $cgi, $cookie, $template->output;
use C4::Auth;
use C4::Output;
-use C4::Koha;
use Koha::Item::Search::Field qw(AddItemSearchField GetItemSearchFields DelItemSearchField);
}
my @fields = GetItemSearchFields();
-my $authorised_values_categories = C4::Koha::GetAuthorisedValueCategories();
$template->param(
fields => \@fields,
- authorised_values_categories => $authorised_values_categories,
);
output_html_with_http_headers $cgi, $cookie, $template->output;
use C4::Context;
use Koha::Caches;
+use Koha::AuthorisedValues;
use Koha::BiblioFrameworks;
# retrieve parameters
$data=$sth->fetchrow_hashref;
}
- my @authorised_values = @{C4::Koha::GetAuthorisedValueCategories()}; # function returns array ref, dereferencing
- unshift @authorised_values, ""; # put empty value first
- my $authorised_value = {
- values => \@authorised_values,
- default => $data->{'authorised_value'},
- };
-
if ($searchfield) {
$template->param(searchfield => $searchfield);
$template->param(action => "Modify tag");
libopac => $data->{'libopac'},
repeatable => $data->{'repeatable'},
mandatory => $data->{'mandatory'},
- authorised_value => $authorised_value,
+ authorised_value => $data->{authorised_value},
frameworkcode => $frameworkcode,
); # FIXME: move checkboxes to presentation layer
# END $OP eq ADD_FORM
categories => $patron_categories,
branches_loop => \@branches_loop,
);
- authorised_value_category_list($template);
$template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS'));
}
$template->param(
attribute_type_form => 1,
confirm_op => 'add_attribute_type_confirmed',
+ authorised_value_category => $input->param('authorised_value_category'),
);
- authorised_value_category_list($template, $input->param('authorised_value_category'));
}
sub add_update_attribute_type {
if ($attr_type->display_checkout()) {
$template->param(display_checkout_checked => 'checked="checked"');
}
- authorised_value_category_list($template, $attr_type->authorised_value_category());
+ $template->param( authorised_value_category => $attr_type->authorised_value_category() );
$template->param(classes_val_loop => GetAuthorisedValues( 'PA_CLASS' ));
-
my $branches = Koha::Libraries->search( {}, { order_by => ['branchname'] } )->unblessed;
my @branches_loop;
my $selected_branches = $attr_type->branches;
$template->param(available_attribute_types => \@attributes_loop);
$template->param(display_list => 1);
}
-
-sub authorised_value_category_list {
- my $template = shift;
- my $selected = @_ ? shift : '';
-
- my $categories = GetAuthorisedValueCategories();
- my @list = ();
- foreach my $category (@$categories) {
- my $entry = { category => $category };
- $entry->{selected} = 1 if $category eq $selected;
- push @list, $entry;
- }
- $template->param(authorised_value_categories => \@list);
-}
<label for="authorised_values_category">Authorised values category: </label>
<select id="authorised_values_category" name="authorised_values_category">
<option value="">- None -</option>
- [% FOREACH category IN authorised_values_categories %]
- [% IF field && field.authorised_values_category == category %]
- <option value="[% category %]" selected="selected">[% category %]</option>
- [% ELSE %]
- <option value="[% category %]">[% category %]</option>
- [% END %]
- [% END %]
+ [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => field.authorised_values_category ) %]
</select>
</li>
</ol>
[% END%]
[% END %]
[% END %]
+
+[% BLOCK options_for_authorised_value_categories %]
+ [% FOREACH avc IN authorised_value_categories %]
+ [% IF avc.selected %]
+ <option value="[% avc.category %]" selected="selected">[% avc.category %]</option>
+ [% ELSE %]
+ <option value="[% avc.category %]">[% avc.category %]</option>
+ [% END %]
+ [% END %]
+[% END %]
+[% USE AuthorisedValues %]
[% USE Branches %]
[% USE Price %]
[% INCLUDE 'doc-head-open.inc' %]
<label style="white-space: nowrap;" for="authorised_value_category1">Statistic 1 done on: </label>
<select name="sort1_authcat" id="authorised_value_category1">
<option value=""></option>
- [% FOREACH authorised_value_categories IN authorised_value_categories1 %]
- [% IF ( authorised_value_categories.selected ) %]
- <option value="[% authorised_value_categories.category %]" selected="selected">
- [% authorised_value_categories.category %]
- </option>
- [% ELSE %]
- <option value="[% authorised_value_categories.category %]">
- [% authorised_value_categories.category %]
- </option>
- [% END %]
- [% END %]
+ [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => sort1_authcat ) %]
</select>
</li>
<li>
<label style="white-space: nowrap;" for="authorised_value_category2">Statistic 2 done on: </label>
<select name="sort2_authcat" id="authorised_value_category2">
<option value=""></option>
- [% FOREACH authorised_value_categories IN authorised_value_categories2 %]
- [% IF ( authorised_value_categories.selected ) %]
- <option value="[% authorised_value_categories.category %]" selected="selected">
- [% authorised_value_categories.category %]
- </option>
- [% ELSE %]
- <option value="[% authorised_value_categories.category %]">
- [% authorised_value_categories.category %]
- </option>
- [% END %]
- [% END %]
+ [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => sort2_authcat ) %]
</select>
</li>
</ol>
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Authority MARC framework [% IF ( add_form ) %][% IF ( use_heading_flags_p ) %]
[% IF ( heading_modify_tag_p ) %]› [% IF ( authtypecode ) %][% authtypecode %] Framework[% ELSE %]Default framework[% END %] › Modify tag[% END %]
</li>
<li><label for="authorised_value">Authorized value: </label>
<select name="authorised_value" id="authorised_value" size="1">
- [% FOREACH value IN authorised_value.values %]
- [% IF ( value == authorised_value.default ) %]
- <option value="[% value %]" selected="selected">[% value %]</option>
- [% ELSE %]
- <option value="[% value %]">[% value %]</option>
- [% END %]
- [% END %]
+ <option value=""></option>
+ [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
</select>
(if you select a value here, the indicators will be limited to the authorized value list)
</li>
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Item search fields</title>
[% INCLUDE 'doc-head-close.inc' %]
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Item search fields</title>
[% INCLUDE 'doc-head-close.inc' %]
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration ›
[% IF ( add_form ) %]MARC frameworks › [% action %] [% searchfield %][% END %]
</li>
<li><label for="authorised_value">Authorized value: </label>
<select name="authorised_value" id="authorised_value" size="1">
- [% FOREACH value IN authorised_value.values %]
- [% IF ( value == authorised_value.default ) %]
- <option value="[% value %]" selected="selected">[% value %]</option>
- [% ELSE %]
- <option value="[% value %]">[% value %]</option>
- [% END %]
- [% END %]
+ <option value=""></option>
+ [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
</select>
(if you select a value here, the indicators will be limited to the authorized value list)</li>
</ol></fieldset>
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Administration › Patron attribute types
[% IF ( attribute_type_form ) %]
<li><label for="authorised_value_category">Authorized value category: </label>
<select name="authorised_value_category" id="authorised_value_category">
<option value=""></option>
- [% FOREACH authorised_value_categorie IN authorised_value_categories %]
- [% IF ( authorised_value_categorie.selected ) %]
- <option value="[% authorised_value_categorie.category %]" selected="selected">
- [% authorised_value_categorie.category %]
- </option>
- [% ELSE %]
- <option value="[% authorised_value_categorie.category %]">
- [% authorised_value_categorie.category %]
- </option>
- [% END %]
- [% END %]
+ [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value_category ) %]
</select>
<span>Authorized value category; if one is selected, the patron record input page will only allow values
to be chosen from the authorized value list. However, an authorized value list is not
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Serials › Manage new fields for subscriptions
[% IF op == "list" %] › List of fields
<label for="av">Authorised value category: </label>
<select name="authorised_value_category">
<option value="">None</option>
- [% FOR category IN categories %]
- [% IF field.authorised_value_category == category %]
- <option value="[% category %]" selected="selected">[% category %]</option>
- [% ELSE %]
- <option value="[% category %]">[% category %]</option>
- [% END %]
- [% END %]
+ [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => field.authorised_value_category ) %]
</select>
</li>
<li>
}
if ( $op eq 'add_form' ) {
- my $categories = C4::Koha::GetAuthorisedValueCategories();
my $field;
if ( $field_id ) {
$field = Koha::AdditionalField->new( { id => $field_id } )->fetch;
$template->param(
field => $field,
- categories => $categories,
);
}