Bugzilla – Attachment 140659 Details for
Bug 31569
Remove GetImportsRecordRange from acqui/addorderiso2709
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31569: DB update and objects
Bug-31569-DB-update-and-objects.patch (text/plain), 5.22 KB, created by
Nick Clemens (kidclamp)
on 2022-09-15 13:55:06 UTC
(
hide
)
Description:
Bug 31569: DB update and objects
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-09-15 13:55:06 UTC
Size:
5.22 KB
patch
obsolete
>From 22b6430df1d708e1d538ab477b5a043e8c67f05a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 15 Sep 2022 12:42:56 +0000 >Subject: [PATCH] Bug 31569: DB update and objects > >--- > Koha/Import/Record.pm | 15 +++++ > Koha/Import/Record/Biblio.pm | 44 +++++++++++++++ > Koha/Import/Record/Biblios.pm | 56 +++++++++++++++++++ > .../data/mysql/atomicupdate/bug_31569.pl | 14 +++++ > installer/data/mysql/kohastructure.sql | 1 + > 5 files changed, 130 insertions(+) > create mode 100644 Koha/Import/Record/Biblio.pm > create mode 100644 Koha/Import/Record/Biblios.pm > create mode 100755 installer/data/mysql/atomicupdate/bug_31569.pl > >diff --git a/Koha/Import/Record.pm b/Koha/Import/Record.pm >index 49a7710e23..a1fedab5fe 100644 >--- a/Koha/Import/Record.pm >+++ b/Koha/Import/Record.pm >@@ -22,6 +22,7 @@ use MARC::Record; > > use C4::Context; > use Koha::Database; >+use Koha::Import::Record::Biblios; > > use base qw(Koha::Object); > >@@ -56,6 +57,20 @@ sub get_marc_record { > return $record; > } > >+=head3 import_biblio >+ >+Returns the import biblio object for this import record >+ >+ my $import_biblio = $import_record->import_biblio() >+ >+=cut >+ >+sub import_biblio { >+ my ( $self ) = @_; >+ my $import_biblio_rs = $self->_result->import_biblio; >+ return Koha::Import::Record::Biblio->_new_from_dbic( $import_biblio_rs ); >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/Koha/Import/Record/Biblio.pm b/Koha/Import/Record/Biblio.pm >new file mode 100644 >index 0000000000..16d3f0eeba >--- /dev/null >+++ b/Koha/Import/Record/Biblio.pm >@@ -0,0 +1,44 @@ >+package Koha::Import::Record::Biblio; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Carp; >+ >+use Koha::Database; >+ >+use base qw(Koha::Object); >+ >+=head1 NAME >+ >+Koha::Import::Record::Biblio - Koha Import Record Biblio Object class >+ >+=head1 API >+ >+=head2 Internal methods >+ >+=head3 _type >+ >+Returns name of corresponding DBIC resultset >+ >+=cut >+ >+sub _type { >+ return 'ImportBiblio'; >+} >+ >+1; >diff --git a/Koha/Import/Record/Biblios.pm b/Koha/Import/Record/Biblios.pm >new file mode 100644 >index 0000000000..36d725f589 >--- /dev/null >+++ b/Koha/Import/Record/Biblios.pm >@@ -0,0 +1,56 @@ >+package Koha::Import::Record::Biblios; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Carp; >+ >+use Koha::Database; >+ >+use Koha::Import::Record::Biblio; >+ >+use base qw(Koha::Objects); >+ >+=head1 NAME >+ >+Koha::Import::Record::Biblios - Koha Import Record Biblios Object set class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub _type { >+ return 'ImportBiblio'; >+} >+ >+=head3 object_class >+ >+Koha::Object class >+ >+=cut >+ >+sub object_class { >+ return 'Koha::Import::Record::Biblio'; >+} >+ >+1; >diff --git a/installer/data/mysql/atomicupdate/bug_31569.pl b/installer/data/mysql/atomicupdate/bug_31569.pl >new file mode 100755 >index 0000000000..c3d98c61c0 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_31569.pl >@@ -0,0 +1,14 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "31569", >+ description => "Add primary key for import_biblios", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ unless( primary_key_exists('import_biblios') ){ >+ $dbh->do(q{ALTER TABLE import_biblios ADD PRIMARY KEY (import_record_id)}); >+ say $out "Added primary key to import_biblios table"; >+ } >+ }, >+}; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 68f9844e6c..afa76c20eb 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -3049,6 +3049,7 @@ CREATE TABLE `import_biblios` ( > `isbn` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, > `issn` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, > `has_items` tinyint(1) NOT NULL DEFAULT 0, >+ PRIMARY KEY (`import_record_id`), > KEY `import_biblios_ibfk_1` (`import_record_id`), > KEY `matched_biblionumber` (`matched_biblionumber`), > KEY `title` (`title`(191)), >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31569
:
140659
|
140660
|
140661
|
140662
|
140663
|
140664
|
140665
|
140676
|
140677
|
140678
|
140679
|
140680
|
140681
|
140682
|
141504
|
141505
|
141506
|
141507
|
141508
|
141509
|
141510
|
141511
|
142031