From b7ac6887818ceb4222de6bda248b3a0394721390 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 13 Jun 2017 01:28:26 +0000 Subject: [PATCH] Bug 14367: [FOLLOW-UP] Fixing merge conflicts... ...and other fixes to make patch work. --- C4/Biblio.pm | 6 +++--- Koha/MetadataRecord/History.pm | 4 ++-- cataloguing/addbiblio.pl | 2 +- installer/data/mysql/atomicupdate/add_history.sql | 1 - .../data/mysql/atomicupdate/bug_14367_-_add_history_column.perl | 9 +++++++++ 5 files changed, 15 insertions(+), 7 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/add_history.sql create mode 100644 installer/data/mysql/atomicupdate/bug_14367_-_add_history_column.perl diff --git a/C4/Biblio.pm b/C4/Biblio.pm index a0e5919..dd599aa 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -323,7 +323,7 @@ sub ModBiblio { # update biblionumber and biblioitemnumber in MARC # FIXME - this is assuming a 1 to 1 relationship between # biblios and biblioitems - my $sth = $dbh->prepare("select biblioitemnumber,history from biblioitems where biblionumber=?"); + my $sth = $dbh->prepare("select biblioitems.biblioitemnumber, biblio_metadata.history from biblioitems, biblio_metadata where biblioitems.biblionumber=?"); $sth->execute($biblionumber); my ($biblioitemnumber, $history) = $sth->fetchrow; $sth->finish(); @@ -3499,8 +3499,8 @@ sub ModBiblioMarc { my $newhistory = HistoryUpdate($newrecord, $historylength, $history); $newhistory = encode_json($newhistory); - $sth = $dbh->prepare("UPDATE biblioitems SET marc=?,marcxml=?,history=? WHERE biblionumber=?"); - $sth->execute( $record->as_usmarc(), $record->as_xml_record($encoding), $newhistory, $biblionumber ); + $sth = $dbh->prepare("UPDATE biblio_metadata SET metadata=?,history=? WHERE biblionumber=?"); + $sth->execute( $record->as_xml_record($encoding), $newhistory, $biblionumber ); $sth->finish; ModZebra( $biblionumber, "specialUpdate", "biblioserver", $record ); diff --git a/Koha/MetadataRecord/History.pm b/Koha/MetadataRecord/History.pm index 2a4e04a..66798db 100644 --- a/Koha/MetadataRecord/History.pm +++ b/Koha/MetadataRecord/History.pm @@ -68,10 +68,10 @@ sub GetMarcBiblioHistory { return; } my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("SELECT marcxml,history FROM biblioitems WHERE biblionumber=? "); + my $sth = $dbh->prepare("SELECT metadata,history FROM biblio_metadata WHERE biblionumber=? "); $sth->execute($biblionumber); my $row = $sth->fetchrow_hashref; - my $marcxml = StripNonXmlChars( $row->{'marcxml'} ); + my $marcxml = StripNonXmlChars( $row->{'metadata'} ); MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') ); my $record = MARC::Record->new(); my ($history, $borrowers) = HistoryParse( $row->{'history'} ); diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index ac7e0ff..678e1d0 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -806,7 +806,7 @@ if ($parentbiblio) { } $is_a_modif = 0; - + if ($biblionumber) { $is_a_modif = 1; my $title = C4::Context->preference('marcflavour') eq "UNIMARC" ? $record->subfield('200', 'a') : $record->title; diff --git a/installer/data/mysql/atomicupdate/add_history.sql b/installer/data/mysql/atomicupdate/add_history.sql deleted file mode 100644 index 4c5c424..0000000 --- a/installer/data/mysql/atomicupdate/add_history.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE biblioitems ADD COLUMN `history` LONGTEXT DEFAULT NULL AFTER `marcxml`; diff --git a/installer/data/mysql/atomicupdate/bug_14367_-_add_history_column.perl b/installer/data/mysql/atomicupdate/bug_14367_-_add_history_column.perl new file mode 100644 index 0000000..b8a1af4 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_14367_-_add_history_column.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + unless( column_exists( 'biblio_metadata', 'history' ) ) { + $dbh->do(q|ALTER TABLE biblio_metadata ADD history longtext default NULL AFTER metadata|); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 14367: Add column biblio_metadata.history)\n"; +} -- 2.1.4