|
Lines 99-104
my %cookies = parse CGI::Cookie($cookie);
Link Here
|
| 99 |
my $sessionID = $cookies{'CGISESSID'}->value; |
99 |
my $sessionID = $cookies{'CGISESSID'}->value; |
| 100 |
|
100 |
|
| 101 |
|
101 |
|
|
|
102 |
|
| 103 |
|
| 104 |
# now, build the item form for entering a new item |
| 105 |
my @loop_data =(); |
| 106 |
my $i=0; |
| 107 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
| 108 |
|
| 109 |
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later. |
| 110 |
|
| 111 |
# Adding a default choice, in case the user does not want to modify the branch |
| 112 |
my $nochange_branch = { branchname => '', value => '', selected => 1 }; |
| 113 |
unshift (@$libraries, $nochange_branch); |
| 114 |
|
| 115 |
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); |
| 116 |
|
| 117 |
# Getting list of subfields to keep when restricted batchmod edit is enabled |
| 118 |
my $subfieldsToAllowForBatchmod = C4::Context->preference('SubfieldsToAllowForRestrictedBatchmod'); |
| 119 |
my $allowAllSubfields = ( |
| 120 |
not defined $subfieldsToAllowForBatchmod |
| 121 |
or $subfieldsToAllowForBatchmod eq q|| |
| 122 |
) ? 1 : 0; |
| 123 |
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod); |
| 124 |
|
| 125 |
our @item_subfields; |
| 126 |
foreach my $tag (sort keys %{$tagslib}) { |
| 127 |
# loop through each subfield |
| 128 |
foreach my $subfield (sort keys %{$tagslib->{$tag}}) { |
| 129 |
next if IsMarcStructureInternal( $tagslib->{$tag}{$subfield} ); |
| 130 |
next if (not $allowAllSubfields and $restrictededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow ); |
| 131 |
next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10"); |
| 132 |
# barcode and stocknumber are not meant to be batch-modified |
| 133 |
next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.barcode'; |
| 134 |
next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.stocknumber'; |
| 135 |
my %subfield_data; |
| 136 |
|
| 137 |
push @item_subfields, { subfield => $subfield, lib => $tagslib->{$tag}->{$subfield}->{lib} }; |
| 138 |
|
| 139 |
my $index_subfield = int(rand(1000000)); |
| 140 |
if ($subfield eq '@'){ |
| 141 |
$subfield_data{id} = "tag_".$tag."_subfield_00_".$index_subfield; |
| 142 |
} else { |
| 143 |
$subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; |
| 144 |
} |
| 145 |
$subfield_data{tag} = $tag; |
| 146 |
$subfield_data{subfield} = $subfield; |
| 147 |
$subfield_data{marc_lib} ="<span id=\"error$i\" title=\"".$tagslib->{$tag}->{$subfield}->{lib}."\">".$tagslib->{$tag}->{$subfield}->{lib}."</span>"; |
| 148 |
$subfield_data{mandatory} = $tagslib->{$tag}->{$subfield}->{mandatory}; |
| 149 |
$subfield_data{repeatable} = $tagslib->{$tag}->{$subfield}->{repeatable}; |
| 150 |
my ($x,$value); |
| 151 |
if ( $use_default_values) { |
| 152 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue}; |
| 153 |
# get today date & replace YYYY, MM, DD if provided in the default value |
| 154 |
my $today = dt_from_string; |
| 155 |
my $year = $today->year; |
| 156 |
my $month = $today->month; |
| 157 |
my $day = $today->day; |
| 158 |
$value =~ s/YYYY/$year/g; |
| 159 |
$value =~ s/MM/$month/g; |
| 160 |
$value =~ s/DD/$day/g; |
| 161 |
} |
| 162 |
$subfield_data{visibility} = "display:none;" if (($tagslib->{$tag}->{$subfield}->{hidden} > 4) || ($tagslib->{$tag}->{$subfield}->{hidden} < -4)); |
| 163 |
# testing branch value if IndependentBranches. |
| 164 |
|
| 165 |
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { |
| 166 |
my @authorised_values; |
| 167 |
my %authorised_lib; |
| 168 |
# builds list, depending on authorised value... |
| 169 |
|
| 170 |
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) { |
| 171 |
foreach my $library (@$libraries) { |
| 172 |
push @authorised_values, $library->{branchcode}; |
| 173 |
$authorised_lib{$library->{branchcode}} = $library->{branchname}; |
| 174 |
} |
| 175 |
$value = ""; |
| 176 |
} |
| 177 |
elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) { |
| 178 |
push @authorised_values, ""; |
| 179 |
my $itemtypes = Koha::ItemTypes->search_with_localization; |
| 180 |
while ( my $itemtype = $itemtypes->next ) { |
| 181 |
push @authorised_values, $itemtype->itemtype; |
| 182 |
$authorised_lib{$itemtype->itemtype} = $itemtype->translated_description; |
| 183 |
} |
| 184 |
$value = ""; |
| 185 |
|
| 186 |
#---- class_sources |
| 187 |
} |
| 188 |
elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "cn_source" ) { |
| 189 |
push @authorised_values, "" unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); |
| 190 |
|
| 191 |
my $class_sources = GetClassSources(); |
| 192 |
my $default_source = C4::Context->preference("DefaultClassificationSource"); |
| 193 |
|
| 194 |
foreach my $class_source (sort keys %$class_sources) { |
| 195 |
next unless $class_sources->{$class_source}->{'used'} or |
| 196 |
($value and $class_source eq $value) or |
| 197 |
($class_source eq $default_source); |
| 198 |
push @authorised_values, $class_source; |
| 199 |
$authorised_lib{$class_source} = $class_sources->{$class_source}->{'description'}; |
| 200 |
} |
| 201 |
$value = ''; |
| 202 |
|
| 203 |
#---- "true" authorised value |
| 204 |
} |
| 205 |
else { |
| 206 |
push @authorised_values, ""; # unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); |
| 207 |
|
| 208 |
my @avs = Koha::AuthorisedValues->search({ category => $tagslib->{$tag}->{$subfield}->{authorised_value}, branchcode => $branch_limit },{order_by=>'lib'}); |
| 209 |
for my $av ( @avs ) { |
| 210 |
push @authorised_values, $av->authorised_value; |
| 211 |
$authorised_lib{$av->authorised_value} = $av->lib; |
| 212 |
} |
| 213 |
$value=""; |
| 214 |
} |
| 215 |
$subfield_data{marc_value} = { |
| 216 |
type => 'select', |
| 217 |
id => "tag_".$tag."_subfield_".$subfield."_".$index_subfield, |
| 218 |
name => "field_value", |
| 219 |
values => \@authorised_values, |
| 220 |
labels => \%authorised_lib, |
| 221 |
default => $value, |
| 222 |
}; |
| 223 |
# it's a thesaurus / authority field |
| 224 |
} |
| 225 |
elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { |
| 226 |
$subfield_data{marc_value} = { |
| 227 |
type => 'text1', |
| 228 |
id => $subfield_data{id}, |
| 229 |
value => $value, |
| 230 |
authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
| 231 |
} |
| 232 |
} |
| 233 |
elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { # plugin |
| 234 |
require Koha::FrameworkPlugin; |
| 235 |
my $plugin = Koha::FrameworkPlugin->new( { |
| 236 |
name => $tagslib->{$tag}->{$subfield}->{'value_builder'}, |
| 237 |
item_style => 1, |
| 238 |
}); |
| 239 |
my $temp; |
| 240 |
my $pars= { dbh => $dbh, record => $temp, tagslib => $tagslib, |
| 241 |
id => $subfield_data{id}, tabloop => \@loop_data }; |
| 242 |
$plugin->build( $pars ); |
| 243 |
if( !$plugin->errstr ) { |
| 244 |
$subfield_data{marc_value} = { |
| 245 |
type => 'text2', |
| 246 |
id => $subfield_data{id}, |
| 247 |
value => $value, |
| 248 |
javascript => $plugin->javascript, |
| 249 |
noclick => $plugin->noclick, |
| 250 |
}; |
| 251 |
} else { |
| 252 |
warn $plugin->errstr; |
| 253 |
$subfield_data{marc_value} = { # supply default input form |
| 254 |
type => 'text', |
| 255 |
id => $subfield_data{id}, |
| 256 |
value => $value, |
| 257 |
}; |
| 258 |
} |
| 259 |
} |
| 260 |
elsif ( $tag eq '' ) { # it's an hidden field |
| 261 |
$subfield_data{marc_value} = { |
| 262 |
type => 'hidden', |
| 263 |
id => $subfield_data{id}, |
| 264 |
value => $value, |
| 265 |
}; |
| 266 |
} |
| 267 |
elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? |
| 268 |
$subfield_data{marc_value} = { |
| 269 |
type => 'text', |
| 270 |
id => $subfield_data{id}, |
| 271 |
value => $value, |
| 272 |
}; |
| 273 |
} |
| 274 |
elsif ( length($value) > 100 |
| 275 |
or (C4::Context->preference("marcflavour") eq "UNIMARC" and |
| 276 |
300 <= $tag && $tag < 400 && $subfield eq 'a' ) |
| 277 |
or (C4::Context->preference("marcflavour") eq "MARC21" and |
| 278 |
500 <= $tag && $tag < 600 ) |
| 279 |
) { |
| 280 |
# oversize field (textarea) |
| 281 |
$subfield_data{marc_value} = { |
| 282 |
type => 'textarea', |
| 283 |
id => $subfield_data{id}, |
| 284 |
value => $value, |
| 285 |
}; |
| 286 |
} else { |
| 287 |
# it's a standard field |
| 288 |
$subfield_data{marc_value} = { |
| 289 |
type => 'text', |
| 290 |
id => $subfield_data{id}, |
| 291 |
value => $value, |
| 292 |
}; |
| 293 |
} |
| 294 |
# $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\">"; |
| 295 |
push (@loop_data, \%subfield_data); |
| 296 |
$i++ |
| 297 |
} |
| 298 |
} # -- End foreach tag |
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 102 |
#--- ---------------------------------------------------------------------------- |
304 |
#--- ---------------------------------------------------------------------------- |
| 103 |
if ($op eq "action") { |
305 |
if ($op eq "action") { |
| 104 |
#------------------------------------------------------------------------------- |
306 |
#------------------------------------------------------------------------------- |
|
Lines 294-299
if ($op eq "show"){
Link Here
|
| 294 |
} |
496 |
} |
| 295 |
} |
497 |
} |
| 296 |
|
498 |
|
|
|
499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 297 |
# Flag to tell the template there are valid results, hidden or not |
503 |
# Flag to tell the template there are valid results, hidden or not |
| 298 |
if(scalar(@itemnumbers) > 0){ $template->param("itemresults" => 1); } |
504 |
if(scalar(@itemnumbers) > 0){ $template->param("itemresults" => 1); } |
| 299 |
# Only display the items if there are no more than pref MaxItemsToProcessForBatchMod or MaxItemsToDisplayForBatchDel |
505 |
# Only display the items if there are no more than pref MaxItemsToProcessForBatchMod or MaxItemsToDisplayForBatchDel |
|
Lines 308-507
if ($op eq "show"){
Link Here
|
| 308 |
# Even if we do not display the items, we need the itemnumbers |
514 |
# Even if we do not display the items, we need the itemnumbers |
| 309 |
$template->param(itemnumbers_array => \@itemnumbers); |
515 |
$template->param(itemnumbers_array => \@itemnumbers); |
| 310 |
} |
516 |
} |
| 311 |
# now, build the item form for entering a new item |
|
|
| 312 |
my @loop_data =(); |
| 313 |
my $i=0; |
| 314 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
| 315 |
|
| 316 |
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later. |
| 317 |
|
| 318 |
# Adding a default choice, in case the user does not want to modify the branch |
| 319 |
my $nochange_branch = { branchname => '', value => '', selected => 1 }; |
| 320 |
unshift (@$libraries, $nochange_branch); |
| 321 |
|
| 322 |
my $pref_itemcallnumber = C4::Context->preference('itemcallnumber'); |
| 323 |
|
| 324 |
# Getting list of subfields to keep when restricted batchmod edit is enabled |
| 325 |
my $subfieldsToAllowForBatchmod = C4::Context->preference('SubfieldsToAllowForRestrictedBatchmod'); |
| 326 |
my $allowAllSubfields = ( |
| 327 |
not defined $subfieldsToAllowForBatchmod |
| 328 |
or $subfieldsToAllowForBatchmod eq q|| |
| 329 |
) ? 1 : 0; |
| 330 |
my @subfieldsToAllow = split(/ /, $subfieldsToAllowForBatchmod); |
| 331 |
|
| 332 |
foreach my $tag (sort keys %{$tagslib}) { |
| 333 |
# loop through each subfield |
| 334 |
foreach my $subfield (sort keys %{$tagslib->{$tag}}) { |
| 335 |
next if IsMarcStructureInternal( $tagslib->{$tag}{$subfield} ); |
| 336 |
next if (not $allowAllSubfields and $restrictededition && !grep { $tag . '$' . $subfield eq $_ } @subfieldsToAllow ); |
| 337 |
next if ($tagslib->{$tag}->{$subfield}->{'tab'} ne "10"); |
| 338 |
# barcode and stocknumber are not meant to be batch-modified |
| 339 |
next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.barcode'; |
| 340 |
next if $tagslib->{$tag}->{$subfield}->{'kohafield'} eq 'items.stocknumber'; |
| 341 |
my %subfield_data; |
| 342 |
|
| 343 |
my $index_subfield = int(rand(1000000)); |
| 344 |
if ($subfield eq '@'){ |
| 345 |
$subfield_data{id} = "tag_".$tag."_subfield_00_".$index_subfield; |
| 346 |
} else { |
| 347 |
$subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_subfield; |
| 348 |
} |
| 349 |
$subfield_data{tag} = $tag; |
| 350 |
$subfield_data{subfield} = $subfield; |
| 351 |
$subfield_data{marc_lib} ="<span id=\"error$i\" title=\"".$tagslib->{$tag}->{$subfield}->{lib}."\">".$tagslib->{$tag}->{$subfield}->{lib}."</span>"; |
| 352 |
$subfield_data{mandatory} = $tagslib->{$tag}->{$subfield}->{mandatory}; |
| 353 |
$subfield_data{repeatable} = $tagslib->{$tag}->{$subfield}->{repeatable}; |
| 354 |
my ($x,$value); |
| 355 |
if ( $use_default_values) { |
| 356 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue}; |
| 357 |
# get today date & replace YYYY, MM, DD if provided in the default value |
| 358 |
my $today = dt_from_string; |
| 359 |
my $year = $today->year; |
| 360 |
my $month = $today->month; |
| 361 |
my $day = $today->day; |
| 362 |
$value =~ s/YYYY/$year/g; |
| 363 |
$value =~ s/MM/$month/g; |
| 364 |
$value =~ s/DD/$day/g; |
| 365 |
} |
| 366 |
$subfield_data{visibility} = "display:none;" if (($tagslib->{$tag}->{$subfield}->{hidden} > 4) || ($tagslib->{$tag}->{$subfield}->{hidden} < -4)); |
| 367 |
# testing branch value if IndependentBranches. |
| 368 |
|
| 369 |
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { |
| 370 |
my @authorised_values; |
| 371 |
my %authorised_lib; |
| 372 |
# builds list, depending on authorised value... |
| 373 |
|
| 374 |
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) { |
| 375 |
foreach my $library (@$libraries) { |
| 376 |
push @authorised_values, $library->{branchcode}; |
| 377 |
$authorised_lib{$library->{branchcode}} = $library->{branchname}; |
| 378 |
} |
| 379 |
$value = ""; |
| 380 |
} |
| 381 |
elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) { |
| 382 |
push @authorised_values, ""; |
| 383 |
my $itemtypes = Koha::ItemTypes->search_with_localization; |
| 384 |
while ( my $itemtype = $itemtypes->next ) { |
| 385 |
push @authorised_values, $itemtype->itemtype; |
| 386 |
$authorised_lib{$itemtype->itemtype} = $itemtype->translated_description; |
| 387 |
} |
| 388 |
$value = ""; |
| 389 |
|
| 390 |
#---- class_sources |
| 391 |
} |
| 392 |
elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "cn_source" ) { |
| 393 |
push @authorised_values, "" unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); |
| 394 |
|
| 395 |
my $class_sources = GetClassSources(); |
| 396 |
my $default_source = C4::Context->preference("DefaultClassificationSource"); |
| 397 |
|
| 398 |
foreach my $class_source (sort keys %$class_sources) { |
| 399 |
next unless $class_sources->{$class_source}->{'used'} or |
| 400 |
($value and $class_source eq $value) or |
| 401 |
($class_source eq $default_source); |
| 402 |
push @authorised_values, $class_source; |
| 403 |
$authorised_lib{$class_source} = $class_sources->{$class_source}->{'description'}; |
| 404 |
} |
| 405 |
$value = ''; |
| 406 |
|
| 407 |
#---- "true" authorised value |
| 408 |
} |
| 409 |
else { |
| 410 |
push @authorised_values, ""; # unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); |
| 411 |
|
| 412 |
my @avs = Koha::AuthorisedValues->search({ category => $tagslib->{$tag}->{$subfield}->{authorised_value}, branchcode => $branch_limit },{order_by=>'lib'}); |
| 413 |
for my $av ( @avs ) { |
| 414 |
push @authorised_values, $av->authorised_value; |
| 415 |
$authorised_lib{$av->authorised_value} = $av->lib; |
| 416 |
} |
| 417 |
$value=""; |
| 418 |
} |
| 419 |
$subfield_data{marc_value} = { |
| 420 |
type => 'select', |
| 421 |
id => "tag_".$tag."_subfield_".$subfield."_".$index_subfield, |
| 422 |
name => "field_value", |
| 423 |
values => \@authorised_values, |
| 424 |
labels => \%authorised_lib, |
| 425 |
default => $value, |
| 426 |
}; |
| 427 |
# it's a thesaurus / authority field |
| 428 |
} |
| 429 |
elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) { |
| 430 |
$subfield_data{marc_value} = { |
| 431 |
type => 'text1', |
| 432 |
id => $subfield_data{id}, |
| 433 |
value => $value, |
| 434 |
authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
| 435 |
} |
| 436 |
} |
| 437 |
elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { # plugin |
| 438 |
require Koha::FrameworkPlugin; |
| 439 |
my $plugin = Koha::FrameworkPlugin->new( { |
| 440 |
name => $tagslib->{$tag}->{$subfield}->{'value_builder'}, |
| 441 |
item_style => 1, |
| 442 |
}); |
| 443 |
my $temp; |
| 444 |
my $pars= { dbh => $dbh, record => $temp, tagslib => $tagslib, |
| 445 |
id => $subfield_data{id}, tabloop => \@loop_data }; |
| 446 |
$plugin->build( $pars ); |
| 447 |
if( !$plugin->errstr ) { |
| 448 |
$subfield_data{marc_value} = { |
| 449 |
type => 'text2', |
| 450 |
id => $subfield_data{id}, |
| 451 |
value => $value, |
| 452 |
javascript => $plugin->javascript, |
| 453 |
noclick => $plugin->noclick, |
| 454 |
}; |
| 455 |
} else { |
| 456 |
warn $plugin->errstr; |
| 457 |
$subfield_data{marc_value} = { # supply default input form |
| 458 |
type => 'text', |
| 459 |
id => $subfield_data{id}, |
| 460 |
value => $value, |
| 461 |
}; |
| 462 |
} |
| 463 |
} |
| 464 |
elsif ( $tag eq '' ) { # it's an hidden field |
| 465 |
$subfield_data{marc_value} = { |
| 466 |
type => 'hidden', |
| 467 |
id => $subfield_data{id}, |
| 468 |
value => $value, |
| 469 |
}; |
| 470 |
} |
| 471 |
elsif ( $tagslib->{$tag}->{$subfield}->{'hidden'} ) { # FIXME: shouldn't input type be "hidden" ? |
| 472 |
$subfield_data{marc_value} = { |
| 473 |
type => 'text', |
| 474 |
id => $subfield_data{id}, |
| 475 |
value => $value, |
| 476 |
}; |
| 477 |
} |
| 478 |
elsif ( length($value) > 100 |
| 479 |
or (C4::Context->preference("marcflavour") eq "UNIMARC" and |
| 480 |
300 <= $tag && $tag < 400 && $subfield eq 'a' ) |
| 481 |
or (C4::Context->preference("marcflavour") eq "MARC21" and |
| 482 |
500 <= $tag && $tag < 600 ) |
| 483 |
) { |
| 484 |
# oversize field (textarea) |
| 485 |
$subfield_data{marc_value} = { |
| 486 |
type => 'textarea', |
| 487 |
id => $subfield_data{id}, |
| 488 |
value => $value, |
| 489 |
}; |
| 490 |
} else { |
| 491 |
# it's a standard field |
| 492 |
$subfield_data{marc_value} = { |
| 493 |
type => 'text', |
| 494 |
id => $subfield_data{id}, |
| 495 |
value => $value, |
| 496 |
}; |
| 497 |
} |
| 498 |
# $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\">"; |
| 499 |
push (@loop_data, \%subfield_data); |
| 500 |
$i++ |
| 501 |
} |
| 502 |
} # -- End foreach tag |
| 503 |
|
| 504 |
|
| 505 |
|
517 |
|
| 506 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
518 |
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. |
| 507 |
$template->param( |
519 |
$template->param( |
|
Lines 573-584
sub BuildItemsData{
Link Here
|
| 573 |
&& $tag ne $itemtagfield |
585 |
&& $tag ne $itemtagfield |
| 574 |
&& $subfcode ne $itemtagsubfield); |
586 |
&& $subfcode ne $itemtagsubfield); |
| 575 |
|
587 |
|
| 576 |
$witness{$subfcode} = $tagslib->{$tag}->{$subfcode}->{lib} if ($tagslib->{$tag}->{$subfcode}->{tab} eq 10); |
588 |
$witness{$subfcode} = $tagslib->{$tag}->{$subfcode}->{lib}; |
| 577 |
if ($tagslib->{$tag}->{$subfcode}->{tab} eq 10) { |
589 |
$this_row{$subfcode} = GetAuthorisedValueDesc( $tag, $subfcode, $subfvalue, '', $tagslib ) || $subfvalue; |
| 578 |
$this_row{$subfcode}=GetAuthorisedValueDesc( $tag, |
|
|
| 579 |
$subfcode, $subfvalue, '', $tagslib) |
| 580 |
|| $subfvalue; |
| 581 |
} |
| 582 |
|
590 |
|
| 583 |
$this_row{itemnumber} = $subfvalue if ($tag eq $itemtagfield && $subfcode eq $itemtagsubfield); |
591 |
$this_row{itemnumber} = $subfvalue if ($tag eq $itemtagfield && $subfcode eq $itemtagsubfield); |
| 584 |
} |
592 |
} |
|
Lines 606-612
sub BuildItemsData{
Link Here
|
| 606 |
my @witnesscodessorted=sort keys %witness; |
614 |
my @witnesscodessorted=sort keys %witness; |
| 607 |
for my $row ( @big_array ) { |
615 |
for my $row ( @big_array ) { |
| 608 |
my %row_data; |
616 |
my %row_data; |
| 609 |
my @item_fields = map +{ field => $_ || '' }, @$row{ @witnesscodessorted }; |
617 |
my @item_fields = map +{ field => $_ || '' }, @$row{ map { $_->{subfield} } @item_subfields }; |
|
|
618 |
|
| 610 |
$row_data{item_value} = [ @item_fields ]; |
619 |
$row_data{item_value} = [ @item_fields ]; |
| 611 |
$row_data{itemnumber} = $row->{itemnumber}; |
620 |
$row_data{itemnumber} = $row->{itemnumber}; |
| 612 |
#reporting this_row values |
621 |
#reporting this_row values |
|
Lines 622-628
sub BuildItemsData{
Link Here
|
| 622 |
$row_data{onloan} = $is_on_loan ? 1 : 0; |
631 |
$row_data{onloan} = $is_on_loan ? 1 : 0; |
| 623 |
push(@item_value_loop,\%row_data); |
632 |
push(@item_value_loop,\%row_data); |
| 624 |
} |
633 |
} |
| 625 |
my @header_loop=map { { header_value=> $witness{$_}} } @witnesscodessorted; |
634 |
my @header_loop = @item_subfields; |
| 626 |
|
635 |
|
| 627 |
return { item_loop => \@item_value_loop, item_header_loop => \@header_loop }; |
636 |
return { item_loop => \@item_value_loop, item_header_loop => \@header_loop }; |
| 628 |
} |
637 |
} |
| 629 |
- |
|
|