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 529-535
sub build_tabs {
Link Here
|
529 |
} |
538 |
} |
530 |
# loop through each field |
539 |
# loop through each field |
531 |
foreach my $field (@fields) { |
540 |
foreach my $field (@fields) { |
532 |
|
|
|
533 |
my @subfields_data; |
541 |
my @subfields_data; |
534 |
if ( $tag < 10 ) { |
542 |
if ( $tag < 10 ) { |
535 |
my ( $value, $subfield ); |
543 |
my ( $value, $subfield ); |
Lines 549-555
sub build_tabs {
Link Here
|
549 |
@subfields_data, |
557 |
@subfields_data, |
550 |
&create_input( |
558 |
&create_input( |
551 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
559 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
552 |
$authorised_values_sth,$input |
560 |
$authorised_values_sth,$input, $history |
553 |
) |
561 |
) |
554 |
); |
562 |
); |
555 |
} |
563 |
} |
Lines 564-570
sub build_tabs {
Link Here
|
564 |
@subfields_data, |
572 |
@subfields_data, |
565 |
&create_input( |
573 |
&create_input( |
566 |
$tag, $subfield, $value, $index_tag, $tabloop, |
574 |
$tag, $subfield, $value, $index_tag, $tabloop, |
567 |
$record, $authorised_values_sth,$input |
575 |
$record, $authorised_values_sth,$input, $history |
568 |
) |
576 |
) |
569 |
); |
577 |
); |
570 |
} |
578 |
} |
Lines 592-598
sub build_tabs {
Link Here
|
592 |
@subfields_data, |
600 |
@subfields_data, |
593 |
&create_input( |
601 |
&create_input( |
594 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
602 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
595 |
$authorised_values_sth,$input |
603 |
$authorised_values_sth,$input, $history |
596 |
) |
604 |
) |
597 |
); |
605 |
); |
598 |
} |
606 |
} |
Lines 638-648
sub build_tabs {
Link Here
|
638 |
# always include in the form regardless of the hidden setting - bug 2206 |
646 |
# always include in the form regardless of the hidden setting - bug 2206 |
639 |
next |
647 |
next |
640 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
648 |
if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); |
|
|
649 |
|
641 |
push( |
650 |
push( |
642 |
@subfields_data, |
651 |
@subfields_data, |
643 |
&create_input( |
652 |
&create_input( |
644 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
653 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
645 |
$authorised_values_sth,$input |
654 |
$authorised_values_sth,$input, $history |
646 |
) |
655 |
) |
647 |
); |
656 |
); |
648 |
} |
657 |
} |
Lines 659-665
sub build_tabs {
Link Here
|
659 |
tagfirstsubfield => $subfields_data[0], |
668 |
tagfirstsubfield => $subfields_data[0], |
660 |
fixedfield => $tag < 10?1:0, |
669 |
fixedfield => $tag < 10?1:0, |
661 |
); |
670 |
); |
662 |
|
671 |
|
663 |
push @loop_data, \%tag_data ; |
672 |
push @loop_data, \%tag_data ; |
664 |
} |
673 |
} |
665 |
} |
674 |
} |
Lines 762-767
$mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode);
Link Here
|
762 |
# -- Global |
771 |
# -- Global |
763 |
|
772 |
|
764 |
my $record = -1; |
773 |
my $record = -1; |
|
|
774 |
my $history = undef; |
765 |
my $encoding = ""; |
775 |
my $encoding = ""; |
766 |
my ( |
776 |
my ( |
767 |
$biblionumbertagfield, |
777 |
$biblionumbertagfield, |
Lines 772-778
my (
Link Here
|
772 |
); |
782 |
); |
773 |
|
783 |
|
774 |
if (($biblionumber) && !($breedingid)){ |
784 |
if (($biblionumber) && !($breedingid)){ |
775 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
785 |
($record, $history) = GetMarcBiblioHistory($biblionumber); |
776 |
} |
786 |
} |
777 |
if ($breedingid) { |
787 |
if ($breedingid) { |
778 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
788 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
Lines 901-907
if ( $op eq "addbiblio" ) {
Link Here
|
901 |
} |
911 |
} |
902 |
} else { |
912 |
} else { |
903 |
# it may be a duplicate, warn the user and do nothing |
913 |
# it may be a duplicate, warn the user and do nothing |
904 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
914 |
build_tabs ($template, $record, $dbh,$encoding, $input, $history); |
905 |
$template->param( |
915 |
$template->param( |
906 |
biblionumber => $biblionumber, |
916 |
biblionumber => $biblionumber, |
907 |
biblioitemnumber => $biblioitemnumber, |
917 |
biblioitemnumber => $biblioitemnumber, |
Lines 948-954
elsif ( $op eq "delete" ) {
Link Here
|
948 |
$record = $urecord; |
958 |
$record = $urecord; |
949 |
}; |
959 |
}; |
950 |
} |
960 |
} |
951 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
961 |
|
|
|
962 |
build_tabs( $template, $record, $dbh, $encoding, $input, $history ); |
952 |
$template->param( |
963 |
$template->param( |
953 |
biblionumber => $biblionumber, |
964 |
biblionumber => $biblionumber, |
954 |
biblionumbertagfield => $biblionumbertagfield, |
965 |
biblionumbertagfield => $biblionumbertagfield, |