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

SF.net SVN: ledger-smb:[4553] branches/1.3/sql/modules/Company.sql



Revision: 4553
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4553&view=rev
Author:   ehuelsmann
Date:     2012-03-24 12:39:19 +0000 (Sat, 24 Mar 2012)
Log Message:
-----------
Fix company__search returning results not having in_meta_number, when it is non-NULL.

Modified Paths:
--------------
    branches/1.3/sql/modules/Company.sql

Modified: branches/1.3/sql/modules/Company.sql
===================================================================
--- branches/1.3/sql/modules/Company.sql	2012-03-24 12:07:11 UTC (rev 4552)
+++ branches/1.3/sql/modules/Company.sql	2012-03-24 12:39:19 UTC (rev 4553)
@@ -229,11 +229,7 @@
                       UNION ALL
                       SELECT * FROM company
                        WHERE in_legal_name IS NULL) c ON (e.id = c.entity_id)
-		LEFT JOIN (SELECT * FROM entity_credit_account 
-                       WHERE meta_number = in_meta_number
-                      UNION ALL
-                      SELECT * from entity_credit_account
-                       WHERE in_meta_number IS NULL) ec ON (ec.entity_id = e.id)
+		LEFT JOIN entity_credit_account ec ON (ec.entity_id = e.id)
 		LEFT JOIN business b ON (ec.business_id = b.id)
 		WHERE coalesce(ec.entity_class,e.entity_class) = in_account_class
 			AND (c.id IN (select company_id FROM company_to_contact
@@ -283,6 +279,8 @@
 				OR (ec.startdate IS NULL))
 			AND (ec.enddate >= coalesce(in_date_from, ec.enddate)
 				OR (ec.enddate IS NULL))
+	 		AND (ec.meta_number = in_meta_number
+			     OR in_meta_number IS NULL)
 	LOOP
 		RETURN NEXT out_row;
 	END LOOP;

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