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

SF.net SVN: ledger-smb:[3335] trunk/sql



Revision: 3335
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3335&view=rev
Author:   einhverfr
Date:     2011-06-25 16:47:02 +0000 (Sat, 25 Jun 2011)

Log Message:
-----------
Location saving API's now beliebed to be information-complete.

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

Added Paths:
-----------
    trunk/sql/upgrade/3335-drop-location_saves.sql

Modified: trunk/sql/modules/Company.sql
===================================================================
--- trunk/sql/modules/Company.sql	2011-06-25 15:51:54 UTC (rev 3334)
+++ trunk/sql/modules/Company.sql	2011-06-25 16:47:02 UTC (rev 3335)
@@ -943,7 +943,7 @@
     in_credit_id int, in_location_id int,
     in_location_class int, in_line_one text, in_line_two text, 
     in_line_three text, in_city TEXT, in_state TEXT, in_mail_code text, 
-    in_country_code int
+    in_country_code int, in_old_location_class int
 ) returns int AS $$
 
     DECLARE
@@ -951,10 +951,11 @@
         l_id INT;
         l_orig_id INT;
     BEGIN
-       PERFORM location_id 
-          FROM eca_to_location
+       
+        UPDATE eca_to_location
+           SET location_class = in_location_class
          WHERE credit_id = in_credit_id
-           AND location_class = in_location_class
+           AND location_class = in_old_location_class
            AND location_id = in_location_id;
            
          IF FOUND THEN

Modified: trunk/sql/modules/Person.sql
===================================================================
--- trunk/sql/modules/Person.sql	2011-06-25 15:51:54 UTC (rev 3334)
+++ trunk/sql/modules/Person.sql	2011-06-25 16:47:02 UTC (rev 3335)
@@ -201,7 +201,8 @@
     in_city TEXT, 
     in_state TEXT, 
     in_mail_code text, 
-    in_country_code int
+    in_country_code int,
+    in_old_location_class int
 ) returns int AS $$
 
     DECLARE
@@ -211,10 +212,13 @@
     BEGIN
 	SELECT id INTO t_person_id
 	FROM person WHERE entity_id = in_entity_id;
-    -- why does it delete?
+
+    UPDATE person_to_location
+       SET location_class = in_location_class
+     WHERE person_id = t_person_id 
+           AND location_class = in_old_location_class
+           AND location_id = in_location_id;
     
-    select * into l_row FROM location
-    WHERE id = in_location_id;
     
     IF NOT FOUND THEN
         -- Create a new one.

Added: trunk/sql/upgrade/3335-drop-location_saves.sql
===================================================================
--- trunk/sql/upgrade/3335-drop-location_saves.sql	                        (rev 0)
+++ trunk/sql/upgrade/3335-drop-location_saves.sql	2011-06-25 16:47:02 UTC (rev 3335)
@@ -0,0 +1,17 @@
+DROP function eca__location_save(
+    in_credit_id int, in_location_id int,
+    in_location_class int, in_line_one text, in_line_two text,
+    in_line_three text, in_city TEXT, in_state TEXT, in_mail_code text,
+    in_country_code int);
+
+DROP function person__save_location(
+    in_entity_id int,
+    in_location_id int,
+    in_location_class int,
+    in_line_one text,
+    in_line_two text,
+    in_line_three text,
+    in_city TEXT,
+    in_state TEXT,
+    in_mail_code text,
+    in_country_code int);


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