[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1467] trunk/LedgerSMB/PriceMatrix.pm



Revision: 1467
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1467&view=rev
Author:   einhverfr
Date:     2007-08-26 22:01:26 -0700 (Sun, 26 Aug 2007)

Log Message:
-----------
Fixing pricematrix queries

Modified Paths:
--------------
    trunk/LedgerSMB/PriceMatrix.pm

Modified: trunk/LedgerSMB/PriceMatrix.pm
===================================================================
--- trunk/LedgerSMB/PriceMatrix.pm	2007-08-27 04:53:35 UTC (rev 1466)
+++ trunk/LedgerSMB/PriceMatrix.pm	2007-08-27 05:01:26 UTC (rev 1467)
@@ -57,33 +57,36 @@
 
 			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 @@
 			SELECT partnumber
 			FROM partsvendor
 			WHERE parts_id = ?
-			AND entity_id = $entity_id|;
+			AND vendor_id = $entity_id|;
         $sth = $dbh->prepare($query) || $form->dberror($query);
     }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.