fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7449]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7449]
Date: Wed, 29 Jun 2011 06:55:30 +0000

Revision: 7449
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7449
Author:   erikhl
Date:     2011-06-29 06:55:29 +0000 (Wed, 29 Jun 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/activitycalendar/inc/class.menu.inc.php
    trunk/activitycalendar/inc/class.soactivity.inc.php
    trunk/activitycalendar/inc/class.soarena.inc.php
    trunk/activitycalendar/inc/class.sogroup.inc.php
    trunk/activitycalendar/inc/class.soorganization.inc.php
    trunk/activitycalendar/inc/class.uiactivities.inc.php
    trunk/activitycalendar/inc/class.uiorganization.inc.php
    trunk/activitycalendar/inc/model/class.activity.inc.php
    trunk/activitycalendar/inc/model/class.group.inc.php
    trunk/activitycalendar/inc/model/class.organization.inc.php
    trunk/activitycalendar/setup/phpgw_no.lang
    trunk/activitycalendar/setup/setup.inc.php
    trunk/activitycalendar/setup/tables_current.inc.php
    trunk/activitycalendar/setup/tables_update.inc.php
    trunk/activitycalendar/templates/base/activity.php
    trunk/activitycalendar/templates/base/organization_list_partial.php

Modified: trunk/activitycalendar/inc/class.menu.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.menu.inc.php       2011-06-29 06:54:50 UTC 
(rev 7448)
+++ trunk/activitycalendar/inc/class.menu.inc.php       2011-06-29 06:55:29 UTC 
(rev 7449)
@@ -38,6 +38,14 @@
                                        'text'  => lang('OrganizationList'),
                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'activitycalendar.uiorganization.index') ),
                            'image'     => array('property', 'location_tenant'),
+                                       'children'      => array(
+                                                               
'changed_organizations' => array
+                                                               (
+                                                                       'text'  
=> lang('changed_org_group'),
+                                                                       'url'   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'activitycalendar.uiorganization.changed_organizations') ),
+                                                                       'image' 
=> array('property', 'location_tenant')
+                                                               )
+                                                       )
                                )      
                        );
                        

Modified: trunk/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soactivity.inc.php 2011-06-29 06:54:50 UTC 
(rev 7448)
+++ trunk/activitycalendar/inc/class.soactivity.inc.php 2011-06-29 06:55:29 UTC 
(rev 7449)
@@ -177,6 +177,7 @@
                        $columns[] = 'activity.target';
                        $columns[] = 'activity.description';
                        $columns[] = 'activity.arena';
+                       $columns[] = 'activity.internal_arena';
                        $columns[] = 'activity.time';
                        $columns[] = 'activity.create_date';
                        $columns[] = 'activity.last_change_date';
@@ -247,6 +248,7 @@
                        'target = '   . $this->marshal($activity->get_target(), 
'string'),
                        'description = '     . 
$this->marshal($activity->get_description(), 'string'),
                        'arena = '      . 
$this->marshal($activity->get_arena(), 'int'),
+                       'internal_arena = '      . 
$this->marshal($activity->get_internal_arena(), 'int'),
                        'time = '      . $this->marshal($activity->get_time(), 
'string'),
                        'last_change_date = '    . $this->marshal($ts_now, 
'int'),
                        'contact_person_1 = '          . 
$this->marshal($activity->get_contact_person_1(), 'int'),
@@ -254,6 +256,7 @@
                        'special_adaptation = '                 
.($activity->get_special_adaptation() ? "true" : "false")
                );
                
+               //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
                $result = $this->db->query('UPDATE activity_activity SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
 
                return isset($result);
@@ -275,6 +278,7 @@
                        'target',
                        'description',
                        'arena',
+                       'internal_arena',
                        'time',
                        'last_change_date',
                        'create_date',
@@ -295,6 +299,7 @@
                        $this->marshal($activity->get_target(), 'string'),
                        $this->marshal($activity->get_description(), 'string'),
                        $this->marshal($activity->get_arena(), 'int'),
+                       $this->marshal($activity->get_internal_arena(), 'int'),
                        $this->marshal($activity->get_time(), 'string'),
                        $this->marshal($activity->get_last_change_date(), 
'int'),
                        $this->marshal($ts_now, 'int'),
@@ -343,6 +348,7 @@
                        
$activity->set_target($this->unmarshal($this->db->f('target'), 'string'));
                        
$activity->set_description($this->unmarshal($this->db->f('description'), 
'string'));
                        
$activity->set_arena($this->unmarshal($this->db->f('arena'), 'string'));
+                       
$activity->set_internal_arena($this->unmarshal($this->db->f('internal_arena'), 
'string'));
                        
$activity->set_time($this->unmarshal($this->db->f('time'), 'string'));
                        
$activity->set_last_change_date($this->unmarshal($this->db->f('last_change_date'),
 'int'));
                        
$activity->set_special_adaptation($this->unmarshal($this->db->f('special_adaptation',
 'bool')));
@@ -830,8 +836,8 @@
                $values[] = "{$street}";
                $values[] = "{$zip_code}";
                $values[] = "{$city}";
+               $values[] = "{$district}";
                $values[] = "{$orgnr}";
-               $values[] = "{$district}";
                $values[] = $activity_id;
                $values[] = $show_in_portal;
                $vals = implode(',',$values);
@@ -848,6 +854,65 @@
                }
        }
        
+       function add_organization_local($org_info)
+       {
+               $name = $org_info['name'];
+               $orgnr = $org_info['orgnr'];
+               $homepage = $org_info['homepage'];
+               $phone = $org_info['phone'];
+               $email = $org_info['email'];
+               $description = $org_info['description'];
+               $street = $org_info['street'];
+               $zip = $org_info['zip'];
+               if($zip && strlen($zip) > 5)
+               {
+                       $zip_code = substr($zip,0,4);
+                       $city = substr($zip, 5);
+               }
+               else
+               {
+                       $zip_code = '';
+                       $city = '';
+               }
+               $district = $org_info['district'];
+               
+               $columns[] = 'name';
+               $columns[] = 'homepage';
+               $columns[] = 'phone';
+               $columns[] = 'email';
+               $columns[] = 'description';
+               $columns[] = 'address';
+               //$columns[] = 'zip_code';
+               //$columns[] = 'city';
+               $columns[] = 'orgno';
+               $columns[] = 'district';
+               $cols = implode(',',$columns);
+               
+               $values[] = "'{$name}'";
+               $values[] = "'{$homepage}'";
+               $values[] = "'{$phone}'";
+               $values[] = "'{$email}'";
+               $values[] = "'{$description}'";
+               $values[] = "'{$street}'";
+               //$values[] = "'{$zip_code}'";
+               //$values[] = "'{$city}'";
+               $values[] = "'{$orgnr}'";
+               $values[] = "'{$district}'";
+               $vals = implode(',',$values);
+               
+               //var_dump("INSERT INTO activity_organization ({$cols}) VALUES 
({$vals})");
+               $sql = "INSERT INTO activity_organization ({$cols}) VALUES 
({$vals})";
+       $result = $this->db->query($sql, __LINE__, __FILE__);
+               if(isset($result))
+               {
+                       return 
$this->db->get_last_insert_id('activity_organization', 'id');
+               }
+               else
+               {
+                       return 0;
+               }
+       }
+       
        function add_group($group_info)
        {
                $name = $group_info['name'];
@@ -882,6 +947,34 @@
                }
        }
        
+       function add_group_local($group_info)
+       {
+               $name = $group_info['name'];
+               $orgid = $group_info['organization_id'];
+               $description = $group_info['description'];
+               
+               $columns[] = 'name';
+               $columns[] = 'description';
+               $columns[] = 'organization_id';
+               $cols = implode(',',$columns);
+               
+               $values[] = "'{$name}'";
+               $values[] = "'{$description}'";
+               $values[] = "'{$orgid}'";
+               $vals = implode(',',$values);
+               
+               $sql = "INSERT INTO activity_group ({$cols}) VALUES ({$vals})";
+       $result = $this->db->query($sql, __LINE__, __FILE__);
+               if(isset($result))
+               {
+                       return $this->db->get_last_insert_id('activity_group', 
'id');
+               }
+               else
+               {
+                       return 0;
+               }
+       }
+       
        function delete_contact_persons($org_id)
        {
                if($org_id)
@@ -960,4 +1053,38 @@
        {
                
        }
+       
+       function add_contact_person_local($contact)
+       {
+               $name = $contact['name'];
+               $phone = $contact['phone'];
+               $mail = $contact['mail'];
+               $org_id = $contact['org_id'];
+               $group_id = $contact['group_id'];
+               
+               $columns[] = 'name';
+               $columns[] = 'phone';
+               $columns[] = 'email';
+               $columns[] = 'organization_id';
+               $columns[] = 'group_id';
+               $columns[] = 'address';
+               $columns[] = 'zipcode'; 
+               $columns[] = 'city';
+               $cols = implode(',',$columns);
+               
+               $values[] = "'{$name}'";
+               $values[] = "'{$phone}'";
+               $values[] = "'{$mail}'";
+               $values[] = $org_id;
+               $values[] = $group_id;
+               $values[] = "''";
+               $values[] = "''";
+               $values[] = "''";
+               $vals = implode(',',$values);
+               
+               //var_dump("INSERT INTO activity_contact_person ({$cols}) 
VALUES ({$vals})");
+               $sql = "INSERT INTO activity_contact_person ({$cols}) VALUES 
({$vals})";
+       $result = $this->db->query($sql, __LINE__, __FILE__);
+               return isset($result);
+       }
 }

Modified: trunk/activitycalendar/inc/class.soarena.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soarena.inc.php    2011-06-29 06:54:50 UTC 
(rev 7448)
+++ trunk/activitycalendar/inc/class.soarena.inc.php    2011-06-29 06:55:29 UTC 
(rev 7449)
@@ -188,7 +188,7 @@
        {
                $buildings = array();
        $q_buildings="SELECT id, name FROM bb_building WHERE active=1 ORDER BY 
id";
-       var_dump($q_buildings);
+       //var_dump($q_buildings);
                $this->db->query($q_buildings, __LINE__, __FILE__);
                while($this->db->next_record()){
                        $id = $this->db->f('id');
@@ -206,6 +206,7 @@
        function get_building_name($building_id){
                if(isset($building_id))
                {
+                       $building_id = (int)$building_id;
                        $q1="SELECT name FROM bb_building WHERE 
id={$building_id}";
                        $this->db->query($q1, __LINE__, __FILE__);
                        while($this->db->next_record()){
@@ -282,7 +283,6 @@
        public function get_address($search)
        {
                $result_arr = array();
-               $result_arr[] = "<option>Ingen</option>"; 
                if($search)
                {
                        $sql = "select * from fm_streetaddress where 
UPPER(descr) like UPPER('{$search}%')";

Modified: trunk/activitycalendar/inc/class.sogroup.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.sogroup.inc.php    2011-06-29 06:54:50 UTC 
(rev 7448)
+++ trunk/activitycalendar/inc/class.sogroup.inc.php    2011-06-29 06:55:29 UTC 
(rev 7449)
@@ -65,6 +65,7 @@
                        }
                }
 
+               $use_local_group = false;
                $filter_clauses = array();
                $filter_clauses[] = "bb_group.show_in_portal=1"; 
                if(isset($filters['org_id']))
@@ -74,7 +75,11 @@
                        {
                                $filter_clauses[] = "bb_group.organization_id = 
{$group_org_id}";
                        }
-               }               
+               }
+               if(isset($filters['changed_groups'])){
+                       $use_local_group = true;
+                       unset($filter_clauses);
+               }
                
                if(count($filter_clauses))
                {
@@ -83,26 +88,50 @@
 
                $condition =  join(' AND ', $clauses);
 
-               if($return_count) // We should only return a count
+               if($use_local_group)
                {
-                       $cols = 'COUNT(DISTINCT(bb_group.id)) AS count';
+                       if($return_count) // We should only return a count
+                       {
+                               $cols = 'COUNT(DISTINCT(activity_group.id)) AS 
count';
+                       }
+                       else
+                       {
+                               $columns[] = 'activity_group.id';
+                               $columns[] = 'activity_group.name';
+                               $columns[] = 'activity_group.description';
+                               $columns[] = 'activity_group.organization_id';
+                               
+                               $dir = $ascending ? 'ASC' : 'DESC';
+                               $order = "ORDER BY activity_group.id $dir";
+                               
+                               $cols = implode(',',$columns);
+                       }
+       
+                       $tables = "activity_group";
                }
                else
                {
-                       $columns[] = 'bb_group.id';
-                       $columns[] = 'bb_group.name';
-                       $columns[] = 'bb_group.description';
-                       $columns[] = 'bb_group.organization_id';
-                       $columns[] = 'bb_group.activity_id';
-                       $columns[] = 'bb_group.active';
-                       $columns[] = 'bb_group.shortname';
-                       $columns[] = 'bb_group.show_in_portal';
-                       
-                       $cols = implode(',',$columns);
+                       if($return_count) // We should only return a count
+                       {
+                               $cols = 'COUNT(DISTINCT(bb_group.id)) AS count';
+                       }
+                       else
+                       {
+                               $columns[] = 'bb_group.id';
+                               $columns[] = 'bb_group.name';
+                               $columns[] = 'bb_group.description';
+                               $columns[] = 'bb_group.organization_id';
+                               $columns[] = 'bb_group.activity_id';
+                               $columns[] = 'bb_group.active';
+                               $columns[] = 'bb_group.shortname';
+                               $columns[] = 'bb_group.show_in_portal';
+                               
+                               $cols = implode(',',$columns);
+                       }
+       
+                       $tables = "bb_group";
                }
-
-               $tables = "bb_group";
-
+               
                //$join_contracts = "   {$this->left_join} 
rental_contract_party c_p ON (c_p.party_id = party.id)
                //{$this->left_join} rental_contract contract ON (contract.id = 
c_p.contract_id)";
                
@@ -181,6 +210,21 @@
                return $contacts;
        }
        
+       function get_contacts_local($group_id)
+       {
+               $contacts = array();
+       if(isset($group_id)){
+               $q1="SELECT id FROM activity_contact_person WHERE 
group_id='{$group_id}'";
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contacts[] = $this->db->f('id');
+                       }
+                       //$result = $contacts;
+       }
+               
+               return $contacts;
+       }
+       
        function get_description($group_id)
        {
        if(isset($group_id)){

Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php     2011-06-29 
06:54:50 UTC (rev 7448)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php     2011-06-29 
06:55:29 UTC (rev 7449)
@@ -77,10 +77,18 @@
                $filter_clauses = array();
                $filter_clauses[] = "show_in_portal=1";
                
+               $use_local_org = false;
+               
                if(isset($filters[$this->get_id_field_name()])){
                        $id = 
$this->marshal($filters[$this->get_id_field_name()],'int');
                        $filter_clauses[] = "org.id = {$id}";
                }
+               if(isset($filters['changed_orgs'])){
+                       $use_local_org = true;
+                       //$id = 
$this->marshal($filters[$this->get_id_field_name()],'int');
+                       //$filter_clauses[] = "org.id = {$id}";
+                       unset($filter_clauses);
+               }
 
 /*
                // All parties with contracts of type X
@@ -100,39 +108,65 @@
                }
 
                $condition =  join(' AND ', $clauses);
-
-               if($return_count) // We should only return a count
+               
+               if($use_local_org)
                {
-                       $cols = 'COUNT(DISTINCT(org.id)) AS count';
+                       if($return_count) // We should only return a count
+                       {
+                               $cols = 'COUNT(DISTINCT(org.id)) AS count';
+                       }
+                       else
+                       {
+                               $columns[] = 'org.id';
+                               $columns[] = 'org.name';
+                               $columns[] = 'org.homepage';
+                               $columns[] = 'org.phone';
+                               $columns[] = 'org.email';
+                               $columns[] = 'org.description';
+                               $columns[] = 'org.address';
+                               $columns[] = 'org.district';
+                               $columns[] = 'org.orgno';
+                               
+                               $cols = implode(',',$columns);
+                       }
+       
+                       $tables = "activity_organization org";
                }
                else
                {
-                       $columns[] = 'org.id';
-                       $columns[] = 'org.name';
-                       $columns[] = 'org.homepage';
-                       $columns[] = 'org.phone';
-                       $columns[] = 'org.email';
-                       $columns[] = 'org.description';
-                       $columns[] = 'org.active';
-                       $columns[] = 'org.street';
-                       $columns[] = 'org.zip_code';
-                       $columns[] = 'org.city';
-                       $columns[] = 'org.district';
-                       $columns[] = 'org.organization_number';
-                       $columns[] = 'org.activity_id';
-                       $columns[] = 'org.customer_number';
-                       $columns[] = 'org.customer_identifier_type';
-                       $columns[] = 'org.customer_organization_number';
-                       $columns[] = 'org.customer_ssn';
-                       $columns[] = 'org.customer_internal';
-                       $columns[] = 'org.shortname';
-                       $columns[] = 'org.show_in_portal';
-                       
-                       $cols = implode(',',$columns);
+                       if($return_count) // We should only return a count
+                       {
+                               $cols = 'COUNT(DISTINCT(org.id)) AS count';
+                       }
+                       else
+                       {
+                               $columns[] = 'org.id';
+                               $columns[] = 'org.name';
+                               $columns[] = 'org.homepage';
+                               $columns[] = 'org.phone';
+                               $columns[] = 'org.email';
+                               $columns[] = 'org.description';
+                               $columns[] = 'org.active';
+                               $columns[] = 'org.street';
+                               $columns[] = 'org.zip_code';
+                               $columns[] = 'org.city';
+                               $columns[] = 'org.district';
+                               $columns[] = 'org.organization_number';
+                               $columns[] = 'org.activity_id';
+                               $columns[] = 'org.customer_number';
+                               $columns[] = 'org.customer_identifier_type';
+                               $columns[] = 'org.customer_organization_number';
+                               $columns[] = 'org.customer_ssn';
+                               $columns[] = 'org.customer_internal';
+                               $columns[] = 'org.shortname';
+                               $columns[] = 'org.show_in_portal';
+                               
+                               $cols = implode(',',$columns);
+                       }
+       
+                       $tables = "bb_organization org";                        
                }
 
-               $tables = "bb_organization org";
-
                //$join_contracts = "   {$this->left_join} 
rental_contract_party c_p ON (c_p.party_id = party.id)
                //{$this->left_join} rental_contract contract ON (contract.id = 
c_p.contract_id)";
                
@@ -169,6 +203,22 @@
                return $contacts;
        }
        
+       function get_contacts_local($organization_id)
+       {
+               $contacts = array();
+       if(isset($organization_id)){
+               $q1="SELECT id FROM activity_contact_person WHERE 
organization_id='{$organization_id}'";
+               var_dump($q1);
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $cont_id = $this->db->f('id');
+                               $contacts[] = $cont_id;
+                       }
+                       //$result=$contacts;
+       }
+               return $contacts;
+       }
+       
        function get_description($organization_id)
        {
        if(isset($organization_id)){

Modified: trunk/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-06-29 
06:54:50 UTC (rev 7448)
+++ trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-06-29 
06:55:29 UTC (rev 7449)
@@ -96,12 +96,14 @@
                // Get the contract part id
                $activity_id = (int)phpgw::get_var('id');
                $so_activity = activitycalendar_soactivity::get_instance();
+               $so_arena = activitycalendar_soarena::get_instance();
                //var_dump($activity_id);
                
                $categories = $so_activity->get_categories();
                $targets = $so_activity->get_targets();
                $offices = $so_activity->select_district_list();
                $districts = $so_activity->get_districts();
+               $buildings = $so_arena->get_buildings();
                                
                // Retrieve the activity object or create a new one
                if(isset($activity_id) && $activity_id > 0)
@@ -124,7 +126,7 @@
                        $persons = 
activitycalendar_soorganization::get_instance()->get_contacts($o_id);
                        $desc = 
activitycalendar_soorganization::get_instance()->get_description($o_id);
                }
-               $arenas = activitycalendar_soarena::get_instance()->get(null, 
null, null, null, null, null, null);
+               $arenas = $so_arena->get(null, null, null, null, null, null, 
null);
                $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, null, null, 
null, null, null);
                $groups = activitycalendar_sogroup::get_instance()->get(null, 
null, null, null, null, null, null);
 
@@ -134,12 +136,22 @@
                        {
                                $old_state = $activity->get_state();
                                $new_state = phpgw::get_var('state');
-
+                               
                                // ... set all parameters
                                $activity->set_title(phpgw::get_var('title'));
                                
$activity->set_organization_id(phpgw::get_var('organization_id'));
                                
$activity->set_group_id(phpgw::get_var('group_id'));
-                               
$activity->set_arena(phpgw::get_var('arena_id'));
+                               $internal_arena = 
phpgw::get_var('internal_arena_id');
+                               if(isset($internal_arena) && $internal_arena > 
0)
+                               {
+                                       $activity->set_arena(0);
+                                       
$activity->set_internal_arena($internal_arena);
+                               }
+                               else
+                               {
+                                       
$activity->set_arena(phpgw::get_var('arena_id'));
+                                       $activity->set_internal_arena(0);
+                               }
                                $district_array = phpgw::get_var('district');
                                $activity->set_district(implode(",", 
$district_array));
                                $activity->set_office(phpgw::get_var('office'));
@@ -185,6 +197,7 @@
                                'organizations' => $organizations,
                                'groups' => $groups,
                                'arenas' => $arenas,
+                               'buildings' => $buildings,
                                'categories' => $categories,
                                'targets' => $targets,
                                'districts' => $districts,

Modified: trunk/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiorganization.inc.php     2011-06-29 
06:54:50 UTC (rev 7448)
+++ trunk/activitycalendar/inc/class.uiorganization.inc.php     2011-06-29 
06:55:29 UTC (rev 7449)
@@ -152,20 +152,33 @@
                
                //Retrieve the type of query and perform type specific logic
                $type = phpgw::get_var('type');
-
+               $changed_org = false;
+               $changed_group = false;
                switch($type)
                {
-                       case 'sync_parties_org_unit':
-                               //$filters = array('sync' => $type, 
'party_type' => phpgw::get_var('party_type'), 'active' => 
phpgw::get_var('active'));
+                       case 'changed_organizations':
+                               $filters = array('changed_orgs' => 'true');
+                               $changed_org = true;
                                break;
+                       case 'changed_groups':
+                               $filters = array('changed_groups' => 'true');
+                               $changed_group = true;
+                               break;
                        default: // ... get all parties of a given type
                                //$filters = array('party_type' => 
phpgw::get_var('party_type'), 'active' => phpgw::get_var('active'));
                                break;
                }
-               
-               $result_objects = 
activitycalendar_soorganization::get_instance()->get($start_index, 
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type, 
$filters);
-               $result_count = 
activitycalendar_soorganization::get_instance()->get_count($search_for, 
$search_type, $filters);
-               
+               if($changed_group)
+               {
+                       $result_objects = 
activitycalendar_sogroup::get_instance()->get($start_index, $num_of_objects, 
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+                       $result_count = 
activitycalendar_sogroup::get_instance()->get_count($search_for, $search_type, 
$filters);
+               }
+               else
+               {
+                       $result_objects = 
activitycalendar_soorganization::get_instance()->get($start_index, 
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type, 
$filters);
+                       $result_count = 
activitycalendar_soorganization::get_instance()->get_count($search_for, 
$search_type, $filters);
+               }
+                               
                //var_dump($result_objects);
                // Create an empty row set
                $rows = array();
@@ -176,13 +189,16 @@
                                $org_id = $result->get_id();
                                //$rows[] = $result->serialize();
                                $rows[] = $res;
-                               $filter_group = array('org_id' => $org_id);
-                               $result_groups = 
activitycalendar_sogroup::get_instance()->get(null, null, $sort_field, 
$sort_ascending, $search_for, $search_type, $filter_group);
-                               foreach ($result_groups as $result_group) {
-                                       if(isset($result_group))
-                                       {
-                                               $res_g = 
$result_group->serialize();
-                                               $rows[] = $res_g;
+                               if(!$changed_group && !$changed_org)
+                               {
+                                       $filter_group = array('org_id' => 
$org_id);
+                                       $result_groups = 
activitycalendar_sogroup::get_instance()->get(null, null, $sort_field, 
$sort_ascending, $search_for, $search_type, $filter_group);
+                                       foreach ($result_groups as 
$result_group) {
+                                               if(isset($result_group))
+                                               {
+                                                       $res_g = 
$result_group->serialize();
+                                                       $rows[] = $res_g;
+                                               }
                                        }
                                }
                        }

Modified: trunk/activitycalendar/inc/model/class.activity.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.activity.inc.php     2011-06-29 
06:54:50 UTC (rev 7448)
+++ trunk/activitycalendar/inc/model/class.activity.inc.php     2011-06-29 
06:55:29 UTC (rev 7449)
@@ -27,6 +27,7 @@
                protected $contact_person_2;
                protected $special_adaptation;
                protected $secret;
+               protected $internal_arena;
                
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
@@ -189,6 +190,13 @@
                
                public function get_secret() { return $this->secret; }
                
+               public function set_internal_arena($internal_arena)
+               {
+                       $this->internal_arena = $internal_arena;
+               }
+               
+               public function get_internal_arena() { return 
$this->internal_arena; }
+               
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 * 
@@ -223,6 +231,15 @@
                                $contact_1 = "";
                                $contact_2 = "";
                        }
+                       
+                       if($this->get_internal_arena() && 
$this->get_internal_arena() > 0)
+                       {
+                               $arena_name = 
activitycalendar_soarena::get_instance()->get_building_name($this->get_internal_arena());
+                       }
+                       else
+                       {
+                               $arena_name = 
activitycalendar_soarena::get_instance()->get_arena_name($this->get_arena());
+                       }
                        return array(
                                'id' => $this->get_id(),
                                'title' => $this->get_title(),
@@ -233,7 +250,7 @@
                                'category' => 
$this->get_so()->get_category_name($this->get_category()),
                                'state' => lang('state_'.$this->get_state()),
                                'description' => $desc,
-                               'arena' => 
activitycalendar_soarena::get_instance()->get_arena_name($this->get_arena()),
+                               'arena' => $arena_name,
                                'time' => $this->get_time(),
                                'contact_person_1' => $contact_1,
                                'contact_person_2' => $contact_2,

Modified: trunk/activitycalendar/inc/model/class.group.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.group.inc.php        2011-06-29 
06:54:50 UTC (rev 7448)
+++ trunk/activitycalendar/inc/model/class.group.inc.php        2011-06-29 
06:55:29 UTC (rev 7449)
@@ -11,6 +11,7 @@
                protected $organization_id;
                protected $show_in_portal;
                protected $shortname;
+               protected $change_type;
                
                /**
                 * Constructor.  Takes an optional ID.  If a organization is 
created from outside
@@ -37,6 +38,13 @@
                
                public function get_name() { return $this->name; }
                
+               public function set_change_type($change_type)
+               {
+                       $this->change_type = $change_type;
+               }
+               
+               public function get_change_type() { return $this->change_type; }
+               
                public function set_description($description)
                {
                        $this->description = $description;
@@ -73,7 +81,8 @@
                                'organization_id' => 
$this->get_organization_id(),
                                'shortname' => $this->get_shortname(),
                                'description' => $this->get_description(),
-                               'show_in_portal' => $this->get_show_in_portal()
+                               'show_in_portal' => $this->get_show_in_portal(),
+                               'change_type' => $this->get_change_type()
                        );
                }
                

Modified: trunk/activitycalendar/inc/model/class.organization.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.organization.inc.php 2011-06-29 
06:54:50 UTC (rev 7448)
+++ trunk/activitycalendar/inc/model/class.organization.inc.php 2011-06-29 
06:55:29 UTC (rev 7449)
@@ -11,6 +11,11 @@
                protected $organization_number;
                protected $show_in_portal;
                protected $district;
+               protected $homepage;
+               protected $email;
+               protected $phone;
+               protected $address;
+               protected $change_type;
                
                /**
                 * Constructor.  Takes an optional ID.  If a organization is 
created from outside
@@ -37,6 +42,41 @@
                
                public function get_name() { return $this->name; }
                
+               public function set_homepage($homepage)
+               {
+                       $this->homepage = $homepage;
+               }
+               
+               public function get_homepage() { return $this->homepage; }
+               
+               public function set_change_type($change_type)
+               {
+                       $this->change_type = $change_type;
+               }
+               
+               public function get_change_type() { return $this->change_type; }
+               
+               public function set_email($email)
+               {
+                       $this->email = $email;
+               }
+               
+               public function get_email() { return $this->email; }
+               
+               public function set_phone($phone)
+               {
+                       $this->phone = $phone;
+               }
+               
+               public function get_phone() { return $this->phone; }
+               
+               public function set_address($address)
+               {
+                       $this->address = $address;
+               }
+               
+               public function get_address() { return $this->address; }
+               
                public function set_description($description)
                {
                        $this->description = $description;
@@ -73,7 +113,12 @@
                                'organization_number' => 
$this->get_organization_number(),
                                'district' => $this->get_district(),
                                'description' => $this->get_description(),
-                               'show_in_portal' => $this->get_show_in_portal()
+                               'homepage'      =>      $this->get_homepage(),
+                               'email' =>      $this->get_email(),
+                               'phone' =>      $this->get_phone(),
+                               'address'       =>      $this->get_address(),
+                               'show_in_portal' => $this->get_show_in_portal(),
+                               'change_type' => $this->get_change_type()
                        );
                }
                

Modified: trunk/activitycalendar/setup/phpgw_no.lang
===================================================================
--- trunk/activitycalendar/setup/phpgw_no.lang  2011-06-29 06:54:50 UTC (rev 
7448)
+++ trunk/activitycalendar/setup/phpgw_no.lang  2011-06-29 06:55:29 UTC (rev 
7449)
@@ -379,4 +379,7 @@
 mail_body_state_5      activitycalendar        no      Ditt tips er behandlet, 
men vil ikke bli publisert i kommuneportalen. Mvh %1 kulturkontor
 send_mail      activitycalendar        no      Send e-post
 marked_as      activitycalendar        no      Status
-address_number activitycalendar        no      Nummer
\ No newline at end of file
+address_number activitycalendar        no      Nummer
+changed_organizations_groups   activitycalendar        no      Endrede 
organisasjoner/grupper
+changed_org_group      activitycalendar        no      Endringer
+building       activitycalendar        no      Kommunale bygg
\ No newline at end of file

Modified: trunk/activitycalendar/setup/setup.inc.php
===================================================================
--- trunk/activitycalendar/setup/setup.inc.php  2011-06-29 06:54:50 UTC (rev 
7448)
+++ trunk/activitycalendar/setup/setup.inc.php  2011-06-29 06:55:29 UTC (rev 
7449)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['activitycalendar']['name'] = 'activitycalendar';
-       $setup_info['activitycalendar']['version'] = '0.1.3';
+       $setup_info['activitycalendar']['version'] = '0.1.4';
        $setup_info['activitycalendar']['app_order'] = 60;
        $setup_info['activitycalendar']['enable'] = 1;
        $setup_info['activitycalendar']['app_group']    = 'office';

Modified: trunk/activitycalendar/setup/tables_current.inc.php
===================================================================
--- trunk/activitycalendar/setup/tables_current.inc.php 2011-06-29 06:54:50 UTC 
(rev 7448)
+++ trunk/activitycalendar/setup/tables_current.inc.php 2011-06-29 06:55:29 UTC 
(rev 7449)
@@ -13,6 +13,7 @@
                                'state' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => True),
                                'description' => array('type' => 
'varchar','precision' => '255'),
                                'arena' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => True),
+                               'internal_arena' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'time' => array('type' => 'varchar','precision' 
=> '255'),
                                'create_date' => array('type' => 'int', 
'precision' => 4, 'precision' => '8', 'nullable' => false),
                                'last_change_date' => array('type' => 'int', 
'precision' => 4, 'precision' => '8', 'nullable' => true),
@@ -38,5 +39,56 @@
                        'fk' => array(),
                        'ix' => array(),
                        'uc' => array()
+               ),
+               'activity_organization' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
+                               'district' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'homepage' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'description' => array('type' => 
'text','nullable' => false),
+                               'email' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'phone' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'address' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'orgno' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'change_type' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'transferred' => array('type' => 
'bool','nullable' => true,'default' => 'false')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'activity_group' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'organization_id' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
+                               'description' => array('type' => 
'text','nullable' => false),
+                               'change_type' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'transferred' => array('type' => 
'bool','nullable' => true,'default' => 'false')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'activity_contact_person' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'organization_id' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'group_id' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
+                               'phone' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'email' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'address' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'zipcode' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'city' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
+                               'transferred' => array('type' => 
'bool','nullable' => true,'default' => 'false')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
                )
        );

Modified: trunk/activitycalendar/setup/tables_update.inc.php
===================================================================
--- trunk/activitycalendar/setup/tables_update.inc.php  2011-06-29 06:54:50 UTC 
(rev 7448)
+++ trunk/activitycalendar/setup/tables_update.inc.php  2011-06-29 06:55:29 UTC 
(rev 7449)
@@ -41,4 +41,77 @@
                $GLOBALS['setup_info']['activitycalendar']['currentver'] = 
'0.1.3';
                return $GLOBALS['setup_info']['activitycalendar']['currentver'];
        }
+       
+       $test[] = '0.1.3';
+       function activitycalendar_upgrade0_1_3()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('activity_activity','internal_arena',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => 'True'
+               ));
+               
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'activity_organization', array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
+                               'district' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'homepage' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'description' => array('type' => 
'text','nullable' => false),
+                               'email' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'phone' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'address' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'orgno' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'change_type' => array('type' => 
'varchar','precision' => '255','default' => 'new','nullable' => false),
+                               'transferred' => array('type' => 
'bool','nullable' => true,'default' => 'false')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+                       )
+               );
+               
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'activity_group', array(
+                               'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'organization_id' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
+                               'description' => array('type' => 
'text','nullable' => false),
+                               'change_type' => array('type' => 
'varchar','precision' => '255','default' => 'new', 'nullable' => false),
+                               'transferred' => array('type' => 
'bool','nullable' => true,'default' => 'false')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+                       )
+               );
+               
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'activity_contact_person', array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
+                               'organization_id' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'group_id' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'name' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
+                               'phone' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'email' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'address' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'zipcode' => array('type' => 
'varchar','precision' => '255','nullable' => false),
+                               'city' => array('type' => 'varchar','precision' 
=> '255','nullable' => false),
+                               'transferred' => array('type' => 
'bool','nullable' => true,'default' => 'false')
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+                       )
+               );
+               
+               $GLOBALS['setup_info']['activitycalendar']['currentver'] = 
'0.1.4';
+               return $GLOBALS['setup_info']['activitycalendar']['currentver'];
+       }
 ?>
\ No newline at end of file

Modified: trunk/activitycalendar/templates/base/activity.php
===================================================================
--- trunk/activitycalendar/templates/base/activity.php  2011-06-29 06:54:50 UTC 
(rev 7448)
+++ trunk/activitycalendar/templates/base/activity.php  2011-06-29 06:55:29 UTC 
(rev 7449)
@@ -126,6 +126,36 @@
                                        ?>
                                </dd>
                                <dt>
+                                       <?php 
if($activity->get_internal_arena() || $editable) { ?>
+                                       <label for="arena"><?php echo 
lang('building') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       $current_internal_arena_id = 
$activity->get_internal_arena();
+                                       if ($editable)
+                                       {
+                                               ?>
+                                               <select 
name="internal_arena_id">
+                                                       <option value="0">Ingen 
kommunale bygg valgt</option>
+                                                       <?php
+                                                       foreach($buildings as 
$building_id => $building_name)
+                                                       {
+                                                               echo "<option 
".($current_internal_arena_id == $building_id? 'selected="selected"' : "")." 
value=\"{$building_id}\">".$building_name."</option>";
+                                                       }
+                                                       ?>
+                                               </select>
+                                               <?php
+                                       }
+                                       else
+                                       {
+                                               
if($activity->get_internal_arena()){
+                                                       echo 
activitycalendar_soarena::get_instance()->get_building_name($activity->get_internal_arena());
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
                                        <?php if($activity->get_arena() || 
$editable) { ?>
                                        <label for="arena"><?php echo 
lang('arena') ?></label>
                                        <?php  } ?>

Modified: trunk/activitycalendar/templates/base/organization_list_partial.php
===================================================================
--- trunk/activitycalendar/templates/base/organization_list_partial.php 
2011-06-29 06:54:50 UTC (rev 7448)
+++ trunk/activitycalendar/templates/base/organization_list_partial.php 
2011-06-29 06:55:29 UTC (rev 7449)
@@ -81,6 +81,8 @@
 <?php
        if($list_form)
        {
+               if(!$nosearch)
+               {
 ?>
 
 <form id="<?php echo $list_id ?>_form" method="GET">
@@ -93,6 +95,7 @@
        </fieldset>
 </form>
 <?php
+               }
        }
 ?>
 




reply via email to

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