|
Lines 46-57
use C4::ImportBatch qw( GetImportRecordMarc );
Link Here
|
| 46 |
use C4::Charset qw( SetMarcUnicodeFlag ); |
46 |
use C4::Charset qw( SetMarcUnicodeFlag ); |
| 47 |
use Koha::BiblioFrameworks; |
47 |
use Koha::BiblioFrameworks; |
| 48 |
use Koha::DateUtils qw( dt_from_string ); |
48 |
use Koha::DateUtils qw( dt_from_string ); |
| 49 |
|
49 |
use C4::Koha; |
| 50 |
use Koha::ItemTypes; |
50 |
use Koha::ItemTypes; |
|
|
51 |
use Koha::MetadataRecord::History; |
| 51 |
use Koha::Libraries; |
52 |
use Koha::Libraries; |
| 52 |
|
|
|
| 53 |
use Koha::BiblioFrameworks; |
| 54 |
|
| 55 |
use MARC::File::USMARC; |
53 |
use MARC::File::USMARC; |
| 56 |
use MARC::File::XML; |
54 |
use MARC::File::XML; |
| 57 |
use URI::Escape qw( uri_escape_utf8 ); |
55 |
use URI::Escape qw( uri_escape_utf8 ); |
|
Lines 283-292
sub GetMandatoryFieldZ3950 {
Link Here
|
| 283 |
=cut |
281 |
=cut |
| 284 |
|
282 |
|
| 285 |
sub create_input { |
283 |
sub create_input { |
| 286 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi ) = @_; |
284 |
|
| 287 |
|
285 |
my ( $tag, $subfield, $value, $index_tag, $tabloop, $rec, $authorised_values_sth,$cgi, $history ) = @_; |
|
|
286 |
|
| 288 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
287 |
my $index_subfield = CreateKey(); # create a specifique key for each subfield |
| 289 |
|
288 |
|
|
|
289 |
my $taghistory = $history->{$tag}->{$subfield}; |
| 290 |
|
| 291 |
$value =~ s/"/"/g; |
| 292 |
|
| 290 |
# if there is no value provided but a default value in parameters, get it |
293 |
# if there is no value provided but a default value in parameters, get it |
| 291 |
if ( $value eq '' ) { |
294 |
if ( $value eq '' ) { |
| 292 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; |
295 |
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue} // q{}; |
|
Lines 304-310
sub create_input {
Link Here
|
| 304 |
# And <<USER>> with surname (?) |
307 |
# And <<USER>> with surname (?) |
| 305 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
308 |
my $username=(C4::Context->userenv?C4::Context->userenv->{'surname'}:"superlibrarian"); |
| 306 |
$value=~s/<<USER>>/$username/g; |
309 |
$value=~s/<<USER>>/$username/g; |
| 307 |
|
310 |
|
| 308 |
} |
311 |
} |
| 309 |
my $dbh = C4::Context->dbh; |
312 |
my $dbh = C4::Context->dbh; |
| 310 |
|
313 |
|
|
Lines 327-332
sub create_input {
Link Here
|
| 327 |
value => $value, |
330 |
value => $value, |
| 328 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
331 |
maxlength => $tagslib->{$tag}->{$subfield}->{maxlength}, |
| 329 |
random => CreateKey(), |
332 |
random => CreateKey(), |
|
|
333 |
history => $taghistory, |
| 330 |
); |
334 |
); |
| 331 |
|
335 |
|
| 332 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
336 |
if(exists $mandatory_z3950->{$tag.$subfield}){ |
|
Lines 385-390
sub create_input {
Link Here
|
| 385 |
maxlength => $subfield_data{maxlength}, |
389 |
maxlength => $subfield_data{maxlength}, |
| 386 |
readonly => ($is_readonly) ? 1 : 0, |
390 |
readonly => ($is_readonly) ? 1 : 0, |
| 387 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
391 |
authtype => $tagslib->{$tag}->{$subfield}->{authtypecode}, |
|
|
392 |
history => $taghistory, |
| 388 |
}; |
393 |
}; |
| 389 |
|
394 |
|
| 390 |
# it's a plugin field |
395 |
# it's a plugin field |
|
Lines 407-412
sub create_input {
Link Here
|
| 407 |
javascript => $plugin->javascript, |
412 |
javascript => $plugin->javascript, |
| 408 |
plugin => $plugin->name, |
413 |
plugin => $plugin->name, |
| 409 |
noclick => $plugin->noclick, |
414 |
noclick => $plugin->noclick, |
|
|
415 |
history => $taghistory, |
| 410 |
}; |
416 |
}; |
| 411 |
} else { |
417 |
} else { |
| 412 |
warn $plugin->errstr; |
418 |
warn $plugin->errstr; |
|
Lines 419-424
sub create_input {
Link Here
|
| 419 |
size => 67, |
425 |
size => 67, |
| 420 |
maxlength => $subfield_data{maxlength}, |
426 |
maxlength => $subfield_data{maxlength}, |
| 421 |
readonly => 0, |
427 |
readonly => 0, |
|
|
428 |
history => $taghistory, |
| 422 |
}; |
429 |
}; |
| 423 |
} |
430 |
} |
| 424 |
|
431 |
|
|
Lines 431-436
sub create_input {
Link Here
|
| 431 |
value => $value, |
438 |
value => $value, |
| 432 |
size => 67, |
439 |
size => 67, |
| 433 |
maxlength => $subfield_data{maxlength}, |
440 |
maxlength => $subfield_data{maxlength}, |
|
|
441 |
history => $taghistory, |
| 434 |
}; |
442 |
}; |
| 435 |
|
443 |
|
| 436 |
} |
444 |
} |
|
Lines 451-456
sub create_input {
Link Here
|
| 451 |
id => $subfield_data{id}, |
459 |
id => $subfield_data{id}, |
| 452 |
name => $subfield_data{id}, |
460 |
name => $subfield_data{id}, |
| 453 |
value => $value, |
461 |
value => $value, |
|
|
462 |
history => $taghistory, |
| 454 |
}; |
463 |
}; |
| 455 |
|
464 |
|
| 456 |
} |
465 |
} |
|
Lines 463-468
sub create_input {
Link Here
|
| 463 |
size => 67, |
472 |
size => 67, |
| 464 |
maxlength => $subfield_data{maxlength}, |
473 |
maxlength => $subfield_data{maxlength}, |
| 465 |
readonly => 0, |
474 |
readonly => 0, |
|
|
475 |
history => $taghistory, |
| 466 |
}; |
476 |
}; |
| 467 |
|
477 |
|
| 468 |
} |
478 |
} |
|
Lines 488-498
sub format_indicator {
Link Here
|
| 488 |
} |
498 |
} |
| 489 |
|
499 |
|
| 490 |
sub build_tabs { |
500 |
sub build_tabs { |
| 491 |
my ( $template, $record, $dbh, $encoding,$input ) = @_; |
501 |
my ( $template, $record, $dbh, $encoding, $input, $history ) = @_; |
| 492 |
|
502 |
|
| 493 |
# fill arrays |
503 |
# fill arrays |
| 494 |
my @loop_data = (); |
504 |
my @loop_data = (); |
| 495 |
my $tag; |
505 |
#my $tag; |
| 496 |
|
506 |
|
| 497 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
507 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
| 498 |
my $query = "SELECT authorised_value, lib |
508 |
my $query = "SELECT authorised_value, lib |
|
Lines 548-554
sub build_tabs {
Link Here
|
| 548 |
} |
558 |
} |
| 549 |
# loop through each field |
559 |
# loop through each field |
| 550 |
foreach my $field (@fields) { |
560 |
foreach my $field (@fields) { |
| 551 |
|
|
|
| 552 |
my @subfields_data; |
561 |
my @subfields_data; |
| 553 |
if ( $tag < 10 ) { |
562 |
if ( $tag < 10 ) { |
| 554 |
my ( $value, $subfield ); |
563 |
my ( $value, $subfield ); |
|
Lines 568-574
sub build_tabs {
Link Here
|
| 568 |
@subfields_data, |
577 |
@subfields_data, |
| 569 |
&create_input( |
578 |
&create_input( |
| 570 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
579 |
$tag, $subfield, $value, $index_tag, $tabloop, $record, |
| 571 |
$authorised_values_sth,$input |
580 |
$authorised_values_sth,$input, $history |
| 572 |
) |
581 |
) |
| 573 |
); |
582 |
); |
| 574 |
} |
583 |
} |
|
Lines 583-589
sub build_tabs {
Link Here
|
| 583 |
@subfields_data, |
592 |
@subfields_data, |
| 584 |
&create_input( |
593 |
&create_input( |
| 585 |
$tag, $subfield, $value, $index_tag, $tabloop, |
594 |
$tag, $subfield, $value, $index_tag, $tabloop, |
| 586 |
$record, $authorised_values_sth,$input |
595 |
$record, $authorised_values_sth,$input, $history |
| 587 |
) |
596 |
) |
| 588 |
); |
597 |
); |
| 589 |
} |
598 |
} |
|
Lines 613-619
sub build_tabs {
Link Here
|
| 613 |
@subfields_data, |
622 |
@subfields_data, |
| 614 |
&create_input( |
623 |
&create_input( |
| 615 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
624 |
$tag, $subfield, '', $index_tag, $tabloop, $record, |
| 616 |
$authorised_values_sth,$input |
625 |
$authorised_values_sth,$input, $history |
| 617 |
) |
626 |
) |
| 618 |
); |
627 |
); |
| 619 |
} |
628 |
} |
|
Lines 669-675
sub build_tabs {
Link Here
|
| 669 |
@subfields_data, |
678 |
@subfields_data, |
| 670 |
&create_input( |
679 |
&create_input( |
| 671 |
$tag, $subfield->{subfield}, '', $index_tag, $tabloop, $record, |
680 |
$tag, $subfield->{subfield}, '', $index_tag, $tabloop, $record, |
| 672 |
$authorised_values_sth,$input |
681 |
$authorised_values_sth,$input, $history |
| 673 |
) |
682 |
) |
| 674 |
); |
683 |
); |
| 675 |
} |
684 |
} |
|
Lines 687-693
sub build_tabs {
Link Here
|
| 687 |
tagfirstsubfield => $subfields_data[0], |
696 |
tagfirstsubfield => $subfields_data[0], |
| 688 |
fixedfield => $tag < 10?1:0, |
697 |
fixedfield => $tag < 10?1:0, |
| 689 |
); |
698 |
); |
| 690 |
|
699 |
|
| 691 |
push @loop_data, \%tag_data ; |
700 |
push @loop_data, \%tag_data ; |
| 692 |
} |
701 |
} |
| 693 |
} |
702 |
} |
|
Lines 789-794
$mandatory_z3950 = GetMandatoryFieldZ3950($frameworkcode);
Link Here
|
| 789 |
# -- Global |
798 |
# -- Global |
| 790 |
|
799 |
|
| 791 |
my $record = -1; |
800 |
my $record = -1; |
|
|
801 |
my $history = undef; |
| 792 |
my $encoding = ""; |
802 |
my $encoding = ""; |
| 793 |
my ( |
803 |
my ( |
| 794 |
$biblionumbertagfield, |
804 |
$biblionumbertagfield, |
|
Lines 799-805
my (
Link Here
|
| 799 |
); |
809 |
); |
| 800 |
|
810 |
|
| 801 |
if (($biblionumber) && !($breedingid)){ |
811 |
if (($biblionumber) && !($breedingid)){ |
| 802 |
$record = GetMarcBiblio({ biblionumber => $biblionumber }); |
812 |
($record, $history) = GetMarcBiblioHistory($biblionumber); |
| 803 |
} |
813 |
} |
| 804 |
if ($breedingid) { |
814 |
if ($breedingid) { |
| 805 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
815 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
|
Lines 869-875
if ( $op eq "addbiblio" ) {
Link Here
|
| 869 |
else { |
879 |
else { |
| 870 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
880 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
| 871 |
} |
881 |
} |
| 872 |
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
882 |
if ($redirect eq "items" || (defined $mode && $mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
| 873 |
if ($frameworkcode eq 'FA'){ |
883 |
if ($frameworkcode eq 'FA'){ |
| 874 |
print $input->redirect( |
884 |
print $input->redirect( |
| 875 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
885 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
|
Lines 928-934
if ( $op eq "addbiblio" ) {
Link Here
|
| 928 |
} |
938 |
} |
| 929 |
} else { |
939 |
} else { |
| 930 |
# it may be a duplicate, warn the user and do nothing |
940 |
# it may be a duplicate, warn the user and do nothing |
| 931 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
941 |
build_tabs ($template, $record, $dbh,$encoding, $input, $history); |
| 932 |
$template->param( |
942 |
$template->param( |
| 933 |
biblionumber => $biblionumber, |
943 |
biblionumber => $biblionumber, |
| 934 |
biblioitemnumber => $biblioitemnumber, |
944 |
biblioitemnumber => $biblioitemnumber, |
|
Lines 975-981
elsif ( $op eq "delete" ) {
Link Here
|
| 975 |
$record = $urecord; |
985 |
$record = $urecord; |
| 976 |
}; |
986 |
}; |
| 977 |
} |
987 |
} |
| 978 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
988 |
|
|
|
989 |
build_tabs( $template, $record, $dbh, $encoding, $input, $history ); |
| 979 |
$template->param( |
990 |
$template->param( |
| 980 |
biblionumber => $biblionumber, |
991 |
biblionumber => $biblionumber, |
| 981 |
biblionumbertagfield => $biblionumbertagfield, |
992 |
biblionumbertagfield => $biblionumbertagfield, |