|
Lines 28-34
use C4::Biblio;
Link Here
|
| 28 |
use C4::Search; |
28 |
use C4::Search; |
| 29 |
use C4::AuthoritiesMarc; |
29 |
use C4::AuthoritiesMarc; |
| 30 |
use C4::Context; |
30 |
use C4::Context; |
| 31 |
use MARC::Record; |
|
|
| 32 |
use C4::Log; |
31 |
use C4::Log; |
| 33 |
use C4::Koha; |
32 |
use C4::Koha; |
| 34 |
use C4::ClassSource; |
33 |
use C4::ClassSource; |
|
Lines 36-48
use C4::ImportBatch;
Link Here
|
| 36 |
use C4::Charset; |
35 |
use C4::Charset; |
| 37 |
use Koha::BiblioFrameworks; |
36 |
use Koha::BiblioFrameworks; |
| 38 |
use Koha::DateUtils; |
37 |
use Koha::DateUtils; |
| 39 |
|
|
|
| 40 |
use Koha::ItemTypes; |
38 |
use Koha::ItemTypes; |
|
|
39 |
use Koha::MetadataRecord::History; |
| 41 |
use Koha::Libraries; |
40 |
use Koha::Libraries; |
| 42 |
|
|
|
| 43 |
use Koha::BiblioFrameworks; |
| 44 |
|
| 45 |
use Date::Calc qw(Today); |
41 |
use Date::Calc qw(Today); |
|
|
42 |
use MARC::Record; |
| 46 |
use MARC::File::USMARC; |
43 |
use MARC::File::USMARC; |
| 47 |
use MARC::File::XML; |
44 |
use MARC::File::XML; |
| 48 |
use URI::Escape; |
45 |
use URI::Escape; |
|
Lines 271-280
sub GetMandatoryFieldZ3950 {
Link Here
|
| 271 |
=cut |
268 |
=cut |
| 272 |
|
269 |
|
| 273 |
sub create_input { |
270 |
sub create_input { |
| 274 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi ) = @_; |
271 |
|
| 275 |
|
272 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi, $history ) = @_; |
|
|
273 |
|
| 276 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
274 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
| 277 |
|
275 |
|
|
|
276 |
my $taghistory = $history->{$tag}->{$subfield}; |
| 277 |
|
| 278 |
$value =~ s/"/"/g; |
| 279 |
|
| 278 |
# if there is no value provided but a default value in parameters, get it |
280 |
# if there is no value provided but a default value in parameters, get it |
| 279 |
if ( $value eq '' ) { |
281 |
if ( $value eq '' ) { |
| 280 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; |
282 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; |
|
Lines 290-296
sub create_input {
Link Here
|
| 290 |
# And <<USER>> with surname (?) |
292 |
# And <<USER>> with surname (?) |
| 291 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
293 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
| 292 |
$value=~s/<<USER>>/$username/g; |
294 |
$value=~s/<<USER>>/$username/g; |
| 293 |
|
295 |
|
| 294 |
} |
296 |
} |
| 295 |
my $dbh = C4::Context->dbh; |
297 |
my $dbh = C4::Context->dbh; |
| 296 |
|
298 |
|
|
Lines 313-318
sub create_input {
Link Here
|
| 313 |
value => $value, |
315 |
value => $value, |
| 314 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
316 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
| 315 |
random => CreateKey(), |
317 |
random => CreateKey(), |
|
|
318 |
history => $taghistory, |
| 316 |
); |
319 |
); |
| 317 |
|
320 |
|
| 318 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
321 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
|
Lines 370-375
sub create_input {
Link Here
|
| 370 |
maxlength => $subfield_data{maxlength}, |
373 |
maxlength => $subfield_data{maxlength}, |
| 371 |
readonly => ($is_readonly) ? 1 : 0, |
374 |
readonly => ($is_readonly) ? 1 : 0, |
| 372 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
375 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
|
|
376 |
history => $taghistory, |
| 373 |
}; |
377 |
}; |
| 374 |
|
378 |
|
| 375 |
# it's a plugin field |
379 |
# it's a plugin field |
|
Lines 391-396
sub create_input {
Link Here
|
| 391 |
maxlength => $subfield_data{maxlength}, |
395 |
maxlength => $subfield_data{maxlength}, |
| 392 |
javascript => $plugin->javascript, |
396 |
javascript => $plugin->javascript, |
| 393 |
noclick => $plugin->noclick, |
397 |
noclick => $plugin->noclick, |
|
|
398 |
history => $taghistory, |
| 394 |
}; |
399 |
}; |
| 395 |
} else { |
400 |
} else { |
| 396 |
warn $plugin->errstr; |
401 |
warn $plugin->errstr; |
|
Lines 403-408
sub create_input {
Link Here
|
| 403 |
size => 67, |
408 |
size => 67, |
| 404 |
maxlength => $subfield_data{maxlength}, |
409 |
maxlength => $subfield_data{maxlength}, |
| 405 |
readonly => 0, |
410 |
readonly => 0, |
|
|
411 |
history => $taghistory, |
| 406 |
}; |
412 |
}; |
| 407 |
} |
413 |
} |
| 408 |
|
414 |
|
|
Lines 415-420
sub create_input {
Link Here
|
| 415 |
value => $value, |
421 |
value => $value, |
| 416 |
size => 67, |
422 |
size => 67, |
| 417 |
maxlength => $subfield_data{maxlength}, |
423 |
maxlength => $subfield_data{maxlength}, |
|
|
424 |
history => $taghistory, |
| 418 |
}; |
425 |
}; |
| 419 |
|
426 |
|
| 420 |
} |
427 |
} |
|
Lines 435-440
sub create_input {
Link Here
|
| 435 |
id => $subfield_data{id}, |
442 |
id => $subfield_data{id}, |
| 436 |
name => $subfield_data{id}, |
443 |
name => $subfield_data{id}, |
| 437 |
value => $value, |
444 |
value => $value, |
|
|
445 |
history => $taghistory, |
| 438 |
}; |
446 |
}; |
| 439 |
|
447 |
|
| 440 |
} |
448 |
} |
|
Lines 447-452
sub create_input {
Link Here
|
| 447 |
size => 67, |
455 |
size => 67, |
| 448 |
maxlength => $subfield_data{maxlength}, |
456 |
maxlength => $subfield_data{maxlength}, |
| 449 |
readonly => 0, |
457 |
readonly => 0, |
|
|
458 |
history => $taghistory, |
| 450 |
}; |
459 |
}; |
| 451 |
|
460 |
|
| 452 |
} |
461 |
} |
|
Lines 472-482
sub format_indicator {
Link Here
|
| 472 |
} |
481 |
} |
| 473 |
|
482 |
|
| 474 |
sub build_tabs { |
483 |
sub build_tabs { |
| 475 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
484 |
my ( $template, $record, $dbh, $encoding, $input, $history ) = @_; |
| 476 |
|
485 |
|
| 477 |
# fill arrays |
486 |
# fill arrays |
| 478 |
my @loop_data = (); |
487 |
my @loop_data = (); |
| 479 |
my $tag; |
488 |
#my $tag; |
| 480 |
|
489 |
|
| 481 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
490 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
| 482 |
my $query = "SELECT authorised_value, lib |
491 |
my $query = "SELECT authorised_value, lib |
|
Lines 532-538
sub build_tabs {
Link Here
|
| 532 |
} |
541 |
} |
| 533 |
# loop through each field |
542 |
# loop through each field |
| 534 |
foreach my $field (@fields) { |
543 |
foreach my $field (@fields) { |
| 535 |
|
|
|
| 536 |
my @subfields_data; |
544 |
my @subfields_data; |
| 537 |
if ( $tag < 10 ) { |
545 |
if ( $tag < 10 ) { |
| 538 |
my ( $value, $subfield ); |
546 |
my ( $value, $subfield ); |
|
Lines 552-558
sub build_tabs {
Link Here
|
| 552 |
@subfields_data, |
560 |
@subfields_data, |
| 553 |
&create_input( |
561 |
&create_input( |
| 554 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
562 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
| 555 |
$authorised_values_sth,$input |
563 |
$authorised_values_sth,$input, $history |
| 556 |
) |
564 |
) |
| 557 |
); |
565 |
); |
| 558 |
} |
566 |
} |
|
Lines 567-573
sub build_tabs {
Link Here
|
| 567 |
@subfields_data, |
575 |
@subfields_data, |
| 568 |
&create_input( |
576 |
&create_input( |
| 569 |
$tag, $subfield, $value, $index_tag, $tabloop, |
577 |
$tag, $subfield, $value, $index_tag, $tabloop, |
| 570 |
$record, $authorised_values_sth,$input |
578 |
$record, $authorised_values_sth,$input, $history |
| 571 |
) |
579 |
) |
| 572 |
); |
580 |
); |
| 573 |
} |
581 |
} |
|
Lines 595-601
sub build_tabs {
Link Here
|
| 595 |
@subfields_data, |
603 |
@subfields_data, |
| 596 |
&create_input( |
604 |
&create_input( |
| 597 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
605 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
| 598 |
$authorised_values_sth,$input |
606 |
$authorised_values_sth,$input, $history |
| 599 |
) |
607 |
) |
| 600 |
); |
608 |
); |
| 601 |
} |
609 |
} |
|
Lines 642-652
sub build_tabs {
Link Here
|
| 642 |
# always include in the form regardless of the hidden setting - bug 2206 |
650 |
# always include in the form regardless of the hidden setting - bug 2206 |
| 643 |
next |
651 |
next |
| 644 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
652 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
|
|
653 |
|
| 645 |
push( |
654 |
push( |
| 646 |
@subfields_data, |
655 |
@subfields_data, |
| 647 |
&create_input( |
656 |
&create_input( |
| 648 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
657 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
| 649 |
$authorised_values_sth,$input |
658 |
$authorised_values_sth,$input, $history |
| 650 |
) |
659 |
) |
| 651 |
); |
660 |
); |
| 652 |
} |
661 |
} |
|
Lines 664-670
sub build_tabs {
Link Here
|
| 664 |
tagfirstsubfield => $subfields_data[0], |
673 |
tagfirstsubfield => $subfields_data[0], |
| 665 |
fixedfield => $tag < 10?1:0, |
674 |
fixedfield => $tag < 10?1:0, |
| 666 |
); |
675 |
); |
| 667 |
|
676 |
|
| 668 |
push @loop_data, \%tag_data ; |
677 |
push @loop_data, \%tag_data ; |
| 669 |
} |
678 |
} |
| 670 |
} |
679 |
} |
|
Lines 767-772
$mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode);
Link Here
|
| 767 |
# -- Global |
776 |
# -- Global |
| 768 |
|
777 |
|
| 769 |
my $record = -1; |
778 |
my $record = -1; |
|
|
779 |
my $history = undef; |
| 770 |
my $encoding = ""; |
780 |
my $encoding = ""; |
| 771 |
my ( |
781 |
my ( |
| 772 |
$biblionumbertagfield, |
782 |
$biblionumbertagfield, |
|
Lines 777-783
my (
Link Here
|
| 777 |
); |
787 |
); |
| 778 |
|
788 |
|
| 779 |
if (($biblionumber) && !($breedingid)){ |
789 |
if (($biblionumber) && !($breedingid)){ |
| 780 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
790 |
($record, $history) = GetMarcBiblioHistory($biblionumber); |
| 781 |
} |
791 |
} |
| 782 |
if ($breedingid) { |
792 |
if ($breedingid) { |
| 783 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
793 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
|
Lines 906-912
if ( $op eq "addbiblio" ) {
Link Here
|
| 906 |
} |
916 |
} |
| 907 |
} else { |
917 |
} else { |
| 908 |
# it may be a duplicate, warn the user and do nothing |
918 |
# it may be a duplicate, warn the user and do nothing |
| 909 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
919 |
build_tabs ($template, $record, $dbh,$encoding, $input, $history); |
| 910 |
$template->param( |
920 |
$template->param( |
| 911 |
biblionumber => $biblionumber, |
921 |
biblionumber => $biblionumber, |
| 912 |
biblioitemnumber => $biblioitemnumber, |
922 |
biblioitemnumber => $biblioitemnumber, |
|
Lines 953-959
elsif ( $op eq "delete" ) {
Link Here
|
| 953 |
$record = $urecord; |
963 |
$record = $urecord; |
| 954 |
}; |
964 |
}; |
| 955 |
} |
965 |
} |
| 956 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
966 |
|
|
|
967 |
build_tabs( $template, $record, $dbh, $encoding, $input, $history ); |
| 957 |
$template->param( |
968 |
$template->param( |
| 958 |
biblionumber => $biblionumber, |
969 |
biblionumber => $biblionumber, |
| 959 |
biblionumbertagfield => $biblionumbertagfield, |
970 |
biblionumbertagfield => $biblionumbertagfield, |