|
Lines 46-58
use C4::ImportBatch qw( GetImportRecordMarc );
Link Here
|
| 46 |
use C4::Charset qw( SetMarcUnicodeFlag ); |
46 |
use C4::Charset qw( SetMarcUnicodeFlag ); |
| 47 |
use Koha::BiblioFrameworks; |
47 |
use Koha::BiblioFrameworks; |
| 48 |
use Koha::DateUtils qw( dt_from_string ); |
48 |
use Koha::DateUtils qw( dt_from_string ); |
| 49 |
|
49 |
use C4::Koha; |
| 50 |
use Koha::ItemTypes; |
50 |
use Koha::ItemTypes; |
|
|
51 |
use Koha::MetadataRecord::History; |
| 51 |
use Koha::Libraries; |
52 |
use Koha::Libraries; |
| 52 |
|
|
|
| 53 |
use Koha::BiblioFrameworks; |
53 |
use Koha::BiblioFrameworks; |
| 54 |
use Koha::Patrons; |
54 |
use Koha::Patrons; |
| 55 |
|
|
|
| 56 |
use MARC::File::USMARC; |
55 |
use MARC::File::USMARC; |
| 57 |
use MARC::File::XML; |
56 |
use MARC::File::XML; |
| 58 |
use URI::Escape qw( uri_escape_utf8 ); |
57 |
use URI::Escape qw( uri_escape_utf8 ); |
|
Lines 284-293
sub GetMandatoryFieldZ3950 {
Link Here
|
| 284 |
=cut |
283 |
=cut |
| 285 |
|
284 |
|
| 286 |
sub create_input { |
285 |
sub create_input { |
| 287 |
my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth,$cgi ) = @_; |
286 |
my ( $tag, $subfield, $value, $index_tag, $rec, $authorised_values_sth,$cgi, $history ) = @_; |
| 288 |
|
287 |
|
| 289 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
288 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
| 290 |
|
289 |
|
|
|
290 |
my $taghistory = $history->{$tag}->{$subfield}; |
| 291 |
|
| 292 |
$value =~ s/"/"/g; |
| 293 |
|
| 291 |
# Apply optional framework default value when it is a new record |
294 |
# Apply optional framework default value when it is a new record |
| 292 |
# Substitute date parts, user name |
295 |
# Substitute date parts, user name |
| 293 |
if ( $value eq '' && !$cgi->param('biblionumber') ) { |
296 |
if ( $value eq '' && !$cgi->param('biblionumber') ) { |
|
Lines 329-334
sub create_input {
Link Here
|
| 329 |
value => $value, |
332 |
value => $value, |
| 330 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
333 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
| 331 |
random => CreateKey(), |
334 |
random => CreateKey(), |
|
|
335 |
history => $taghistory, |
| 332 |
); |
336 |
); |
| 333 |
|
337 |
|
| 334 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
338 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
|
Lines 387-392
sub create_input {
Link Here
|
| 387 |
maxlength => $subfield_data{maxlength}, |
391 |
maxlength => $subfield_data{maxlength}, |
| 388 |
readonly => ($is_readonly) ? 1 : 0, |
392 |
readonly => ($is_readonly) ? 1 : 0, |
| 389 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
393 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
|
|
394 |
history => $taghistory, |
| 390 |
}; |
395 |
}; |
| 391 |
|
396 |
|
| 392 |
# it's a plugin field |
397 |
# it's a plugin field |
|
Lines 409-414
sub create_input {
Link Here
|
| 409 |
javascript => $plugin->javascript, |
414 |
javascript => $plugin->javascript, |
| 410 |
plugin => $plugin->name, |
415 |
plugin => $plugin->name, |
| 411 |
noclick => $plugin->noclick, |
416 |
noclick => $plugin->noclick, |
|
|
417 |
history => $taghistory, |
| 412 |
}; |
418 |
}; |
| 413 |
} else { |
419 |
} else { |
| 414 |
warn $plugin->errstr; |
420 |
warn $plugin->errstr; |
|
Lines 421-426
sub create_input {
Link Here
|
| 421 |
size => 67, |
427 |
size => 67, |
| 422 |
maxlength => $subfield_data{maxlength}, |
428 |
maxlength => $subfield_data{maxlength}, |
| 423 |
readonly => 0, |
429 |
readonly => 0, |
|
|
430 |
history => $taghistory, |
| 424 |
}; |
431 |
}; |
| 425 |
} |
432 |
} |
| 426 |
|
433 |
|
|
Lines 433-438
sub create_input {
Link Here
|
| 433 |
value => $value, |
440 |
value => $value, |
| 434 |
size => 67, |
441 |
size => 67, |
| 435 |
maxlength => $subfield_data{maxlength}, |
442 |
maxlength => $subfield_data{maxlength}, |
|
|
443 |
history => $taghistory, |
| 436 |
}; |
444 |
}; |
| 437 |
|
445 |
|
| 438 |
} |
446 |
} |
|
Lines 453-458
sub create_input {
Link Here
|
| 453 |
id => $subfield_data{id}, |
461 |
id => $subfield_data{id}, |
| 454 |
name => $subfield_data{id}, |
462 |
name => $subfield_data{id}, |
| 455 |
value => $value, |
463 |
value => $value, |
|
|
464 |
history => $taghistory, |
| 456 |
}; |
465 |
}; |
| 457 |
|
466 |
|
| 458 |
} |
467 |
} |
|
Lines 465-470
sub create_input {
Link Here
|
| 465 |
size => 67, |
474 |
size => 67, |
| 466 |
maxlength => $subfield_data{maxlength}, |
475 |
maxlength => $subfield_data{maxlength}, |
| 467 |
readonly => 0, |
476 |
readonly => 0, |
|
|
477 |
history => $taghistory, |
| 468 |
}; |
478 |
}; |
| 469 |
|
479 |
|
| 470 |
} |
480 |
} |
|
Lines 490-500
sub format_indicator {
Link Here
|
| 490 |
} |
500 |
} |
| 491 |
|
501 |
|
| 492 |
sub build_tabs { |
502 |
sub build_tabs { |
| 493 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
503 |
my ( $template, $record, $dbh, $encoding, $input, $history ) = @_; |
| 494 |
|
504 |
|
| 495 |
# fill arrays |
505 |
# fill arrays |
| 496 |
my @loop_data = (); |
506 |
my @loop_data = (); |
| 497 |
my $tag; |
507 |
#my $tag; |
| 498 |
|
508 |
|
| 499 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
509 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
| 500 |
my $query = "SELECT authorised_value, lib |
510 |
my $query = "SELECT authorised_value, lib |
|
Lines 550-556
sub build_tabs {
Link Here
|
| 550 |
} |
560 |
} |
| 551 |
# loop through each field |
561 |
# loop through each field |
| 552 |
foreach my $field (@fields) { |
562 |
foreach my $field (@fields) { |
| 553 |
|
|
|
| 554 |
my @subfields_data; |
563 |
my @subfields_data; |
| 555 |
if ( $tag < 10 ) { |
564 |
if ( $tag < 10 ) { |
| 556 |
my ( $value, $subfield ); |
565 |
my ( $value, $subfield ); |
|
Lines 570-576
sub build_tabs {
Link Here
|
| 570 |
@subfields_data, |
579 |
@subfields_data, |
| 571 |
&create_input( |
580 |
&create_input( |
| 572 |
$tag, $subfield, $value, $index_tag, $record, |
581 |
$tag, $subfield, $value, $index_tag, $record, |
| 573 |
$authorised_values_sth,$input |
582 |
$authorised_values_sth,$input, $history |
| 574 |
) |
583 |
) |
| 575 |
); |
584 |
); |
| 576 |
} |
585 |
} |
|
Lines 585-591
sub build_tabs {
Link Here
|
| 585 |
@subfields_data, |
594 |
@subfields_data, |
| 586 |
&create_input( |
595 |
&create_input( |
| 587 |
$tag, $subfield, $value, $index_tag, |
596 |
$tag, $subfield, $value, $index_tag, |
| 588 |
$record, $authorised_values_sth,$input |
597 |
$record, $authorised_values_sth,$input, $history |
| 589 |
) |
598 |
) |
| 590 |
); |
599 |
); |
| 591 |
} |
600 |
} |
|
Lines 615-621
sub build_tabs {
Link Here
|
| 615 |
@subfields_data, |
624 |
@subfields_data, |
| 616 |
&create_input( |
625 |
&create_input( |
| 617 |
$tag, $subfield, '', $index_tag, $record, |
626 |
$tag, $subfield, '', $index_tag, $record, |
| 618 |
$authorised_values_sth,$input |
627 |
$authorised_values_sth,$input, $history |
| 619 |
) |
628 |
) |
| 620 |
); |
629 |
); |
| 621 |
} |
630 |
} |
|
Lines 671-677
sub build_tabs {
Link Here
|
| 671 |
@subfields_data, |
680 |
@subfields_data, |
| 672 |
&create_input( |
681 |
&create_input( |
| 673 |
$tag, $subfield->{subfield}, '', $index_tag, $record, |
682 |
$tag, $subfield->{subfield}, '', $index_tag, $record, |
| 674 |
$authorised_values_sth,$input |
683 |
$authorised_values_sth,$input, $history |
| 675 |
) |
684 |
) |
| 676 |
); |
685 |
); |
| 677 |
} |
686 |
} |
|
Lines 689-695
sub build_tabs {
Link Here
|
| 689 |
tagfirstsubfield => $subfields_data[0], |
698 |
tagfirstsubfield => $subfields_data[0], |
| 690 |
fixedfield => $tag < 10?1:0, |
699 |
fixedfield => $tag < 10?1:0, |
| 691 |
); |
700 |
); |
| 692 |
|
701 |
|
| 693 |
push @loop_data, \%tag_data ; |
702 |
push @loop_data, \%tag_data ; |
| 694 |
} |
703 |
} |
| 695 |
} |
704 |
} |
|
Lines 791-796
$mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode);
Link Here
|
| 791 |
# -- Global |
800 |
# -- Global |
| 792 |
|
801 |
|
| 793 |
my $record = -1; |
802 |
my $record = -1; |
|
|
803 |
my $history = undef; |
| 794 |
my $encoding = ""; |
804 |
my $encoding = ""; |
| 795 |
my ( |
805 |
my ( |
| 796 |
$biblionumbertagfield, |
806 |
$biblionumbertagfield, |
|
Lines 801-807
my (
Link Here
|
| 801 |
); |
811 |
); |
| 802 |
|
812 |
|
| 803 |
if (($biblionumber) && !($breedingid)){ |
813 |
if (($biblionumber) && !($breedingid)){ |
| 804 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
814 |
($record, $history) = GetMarcBiblioHistory($biblionumber); |
| 805 |
} |
815 |
} |
| 806 |
if ($breedingid) { |
816 |
if ($breedingid) { |
| 807 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
817 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
|
Lines 883-889
if ( $op eq "addbiblio" ) {
Link Here
|
| 883 |
else { |
893 |
else { |
| 884 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
894 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
| 885 |
} |
895 |
} |
| 886 |
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
896 |
if ($redirect eq "items" || (defined $mode && $mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
| 887 |
if ($frameworkcode eq 'FA'){ |
897 |
if ($frameworkcode eq 'FA'){ |
| 888 |
print $input->redirect( |
898 |
print $input->redirect( |
| 889 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
899 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
|
Lines 942-948
if ( $op eq "addbiblio" ) {
Link Here
|
| 942 |
} |
952 |
} |
| 943 |
} else { |
953 |
} else { |
| 944 |
# it may be a duplicate, warn the user and do nothing |
954 |
# it may be a duplicate, warn the user and do nothing |
| 945 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
955 |
build_tabs ($template, $record, $dbh,$encoding, $input, $history); |
| 946 |
$template->param( |
956 |
$template->param( |
| 947 |
biblionumber => $biblionumber, |
957 |
biblionumber => $biblionumber, |
| 948 |
biblioitemnumber => $biblioitemnumber, |
958 |
biblioitemnumber => $biblioitemnumber, |
|
Lines 990-996
elsif ( $op eq "delete" ) {
Link Here
|
| 990 |
$record = $urecord; |
1000 |
$record = $urecord; |
| 991 |
}; |
1001 |
}; |
| 992 |
} |
1002 |
} |
| 993 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
1003 |
|
|
|
1004 |
build_tabs( $template, $record, $dbh, $encoding, $input, $history ); |
| 994 |
$template->param( |
1005 |
$template->param( |
| 995 |
biblionumber => $biblionumber, |
1006 |
biblionumber => $biblionumber, |
| 996 |
biblionumbertagfield => $biblionumbertagfield, |
1007 |
biblionumbertagfield => $biblionumbertagfield, |