From c5e8f760fbd4df86a8244a82db9e7c34664756c8 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. Signed-off-by: David Nind Signed-off-by: David Nind --- C4/Biblio.pm | 6 +++--- Koha/MetadataRecord/History.pm | 4 ++-- .../data/mysql/atomicupdate/bug_14367_-_add_history_column.perl | 9 +++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_14367_-_add_history_column.perl diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 7a75973c15..a322b11108 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -301,7 +301,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(); @@ -3160,8 +3160,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 2a4e04addf..66798db504 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/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 0000000000..b8a1af42fb --- /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.11.0