Lines 57-62
use Koha::Libraries;
Link Here
|
57 |
use Koha::BiblioFrameworks; |
57 |
use Koha::BiblioFrameworks; |
58 |
use Koha::Patrons; |
58 |
use Koha::Patrons; |
59 |
use Koha::UI::Form::Builder::Biblio; |
59 |
use Koha::UI::Form::Builder::Biblio; |
|
|
60 |
use Koha::Util::Misc; |
60 |
|
61 |
|
61 |
use MARC::File::USMARC; |
62 |
use MARC::File::USMARC; |
62 |
use MARC::File::XML; |
63 |
use MARC::File::XML; |
Lines 603-608
my (
Link Here
|
603 |
$biblioitemnumber |
604 |
$biblioitemnumber |
604 |
); |
605 |
); |
605 |
|
606 |
|
|
|
607 |
my $digest; |
606 |
if ( $biblio && !$breedingid ) { |
608 |
if ( $biblio && !$breedingid ) { |
607 |
eval { $record = $biblio->metadata->record }; |
609 |
eval { $record = $biblio->metadata->record }; |
608 |
if ($@) { |
610 |
if ($@) { |
Lines 611-616
if ( $biblio && !$breedingid ) {
Link Here
|
611 |
$record = $biblio->metadata->record_strip_nonxml; |
613 |
$record = $biblio->metadata->record_strip_nonxml; |
612 |
$template->param( INVALID_METADATA => $exception ); |
614 |
$template->param( INVALID_METADATA => $exception ); |
613 |
} |
615 |
} |
|
|
616 |
$digest = digest($record) if $record; |
614 |
} |
617 |
} |
615 |
if ($breedingid) { |
618 |
if ($breedingid) { |
616 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
619 |
( $record, $encoding ) = MARCfindbreeding( $breedingid ) ; |
Lines 701-711
if ( $op eq "cud-addbiblio" ) {
Link Here
|
701 |
( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($record); |
704 |
( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($record); |
702 |
} |
705 |
} |
703 |
my $confirm_not_duplicate = $input->param('confirm_not_duplicate'); |
706 |
my $confirm_not_duplicate = $input->param('confirm_not_duplicate'); |
|
|
707 |
my $digest_orig = $input->param('digest'); |
704 |
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate) |
708 |
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate) |
705 |
if ( !$duplicatebiblionumber or $confirm_not_duplicate ) { |
709 |
if ( !$duplicatebiblionumber or $confirm_not_duplicate ) { |
706 |
my $oldbibitemnum; |
710 |
my $oldbibitemnum; |
707 |
if ( $is_a_modif ) { |
711 |
if ( $is_a_modif ) { |
708 |
ModBiblio( |
712 |
my $success = ModBiblio( |
709 |
$record, |
713 |
$record, |
710 |
$biblionumber, |
714 |
$biblionumber, |
711 |
$frameworkcode, |
715 |
$frameworkcode, |
Lines 714-722
if ( $op eq "cud-addbiblio" ) {
Link Here
|
714 |
source => $z3950 ? 'z3950' : 'intranet', |
718 |
source => $z3950 ? 'z3950' : 'intranet', |
715 |
categorycode => $logged_in_patron->categorycode, |
719 |
categorycode => $logged_in_patron->categorycode, |
716 |
userid => $logged_in_patron->userid, |
720 |
userid => $logged_in_patron->userid, |
717 |
} |
721 |
}, |
|
|
722 |
original_digest => $digest_orig, |
718 |
} |
723 |
} |
719 |
); |
724 |
); |
|
|
725 |
|
726 |
# in case of unsuccessful record modification let's redirect to merge |
727 |
unless ( $success > 0 ) { |
728 |
$success ||= 1; |
729 |
|
730 |
( $template, undef, undef ) = get_template_and_user( |
731 |
{ |
732 |
template_name => "cataloguing/merge.tt", |
733 |
query => $input, |
734 |
type => "intranet", |
735 |
flagsrequired => { editcatalogue => 'edit_catalogue' }, |
736 |
} |
737 |
); |
738 |
|
739 |
my $framework_database = GetFrameworkCode($biblionumber); |
740 |
|
741 |
# Getting MARC Structure |
742 |
my $tagslib = GetMarcStructure( 1, $framework_database ); |
743 |
|
744 |
my $marcflavour = lc( C4::Context->preference('marcflavour') ); |
745 |
|
746 |
# Creating a loop for display |
747 |
my @records; |
748 |
|
749 |
for my $i ( 0 .. 1 ) { |
750 |
my $biblio; |
751 |
my $marcrecord; |
752 |
my $frmwkcode; |
753 |
my $template_record; |
754 |
if ( $i == 0 ) { #database version |
755 |
$biblio = Koha::Biblios->find($biblionumber); |
756 |
$marcrecord = $biblio->record; |
757 |
$frmwkcode = $framework_database; |
758 |
$template_record->{reference} = 1; |
759 |
$template->param( ref_record => $template_record ); |
760 |
$template_record->{recordid} = $biblionumber; |
761 |
} else { #modified version |
762 |
$marcrecord = $record; |
763 |
$frmwkcode = $frameworkcode; |
764 |
$template_record->{recordid} = -1; # NOTE for the modified version |
765 |
} |
766 |
|
767 |
my $recordObj = Koha::MetadataRecord->new( { 'record' => $marcrecord, schema => $marcflavour } ); |
768 |
$template_record->{record} = $marcrecord; |
769 |
$template_record->{frameworkcode} = $frmwkcode; |
770 |
$template_record->{display} = $recordObj->createMergeHash($tagslib); |
771 |
push @records, $template_record; |
772 |
} |
773 |
|
774 |
my ($biblionumbertag) = GetMarcFromKohaField('biblio.biblionumber'); |
775 |
|
776 |
# Parameters |
777 |
$template->param( |
778 |
ref_biblionumber => $biblionumber, |
779 |
records => \@records, |
780 |
ref_record => $records[0], |
781 |
framework => $framework_database, |
782 |
biblionumbertag => $biblionumbertag, |
783 |
mid_air_collision => 1, |
784 |
digest => digest( $records[0]->{record} ), |
785 |
); |
786 |
|
787 |
output_html_with_http_headers $input, $cookie, $template->output; |
788 |
exit; |
789 |
} |
720 |
} |
790 |
} |
721 |
else { |
791 |
else { |
722 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
792 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
Lines 845-857
elsif ( $op eq "cud-delete" ) {
Link Here
|
845 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
915 |
build_tabs( $template, $record, $dbh, $encoding,$input ); |
846 |
$template->param( |
916 |
$template->param( |
847 |
biblionumber => $biblionumber, |
917 |
biblionumber => $biblionumber, |
848 |
biblionumbertagfield => $biblionumbertagfield, |
918 |
biblionumbertagfield => $biblionumbertagfield, |
849 |
biblionumbertagsubfield => $biblionumbertagsubfield, |
919 |
biblionumbertagsubfield => $biblionumbertagsubfield, |
850 |
biblioitemnumtagfield => $biblioitemnumtagfield, |
920 |
biblioitemnumtagfield => $biblioitemnumtagfield, |
851 |
biblioitemnumtagsubfield => $biblioitemnumtagsubfield, |
921 |
biblioitemnumtagsubfield => $biblioitemnumtagsubfield, |
852 |
biblioitemnumber => $biblioitemnumber, |
922 |
biblioitemnumber => $biblioitemnumber, |
853 |
hostbiblionumber => $hostbiblionumber, |
923 |
hostbiblionumber => $hostbiblionumber, |
854 |
hostitemnumber => $hostitemnumber |
924 |
hostitemnumber => $hostitemnumber, |
|
|
925 |
digest => $digest, |
855 |
); |
926 |
); |
856 |
} |
927 |
} |
857 |
|
928 |
|