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 274-283
sub GetMandatoryFieldZ3950 {
Link Here
|
274 |
=cut |
271 |
=cut |
275 |
|
272 |
|
276 |
sub create_input { |
273 |
sub create_input { |
277 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi ) = @_; |
274 |
|
278 |
|
275 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi, $history ) = @_; |
|
|
276 |
|
279 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
277 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
280 |
|
278 |
|
|
|
279 |
my $taghistory = $history->{$tag}->{$subfield}; |
280 |
|
281 |
$value =~ s/"/"/g; |
282 |
|
281 |
# if there is no value provided but a default value in parameters, get it |
283 |
# if there is no value provided but a default value in parameters, get it |
282 |
if ( $value eq '' ) { |
284 |
if ( $value eq '' ) { |
283 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; |
285 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; |
Lines 295-301
sub create_input {
Link Here
|
295 |
# And <<USER>> with surname (?) |
297 |
# And <<USER>> with surname (?) |
296 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
298 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
297 |
$value=~s/<<USER>>/$username/g; |
299 |
$value=~s/<<USER>>/$username/g; |
298 |
|
300 |
|
299 |
} |
301 |
} |
300 |
my $dbh = C4::Context->dbh; |
302 |
my $dbh = C4::Context->dbh; |
301 |
|
303 |
|
Lines 318-323
sub create_input {
Link Here
|
318 |
value => $value, |
320 |
value => $value, |
319 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
321 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
320 |
random => CreateKey(), |
322 |
random => CreateKey(), |
|
|
323 |
history => $taghistory, |
321 |
); |
324 |
); |
322 |
|
325 |
|
323 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
326 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
Lines 375-380
sub create_input {
Link Here
|
375 |
maxlength => $subfield_data{maxlength}, |
378 |
maxlength => $subfield_data{maxlength}, |
376 |
readonly => ($is_readonly) ? 1 : 0, |
379 |
readonly => ($is_readonly) ? 1 : 0, |
377 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
380 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
|
|
381 |
history => $taghistory, |
378 |
}; |
382 |
}; |
379 |
|
383 |
|
380 |
# it's a plugin field |
384 |
# it's a plugin field |
Lines 397-402
sub create_input {
Link Here
|
397 |
javascript => $plugin->javascript, |
401 |
javascript => $plugin->javascript, |
398 |
plugin => $plugin->name, |
402 |
plugin => $plugin->name, |
399 |
noclick => $plugin->noclick, |
403 |
noclick => $plugin->noclick, |
|
|
404 |
history => $taghistory, |
400 |
}; |
405 |
}; |
401 |
} else { |
406 |
} else { |
402 |
warn $plugin->errstr; |
407 |
warn $plugin->errstr; |
Lines 409-414
sub create_input {
Link Here
|
409 |
size => 67, |
414 |
size => 67, |
410 |
maxlength => $subfield_data{maxlength}, |
415 |
maxlength => $subfield_data{maxlength}, |
411 |
readonly => 0, |
416 |
readonly => 0, |
|
|
417 |
history => $taghistory, |
412 |
}; |
418 |
}; |
413 |
} |
419 |
} |
414 |
|
420 |
|
Lines 421-426
sub create_input {
Link Here
|
421 |
value => $value, |
427 |
value => $value, |
422 |
size => 67, |
428 |
size => 67, |
423 |
maxlength => $subfield_data{maxlength}, |
429 |
maxlength => $subfield_data{maxlength}, |
|
|
430 |
history => $taghistory, |
424 |
}; |
431 |
}; |
425 |
|
432 |
|
426 |
} |
433 |
} |
Lines 441-446
sub create_input {
Link Here
|
441 |
id => $subfield_data{id}, |
448 |
id => $subfield_data{id}, |
442 |
name => $subfield_data{id}, |
449 |
name => $subfield_data{id}, |
443 |
value => $value, |
450 |
value => $value, |
|
|
451 |
history => $taghistory, |
444 |
}; |
452 |
}; |
445 |
|
453 |
|
446 |
} |
454 |
} |
Lines 453-458
sub create_input {
Link Here
|
453 |
size => 67, |
461 |
size => 67, |
454 |
maxlength => $subfield_data{maxlength}, |
462 |
maxlength => $subfield_data{maxlength}, |
455 |
readonly => 0, |
463 |
readonly => 0, |
|
|
464 |
history => $taghistory, |
456 |
}; |
465 |
}; |
457 |
|
466 |
|
458 |
} |
467 |
} |
Lines 478-488
sub format_indicator {
Link Here
|
478 |
} |
487 |
} |
479 |
|
488 |
|
480 |
sub build_tabs { |
489 |
sub build_tabs { |
481 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
490 |
my ( $template, $record, $dbh, $encoding, $input, $history ) = @_; |
482 |
|
491 |
|
483 |
# fill arrays |
492 |
# fill arrays |
484 |
my @loop_data = (); |
493 |
my @loop_data = (); |
485 |
my $tag; |
494 |
#my $tag; |
486 |
|
495 |
|
487 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
496 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
488 |
my $query = "SELECT authorised_value, lib |
497 |
my $query = "SELECT authorised_value, lib |
Lines 538-544
sub build_tabs {
Link Here
|
538 |
} |
547 |
} |
539 |
# loop through each field |
548 |
# loop through each field |
540 |
foreach my $field (@fields) { |
549 |
foreach my $field (@fields) { |
541 |
|
|
|
542 |
my @subfields_data; |
550 |
my @subfields_data; |
543 |
if ( $tag < 10 ) { |
551 |
if ( $tag < 10 ) { |
544 |
my ( $value, $subfield ); |
552 |
my ( $value, $subfield ); |
Lines 558-564
sub build_tabs {
Link Here
|
558 |
@subfields_data, |
566 |
@subfields_data, |
559 |
&create_input( |
567 |
&create_input( |
560 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
568 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
561 |
$authorised_values_sth,$input |
569 |
$authorised_values_sth,$input, $history |
562 |
) |
570 |
) |
563 |
); |
571 |
); |
564 |
} |
572 |
} |
Lines 573-579
sub build_tabs {
Link Here
|
573 |
@subfields_data, |
581 |
@subfields_data, |
574 |
&create_input( |
582 |
&create_input( |
575 |
$tag, $subfield, $value, $index_tag, $tabloop, |
583 |
$tag, $subfield, $value, $index_tag, $tabloop, |
576 |
$record, $authorised_values_sth,$input |
584 |
$record, $authorised_values_sth,$input, $history |
577 |
) |
585 |
) |
578 |
); |
586 |
); |
579 |
} |
587 |
} |
Lines 601-607
sub build_tabs {
Link Here
|
601 |
@subfields_data, |
609 |
@subfields_data, |
602 |
&create_input( |
610 |
&create_input( |
603 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
611 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
604 |
$authorised_values_sth,$input |
612 |
$authorised_values_sth,$input, $history |
605 |
) |
613 |
) |
606 |
); |
614 |
); |
607 |
} |
615 |
} |
Lines 655-661
sub build_tabs {
Link Here
|
655 |
@subfields_data, |
663 |
@subfields_data, |
656 |
&create_input( |
664 |
&create_input( |
657 |
$tag, $subfield->{subfield}, '', $index_tag, $tabloop, $record, |
665 |
$tag, $subfield->{subfield}, '', $index_tag, $tabloop, $record, |
658 |
$authorised_values_sth,$input |
666 |
$authorised_values_sth,$input, $history |
659 |
) |
667 |
) |
660 |
); |
668 |
); |
661 |
} |
669 |
} |
Lines 673-679
sub build_tabs {
Link Here
|
673 |
tagfirstsubfield => $subfields_data[0], |
681 |
tagfirstsubfield => $subfields_data[0], |
674 |
fixedfield => $tag < 10?1:0, |
682 |
fixedfield => $tag < 10?1:0, |
675 |
); |
683 |
); |
676 |
|
684 |
|
677 |
push @loop_data, \%tag_data ; |
685 |
push @loop_data, \%tag_data ; |
678 |
} |
686 |
} |
679 |
} |
687 |
} |
Lines 775-780
$mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode);
Link Here
|
775 |
# -- Global |
783 |
# -- Global |
776 |
|
784 |
|
777 |
my $record = -1; |
785 |
my $record = -1; |
|
|
786 |
my $history = undef; |
778 |
my $encoding = ""; |
787 |
my $encoding = ""; |
779 |
my ( |
788 |
my ( |
780 |
$biblionumbertagfield, |
789 |
$biblionumbertagfield, |
Lines 785-791
my (
Link Here
|
785 |
); |
794 |
); |
786 |
|
795 |
|
787 |
if (($biblionumber) && !($breedingid)){ |
796 |
if (($biblionumber) && !($breedingid)){ |
788 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
797 |
($record, $history) = GetMarcBiblioHistory($biblionumber); |
789 |
} |
798 |
} |
790 |
if ($breedingid) { |
799 |
if ($breedingid) { |
791 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
800 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
Lines 855-861
if ( $op eq "addbiblio" ) {
Link Here
|
855 |
else { |
864 |
else { |
856 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
865 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
857 |
} |
866 |
} |
858 |
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
867 |
if ($redirect eq "items" || (defined $mode && $mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
859 |
if ($frameworkcode eq 'FA'){ |
868 |
if ($frameworkcode eq 'FA'){ |
860 |
print $input->redirect( |
869 |
print $input->redirect( |
861 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
870 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
Lines 914-920
if ( $op eq "addbiblio" ) {
Link Here
|
914 |
} |
923 |
} |
915 |
} else { |
924 |
} else { |
916 |
# it may be a duplicate, warn the user and do nothing |
925 |
# it may be a duplicate, warn the user and do nothing |
917 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
926 |
build_tabs ($template, $record, $dbh,$encoding, $input, $history); |
918 |
$template->param( |
927 |
$template->param( |
919 |
biblionumber => $biblionumber, |
928 |
biblionumber => $biblionumber, |
920 |
biblioitemnumber => $biblioitemnumber, |
929 |
biblioitemnumber => $biblioitemnumber, |
Lines 961-967
elsif ( $op eq "delete" ) {
Link Here
|
961 |
$record = $urecord; |
970 |
$record = $urecord; |
962 |
}; |
971 |
}; |
963 |
} |
972 |
} |
964 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
973 |
|
|
|
974 |
build_tabs( $template, $record, $dbh, $encoding, $input, $history ); |
965 |
$template->param( |
975 |
$template->param( |
966 |
biblionumber => $biblionumber, |
976 |
biblionumber => $biblionumber, |
967 |
biblionumbertagfield => $biblionumbertagfield, |
977 |
biblionumbertagfield => $biblionumbertagfield, |