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 271-280
sub GetMandatoryFieldZ3950 {
Link Here
|
271 |
=cut |
268 |
=cut |
272 |
|
269 |
|
273 |
sub create_input { |
270 |
sub create_input { |
274 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi ) = @_; |
271 |
|
275 |
|
272 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi, $history ) = @_; |
|
|
273 |
|
276 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
274 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
277 |
|
275 |
|
|
|
276 |
my $taghistory = $history->{$tag}->{$subfield}; |
277 |
|
278 |
$value =~ s/"/"/g; |
279 |
|
278 |
# if there is no value provided but a default value in parameters, get it |
280 |
# if there is no value provided but a default value in parameters, get it |
279 |
if ( $value eq '' ) { |
281 |
if ( $value eq '' ) { |
280 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; |
282 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; |
Lines 290-296
sub create_input {
Link Here
|
290 |
# And <<USER>> with surname (?) |
292 |
# And <<USER>> with surname (?) |
291 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
293 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
292 |
$value=~s/<<USER>>/$username/g; |
294 |
$value=~s/<<USER>>/$username/g; |
293 |
|
295 |
|
294 |
} |
296 |
} |
295 |
my $dbh = C4::Context->dbh; |
297 |
my $dbh = C4::Context->dbh; |
296 |
|
298 |
|
Lines 312-317
sub create_input {
Link Here
|
312 |
value => $value, |
314 |
value => $value, |
313 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
315 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
314 |
random => CreateKey(), |
316 |
random => CreateKey(), |
|
|
317 |
history => $taghistory, |
315 |
); |
318 |
); |
316 |
|
319 |
|
317 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
320 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
Lines 367-372
sub create_input {
Link Here
|
367 |
maxlength => $subfield_data{maxlength}, |
370 |
maxlength => $subfield_data{maxlength}, |
368 |
readonly => ($is_readonly) ? 1 : 0, |
371 |
readonly => ($is_readonly) ? 1 : 0, |
369 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
372 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
|
|
373 |
history => $taghistory, |
370 |
}; |
374 |
}; |
371 |
|
375 |
|
372 |
# it's a plugin field |
376 |
# it's a plugin field |
Lines 388-393
sub create_input {
Link Here
|
388 |
maxlength => $subfield_data{maxlength}, |
392 |
maxlength => $subfield_data{maxlength}, |
389 |
javascript => $plugin->javascript, |
393 |
javascript => $plugin->javascript, |
390 |
noclick => $plugin->noclick, |
394 |
noclick => $plugin->noclick, |
|
|
395 |
history => $taghistory, |
391 |
}; |
396 |
}; |
392 |
} else { |
397 |
} else { |
393 |
warn $plugin->errstr; |
398 |
warn $plugin->errstr; |
Lines 400-405
sub create_input {
Link Here
|
400 |
size => 67, |
405 |
size => 67, |
401 |
maxlength => $subfield_data{maxlength}, |
406 |
maxlength => $subfield_data{maxlength}, |
402 |
readonly => 0, |
407 |
readonly => 0, |
|
|
408 |
history => $taghistory, |
403 |
}; |
409 |
}; |
404 |
} |
410 |
} |
405 |
|
411 |
|
Lines 412-417
sub create_input {
Link Here
|
412 |
value => $value, |
418 |
value => $value, |
413 |
size => 67, |
419 |
size => 67, |
414 |
maxlength => $subfield_data{maxlength}, |
420 |
maxlength => $subfield_data{maxlength}, |
|
|
421 |
history => $taghistory, |
415 |
}; |
422 |
}; |
416 |
|
423 |
|
417 |
} |
424 |
} |
Lines 432-437
sub create_input {
Link Here
|
432 |
id => $subfield_data{id}, |
439 |
id => $subfield_data{id}, |
433 |
name => $subfield_data{id}, |
440 |
name => $subfield_data{id}, |
434 |
value => $value, |
441 |
value => $value, |
|
|
442 |
history => $taghistory, |
435 |
}; |
443 |
}; |
436 |
|
444 |
|
437 |
} |
445 |
} |
Lines 444-449
sub create_input {
Link Here
|
444 |
size => 67, |
452 |
size => 67, |
445 |
maxlength => $subfield_data{maxlength}, |
453 |
maxlength => $subfield_data{maxlength}, |
446 |
readonly => 0, |
454 |
readonly => 0, |
|
|
455 |
history => $taghistory, |
447 |
}; |
456 |
}; |
448 |
|
457 |
|
449 |
} |
458 |
} |
Lines 469-479
sub format_indicator {
Link Here
|
469 |
} |
478 |
} |
470 |
|
479 |
|
471 |
sub build_tabs { |
480 |
sub build_tabs { |
472 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
481 |
my ( $template, $record, $dbh, $encoding, $input, $history ) = @_; |
473 |
|
482 |
|
474 |
# fill arrays |
483 |
# fill arrays |
475 |
my @loop_data = (); |
484 |
my @loop_data = (); |
476 |
my $tag; |
485 |
#my $tag; |
477 |
|
486 |
|
478 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
487 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
479 |
my $query = "SELECT authorised_value, lib |
488 |
my $query = "SELECT authorised_value, lib |
Lines 489-495
sub build_tabs {
Link Here
|
489 |
my @BIG_LOOP; |
498 |
my @BIG_LOOP; |
490 |
my %seen; |
499 |
my %seen; |
491 |
my @tab_data; # all tags to display |
500 |
my @tab_data; # all tags to display |
492 |
|
|
|
493 |
foreach my $used ( @$usedTagsLib ){ |
501 |
foreach my $used ( @$usedTagsLib ){ |
494 |
push @tab_data,$used->{tagfield} if not $seen{$used->{tagfield}}; |
502 |
push @tab_data,$used->{tagfield} if not $seen{$used->{tagfield}}; |
495 |
$seen{$used->{tagfield}}++; |
503 |
$seen{$used->{tagfield}}++; |
Lines 526-532
sub build_tabs {
Link Here
|
526 |
} |
534 |
} |
527 |
# loop through each field |
535 |
# loop through each field |
528 |
foreach my $field (@fields) { |
536 |
foreach my $field (@fields) { |
529 |
|
|
|
530 |
my @subfields_data; |
537 |
my @subfields_data; |
531 |
if ( $tag < 10 ) { |
538 |
if ( $tag < 10 ) { |
532 |
my ( $value, $subfield ); |
539 |
my ( $value, $subfield ); |
Lines 546-552
sub build_tabs {
Link Here
|
546 |
@subfields_data, |
553 |
@subfields_data, |
547 |
&create_input( |
554 |
&create_input( |
548 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
555 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
549 |
$authorised_values_sth,$input |
556 |
$authorised_values_sth,$input, $history |
550 |
) |
557 |
) |
551 |
); |
558 |
); |
552 |
} |
559 |
} |
Lines 561-567
sub build_tabs {
Link Here
|
561 |
@subfields_data, |
568 |
@subfields_data, |
562 |
&create_input( |
569 |
&create_input( |
563 |
$tag, $subfield, $value, $index_tag, $tabloop, |
570 |
$tag, $subfield, $value, $index_tag, $tabloop, |
564 |
$record, $authorised_values_sth,$input |
571 |
$record, $authorised_values_sth,$input, $history |
565 |
) |
572 |
) |
566 |
); |
573 |
); |
567 |
} |
574 |
} |
Lines 589-595
sub build_tabs {
Link Here
|
589 |
@subfields_data, |
596 |
@subfields_data, |
590 |
&create_input( |
597 |
&create_input( |
591 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
598 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
592 |
$authorised_values_sth,$input |
599 |
$authorised_values_sth,$input, $history |
593 |
) |
600 |
) |
594 |
); |
601 |
); |
595 |
} |
602 |
} |
Lines 635-645
sub build_tabs {
Link Here
|
635 |
# always include in the form regardless of the hidden setting - bug 2206 |
642 |
# always include in the form regardless of the hidden setting - bug 2206 |
636 |
next |
643 |
next |
637 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
644 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
|
|
645 |
|
638 |
push( |
646 |
push( |
639 |
@subfields_data, |
647 |
@subfields_data, |
640 |
&create_input( |
648 |
&create_input( |
641 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
649 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
642 |
$authorised_values_sth,$input |
650 |
$authorised_values_sth,$input, $history |
643 |
) |
651 |
) |
644 |
); |
652 |
); |
645 |
} |
653 |
} |
Lines 656-662
sub build_tabs {
Link Here
|
656 |
tagfirstsubfield => $subfields_data[0], |
664 |
tagfirstsubfield => $subfields_data[0], |
657 |
fixedfield => $tag < 10?1:0, |
665 |
fixedfield => $tag < 10?1:0, |
658 |
); |
666 |
); |
659 |
|
667 |
|
660 |
push @loop_data, \%tag_data ; |
668 |
push @loop_data, \%tag_data ; |
661 |
} |
669 |
} |
662 |
} |
670 |
} |
Lines 755-760
$mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode);
Link Here
|
755 |
# -- Global |
763 |
# -- Global |
756 |
|
764 |
|
757 |
my $record = -1; |
765 |
my $record = -1; |
|
|
766 |
my $history = undef; |
758 |
my $encoding = ""; |
767 |
my $encoding = ""; |
759 |
my ( |
768 |
my ( |
760 |
$biblionumbertagfield, |
769 |
$biblionumbertagfield, |
Lines 765-771
my (
Link Here
|
765 |
); |
774 |
); |
766 |
|
775 |
|
767 |
if (($biblionumber) && !($breedingid)){ |
776 |
if (($biblionumber) && !($breedingid)){ |
768 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
777 |
($record, $history) = GetMarcBiblioHistory($biblionumber); |
769 |
} |
778 |
} |
770 |
if ($breedingid) { |
779 |
if ($breedingid) { |
771 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
780 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
Lines 894-900
if ( $op eq "addbiblio" ) {
Link Here
|
894 |
} |
903 |
} |
895 |
} else { |
904 |
} else { |
896 |
# it may be a duplicate, warn the user and do nothing |
905 |
# it may be a duplicate, warn the user and do nothing |
897 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
906 |
build_tabs ($template, $record, $dbh,$encoding, $input, $history); |
898 |
$template->param( |
907 |
$template->param( |
899 |
biblionumber => $biblionumber, |
908 |
biblionumber => $biblionumber, |
900 |
biblioitemnumber => $biblioitemnumber, |
909 |
biblioitemnumber => $biblioitemnumber, |
Lines 941-947
elsif ( $op eq "delete" ) {
Link Here
|
941 |
$record = $urecord; |
950 |
$record = $urecord; |
942 |
}; |
951 |
}; |
943 |
} |
952 |
} |
944 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
953 |
|
|
|
954 |
build_tabs( $template, $record, $dbh, $encoding, $input, $history ); |
945 |
$template->param( |
955 |
$template->param( |
946 |
biblionumber => $biblionumber, |
956 |
biblionumber => $biblionumber, |
947 |
biblionumbertagfield => $biblionumbertagfield, |
957 |
biblionumbertagfield => $biblionumbertagfield, |