Lines 169-175
sub generate_subfield_form {
Link Here
|
169 |
if ( $subfield->{authorised_value} ) { |
169 |
if ( $subfield->{authorised_value} ) { |
170 |
my @authorised_values; |
170 |
my @authorised_values; |
171 |
my %authorised_lib; |
171 |
my %authorised_lib; |
172 |
my %authorised_restricted; |
172 |
my %restricted_values; |
173 |
|
173 |
|
174 |
# builds list, depending on authorised value... |
174 |
# builds list, depending on authorised value... |
175 |
if ( $subfield->{authorised_value} eq "LOST" ) { |
175 |
if ( $subfield->{authorised_value} eq "LOST" ) { |
Lines 203-218
sub generate_subfield_form {
Link Here
|
203 |
} |
203 |
} |
204 |
} elsif ( $subfield->{authorised_value} eq "itemtypes" ) { |
204 |
} elsif ( $subfield->{authorised_value} eq "itemtypes" ) { |
205 |
push @authorised_values, ""; |
205 |
push @authorised_values, ""; |
206 |
my $itemtypes; |
206 |
my $all_itemtypes = Koha::ItemTypes->search_with_localization; |
|
|
207 |
my $filtered_itemtypes; |
207 |
if ($branch_limit) { |
208 |
if ($branch_limit) { |
208 |
$itemtypes = Koha::ItemTypes->search_with_localization( { branchcode => $branch_limit } ); |
209 |
$filtered_itemtypes = Koha::ItemTypes->search_with_localization( { branchcode => $branch_limit } ); |
209 |
} else { |
210 |
} else { |
210 |
$itemtypes = Koha::ItemTypes->search_with_localization; |
211 |
$filtered_itemtypes = $all_itemtypes; |
211 |
} |
212 |
} |
212 |
while ( my $itemtype = $itemtypes->next ) { |
213 |
while (my $itemtype = $filtered_itemtypes->next) { |
213 |
push @authorised_values, $itemtype->itemtype; |
214 |
push @authorised_values, $itemtype->itemtype; |
214 |
$authorised_lib{ $itemtype->itemtype } = $itemtype->translated_description; |
215 |
$authorised_lib{ $itemtype->itemtype } = $itemtype->translated_description; |
215 |
} |
216 |
} |
|
|
217 |
while (my $itemtype = $all_itemtypes->next) { |
218 |
if (!grep { $_ eq $itemtype->itemtype } @authorised_values) { |
219 |
$restricted_values{ $itemtype->itemtype } = $itemtype->translated_description; |
220 |
} |
221 |
} |
216 |
|
222 |
|
217 |
if ( !$value && $biblionumber ) { |
223 |
if ( !$value && $biblionumber ) { |
218 |
my $itype_sth = $dbh->prepare("SELECT itemtype FROM biblioitems WHERE biblionumber = ?"); |
224 |
my $itype_sth = $dbh->prepare("SELECT itemtype FROM biblioitems WHERE biblionumber = ?"); |
Lines 249-257
sub generate_subfield_form {
Link Here
|
249 |
my $av = GetAuthorisedValues( $subfield->{authorised_value}, undef, { 'no_limit' => 1 } ); |
255 |
my $av = GetAuthorisedValues( $subfield->{authorised_value}, undef, { 'no_limit' => 1 } ); |
250 |
for my $r (@$av) { |
256 |
for my $r (@$av) { |
251 |
push @authorised_values, $r->{authorised_value}; |
257 |
push @authorised_values, $r->{authorised_value}; |
252 |
|
258 |
$authorised_lib{ $r->{authorised_value} } = $r->{lib}; |
253 |
$authorised_lib{ $r->{authorised_value} } = $r->{lib}; |
259 |
$restricted_values{ $r->{authorised_value} } = $r->{restricted}; |
254 |
$authorised_restricted{ $r->{authorised_value} } = $r->{restricted}; |
|
|
255 |
} |
260 |
} |
256 |
} |
261 |
} |
257 |
|
262 |
|
Lines 273-279
sub generate_subfield_form {
Link Here
|
273 |
id => "tag_" . $tag . "_subfield_" . $subfieldtag . "_" . $index_subfield, |
278 |
id => "tag_" . $tag . "_subfield_" . $subfieldtag . "_" . $index_subfield, |
274 |
values => \@authorised_values, |
279 |
values => \@authorised_values, |
275 |
labels => \%authorised_lib, |
280 |
labels => \%authorised_lib, |
276 |
restricted => \%authorised_restricted, |
281 |
restricted => \%restricted_values, |
277 |
default => $value, |
282 |
default => $value, |
278 |
( |
283 |
( |
279 |
( grep { $_ eq $subfield->{authorised_value} } (qw(branches itemtypes cn_source)) ) |
284 |
( grep { $_ eq $subfield->{authorised_value} } (qw(branches itemtypes cn_source)) ) |