Lines 36-42
use C4::ImportBatch;
Link Here
|
36 |
use C4::Charset; |
36 |
use C4::Charset; |
37 |
use Koha::BiblioFrameworks; |
37 |
use Koha::BiblioFrameworks; |
38 |
use Koha::DateUtils; |
38 |
use Koha::DateUtils; |
39 |
|
39 |
use Koha::MetadataRecord::History; |
40 |
use Koha::Libraries; |
40 |
use Koha::Libraries; |
41 |
|
41 |
|
42 |
use Date::Calc qw(Today); |
42 |
use Date::Calc qw(Today); |
Lines 279-288
sub GetMandatoryFieldZ3950 {
Link Here
|
279 |
=cut |
279 |
=cut |
280 |
|
280 |
|
281 |
sub create_input { |
281 |
sub create_input { |
282 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi ) = @_; |
282 |
|
283 |
|
283 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi, $history ) = @_; |
|
|
284 |
|
284 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
285 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
285 |
|
286 |
|
|
|
287 |
my $taghistory = $history->{$tag}->{$subfield}; |
288 |
|
286 |
$value =~ s/"/"/g; |
289 |
$value =~ s/"/"/g; |
287 |
|
290 |
|
288 |
# if there is no value provided but a default value in parameters, get it |
291 |
# if there is no value provided but a default value in parameters, get it |
Lines 300-306
sub create_input {
Link Here
|
300 |
# And <<USER>> with surname (?) |
303 |
# And <<USER>> with surname (?) |
301 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
304 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
302 |
$value=~s/<<USER>>/$username/g; |
305 |
$value=~s/<<USER>>/$username/g; |
303 |
|
306 |
|
304 |
} |
307 |
} |
305 |
my $dbh = C4::Context->dbh; |
308 |
my $dbh = C4::Context->dbh; |
306 |
|
309 |
|
Lines 322-327
sub create_input {
Link Here
|
322 |
value => $value, |
325 |
value => $value, |
323 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
326 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
324 |
random => CreateKey(), |
327 |
random => CreateKey(), |
|
|
328 |
history => $taghistory, |
325 |
); |
329 |
); |
326 |
|
330 |
|
327 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
331 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
Lines 377-382
sub create_input {
Link Here
|
377 |
maxlength => $subfield_data{maxlength}, |
381 |
maxlength => $subfield_data{maxlength}, |
378 |
readonly => ($is_readonly) ? 1 : 0, |
382 |
readonly => ($is_readonly) ? 1 : 0, |
379 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
383 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
|
|
384 |
history => $taghistory, |
380 |
}; |
385 |
}; |
381 |
|
386 |
|
382 |
# it's a plugin field |
387 |
# it's a plugin field |
Lines 398-403
sub create_input {
Link Here
|
398 |
maxlength => $subfield_data{maxlength}, |
403 |
maxlength => $subfield_data{maxlength}, |
399 |
javascript => $plugin->javascript, |
404 |
javascript => $plugin->javascript, |
400 |
noclick => $plugin->noclick, |
405 |
noclick => $plugin->noclick, |
|
|
406 |
history => $taghistory, |
401 |
}; |
407 |
}; |
402 |
} else { |
408 |
} else { |
403 |
warn $plugin->errstr; |
409 |
warn $plugin->errstr; |
Lines 410-415
sub create_input {
Link Here
|
410 |
size => 67, |
416 |
size => 67, |
411 |
maxlength => $subfield_data{maxlength}, |
417 |
maxlength => $subfield_data{maxlength}, |
412 |
readonly => 0, |
418 |
readonly => 0, |
|
|
419 |
history => $taghistory, |
413 |
}; |
420 |
}; |
414 |
} |
421 |
} |
415 |
|
422 |
|
Lines 422-427
sub create_input {
Link Here
|
422 |
value => $value, |
429 |
value => $value, |
423 |
size => 67, |
430 |
size => 67, |
424 |
maxlength => $subfield_data{maxlength}, |
431 |
maxlength => $subfield_data{maxlength}, |
|
|
432 |
history => $taghistory, |
425 |
}; |
433 |
}; |
426 |
|
434 |
|
427 |
} |
435 |
} |
Lines 442-447
sub create_input {
Link Here
|
442 |
id => $subfield_data{id}, |
450 |
id => $subfield_data{id}, |
443 |
name => $subfield_data{id}, |
451 |
name => $subfield_data{id}, |
444 |
value => $value, |
452 |
value => $value, |
|
|
453 |
history => $taghistory, |
445 |
}; |
454 |
}; |
446 |
|
455 |
|
447 |
} |
456 |
} |
Lines 454-459
sub create_input {
Link Here
|
454 |
size => 67, |
463 |
size => 67, |
455 |
maxlength => $subfield_data{maxlength}, |
464 |
maxlength => $subfield_data{maxlength}, |
456 |
readonly => 0, |
465 |
readonly => 0, |
|
|
466 |
history => $taghistory, |
457 |
}; |
467 |
}; |
458 |
|
468 |
|
459 |
} |
469 |
} |
Lines 479-489
sub format_indicator {
Link Here
|
479 |
} |
489 |
} |
480 |
|
490 |
|
481 |
sub build_tabs { |
491 |
sub build_tabs { |
482 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
492 |
my ( $template, $record, $dbh, $encoding, $input, $history ) = @_; |
483 |
|
493 |
|
484 |
# fill arrays |
494 |
# fill arrays |
485 |
my @loop_data = (); |
495 |
my @loop_data = (); |
486 |
my $tag; |
496 |
#my $tag; |
487 |
|
497 |
|
488 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
498 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
489 |
my $query = "SELECT authorised_value, lib |
499 |
my $query = "SELECT authorised_value, lib |
Lines 499-505
sub build_tabs {
Link Here
|
499 |
my @BIG_LOOP; |
509 |
my @BIG_LOOP; |
500 |
my %seen; |
510 |
my %seen; |
501 |
my @tab_data; # all tags to display |
511 |
my @tab_data; # all tags to display |
502 |
|
|
|
503 |
foreach my $used ( @$usedTagsLib ){ |
512 |
foreach my $used ( @$usedTagsLib ){ |
504 |
push @tab_data,$used->{tagfield} if not $seen{$used->{tagfield}}; |
513 |
push @tab_data,$used->{tagfield} if not $seen{$used->{tagfield}}; |
505 |
$seen{$used->{tagfield}}++; |
514 |
$seen{$used->{tagfield}}++; |
Lines 536-542
sub build_tabs {
Link Here
|
536 |
} |
545 |
} |
537 |
# loop through each field |
546 |
# loop through each field |
538 |
foreach my $field (@fields) { |
547 |
foreach my $field (@fields) { |
539 |
|
|
|
540 |
my @subfields_data; |
548 |
my @subfields_data; |
541 |
if ( $tag < 10 ) { |
549 |
if ( $tag < 10 ) { |
542 |
my ( $value, $subfield ); |
550 |
my ( $value, $subfield ); |
Lines 556-562
sub build_tabs {
Link Here
|
556 |
@subfields_data, |
564 |
@subfields_data, |
557 |
&create_input( |
565 |
&create_input( |
558 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
566 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
559 |
$authorised_values_sth,$input |
567 |
$authorised_values_sth,$input, $history |
560 |
) |
568 |
) |
561 |
); |
569 |
); |
562 |
} |
570 |
} |
Lines 571-577
sub build_tabs {
Link Here
|
571 |
@subfields_data, |
579 |
@subfields_data, |
572 |
&create_input( |
580 |
&create_input( |
573 |
$tag, $subfield, $value, $index_tag, $tabloop, |
581 |
$tag, $subfield, $value, $index_tag, $tabloop, |
574 |
$record, $authorised_values_sth,$input |
582 |
$record, $authorised_values_sth,$input, $history |
575 |
) |
583 |
) |
576 |
); |
584 |
); |
577 |
} |
585 |
} |
Lines 599-605
sub build_tabs {
Link Here
|
599 |
@subfields_data, |
607 |
@subfields_data, |
600 |
&create_input( |
608 |
&create_input( |
601 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
609 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
602 |
$authorised_values_sth,$input |
610 |
$authorised_values_sth,$input, $history |
603 |
) |
611 |
) |
604 |
); |
612 |
); |
605 |
} |
613 |
} |
Lines 645-655
sub build_tabs {
Link Here
|
645 |
# always include in the form regardless of the hidden setting - bug 2206 |
653 |
# always include in the form regardless of the hidden setting - bug 2206 |
646 |
next |
654 |
next |
647 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
655 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
|
|
656 |
|
648 |
push( |
657 |
push( |
649 |
@subfields_data, |
658 |
@subfields_data, |
650 |
&create_input( |
659 |
&create_input( |
651 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
660 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
652 |
$authorised_values_sth,$input |
661 |
$authorised_values_sth,$input, $history |
653 |
) |
662 |
) |
654 |
); |
663 |
); |
655 |
} |
664 |
} |
Lines 666-672
sub build_tabs {
Link Here
|
666 |
tagfirstsubfield => $subfields_data[0], |
675 |
tagfirstsubfield => $subfields_data[0], |
667 |
fixedfield => $tag < 10?1:0, |
676 |
fixedfield => $tag < 10?1:0, |
668 |
); |
677 |
); |
669 |
|
678 |
|
670 |
push @loop_data, \%tag_data ; |
679 |
push @loop_data, \%tag_data ; |
671 |
} |
680 |
} |
672 |
} |
681 |
} |
Lines 755-760
$mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode);
Link Here
|
755 |
# -- Global |
764 |
# -- Global |
756 |
|
765 |
|
757 |
my $record = -1; |
766 |
my $record = -1; |
|
|
767 |
my $history = undef; |
758 |
my $encoding = ""; |
768 |
my $encoding = ""; |
759 |
my ( |
769 |
my ( |
760 |
$biblionumbertagfield, |
770 |
$biblionumbertagfield, |
Lines 765-771
my (
Link Here
|
765 |
); |
775 |
); |
766 |
|
776 |
|
767 |
if (($biblionumber) && !($breedingid)){ |
777 |
if (($biblionumber) && !($breedingid)){ |
768 |
$record = GetMarcBiblio($biblionumber); |
778 |
($record, $history) = GetMarcBiblioHistory($biblionumber); |
769 |
} |
779 |
} |
770 |
if ($breedingid) { |
780 |
if ($breedingid) { |
771 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
781 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
Lines 898-904
if ( $op eq "addbiblio" ) {
Link Here
|
898 |
} |
908 |
} |
899 |
} else { |
909 |
} else { |
900 |
# it may be a duplicate, warn the user and do nothing |
910 |
# it may be a duplicate, warn the user and do nothing |
901 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
911 |
build_tabs ($template, $record, $dbh,$encoding, $input, $history); |
902 |
$template->param( |
912 |
$template->param( |
903 |
biblionumber => $biblionumber, |
913 |
biblionumber => $biblionumber, |
904 |
biblioitemnumber => $biblioitemnumber, |
914 |
biblioitemnumber => $biblioitemnumber, |
Lines 945-951
elsif ( $op eq "delete" ) {
Link Here
|
945 |
$record = $urecord; |
955 |
$record = $urecord; |
946 |
}; |
956 |
}; |
947 |
} |
957 |
} |
948 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
958 |
|
|
|
959 |
build_tabs( $template, $record, $dbh, $encoding, $input, $history ); |
949 |
$template->param( |
960 |
$template->param( |
950 |
biblionumber => $biblionumber, |
961 |
biblionumber => $biblionumber, |
951 |
biblionumbertagfield => $biblionumbertagfield, |
962 |
biblionumbertagfield => $biblionumbertagfield, |