|
Lines 47-58
use Koha::BiblioFrameworks;
Link Here
|
| 47 |
use Koha::DateUtils qw( dt_from_string ); |
47 |
use Koha::DateUtils qw( dt_from_string ); |
| 48 |
|
48 |
|
| 49 |
use Koha::Biblios; |
49 |
use Koha::Biblios; |
|
|
50 |
use C4::Koha; |
| 50 |
use Koha::ItemTypes; |
51 |
use Koha::ItemTypes; |
|
|
52 |
use Koha::MetadataRecord::History; |
| 51 |
use Koha::Libraries; |
53 |
use Koha::Libraries; |
| 52 |
|
|
|
| 53 |
use Koha::BiblioFrameworks; |
54 |
use Koha::BiblioFrameworks; |
| 54 |
use Koha::Patrons; |
55 |
use Koha::Patrons; |
| 55 |
|
|
|
| 56 |
use MARC::File::USMARC; |
56 |
use MARC::File::USMARC; |
| 57 |
use MARC::File::XML; |
57 |
use MARC::File::XML; |
| 58 |
use URI::Escape qw( uri_escape_utf8 ); |
58 |
use URI::Escape qw( uri_escape_utf8 ); |
|
Lines 288-297
sub GetMandatoryFieldZ3950 {
Link Here
|
| 288 |
=cut |
288 |
=cut |
| 289 |
|
289 |
|
| 290 |
sub create_input { |
290 |
sub create_input { |
| 291 |
my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth,$cgi ) = @_; |
291 |
my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth,$cgi, $history ) = @_; |
| 292 |
|
292 |
|
| 293 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
293 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
| 294 |
|
294 |
|
|
|
295 |
my $taghistory = $history->{$tag}->{$subfield}; |
| 296 |
|
| 297 |
$value =~ s/"/"/g; |
| 298 |
|
| 295 |
# Apply optional framework default value when it is a new record, |
299 |
# Apply optional framework default value when it is a new record, |
| 296 |
# or when editing as new (duplicating a record), |
300 |
# or when editing as new (duplicating a record), |
| 297 |
# or when changing a record's framework, |
301 |
# or when changing a record's framework, |
|
Lines 343-348
sub create_input {
Link Here
|
| 343 |
value => $value, |
347 |
value => $value, |
| 344 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
348 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
| 345 |
random => CreateKey(), |
349 |
random => CreateKey(), |
|
|
350 |
history => $taghistory, |
| 346 |
); |
351 |
); |
| 347 |
|
352 |
|
| 348 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
353 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
|
Lines 401-406
sub create_input {
Link Here
|
| 401 |
maxlength => $subfield_data{maxlength}, |
406 |
maxlength => $subfield_data{maxlength}, |
| 402 |
readonly => ($is_readonly) ? 1 : 0, |
407 |
readonly => ($is_readonly) ? 1 : 0, |
| 403 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
408 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
|
|
409 |
history => $taghistory, |
| 404 |
}; |
410 |
}; |
| 405 |
|
411 |
|
| 406 |
# it's a plugin field |
412 |
# it's a plugin field |
|
Lines 423-428
sub create_input {
Link Here
|
| 423 |
javascript => $plugin->javascript, |
429 |
javascript => $plugin->javascript, |
| 424 |
plugin => $plugin->name, |
430 |
plugin => $plugin->name, |
| 425 |
noclick => $plugin->noclick, |
431 |
noclick => $plugin->noclick, |
|
|
432 |
history => $taghistory, |
| 426 |
}; |
433 |
}; |
| 427 |
} else { |
434 |
} else { |
| 428 |
warn $plugin->errstr; |
435 |
warn $plugin->errstr; |
|
Lines 435-440
sub create_input {
Link Here
|
| 435 |
size => 67, |
442 |
size => 67, |
| 436 |
maxlength => $subfield_data{maxlength}, |
443 |
maxlength => $subfield_data{maxlength}, |
| 437 |
readonly => 0, |
444 |
readonly => 0, |
|
|
445 |
history => $taghistory, |
| 438 |
}; |
446 |
}; |
| 439 |
} |
447 |
} |
| 440 |
|
448 |
|
|
Lines 447-452
sub create_input {
Link Here
|
| 447 |
value => $value, |
455 |
value => $value, |
| 448 |
size => 67, |
456 |
size => 67, |
| 449 |
maxlength => $subfield_data{maxlength}, |
457 |
maxlength => $subfield_data{maxlength}, |
|
|
458 |
history => $taghistory, |
| 450 |
}; |
459 |
}; |
| 451 |
|
460 |
|
| 452 |
} |
461 |
} |
|
Lines 467-472
sub create_input {
Link Here
|
| 467 |
id => $subfield_data{id}, |
476 |
id => $subfield_data{id}, |
| 468 |
name => $subfield_data{id}, |
477 |
name => $subfield_data{id}, |
| 469 |
value => $value, |
478 |
value => $value, |
|
|
479 |
history => $taghistory, |
| 470 |
}; |
480 |
}; |
| 471 |
|
481 |
|
| 472 |
} |
482 |
} |
|
Lines 479-484
sub create_input {
Link Here
|
| 479 |
size => 67, |
489 |
size => 67, |
| 480 |
maxlength => $subfield_data{maxlength}, |
490 |
maxlength => $subfield_data{maxlength}, |
| 481 |
readonly => 0, |
491 |
readonly => 0, |
|
|
492 |
history => $taghistory, |
| 482 |
}; |
493 |
}; |
| 483 |
|
494 |
|
| 484 |
} |
495 |
} |
|
Lines 504-514
sub format_indicator {
Link Here
|
| 504 |
} |
515 |
} |
| 505 |
|
516 |
|
| 506 |
sub build_tabs { |
517 |
sub build_tabs { |
| 507 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
518 |
my ( $template, $record, $dbh, $encoding, $input, $history ) = @_; |
| 508 |
|
519 |
|
| 509 |
# fill arrays |
520 |
# fill arrays |
| 510 |
my @loop_data = (); |
521 |
my @loop_data = (); |
| 511 |
my $tag; |
522 |
#my $tag; |
| 512 |
|
523 |
|
| 513 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
524 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
| 514 |
my $query = "SELECT authorised_value, lib |
525 |
my $query = "SELECT authorised_value, lib |
|
Lines 564-570
sub build_tabs {
Link Here
|
| 564 |
} |
575 |
} |
| 565 |
# loop through each field |
576 |
# loop through each field |
| 566 |
foreach my $field (@fields) { |
577 |
foreach my $field (@fields) { |
| 567 |
|
|
|
| 568 |
my @subfields_data; |
578 |
my @subfields_data; |
| 569 |
if ( $tag < 10 ) { |
579 |
if ( $tag < 10 ) { |
| 570 |
my ( $value, $subfield ); |
580 |
my ( $value, $subfield ); |
|
Lines 584-590
sub build_tabs {
Link Here
|
| 584 |
@subfields_data, |
594 |
@subfields_data, |
| 585 |
&create_input( |
595 |
&create_input( |
| 586 |
$tag, $subfield, $value, $index_tag, $record, |
596 |
$tag, $subfield, $value, $index_tag, $record, |
| 587 |
$authorised_values_sth,$input |
597 |
$authorised_values_sth,$input, $history |
| 588 |
) |
598 |
) |
| 589 |
); |
599 |
); |
| 590 |
} |
600 |
} |
|
Lines 599-605
sub build_tabs {
Link Here
|
| 599 |
@subfields_data, |
609 |
@subfields_data, |
| 600 |
&create_input( |
610 |
&create_input( |
| 601 |
$tag, $subfield, $value, $index_tag, |
611 |
$tag, $subfield, $value, $index_tag, |
| 602 |
$record, $authorised_values_sth,$input |
612 |
$record, $authorised_values_sth,$input, $history |
| 603 |
) |
613 |
) |
| 604 |
); |
614 |
); |
| 605 |
} |
615 |
} |
|
Lines 629-635
sub build_tabs {
Link Here
|
| 629 |
@subfields_data, |
639 |
@subfields_data, |
| 630 |
&create_input( |
640 |
&create_input( |
| 631 |
$tag, $subfield, '', $index_tag, $record, |
641 |
$tag, $subfield, '', $index_tag, $record, |
| 632 |
$authorised_values_sth,$input |
642 |
$authorised_values_sth,$input, $history |
| 633 |
) |
643 |
) |
| 634 |
); |
644 |
); |
| 635 |
} |
645 |
} |
|
Lines 685-691
sub build_tabs {
Link Here
|
| 685 |
@subfields_data, |
695 |
@subfields_data, |
| 686 |
&create_input( |
696 |
&create_input( |
| 687 |
$tag, $subfield->{subfield}, '', $index_tag, $record, |
697 |
$tag, $subfield->{subfield}, '', $index_tag, $record, |
| 688 |
$authorised_values_sth,$input |
698 |
$authorised_values_sth,$input, $history |
| 689 |
) |
699 |
) |
| 690 |
); |
700 |
); |
| 691 |
} |
701 |
} |
|
Lines 703-709
sub build_tabs {
Link Here
|
| 703 |
tagfirstsubfield => $subfields_data[0], |
713 |
tagfirstsubfield => $subfields_data[0], |
| 704 |
fixedfield => $tag < 10?1:0, |
714 |
fixedfield => $tag < 10?1:0, |
| 705 |
); |
715 |
); |
| 706 |
|
716 |
|
| 707 |
push @loop_data, \%tag_data ; |
717 |
push @loop_data, \%tag_data ; |
| 708 |
} |
718 |
} |
| 709 |
} |
719 |
} |
|
Lines 806-811
$mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode);
Link Here
|
| 806 |
# -- Global |
816 |
# -- Global |
| 807 |
|
817 |
|
| 808 |
my $record = -1; |
818 |
my $record = -1; |
|
|
819 |
my $history = undef; |
| 809 |
my $encoding = ""; |
820 |
my $encoding = ""; |
| 810 |
my ( |
821 |
my ( |
| 811 |
$biblionumbertagfield, |
822 |
$biblionumbertagfield, |
|
Lines 816-822
my (
Link Here
|
| 816 |
); |
827 |
); |
| 817 |
|
828 |
|
| 818 |
if ( $biblio && !$breedingid ) { |
829 |
if ( $biblio && !$breedingid ) { |
| 819 |
$record = $biblio->metadata->record; |
830 |
($record, $history) = GetMarcBiblioHistory($biblio->id); |
| 820 |
} |
831 |
} |
| 821 |
if ($breedingid) { |
832 |
if ($breedingid) { |
| 822 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
833 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
|
Lines 902-908
if ( $op eq "addbiblio" ) {
Link Here
|
| 902 |
else { |
913 |
else { |
| 903 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
914 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
| 904 |
} |
915 |
} |
| 905 |
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
916 |
if ($redirect eq "items" || (defined $mode && $mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
| 906 |
if ($frameworkcode eq 'FA'){ |
917 |
if ($frameworkcode eq 'FA'){ |
| 907 |
print $input->redirect( |
918 |
print $input->redirect( |
| 908 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
919 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
|
Lines 961-967
if ( $op eq "addbiblio" ) {
Link Here
|
| 961 |
} |
972 |
} |
| 962 |
} else { |
973 |
} else { |
| 963 |
# it may be a duplicate, warn the user and do nothing |
974 |
# it may be a duplicate, warn the user and do nothing |
| 964 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
975 |
build_tabs ($template, $record, $dbh,$encoding, $input, $history); |
| 965 |
$template->param( |
976 |
$template->param( |
| 966 |
biblionumber => $biblionumber, |
977 |
biblionumber => $biblionumber, |
| 967 |
biblioitemnumber => $biblioitemnumber, |
978 |
biblioitemnumber => $biblioitemnumber, |
|
Lines 1009-1015
elsif ( $op eq "delete" ) {
Link Here
|
| 1009 |
$record = $urecord; |
1020 |
$record = $urecord; |
| 1010 |
}; |
1021 |
}; |
| 1011 |
} |
1022 |
} |
| 1012 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
1023 |
|
|
|
1024 |
build_tabs( $template, $record, $dbh, $encoding, $input, $history ); |
| 1013 |
$template->param( |
1025 |
$template->param( |
| 1014 |
biblionumber => $biblionumber, |
1026 |
biblionumber => $biblionumber, |
| 1015 |
biblionumbertagfield => $biblionumbertagfield, |
1027 |
biblionumbertagfield => $biblionumbertagfield, |