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

SF.net SVN: ledger-smb:[2718] trunk



Revision: 2718
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2718&view=rev
Author:   einhverfr
Date:     2009-07-10 17:54:46 +0000 (Fri, 10 Jul 2009)

Log Message:
-----------
Correction to company_save to update entity.name and entity.control_code.

Modified Paths:
--------------
    trunk/LedgerSMB/DBObject/Asset.pm
    trunk/sql/modules/Company.sql

Modified: trunk/LedgerSMB/DBObject/Asset.pm
===================================================================
--- trunk/LedgerSMB/DBObject/Asset.pm	2009-07-10 17:39:36 UTC (rev 2717)
+++ trunk/LedgerSMB/DBObject/Asset.pm	2009-07-10 17:54:46 UTC (rev 2718)
@@ -33,12 +33,15 @@
 }
 
 sub search_assets {
-    # TODO
+    my ($self) = @_;
+    my @results = $self->exec_method(funcname => 'asset__search');
+    $self->{search_results} = ..hidden..;
+    return @results;
 }
 
 
 sub get_metadata {
-    # TODO
+    my ($self) = @_;
 }
 
 

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2009-07-10 17:39:36 UTC (rev 2717)
+++ trunk/sql/modules/Company.sql	2009-07-10 17:54:46 UTC (rev 2718)
@@ -341,34 +341,20 @@
 		t_control_code := in_control_code;
 	END IF;
 
-	IF in_entity_id IS NULL THEN
-		IF in_id IS NULL THEN
-			SELECT id INTO t_company_id FROM company
-			WHERE entity_id = (SELECT id FROM entity WHERE 
-				control_code = t_control_code);
-		END IF;
-		IF t_company_id IS NOT NULL THEN
-			SELECT entity_id INTO t_entity_id FROM company
-			WHERE id = t_company_id;
-			
+	UPDATE entity 
+	SET name = in_name, 
+		entity_class = in_entity_class,
+		control_code = in_control_code
+	WHERE id = in_entity_id;
+
+	IF FOUND THEN
+		t_entity_id = in_entity_id;
 	ELSE
-		t_entity_id := in_entity_id;
-	END IF;
-	IF t_entity_id IS NULL THEN
 		INSERT INTO entity (name, entity_class, control_code,country_id)
 		VALUES (in_name, in_entity_class, t_control_code,in_country_id_t);
 		t_entity_id := currval('entity_id_seq');
-		END IF;
 	END IF;
 
-	UPDATE entity
-	SET name = in_name,
-            entity_class = in_entity_class,
-	    control_code = t_control_code,
-	    country_id = in_country_id_t
-	WHERE id = t_entity_id;
-
-
 	UPDATE company
 	SET legal_name = in_name,
 		tax_id = in_tax_id,


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