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 648-658
sub build_tabs {
Link Here
|
648 |
# always include in the form regardless of the hidden setting - bug 2206 |
656 |
# always include in the form regardless of the hidden setting - bug 2206 |
649 |
next |
657 |
next |
650 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
658 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
|
|
659 |
|
651 |
push( |
660 |
push( |
652 |
@subfields_data, |
661 |
@subfields_data, |
653 |
&create_input( |
662 |
&create_input( |
654 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
663 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
655 |
$authorised_values_sth,$input |
664 |
$authorised_values_sth,$input, $history |
656 |
) |
665 |
) |
657 |
); |
666 |
); |
658 |
} |
667 |
} |
Lines 670-676
sub build_tabs {
Link Here
|
670 |
tagfirstsubfield => $subfields_data[0], |
679 |
tagfirstsubfield => $subfields_data[0], |
671 |
fixedfield => $tag < 10?1:0, |
680 |
fixedfield => $tag < 10?1:0, |
672 |
); |
681 |
); |
673 |
|
682 |
|
674 |
push @loop_data, \%tag_data ; |
683 |
push @loop_data, \%tag_data ; |
675 |
} |
684 |
} |
676 |
} |
685 |
} |
Lines 772-777
$mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode);
Link Here
|
772 |
# -- Global |
781 |
# -- Global |
773 |
|
782 |
|
774 |
my $record = -1; |
783 |
my $record = -1; |
|
|
784 |
my $history = undef; |
775 |
my $encoding = ""; |
785 |
my $encoding = ""; |
776 |
my ( |
786 |
my ( |
777 |
$biblionumbertagfield, |
787 |
$biblionumbertagfield, |
Lines 782-788
my (
Link Here
|
782 |
); |
792 |
); |
783 |
|
793 |
|
784 |
if (($biblionumber) && !($breedingid)){ |
794 |
if (($biblionumber) && !($breedingid)){ |
785 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
795 |
($record, $history) = GetMarcBiblioHistory($biblionumber); |
786 |
} |
796 |
} |
787 |
if ($breedingid) { |
797 |
if ($breedingid) { |
788 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
798 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
Lines 911-917
if ( $op eq "addbiblio" ) {
Link Here
|
911 |
} |
921 |
} |
912 |
} else { |
922 |
} else { |
913 |
# it may be a duplicate, warn the user and do nothing |
923 |
# it may be a duplicate, warn the user and do nothing |
914 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
924 |
build_tabs ($template, $record, $dbh,$encoding, $input, $history); |
915 |
$template->param( |
925 |
$template->param( |
916 |
biblionumber => $biblionumber, |
926 |
biblionumber => $biblionumber, |
917 |
biblioitemnumber => $biblioitemnumber, |
927 |
biblioitemnumber => $biblioitemnumber, |
Lines 958-964
elsif ( $op eq "delete" ) {
Link Here
|
958 |
$record = $urecord; |
968 |
$record = $urecord; |
959 |
}; |
969 |
}; |
960 |
} |
970 |
} |
961 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
971 |
|
|
|
972 |
build_tabs( $template, $record, $dbh, $encoding, $input, $history ); |
962 |
$template->param( |
973 |
$template->param( |
963 |
biblionumber => $biblionumber, |
974 |
biblionumber => $biblionumber, |
964 |
biblionumbertagfield => $biblionumbertagfield, |
975 |
biblionumbertagfield => $biblionumbertagfield, |