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

SF.net SVN: ledger-smb:[4213] branches/1.3



Revision: 4213
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4213&view=rev
Author:   tshvr
Date:     2011-12-15 08:16:19 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
allow entities to be found if entity_credit_account not defined yet,put http_href on legal_name,Fixes.sql needed?

Modified Paths:
--------------
    branches/1.3/LedgerSMB/ScriptLib/Company.pm
    branches/1.3/sql/modules/Company.sql

Modified: branches/1.3/LedgerSMB/ScriptLib/Company.pm
===================================================================
--- branches/1.3/LedgerSMB/ScriptLib/Company.pm	2011-12-15 08:11:32 UTC (rev 4212)
+++ branches/1.3/LedgerSMB/ScriptLib/Company.pm	2011-12-15 08:16:19 UTC (rev 4213)
@@ -380,13 +380,13 @@
 
     my @rows;
     for $ref (@{$company->{search_results}}){
+    if(!$ref->{meta_number}){$ref->{meta_number}='';}
+    my $http_href="$get_url&entity_id=$ref->{entity_id}"."&meta_number=$ref->{meta_number}";
 	push @rows, 
-                {legal_name   => $ref->{legal_name},
+                {legal_name   => {text=>$ref->{legal_name},href=>$http_href},
 		entity_control_code => $ref->{entity_control_code},
 		credit_description => $ref->{credit_description},
-                meta_number   => {text => $ref->{meta_number},
-                                  href => "$get_url&entity_id=$ref->{entity_id}"		                           . "&meta_number=$ref->{meta_number}"
-		                 },
+                meta_number   => {text=>$ref->{meta_number}},
 		business_type => $ref->{business_type},
                 curr          => $ref->{curr},
                 };

Modified: branches/1.3/sql/modules/Company.sql
===================================================================
--- branches/1.3/sql/modules/Company.sql	2011-12-15 08:11:32 UTC (rev 4212)
+++ branches/1.3/sql/modules/Company.sql	2011-12-15 08:16:19 UTC (rev 4213)
@@ -202,7 +202,7 @@
  group by id, name, meta_number, curr, parts_id, partnumber, description, unit
  order by meta_number;
 $$ LANGUAGE SQL;
-
+--HV coalesce(ec.entity_class,e.entity_class) in case entity but not yet entity_credit_account
 CREATE OR REPLACE FUNCTION company__search
 (in_account_class int, in_contact text, in_contact_info text[], 
 	in_meta_number text, in_address text, in_city text, in_state text, 
@@ -235,7 +235,7 @@
                       SELECT * from entity_credit_account
                        WHERE in_meta_number IS NULL) ec ON (ec.entity_id = e.id)
 		LEFT JOIN business b ON (ec.business_id = b.id)
-		WHERE ec.entity_class = in_account_class
+		WHERE coalesce(ec.entity_class,e.entity_class) = in_account_class
 			AND (c.id IN (select company_id FROM company_to_contact
 				WHERE contact ILIKE ALL(t_contact_info))
 				OR '' ILIKE ALL(t_contact_info))

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