From 00dbb7713080738a516128afcde1476f960c47cb Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Sun, 14 Jul 2019 18:47:48 +0100 Subject: [PATCH] Possible fix for transactions under postgres --- lib/Pear/LocalLoop/Controller/Api/External.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/External.pm b/lib/Pear/LocalLoop/Controller/Api/External.pm index 629efd3..4b13e4f 100644 --- a/lib/Pear/LocalLoop/Controller/Api/External.pm +++ b/lib/Pear/LocalLoop/Controller/Api/External.pm @@ -84,11 +84,23 @@ sub post_lcc_suppliers { return 0 unless $lcc_import_ext_ref; + my $columns = [qw/ + sales.id + seller.id + organisation.id + organisation.name + organisation.street_name + organisation.town + organisation.postcode + organisation.country + /]; + my $lcc_suppliers = $user->entity->purchases->search_related('seller',undef)->search( undef, { prefetch => ['sales', 'organisation'], - group_by => 'seller.id', + columns => $columns, + group_by => $columns, '+select' => [ { 'sum' => 'sales.value',