From df71b4750efd8607a7852b25f26a3b121a8ee7a1 Mon Sep 17 00:00:00 2001 From: "Martin Helmling martin.helmling@octosoft.eu" Date: Fri, 2 Sep 2016 17:25:11 +0200 Subject: [PATCH] CSV-Import: single-dbh --- SL/Controller/CsvImport/Base.pm | 2 +- SL/Controller/CsvImport/Inventory.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SL/Controller/CsvImport/Base.pm b/SL/Controller/CsvImport/Base.pm index 2fa788753..17a3bfdd6 100644 --- a/SL/Controller/CsvImport/Base.pm +++ b/SL/Controller/CsvImport/Base.pm @@ -461,7 +461,7 @@ sub save_objects { $self->controller->track_progress(phase => 'saving data', progress => 0); # scale from 45..95%; - my $dbh = $data->[0]{object}->db; + my $dbh = $data->[0]{object}->db->dbh; my $last_index = $#$data; my $chunk_size = 100; # one transaction and progress update every 100 objects diff --git a/SL/Controller/CsvImport/Inventory.pm b/SL/Controller/CsvImport/Inventory.pm index a6e900189..238abf33a 100644 --- a/SL/Controller/CsvImport/Inventory.pm +++ b/SL/Controller/CsvImport/Inventory.pm @@ -395,7 +395,7 @@ sub save_objects { my $data = $params{data} || $self->controller->data; foreach my $entry (@{ $data }) { - my ($trans_id) = selectrow_query($::form, $::form->get_standard_dbh, qq|SELECT nextval('id')|); + my ($trans_id) = selectrow_query($::form,$entry->{object}->db->dbh, qq|SELECT nextval('id')|); $entry->{object}->trans_id($trans_id); } @@ -424,7 +424,7 @@ SQL $object->chargenumber); push @values, $object->bestbefore if $bestbefore_val_cnt; - my ($stocked_qty) = selectrow_query($::form, $::form->get_standard_dbh, $query, @values); + my ($stocked_qty) = selectrow_query($::form, $object->db->dbh, $query, @values); return $stocked_qty; } -- 2.20.1