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

SF.net SVN: ledger-smb:[5469] trunk/sql/modules/Company.sql



Revision: 5469
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5469&view=rev
Author:   einhverfr
Date:     2013-01-04 08:03:16 +0000 (Fri, 04 Jan 2013)
Log Message:
-----------
Fixing user search not working

Modified Paths:
--------------
    trunk/sql/modules/Company.sql

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2013-01-04 07:17:51 UTC (rev 5468)
+++ trunk/sql/modules/Company.sql	2013-01-04 08:03:16 UTC (rev 5469)
@@ -241,13 +241,21 @@
         in_active_date_to date,
         in_business_id int, in_name_part text, in_control_code text);
 
+DROP FUNCTION IF EXISTS contact__search
+(in_entity_class int, in_contact text, in_contact_info text[], 
+	in_meta_number text, in_address text, in_city text, in_state text, 
+	in_mail_code text, in_country text, in_active_date_from date, 
+        in_active_date_to date,
+	in_business_id int, in_name_part text, in_control_code text,
+        in_notes text);
+
 CREATE OR REPLACE FUNCTION contact__search
 (in_entity_class int, in_contact text, in_contact_info text[], 
 	in_meta_number text, in_address text, in_city text, in_state text, 
 	in_mail_code text, in_country text, in_active_date_from date, 
         in_active_date_to date,
 	in_business_id int, in_name_part text, in_control_code text,
-        in_notes text)
+        in_notes text, in_users bool)
 RETURNS SETOF contact_search_result AS $$
 DECLARE
 	out_row contact_search_result;
@@ -349,6 +357,9 @@
                                       WHERE note @@ plainto_tsquery(in_notes))
                                   OR ec.id IN (select ref_key FROM eca_note
                                      WHERE note @@ plainto_tsquery(in_notes)))
+                        AND (in_users IS NULL OR in_users = 
+                             (exists (select 1 from users 
+                                       where entity_id = e.id)))
                ORDER BY legal_name
 	LOOP
 		RETURN NEXT out_row;

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