diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-08-27 05:01:26 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-08-27 05:01:26 +0000 |
commit | 6a5ffe52f447695df07100c1af58ef5a103aaf0f (patch) | |
tree | 4cf7644dfd28e3e5c62f19b8afa7c4baae35cf98 /LedgerSMB | |
parent | 031e69854f83964266e5821d13cf49f438277cd1 (diff) |
Fixing pricematrix queries
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1467 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r-- | LedgerSMB/PriceMatrix.pm | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/LedgerSMB/PriceMatrix.pm b/LedgerSMB/PriceMatrix.pm index bfebde4a..87e04fd3 100644 --- a/LedgerSMB/PriceMatrix.pm +++ b/LedgerSMB/PriceMatrix.pm @@ -57,33 +57,36 @@ sub price_matrix_query { UNION - SELECT p.parts_id, p.entity_id, p.pricegroup_id, + SELECT p.parts_id, p.customer_id AS entity_id, + p.pricegroup_id, p.pricebreak, p.sellprice, p.validfrom, p.validto, p.curr, g.pricegroup FROM partscustomer p LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id) WHERE p.parts_id = ? - AND p.entity_id = $entity_id + AND p.customer_id = $entity_id UNION - SELECT p.parts_id, p.entity_id, p.pricegroup_id, + SELECT p.parts_id, p.customer_id AS entity_id, + p.pricegroup_id, p.pricebreak, p.sellprice, p.validfrom, p.validto, p.curr, g.pricegroup FROM partscustomer p LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id) - JOIN customer c ON (c.pricegroup_id = g.id) + JOIN entity_credit_account c ON (c.pricegroup_id = g.id) WHERE p.parts_id = ? - AND c.id = $entity_id + AND c.entity_id = $entity_id UNION - SELECT p.parts_id, p.entity_id, p.pricegroup_id, + SELECT p.parts_id, p.customer_id AS entity_id, + p.pricegroup_id, p.pricebreak, p.sellprice, p.validfrom, p.validto, p.curr, g.pricegroup FROM partscustomer p LEFT JOIN pricegroup g ON (g.id = p.pricegroup_id) - WHERE p.entity_id = 0 + WHERE p.customer_id = 0 AND p.pricegroup_id = 0 AND p.parts_id = ? @@ -99,7 +102,7 @@ sub price_matrix_query { SELECT partnumber FROM partsvendor WHERE parts_id = ? - AND entity_id = $entity_id|; + AND vendor_id = $entity_id|; $sth = $dbh->prepare($query) || $form->dberror($query); } |