From 28cade6ec8c1eef99f5734bdf8c0bfb1c364ac36 Mon Sep 17 00:00:00 2001 From: tetragon Date: Sun, 28 Oct 2007 18:52:18 +0000 Subject: Get the transaction search working well enough to not blow up on a simple search git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1823 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/OE.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/LedgerSMB/OE.pm b/LedgerSMB/OE.pm index c296ef30..d129ba7c 100644 --- a/LedgerSMB/OE.pm +++ b/LedgerSMB/OE.pm @@ -77,14 +77,19 @@ sub transactions { } my $query = qq| SELECT o.id, o.ordnumber, o.transdate, o.reqdate, - o.amount, ct.name, o.netamount, o.$form->{vc}_id, + o.amount, c.legal_name AS name, o.netamount, o.entity_id AS $form->{vc}_id, ex.$rate AS exchangerate, o.closed, o.quonumber, - o.shippingpoint, o.shipvia, e.name AS employee, - m.name AS manager, o.curr, o.ponumber + o.shippingpoint, o.shipvia, + pe.first_name \|\| ' ' \|\| pe.last_name AS employee, + pm.first_name \|\| ' ' \|\| pm.last_name AS manager, + o.curr, o.ponumber FROM oe o - JOIN $form->{vc} ct ON (o.$form->{vc}_id = ct.id) - LEFT JOIN employee e ON (o.employee_id = e.id) - LEFT JOIN employee m ON (e.managerid = m.id) + JOIN $form->{vc} ct ON (o.entity_id = ct.id) + JOIN company c ON (c.entity_id = ct.entity_id) + LEFT JOIN person pe ON (o.person_id = pe.id) + LEFT JOIN employee e ON (pe.entity_id = e.entity_id) + LEFT JOIN person pm ON (e.managerid = pm.id) + LEFT JOIN employee m ON (pm.entity_id = m.entity_id) LEFT JOIN exchangerate ex ON (ex.curr = o.curr AND ex.transdate = o.transdate) WHERE o.quotation = ? @@ -355,7 +360,7 @@ sub save { ($form->{id}, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, - ?, ?, ?, ?, ?)|; + ?, ?, ?, ?)|; @queryargs = ( $form->{ordnumber}, $form->{quonumber}, $form->{transdate}, $form->{entity_id}, $form->{reqdate}, -- cgit v1.2.3