From d6bbf0ffcbd60bea2770c2e869eec4f71e2f45a6 Mon Sep 17 00:00:00 2001 From: Aung Zaw Win Date: Wed, 23 Sep 2020 14:42:23 +0630 Subject: [PATCH] 1.8: Fix #5115 - Salesperson/Employee cannot save $form->{employee} only contain Entity Name and Entity Id from entity table. not username from user table. Since entity id is already in the $form we don't need to run sub query that take entity from user table. --- old/lib/LedgerSMB/AA.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/old/lib/LedgerSMB/AA.pm b/old/lib/LedgerSMB/AA.pm index 7ee1ca90a6..06e6cb444f 100644 --- a/old/lib/LedgerSMB/AA.pm +++ b/old/lib/LedgerSMB/AA.pm @@ -330,8 +330,7 @@ sub post_transaction { person_id, entity_credit_account, approved, setting_sequence ) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, - (SELECT u.entity_id FROM users u WHERE u.username = ?), ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id |; } @@ -343,8 +342,7 @@ sub post_transaction { notes, intnotes, ponumber, crdate, reverse, person_id, entity_credit_account, approved ) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, - (SELECT u.entity_id FROM users u WHERE u.username = ?), ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING id |; } @@ -363,7 +361,7 @@ sub post_transaction { $form->{duedate}, $form->{notes}, $form->{intnotes}, $form->{ponumber}, $form->{crdate}, - $form->{reverse}, $form->{employee_name}, + $form->{reverse}, $form->{employee_id}, $form->{"$form->{vc}_id"}, $form->{approved} ); if ($table eq 'ar') {