Bugzilla – Attachment 116888 Details for
Bug 27569
marc-framework import function doesn't accept LibreOffice csv/ods file formats
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27569: Remove non mysql code
Bug-27569-Remove-non-mysql-code.patch (text/plain), 3.99 KB, created by
Katrin Fischer
on 2021-02-15 21:01:03 UTC
(
hide
)
Description:
Bug 27569: Remove non mysql code
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-02-15 21:01:03 UTC
Size:
3.99 KB
patch
obsolete
>From 10fa441ec1243cf25421e2aae2dd8130e423b031 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 1 Feb 2021 15:59:37 +0100 >Subject: [PATCH] Bug 27569: Remove non mysql code > >Remove a bit of the confusion by removing unless code (not related to >mysql) > >Signed-off-by: Ron Houk <rhouk@ottumwapubliclibrary.org> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/ImportExportFramework.pm | 32 +++++--------------------------- > 1 file changed, 5 insertions(+), 27 deletions(-) > >diff --git a/C4/ImportExportFramework.pm b/C4/ImportExportFramework.pm >index d4a11cabc5..82ce01367e 100644 >--- a/C4/ImportExportFramework.pm >+++ b/C4/ImportExportFramework.pm >@@ -848,36 +848,16 @@ sub _import_table > # Insert/Update the row from the spreadsheet in the database > sub _processRow_DB > { >- my ($dbh, $db_scheme, $table, $fields, $dataStr, $updateStr, $dataFields, $dataFieldsHash, $PKArray, $fieldsPK, $fields2Delete) = @_; >+ my ($dbh, $table, $fields, $dataStr, $updateStr, $dataFields, $dataFieldsHash, $PKArray, $fieldsPK, $fields2Delete) = @_; > > my $ok = 0; > my $query; >- if ($db_scheme eq 'mysql') { >- $query = 'INSERT INTO ' . $table . ' (' . $fields . ') VALUES (' . $dataStr . ') ON DUPLICATE KEY UPDATE ' . $updateStr; >- } else { >- $query = 'INSERT INTO ' . $table . ' (' . $fields . ') VALUES (' . $dataStr . ')'; >- } >+ $query = 'INSERT INTO ' . $table . ' (' . $fields . ') VALUES (' . $dataStr . ') ON DUPLICATE KEY UPDATE ' . $updateStr; > eval { > my $sth = $dbh->prepare($query); >- if ($db_scheme eq 'mysql') { >- $sth->execute((@$dataFields, @$dataFields)); >- } else { >- $sth->execute(@$dataFields); >- } >+ $sth->execute((@$dataFields, @$dataFields)); > }; > if ($@) { >- unless ($db_scheme eq 'mysql') { >- $query = 'UPDATE ' . $table . ' SET ' . $updateStr . ' WHERE '; >- map {$query .= $_ . '=? AND ';} @$PKArray; >- $query = substr($query, 0, -4); >- eval { >- my $sth2 = $dbh->prepare($query); >- my @dataPK = (); >- map {push @dataPK, $dataFieldsHash->{$_};} @$PKArray; >- $sth2->execute((@$dataFields, @dataPK)); >- }; >- $ok = 1 unless ($@); >- } > $debug and warn "Error _processRows_Table $@\n"; > } else { > $ok = 1; >@@ -903,7 +883,6 @@ sub _processRows_Table > my $dataStr = ''; > my $updateStr = ''; > my $j = 0; >- my $db_scheme = C4::Context->config("db_scheme"); > my $ok = 0; > my @fieldsPK = @$PKArray; > shift @fieldsPK; >@@ -924,7 +903,7 @@ sub _processRows_Table > # Get data from row > my ($dataFields, $dataFieldsR) = _getDataFields($frameworkcode, $nodeR, \@fields, $format); > if (scalar(@fields) == scalar(@$dataFieldsR)) { >- $ok = _processRow_DB($dbh, $db_scheme, $table, $fields, $dataStr, $updateStr, $dataFieldsR, $dataFields, $PKArray, \@fieldsPK, $fields2Delete); >+ $ok = _processRow_DB($dbh, $table, $fields, $dataStr, $updateStr, $dataFieldsR, $dataFields, $PKArray, \@fieldsPK, $fields2Delete); > } > } > $j++; >@@ -948,7 +927,6 @@ sub _import_table_csv > my $fieldsNameRead = 0; > my @arrData; > my ($fieldsStr, $dataStr, $updateStr); >- my $db_scheme = C4::Context->config("db_scheme"); > my @fieldsPK = @$PKArray; > shift @fieldsPK; > my $ok = 0; >@@ -1005,7 +983,7 @@ sub _import_table_csv > } > $j++ > } >- $ok = _processRow_DB($dbh, $db_scheme, $table, $fieldsStr, $dataStr, $updateStr, \@arrData, \%dataFields, $PKArray, \@fieldsPK, $fields2Delete); >+ $ok = _processRow_DB($dbh, $table, $fieldsStr, $dataStr, $updateStr, \@arrData, \%dataFields, $PKArray, \@fieldsPK, $fields2Delete); > } > $pos = tell($dom); > } >-- >2.11.0
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 27569
:
116164
|
116165
|
116166
|
116167
|
116168
|
116169
|
116170
|
116871
|
116872
|
116873
|
116874
|
116875
|
116876
|
116877
| 116888 |
116889
|
116890
|
116891
|
116892
|
116893
|
116894