fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9895] added automatic assignment of district to orga


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [9895] added automatic assignment of district to organizations registered via frontend
Date: Tue, 21 Aug 2012 10:38:46 +0000

Revision: 9895
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9895
Author:   erikhl
Date:     2012-08-21 10:38:46 +0000 (Tue, 21 Aug 2012)
Log Message:
-----------
added automatic assignment of district to organizations registered via frontend

Modified Paths:
--------------
    trunk/activitycalendar/inc/class.soorganization.inc.php
    trunk/activitycalendar/inc/class.uiorganization.inc.php
    trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php

Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php     2012-08-21 
10:38:15 UTC (rev 9894)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php     2012-08-21 
10:38:46 UTC (rev 9895)
@@ -629,6 +629,7 @@
                $street_2 = $org_info['streetnumber'];
                $street = $street_1 . ' ' . $street_2;
                $zip_code = $org_info['zip'];
+                $district = $org_info['district'];
                $city = $org_info['postaddress'];
                $activity_id = 1;
                $show_in_portal = 1; 
@@ -655,7 +656,7 @@
                $values[] = "'{$street}'";
                $values[] = "'{$zip_code}'";
                $values[] = "'{$city}'";
-               $values[] = "''";
+               $values[] = "'{$district}'";
                $values[] = "'{$orgnr}'";
                $values[] = $this->marshal($activity_id, 'int');
                $values[] = $show_in_portal;
@@ -750,7 +751,7 @@
                        'street = ' . $this->marshal($street, 'string'),
                        'zip_code = ' . $this->marshal($zip_code, 'string'),
                        'city = ' . $this->marshal($city, 'string'),
-                       'district = ' . $this->marshal($district),
+                       'district = ' . $this->marshal($district, 'string'),
                        'activity_id = ' . $this->marshal($activity_id, 'int'),
                        'show_in_portal = 1'
                );
@@ -850,5 +851,19 @@
        {
                return false;
        }
+        
+        function update_org_district_local($org_id, $district_id)
+       {
+            $sql = "UPDATE activity_organization SET district='{$district_id}' 
WHERE ID={$org_id}";
+            $result = $this->db->query($sql, __LINE__, __FILE__);
+            if(isset($result))
+            {
+               return true;
+            }
+            else
+            {
+               return false;
+            }
+       }
 }
 ?>

Modified: trunk/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiorganization.inc.php     2012-08-21 
10:38:15 UTC (rev 9894)
+++ trunk/activitycalendar/inc/class.uiorganization.inc.php     2012-08-21 
10:38:46 UTC (rev 9895)
@@ -96,6 +96,15 @@
                        {
                                $orgno = phpgw::get_var('orgno');
                                $district = phpgw::get_var('org_district');
+                                if(isset($district) && is_numeric($district))
+                                {
+                                    //get district name before storing to 
booking
+                                    $district_name = 
$so_activity->get_district_from_id($district);
+                                }
+                                else
+                                {
+                                    $district_name = "";
+                                }
                                $homepage = phpgw::get_var('homepage');
                                $email = phpgw::get_var('email');
                                $phone = phpgw::get_var('phone');
@@ -123,7 +132,7 @@
                                $org_info['zip'] = $zip;
                                 $org_info['postaddress'] = $city;
                                $org_info['activity_id'] = '';
-                               $org_info['district'] = $district;
+                               $org_info['district'] = $district_name;
                                
                                $contact1_id = phpgw::get_var('contact1_id');
                                $contact2_id = phpgw::get_var('contact2_id');
@@ -178,6 +187,15 @@
                                $original_org_id = 
phpgw::get_var('original_org_id');
                                $orgno = phpgw::get_var('orgno');
                                $district = phpgw::get_var('org_district');
+                                if(isset($district) && is_numeric($district))
+                                {
+                                    //get district name before storing to 
booking
+                                    $district_name = 
$so_activity->get_district_from_id($district);
+                                }
+                                else
+                                {
+                                    $district_name = "";
+                                }
                                $homepage = phpgw::get_var('homepage');
                                $email = phpgw::get_var('email');
                                $phone = phpgw::get_var('phone');
@@ -203,7 +221,7 @@
                                $org_info['zip_code'] = $zip;
                                 $org_info['city'] = $city;
                                $org_info['activity_id'] = '';
-                               $org_info['district'] = $district;
+                               $org_info['district'] = $district_name;
                                 $org_info['orgid'] = $original_org_id;
                                
                                $contact1_id = phpgw::get_var('contact1_id');

Modified: trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2012-08-21 
10:38:15 UTC (rev 9894)
+++ trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2012-08-21 
10:38:46 UTC (rev 9895)
@@ -301,6 +301,13 @@
                                $activity->set_new_group($new_group);
                                $target_ok = false;
                                $district_ok = false;
+                                
+                                if($get_org_from_local)
+                                {
+                                    //update new organization with district-id 
from activity.
+                                    
$this->so_organization->update_org_district_local($organization->get_id(), 
$activity->get_district());
+                                }
+                                
                                if($activity->get_target() && 
$activity->get_target() != '')
                                {
                                        $target_ok = true;
@@ -819,6 +826,7 @@
                                         $org_info['streetnumber'] = 
phpgw::get_var('number');
                                        $org_info['zip'] = 
phpgw::get_var('postzip');
                                        $org_info['postaddress'] = 
phpgw::get_var('postaddress');
+                                        $org_info['district'] = 
$organization->get_district();
                                        $org_info['status'] = "change";
                                        $org_info['original_org_id'] = $org_id;
                                        $o_id = 
$this->so_activity->add_organization_local($org_info);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]