fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7506]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7506]
Date: Wed, 17 Aug 2011 07:21:43 +0000

Revision: 7506
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7506
Author:   erikhl
Date:     2011-08-17 07:21:42 +0000 (Wed, 17 Aug 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/activitycalendar/inc/class.soactivity.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.uiimport.inc.php
    trunk/activitycalendar/inc/class.uiorganization.inc.php
    trunk/activitycalendar/inc/model/class.activity.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

Added Paths:
-----------
    trunk/activitycalendar/templates/base/group.php
    trunk/activitycalendar/templates/base/organization.php

Modified: trunk/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soactivity.inc.php 2011-08-17 06:39:55 UTC 
(rev 7505)
+++ trunk/activitycalendar/inc/class.soactivity.inc.php 2011-08-17 07:21:42 UTC 
(rev 7506)
@@ -194,6 +194,8 @@
                        $columns[] = 'activity.last_change_date';
                        $columns[] = 'activity.contact_person_1';
                        $columns[] = 'activity.contact_person_2';
+                       $columns[] = 'activity.contact_person_2_address';
+                       $columns[] = 'activity.contact_person_2_zip';
                        $columns[] = 'activity.special_adaptation';
                        $columns[] = 'activity.secret';
                        
@@ -264,6 +266,8 @@
                        'last_change_date = '    . $this->marshal($ts_now, 
'int'),
                        'contact_person_1 = '          . 
$this->marshal($activity->get_contact_person_1(), 'int'),
                        'contact_person_2 = '          . 
$this->marshal($activity->get_contact_person_2(), 'int'),
+                       'contact_person_2_address = '          . 
$this->marshal($activity->get_contact_person_2_address(), 'string'),
+                       'contact_person_2_zip = '          . 
$this->marshal($activity->get_contact_person_2_zip(), 'string'),
                        'special_adaptation = '                 
.($activity->get_special_adaptation() ? "true" : "false")
                );
                
@@ -295,6 +299,8 @@
                        'create_date',
                        'contact_person_1',
                        'contact_person_2',
+                       'contact_person_2_address',
+                       'contact_person_2_zip',
                        'secret',
                        'special_adaptation'
                );
@@ -316,6 +322,8 @@
                        $this->marshal($ts_now, 'int'),
                        $this->marshal($activity->get_contact_person_1(), 
'int'),
                        $this->marshal($activity->get_contact_person_2(), 
'int'),
+                       
$this->marshal($activity->get_contact_person_2_address(), 'string'),
+                       $this->marshal($activity->get_contact_person_2_zip(), 
'string'),
                        $this->marshal($this->generate_secret(),'string'),
                        ($activity->get_special_adaptation() ? "true" : "false")
                );
@@ -364,11 +372,15 @@
                        
$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')));
                        
$activity->set_secret($this->unmarshal($this->db->f('secret'), 'string'));
+                       
$activity->set_contact_person_2_address($this->unmarshal($this->db->f('contact_person_2_address'),
 'string'));
+                       
$activity->set_contact_person_2_zip($this->unmarshal($this->db->f('contact_person_2_zip'),
 'string'));
                        
                        if($activity->get_group_id() && 
$activity->get_group_id() > 0)
                        {
                                $contacts = 
activitycalendar_sogroup::get_instance()->get_contacts($activity->get_group_id());
                                $activity->set_contact_persons($contacts);
+                               $org_tmp = 
activitycalendar_sogroup::get_instance()->get_orgid_from_group($activity->get_group_id());
+                               $activity->set_organization_id($org_tmp);
                        }
                        else if($activity->get_organization_id() && 
$activity->get_organization_id() > 0)
                        {
@@ -782,10 +794,30 @@
                $name = $org_info['name'];
                $orgid = (int)$org_info['orgid'];
                $homepage = $org_info['homepage'];
+               if(!$homepage)
+               {
+                       $homepage = '';
+               }
                $phone = $org_info['phone'];
+               if(!$phone)
+               {
+                       $phone = '';
+               }
                $email = $org_info['email'];
+               if(!$email)
+               {
+                       $email = '';
+               }
                $description = $org_info['description'];
+               if(!$description)
+               {
+                       $description = '';
+               }
                $street = $org_info['street'];
+               if(!$street)
+               {
+                       $street = '';
+               }
                $zip = $org_info['zip'];
                if($zip && strlen($zip) > 5)
                {
@@ -855,17 +887,17 @@
                $columns[] = 'show_in_portal';
                $cols = implode(',',$columns);
                
-               $values[] = "{$name}";
-               $values[] = "{$homepage}";
-               $values[] = "{$phone}";
-               $values[] = "{$email}";
-               $values[] = "{$description}";
-               $values[] = "{$street}";
-               $values[] = "{$zip_code}";
-               $values[] = "{$city}";
-               $values[] = "{$district}";
-               $values[] = "{$orgnr}";
-               $values[] = $activity_id;
+               $values[] = "'{$name}'";
+               $values[] = "'{$homepage}'";
+               $values[] = "'{$phone}'";
+               $values[] = "'{$email}'";
+               $values[] = "'{$description}'";
+               $values[] = "'{$street}'";
+               $values[] = "'{$zip_code}'";
+               $values[] = "'{$city}'";
+               $values[] = "'{$district}'";
+               $values[] = "'{$orgnr}'";
+               $values[] = $this->marshal($activity_id, 'int');
                $values[] = $show_in_portal;
                $vals = implode(',',$values);
                
@@ -958,7 +990,7 @@
                $values[] = "'{$name}'";
                $values[] = "'{$description}'";
                $values[] = "'{$orgid}'";
-               $values[] = $activity_id;
+               $values[] = $this->marshal($activity_id, 'int');
                $values[] = $show_in_portal;
                $vals = implode(',',$values);
                

Modified: trunk/activitycalendar/inc/class.sogroup.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.sogroup.inc.php    2011-08-17 06:39:55 UTC 
(rev 7505)
+++ trunk/activitycalendar/inc/class.sogroup.inc.php    2011-08-17 07:21:42 UTC 
(rev 7506)
@@ -79,6 +79,10 @@
                if(isset($filters['changed_groups'])){
                        $use_local_group = true;
                        unset($filter_clauses);
+                       if(isset($filters[$this->get_id_field_name()])){
+                               $id = 
$this->marshal($filters[$this->get_id_field_name()],'int');
+                               $filter_clauses[] = "activity_group.id = {$id}";
+                       }
                }
                
                if(count($filter_clauses))
@@ -195,6 +199,20 @@
                return $result;
        }
        
+       function get_orgid_from_group($group_id)
+       {
+               $result = 0;
+       if(isset($group_id)){
+               $q1="SELECT organization_id FROM bb_group WHERE id={$group_id}";
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $result = $this->db->f('organization_id');
+                       }
+       }
+               
+               return $result;
+       }
+       
        function get_contacts($group_id)
        {
                $contacts = array();

Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php     2011-08-17 
06:39:55 UTC (rev 7505)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php     2011-08-17 
07:21:42 UTC (rev 7506)
@@ -88,6 +88,10 @@
                        //$id = 
$this->marshal($filters[$this->get_id_field_name()],'int');
                        //$filter_clauses[] = "org.id = {$id}";
                        unset($filter_clauses);
+                       if(isset($filters[$this->get_id_field_name()])){
+                               $id = 
$this->marshal($filters[$this->get_id_field_name()],'int');
+                               $filter_clauses[] = "org.id = {$id}";
+                       }
                }
 
 /*
@@ -125,7 +129,7 @@
                                $columns[] = 'org.description';
                                $columns[] = 'org.address';
                                $columns[] = 'org.district';
-                               $columns[] = 'org.orgno';
+                               $columns[] = 'org.orgno AS organization_number';
                                
                                $cols = implode(',',$columns);
                        }
@@ -303,6 +307,10 @@
 
                        
$organization->set_name($this->unmarshal($this->db->f('name'), 'string'));
                        
$organization->set_organization_number($this->unmarshal($this->db->f('organization_number'),
 'int'));
+                       
$organization->set_address($this->unmarshal($this->db->f('address'), 'string'));
+                       
$organization->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                       
$organization->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                       
$organization->set_homepage($this->unmarshal($this->db->f('homepage'), 
'string'));
                        
$organization->set_district($this->unmarshal($this->db->f('district'), 
'string'));
                        
$organization->set_description($this->unmarshal($this->db->f('description'), 
'string'));
                        
$organization->set_show_in_portal($this->unmarshal($this->db->f('show_in_portal'),
 'int'));

Modified: trunk/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-08-17 
06:39:55 UTC (rev 7505)
+++ trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-08-17 
07:21:42 UTC (rev 7506)
@@ -162,6 +162,8 @@
                                $activity->set_description($desc);
                                $activity->set_time(phpgw::get_var('time'));
                                $activity->set_contact_persons($persons);
+                               
$activity->set_contact_person_2_address(phpgw::get_var('contact_person_2_address'));
+                               
$activity->set_contact_person_2_zip(phpgw::get_var('contact_person_2_zip'));
                                
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
                                
                                if($so_activity->store($activity)) // ... and 
then try to store the object

Modified: trunk/activitycalendar/inc/class.uiimport.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiimport.inc.php   2011-08-17 06:39:55 UTC 
(rev 7505)
+++ trunk/activitycalendar/inc/class.uiimport.inc.php   2011-08-17 07:21:42 UTC 
(rev 7506)
@@ -218,42 +218,93 @@
                                unset($contact3);
                                unset($contact4);
                                
-                               $arena = new activitycalendar_arena();
-                               //8: sted, 9:adresse
-                               $arena_name = $this->decode($data[8]);
-                               $arena_address = $this->decode($data[9]);
-                               $curr_arena_id = 0;
-
-                               if($arena_name){
-                                       $arena->set_arena_name($arena_name);
-                                       $arena->set_address($arena_address);
+                               $internal_arena = $this->decode($data[9]);
+                               if($internal_arena)
+                               {
+                                       $internal_arena_id = $internal_arena;
+                                       $curr_arena_id = "";
+                               }
+                               else
+                               {                               
+                                       $arena = new activitycalendar_arena();
+                                       //8: sted, 10:adresse
+                                       $arena_name = $this->decode($data[8]);
+                                       $arena_address = 
$this->decode($data[10]);
+                                       $curr_arena_id = 0;
+                                       $internal_arena_id = "";
        
-                                       // All is good, store notification
-                                       if ($soarena->store($arena)) {
-                                               $this->messages[] = 
"Successfully imported arena: Name ({$arena_name})";
-                                               $curr_arena_id = 
$arena->get_id();
-                                       } else {
-                                               $this->errors[] = "Error 
importing arena: Name ({$arena_name})";
+                                       if($arena_name){
+                                               
$arena->set_arena_name($arena_name);
+                                               
$arena->set_address($arena_address);
+               
+                                               // All is good, store 
notification
+                                               if ($soarena->store($arena)) {
+                                                       $this->messages[] = 
"Successfully imported arena: Name ({$arena_name})";
+                                                       $curr_arena_id = 
$arena->get_id();
+                                               } else {
+                                                       $this->errors[] = 
"Error importing arena: Name ({$arena_name})";
+                                                       $curr_arena_id = 0;
+                                                       $arenaOK = false;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $this->errors[] = "Error 
importing arena: Name not supplied";
                                                $curr_arena_id = 0;
-                                               $arenaOK = false;
                                        }
                                }
-                               else
-                               {
-                                       $this->errors[] = "Error importing 
arena: Name not supplied";
-                                       $curr_arena_id = 0;
-                               }
                                
                                $activity = new activitycalendar_activity();
                                $activity_title = $this->decode($data[1]);
                                $activity_group = $this->decode($data[2]);
                                $activity_org = $this->decode($data[3]);
                                $activity_category = $this->decode($data[5]);
+                               $org_name_tmp = $this->decode($data[1]);
+                               if(strlen($org_name_tmp) > 50)
+                               {
+                                       $org_name_tmp = 
substr($org_name_tmp,0,49);
+                               }
+                               $org_email = $this->decode($data[15]);
+                               if(strlen($org_email) > 50)
+                               {
+                                       $org_email = substr($org_email,0,49);
+                               }
+                               $org_phone = $this->decode($data[14]);
+                               if(strlen($org_phone) > 50)
+                               {
+                                       $org_phone = substr($org_phone,0,49);
+                               }
+                               $contact_mail_2 = $this->decode($data[21]);
+                               if(strlen($contact_mail_2) > 50)
+                               {
+                                       $contact_mail_2 = 
substr($contact_mail_2,0,49);
+                               }
                                if($activity_category)
                                {
                                        $activity_category = 
$soactivity->get_category_from_name($activity_category);
                                }
                                
+                               $contact1_name = $this->decode($data[13]);
+                               if(strlen($contact1_name) > 50)
+                               {
+                                       $contact1_name = 
substr($contact1_name,0,49);
+                               }
+                               $contact1_phone = $this->decode($data[14]);
+                               if(strlen($contact1_phone) > 50)
+                               {
+                                       $contact1_phone = 
substr($contact1_phone,0,49);
+                               }
+                               $contact2_name = $this->decode($data[17]);
+                               if(strlen($contact2_name) > 50)
+                               {
+                                       $contact2_name = 
substr($contact2_name,0,49);
+                               }
+                               $contact2_phone = $this->decode($data[20]);
+                               if(strlen($contact2_phone) > 50)
+                               {
+                                       $contact2_phone = 
substr($contact2_phone,0,49);
+                               }
+                               
                                if($activity_org)
                                {
                                        $activity_org = 
$soactivity->get_orgid_from_orgno($activity_org);
@@ -262,31 +313,31 @@
                                                //update the organization found
                                                $org_info = array();
                                                $org_info['orgid'] = 
$activity_org;
-                                               $org_info['name'] = 
$this->decode($data[2]); //new
-                                               $org_info['homepage'] = 
$this->decode($data[15]);
-                                               $org_info['phone'] = 
$this->decode($data[13]);
-                                               $org_info['email'] = 
$this->decode($data[12]);
+                                               $org_info['name'] = 
$org_name_tmp; //new
+                                               $org_info['homepage'] = 
$this->decode($data[16]);
+                                               $org_info['phone'] = $org_phone;
+                                               $org_info['email'] = $org_email;
                                                $org_info['description'] = 
$this->decode($data[6]);
-                                               $org_info['street'] = 
$this->decode($data[9]);
-                                               $org_info['zip'] = 
$this->decode($data[18]);
+                                               $org_info['street'] = 
$this->decode($data[10]);
+                                               $org_info['zip'] = 
$this->decode($data[19]);
                                                $org_info['activity_id'] = 
$activity_category;
-                                               $org_info['district'] = 
$this->decode($data[22]); 
+                                               $org_info['district'] = 
$this->decode($data[23]); 
                                                
$soactivity->update_organization($org_info);
                                                //$new_org_id = $activity_org;
                                                
                                                
$soactivity->delete_contact_persons($activity_org);
                                                
                                                $contact1 = array();
-                                               $contact1['name'] = 
$this->decode($data[12]);
-                                               $contact1['phone'] = 
$this->decode($data[13]);
-                                               $contact1['mail'] = 
$this->decode($data[14]);
+                                               $contact1['name'] = 
$contact1_name;
+                                               $contact1['phone'] = 
$contact1_phone;
+                                               $contact1['mail'] = $org_email;
                                                $contact1['org_id'] = 
$this->decode($activity_org);
                                                
$soactivity->add_contact_person_org($contact1);
                                                
                                                $contact2 = array();
-                                               $contact2['name'] = 
$this->decode($data[16]);
-                                               $contact2['phone'] = 
$this->decode($data[19]);
-                                               $contact2['mail'] = 
$this->decode($data[20]);
+                                               $contact2['name'] = 
$contact2_name;
+                                               $contact2['phone'] = 
$contact2_phone;
+                                               $contact2['mail'] = 
$contact_mail_2;
                                                $contact2['org_id'] = 
$this->decode($activity_org);
                                                
$soactivity->add_contact_person_org($contact2);
                                                
@@ -301,16 +352,16 @@
                                                        $new_group_id = 
$soactivity->add_group($group_info);
                                                        
                                                        $contact3 = array();
-                                                       $contact3['name'] = 
$this->decode($data[12]);
-                                                       $contact3['phone'] = 
$this->decode($data[13]);
-                                                       $contact3['mail'] = 
$this->decode($data[14]);
+                                                       $contact3['name'] = 
$contact1_name;
+                                                       $contact3['phone'] = 
$contact1_phone;
+                                                       $contact3['mail'] = 
$org_email;
                                                        $contact3['group_id'] = 
$this->decode($new_group_id);
                                                        
$soactivity->add_contact_person_group($contact3);
                                                        
                                                        $contact4 = array();
-                                                       $contact4['name'] = 
$this->decode($data[16]);
-                                                       $contact4['phone'] = 
$this->decode($data[19]);
-                                                       $contact4['mail'] = 
$this->decode($data[20]);
+                                                       $contact4['name'] = 
$contact2_name;
+                                                       $contact4['phone'] = 
$contact2_phone;
+                                                       $contact4['mail'] = 
$contact_mail_2;
                                                        $contact4['group_id'] = 
$this->decode($new_group_id);
                                                        
$soactivity->add_contact_person_group($contact4);
                                                        
@@ -351,29 +402,35 @@
                                        else    //add org unit
                                        {
                                                $org_info = array();
-                                               $org_info['name'] = 
$this->decode($data[2]); //new
-                                               $org_info['orgnr'] = 
$this->decode($data[3]);
-                                               $org_info['homepage'] = 
$this->decode($data[15]);
-                                               $org_info['phone'] = 
$this->decode($data[13]);
-                                               $org_info['email'] = 
$this->decode($data[14]);
+                                               $org_info['name'] = 
$org_name_tmp; //new
+                                               $orgno_tmp = 
$this->decode($data[3]);
+                                               if(strlen($orgno_tmp) > 9)
+                                               {
+                                                       $orgno_tmp = NULL;
+                                               }
+                                               $org_info['orgnr'] = 
$orgno_tmp; 
+                                               
+                                               $org_info['homepage'] = 
$this->decode($data[16]);
+                                               $org_info['phone'] = $org_phone;
+                                               $org_info['email'] = $org_email;
                                                $org_info['description'] = 
$this->decode($data[6]);
-                                               $org_info['street'] = 
$this->decode($data[9]);
-                                               $org_info['zip'] = 
$this->decode($data[18]);
+                                               $org_info['street'] = 
$this->decode($data[10]);
+                                               $org_info['zip'] = 
$this->decode($data[19]);
                                                $org_info['activity_id'] = 
$activity_category;
-                                               $org_info['district'] = 
$this->decode($data[22]); 
+                                               $org_info['district'] = 
$this->decode($data[23]); 
                                                $new_org_id = 
$soactivity->add_organization($org_info);
                                                
                                                $contact1 = array();
-                                               $contact1['name'] = 
$this->decode($data[12]);
-                                               $contact1['phone'] = 
$this->decode($data[13]);
-                                               $contact1['mail'] = 
$this->decode($data[14]);
+                                               $contact1['name'] = 
$contact1_name;
+                                               $contact1['phone'] = 
$contact1_phone;
+                                               $contact1['mail'] = $org_email;
                                                $contact1['org_id'] = 
$this->decode($new_org_id);
                                                
$soactivity->add_contact_person_org($contact1);
                                                
                                                $contact2 = array();
-                                               $contact2['name'] = 
$this->decode($data[16]);
-                                               $contact2['phone'] = 
$this->decode($data[19]);
-                                               $contact2['mail'] = 
$this->decode($data[20]);
+                                               $contact2['name'] = 
$contact2_name;
+                                               $contact2['phone'] = 
$contact2_phone;
+                                               $contact2['mail'] = 
$contact_mail_2;
                                                $contact2['org_id'] = 
$this->decode($new_org_id);
                                                
$soactivity->add_contact_person_org($contact2);
                                                
@@ -388,16 +445,16 @@
                                                        $new_group_id = 
$soactivity->add_group($group_info);
                                                        
                                                        $contact3 = array();
-                                                       $contact3['name'] = 
$this->decode($data[12]);
-                                                       $contact3['phone'] = 
$this->decode($data[13]);
-                                                       $contact3['mail'] = 
$this->decode($data[14]);
+                                                       $contact3['name'] = 
$contact1_name;
+                                                       $contact3['phone'] = 
$contact1_phone;
+                                                       $contact3['mail'] = 
$org_email;
                                                        $contact3['group_id'] = 
$this->decode($new_group_id);
                                                        
$soactivity->add_contact_person_group($contact3);
                                                        
                                                        $contact4 = array();
-                                                       $contact4['name'] = 
$this->decode($data[16]);
-                                                       $contact4['phone'] = 
$this->decode($data[19]);
-                                                       $contact4['mail'] = 
$this->decode($data[20]);
+                                                       $contact4['name'] = 
$contact2_name;
+                                                       $contact4['phone'] = 
$contact2_phone;
+                                                       $contact4['mail'] = 
$contact_mail_2;
                                                        $contact4['group_id'] = 
$this->decode($new_group_id);
                                                        
$soactivity->add_contact_person_group($contact4);
                                                        
@@ -418,31 +475,31 @@
                                        }
                                        else
                                        {
-                                               $org_info['name'] = 
$this->decode($data[1]);
+                                               $org_info['name'] = 
$org_name_tmp;
                                        }
                                         
                                        //$org_info['orgnr'] = 
$this->decode($data[2]);
-                                       $org_info['homepage'] = 
$this->decode($data[15]);
-                                       $org_info['phone'] = 
$this->decode($data[13]);
-                                       $org_info['email'] = 
$this->decode($data[14]);
+                                       $org_info['homepage'] = 
$this->decode($data[16]);
+                                       $org_info['phone'] = $org_phone;
+                                       $org_info['email'] = $org_email;
                                        $org_info['description'] = 
$this->decode($data[6]);
-                                       $org_info['street'] = 
$this->decode($data[9]);
-                                       $org_info['zip'] = 
$this->decode($data[18]);
+                                       $org_info['street'] = 
$this->decode($data[10]);
+                                       $org_info['zip'] = 
$this->decode($data[19]);
                                        $org_info['activity_id'] = 
$activity_category;
-                                       $org_info['district'] = 
$this->decode($data[22]); 
+                                       $org_info['district'] = 
$this->decode($data[23]); 
                                        $new_org_id = 
$soactivity->add_organization($org_info);
                                                
                                        $contact1 = array();
-                                       $contact1['name'] = 
$this->decode($data[12]);
-                                       $contact1['phone'] = 
$this->decode($data[13]);
-                                       $contact1['mail'] = 
$this->decode($data[14]);
+                                       $contact1['name'] = $contact1_name;
+                                       $contact1['phone'] = $contact1_phone;
+                                       $contact1['mail'] = $org_email;
                                        $contact1['org_id'] = 
$this->decode($new_org_id);
                                        
$soactivity->add_contact_person_org($contact1);
                                        
                                        $contact2 = array();
-                                       $contact2['name'] = 
$this->decode($data[16]);
-                                       $contact2['phone'] = 
$this->decode($data[19]);
-                                       $contact2['mail'] = 
$this->decode($data[20]);
+                                       $contact2['name'] = $contact2_name;
+                                       $contact2['phone'] = $contact2_phone;
+                                       $contact2['mail'] = $contact_mail_2;
                                        $contact2['org_id'] = 
$this->decode($new_org_id);
                                        
$soactivity->add_contact_person_org($contact2);
                                        
@@ -450,23 +507,23 @@
                                        if($activity_group)
                                        {
                                                $group_info = array();
-                                               $group_info['organization_id'] 
= $org_id;
+                                               $group_info['organization_id'] 
= $new_org_id;
                                                $group_info['description'] = 
$this->decode($data[6]);
                                                $group_info['name'] = 
$this->decode($data[1]);
                                                $group_info['activity_id'] = 
$activity_category;
                                                $new_group_id = 
$soactivity->add_group($group_info);
                                                
                                                $contact3 = array();
-                                               $contact3['name'] = 
$this->decode($data[12]);
-                                               $contact3['phone'] = 
$this->decode($data[13]);
-                                               $contact3['mail'] = 
$this->decode($data[14]);
+                                               $contact3['name'] = 
$contact1_name;
+                                               $contact3['phone'] = 
$contact1_phone;
+                                               $contact3['mail'] = $org_email;
                                                $contact3['group_id'] = 
$this->decode($new_group_id);
                                                
$soactivity->add_contact_person_group($contact3);
                                                
                                                $contact4 = array();
-                                               $contact4['name'] = 
$this->decode($data[16]);
-                                               $contact4['phone'] = 
$this->decode($data[19]);
-                                               $contact4['mail'] = 
$this->decode($data[20]);
+                                               $contact4['name'] = 
$contact2_name;
+                                               $contact4['phone'] = 
$contact2_phone;
+                                               $contact4['mail'] = 
$contact_mail_2;
                                                $contact4['group_id'] = 
$this->decode($new_group_id);
                                                
$soactivity->add_contact_person_group($contact4);
                                                
@@ -491,9 +548,9 @@
                                        $activity_target = implode(",", 
$act_targets);
                                }
 
-                               $activity_day = $this->decode($data[10]);
-                               $activity_time = $this->decode($data[11]);
-                               $activity_update_date = 
$this->decode($data[21]);
+                               $activity_day = $this->decode($data[11]);
+                               $activity_time = $this->decode($data[12]);
+                               $activity_update_date = 
$this->decode($data[22]);
                                if($activity_update_date)
                                {
                                        $act_update_array = explode(".", 
$activity_update_date);
@@ -506,12 +563,15 @@
                                                
//var_dump($activity_updated_date);
                                        }
                                }
-                               $activity_district = $this->decode($data[22]);
+                               $activity_district = $this->decode($data[23]);
                                if($activity_district)
                                {
                                        $activity_district = 
$soactivity->get_district_from_name($activity_district);
                                }
                                
+                               $activity_contact_person_2_address = 
$this->decode($data[18]);
+                               $activity_contact_person_2_zip = 
$this->decode($data[19]);
+                               
                                if($activity_title){
                                        $activity->set_title($activity_title);
                                        
$activity->set_organization_id($activity_org);
@@ -520,6 +580,7 @@
                                        $activity->set_target($activity_target);
                                        
$activity->set_description($activity_description);
                                        $activity->set_arena($curr_arena_id);
+                                       
$activity->set_internal_arena($internal_arena_id);
                                        $activity->set_state(3);
                                        $activity->set_time($activity_day.' 
'.$activity_time);
                                        if($activity_adapted)
@@ -528,6 +589,8 @@
                                        }
                                        $activity->set_office($this->office);
                                        
$activity->set_district($activity_district);
+                                       
$activity->set_contact_person_2_address($activity_contact_person_2_address);
+                                       
$activity->set_contact_person_2_zip($activity_contact_person_2_zip);
                                        
$activity->set_last_change_date($activity_updated_date);
                                        if($activity_persons)
                                        {

Modified: trunk/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiorganization.inc.php     2011-08-17 
06:39:55 UTC (rev 7505)
+++ trunk/activitycalendar/inc/class.uiorganization.inc.php     2011-08-17 
07:21:42 UTC (rev 7506)
@@ -2,6 +2,7 @@
 phpgw::import_class('activitycalendar.uicommon');
 phpgw::import_class('activitycalendar.soorganization');
 phpgw::import_class('activitycalendar.sogroup');
+phpgw::import_class('activitycalendar.soactivity');
 
 include_class('activitycalendar', 'organization', 'inc/model/');
 include_class('activitycalendar', 'group', 'inc/model/');
@@ -36,7 +37,8 @@
        }
        
        public function changed_organizations()
-       {                       
+       {
+               
self::set_active_menu('activitycalendar::organizationList::changed_organizations');
                $this->render('organization_list_changed.php');
        }
        
@@ -63,53 +65,150 @@
        
        public function edit()
        {
+               $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('edit');
                $id = (int)phpgw::get_var('id');
                $type = phpgw::get_var('type');
                if($type)
                {
                        //var_dump($type);
                        $so = activitycalendar_sogroup::get_instance();
+                       $group = $so->get(null, null, null, null, null, null, 
array('id' => $id, 'changed_groups' => 'true'));
+                       if(count($group_array) > 0){
+                               $keys = array_keys($group_array);
+                               $group = $group_array[$keys[0]];
+                       }
+                       if(isset($_POST['save_organization'])) // The user has 
pressed the save button
+                       {
+                               $orgno = phpgw::get_var('orgno');
+                               $district = phpgw::get_var('org_district');
+                               $homepage = phpgw::get_var('homepage');
+                               $email = phpgw::get_var('email');
+                               $phone = phpgw::get_var('phone');
+                               $address = phpgw::get_var('address');
+                               $desc = phpgw::get_var('org_description');
+                       }
+                       else if(isset($_POST['store_organization'])) // The 
user has pressed the store button
+                       {
+                               $orgno = phpgw::get_var('orgno');
+                               $district = phpgw::get_var('org_district');
+                               $homepage = phpgw::get_var('homepage');
+                               $email = phpgw::get_var('email');
+                               $phone = phpgw::get_var('phone');
+                               $address = phpgw::get_var('address');
+                               $desc = phpgw::get_var('org_description');
+                       }
+                       
+                       $data = array
+                       (
+                               'group'         => $group,
+                               'editable' => true,
+                               'errorMsgs' => $errorMsgs,
+                               'infoMsgs' => $infoMsgs
+                       );
+                       return $this->render('group.php', $data);
                }
                else
                {
                        //var_dump('org');
                        $so = activitycalendar_soorganization::get_instance();
+                       $so_activity = 
activitycalendar_soactivity::get_instance();
+                       $org_array = $so->get(null, null, null, null, null, 
null, array('id' => $id, 'changed_orgs' => 'true'));
+                       if(count($org_array)>0){
+                               $keys = array_keys($org_array);
+                               $org = $org_array[$keys[0]];
+                       }
+                       //var_dump($org);
+                       $districts = $so_activity->get_districts();
+                       
+                       if(isset($_POST['save_organization'])) // The user has 
pressed the save button
+                       {
+                               
$org->set_organization_number(phpgw::get_var('orgno'));
+                               
$org->set_district(phpgw::get_var('org_district'));
+                               $org->set_homepage(phpgw::get_var('homepage'));
+                               $org->set_email(phpgw::get_var('email'));
+                               $org->set_phone(phpgw::get_var('phone'));
+                               $org->set_address(phpgw::get_var('address'));
+                               
$org->set_description(phpgw::get_var('org_description'));
+                               
+                               if($so->store($org))
+                               {
+                                       $message = lang('messages_saved_form'); 
+                               }
+                               else
+                               {
+                                       $error = lang('messages_form_error');
+                               }
+                               
+                               
+                               
+                       }
+                       else if(isset($_POST['store_organization'])) // The 
user has pressed the store button
+                       {
+                               $orgno = phpgw::get_var('orgno');
+                               $district = phpgw::get_var('org_district');
+                               $homepage = phpgw::get_var('homepage');
+                               $email = phpgw::get_var('email');
+                               $phone = phpgw::get_var('phone');
+                               $address = phpgw::get_var('address');
+                               $desc = phpgw::get_var('org_description');
+                       }
+                       
+                       $data = array
+                       (
+                               'organization'  => $org,
+                               'districts'     =>      $districts,
+                               'editable' => true,
+                               'errorMsgs' => $errorMsgs,
+                               'infoMsgs' => $infoMsgs
+                       );
+                       
+                       return $this->render('organization.php', $data);
                }
        }
        
        public function show()
        {
+               $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('view');
                $id = (int)phpgw::get_var('id');
                $type = phpgw::get_var('type');
                if($type)
                {
                        //var_dump($type);
                        $so = activitycalendar_sogroup::get_instance();
-                       $group = $so->get(null, null, null, null, null, null, 
array('id' => $id));
+                       $group_array = $so->get(null, null, null, null, null, 
null, array('id' => $id));
+                       if(count($group_array) > 0){
+                               $keys = array_keys($group_array);
+                               $group = $group_array[$keys[0]];
+                       }
                        
-                       return $this->render('group.php', array
-                               (
-                                       'group'         => $group,
-                                       'editable' => true,
-                                       'message' => isset($message) ? $message 
: phpgw::get_var('message'),
-                                       'error' => isset($error) ? $error : 
phpgw::get_var('error')
-                               )
+                       $data = array
+                       (
+                               'group'         => $group,
+                               'errorMsgs' => $errorMsgs,
+                               'infoMsgs' => $infoMsgs
                        );
+                       return $this->render('group.php', $data);
                }
                else
                {
                        //var_dump('org');
                        $so = activitycalendar_soorganization::get_instance();
-                       $org = $so->get(null, null, null, null, null, null, 
array('id' => $id));
+                       $org_array = $so->get(null, null, null, null, null, 
null, array('id' => $id, 'changed_orgs' => 'true'));
+                       if(count($org_array)>0){
+                               $keys = array_keys($org_array);
+                               $org = $org_array[$keys[0]];
+                       }
                        
-                       return $this->render('organization.php', array
-                               (
-                                       'organization'  => $org,
-                                       'editable' => true,
-                                       'message' => isset($message) ? $message 
: phpgw::get_var('message'),
-                                       'error' => isset($error) ? $error : 
phpgw::get_var('error')
-                               )
+                       var_dump($org);
+                       
+                       $data = array
+                       (
+                               'organization'  => $org,
+                               'errorMsgs' => $errorMsgs,
+                               'infoMsgs' => $infoMsgs
                        );
+                       
+                       return $this->render('organization.php', $data);
                }
        }
        

Modified: trunk/activitycalendar/inc/model/class.activity.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.activity.inc.php     2011-08-17 
06:39:55 UTC (rev 7505)
+++ trunk/activitycalendar/inc/model/class.activity.inc.php     2011-08-17 
07:21:42 UTC (rev 7506)
@@ -25,6 +25,8 @@
                protected $last_change_date;
                protected $contact_person_1;
                protected $contact_person_2;
+               protected $contact_person_2_address;
+               protected $contact_person_2_zip;
                protected $special_adaptation;
                protected $secret;
                protected $internal_arena;
@@ -176,6 +178,20 @@
                
                public function get_contact_person_2() { return 
$this->contact_person_2; }
                
+               public function 
set_contact_person_2_address($contact_person_2_address)
+               {
+                       $this->contact_person_2_address = 
$contact_person_2_address;
+               }
+               
+               public function get_contact_person_2_address() { return 
$this->contact_person_2_address; }
+               
+               public function set_contact_person_2_zip($contact_person_2_zip)
+               {
+                       $this->contact_person_2_zip = $contact_person_2_zip;
+               }
+               
+               public function get_contact_person_2_zip() { return 
$this->contact_person_2_zip; }
+               
                public function set_special_adaptation($special_adaptation)
                {
                        $this->special_adaptation = $special_adaptation;

Modified: trunk/activitycalendar/setup/phpgw_no.lang
===================================================================
--- trunk/activitycalendar/setup/phpgw_no.lang  2011-08-17 06:39:55 UTC (rev 
7505)
+++ trunk/activitycalendar/setup/phpgw_no.lang  2011-08-17 07:21:42 UTC (rev 
7506)
@@ -385,4 +385,6 @@
 building       activitycalendar        no      Kommunale bygg
 Download as excel      activitycalendar        no      Last ned i Excel-format
 arena_name     activitycalendar        no      Navn
-Send mail to selection activitycalendar        no      Send E-post til utvalg
\ No newline at end of file
+Send mail to selection activitycalendar        no      Send E-post til utvalg
+contact_person_2_address       activitycalendar        no      Adresse for 
kulturkontoret
+contact_person_2_zip   activitycalendar        no      Poststed for 
kulturkontoret
\ No newline at end of file

Modified: trunk/activitycalendar/setup/setup.inc.php
===================================================================
--- trunk/activitycalendar/setup/setup.inc.php  2011-08-17 06:39:55 UTC (rev 
7505)
+++ trunk/activitycalendar/setup/setup.inc.php  2011-08-17 07:21:42 UTC (rev 
7506)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['activitycalendar']['name'] = 'activitycalendar';
-       $setup_info['activitycalendar']['version'] = '0.1.4';
+       $setup_info['activitycalendar']['version'] = '0.1.5';
        $setup_info['activitycalendar']['app_order'] = 60;
        $setup_info['activitycalendar']['enable'] = 1;
        $setup_info['activitycalendar']['app_group']    = 'office';
@@ -8,7 +8,10 @@
        $setup_info['activitycalendar']['tables'] = array 
        (
                'activity_activity',
-               'activity_arena'
+               'activity_arena',
+               'activity_organization',
+               'activity_group',
+               'activity_contact_person'
        );
 
        $setup_info['activitycalendar']['description'] = 'Bergen kommune 
activitycalendar';

Modified: trunk/activitycalendar/setup/tables_current.inc.php
===================================================================
--- trunk/activitycalendar/setup/tables_current.inc.php 2011-08-17 06:39:55 UTC 
(rev 7505)
+++ trunk/activitycalendar/setup/tables_current.inc.php 2011-08-17 07:21:42 UTC 
(rev 7506)
@@ -20,7 +20,9 @@
                                'contact_person_1' => array('type' => 
'varchar','precision' => '255'),
                                'contact_person_2' => array('type' => 
'varchar','precision' => '255'),
                                'secret' => array('type' => 'text','nullable' 
=> False),
-                               'special_adaptation' => array('type' => 
'bool','nullable' => true,'default' => 'false')
+                               'special_adaptation' => array('type' => 
'bool','nullable' => true,'default' => 'false'),
+                               'contact_person_2_address' => array('type' => 
'varchar','precision' => '255'),
+                               'contact_person_2_zip' => array('type' => 
'varchar','precision' => '255'),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/activitycalendar/setup/tables_update.inc.php
===================================================================
--- trunk/activitycalendar/setup/tables_update.inc.php  2011-08-17 06:39:55 UTC 
(rev 7505)
+++ trunk/activitycalendar/setup/tables_update.inc.php  2011-08-17 07:21:42 UTC 
(rev 7506)
@@ -114,4 +114,19 @@
                $GLOBALS['setup_info']['activitycalendar']['currentver'] = 
'0.1.4';
                return $GLOBALS['setup_info']['activitycalendar']['currentver'];
        }
+       $test[] = '0.1.4';
+       function activitycalendar_upgrade0_1_4()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('activity_activity','contact_person_2_address',array(
+                       'type' => 'varchar',
+                       'precision' => '255'
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('activity_activity','contact_person_2_zip',array(
+                       'type' => 'varchar',
+                       'precision' => '255'
+               ));
+               
+               $GLOBALS['setup_info']['activitycalendar']['currentver'] = 
'0.1.5';
+               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-08-17 06:39:55 UTC 
(rev 7505)
+++ trunk/activitycalendar/templates/base/activity.php  2011-08-17 07:21:42 UTC 
(rev 7506)
@@ -399,6 +399,44 @@
                                                }
                                        ?>
                                </dd>
+                               <dt>
+                                       <?php 
if($activity->get_contact_person_2_address() || $editable) { ?>
+                                       <label 
for="contact_person_2_address"><?php echo lang('contact_person_2_address') 
?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       if ($editable)
+                                       {
+                                       ?>
+                                               <input type="text" 
name="contact_person_2_address" id="contact_person_2_address" value="<?php echo 
$activity->get_contact_person_2_address() ?>" />
+                                       <?php
+                                       }
+                                       else
+                                       {
+                                               echo 
$activity->get_contact_person_2_address();
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <?php 
if($activity->get_contact_person_2_zip() || $editable) { ?>
+                                       <label for="contact_person_2_zip"><?php 
echo lang('contact_person_2_zip') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       if ($editable)
+                                       {
+                                       ?>
+                                               <input type="text" 
name="contact_person_2_zip" id="contact_person_2_zip" value="<?php echo 
$activity->get_contact_person_2_zip() ?>" />
+                                       <?php
+                                       }
+                                       else
+                                       {
+                                               echo 
$activity->get_contact_person_2_zip();
+                                       }
+                                       ?>
+                               </dd>
                            <dt>
                                        <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
                                </dt>

Added: trunk/activitycalendar/templates/base/group.php
===================================================================
--- trunk/activitycalendar/templates/base/group.php                             
(rev 0)
+++ trunk/activitycalendar/templates/base/group.php     2011-08-17 07:21:42 UTC 
(rev 7506)
@@ -0,0 +1 @@
+<?php

Added: trunk/activitycalendar/templates/base/organization.php
===================================================================
--- trunk/activitycalendar/templates/base/organization.php                      
        (rev 0)
+++ trunk/activitycalendar/templates/base/organization.php      2011-08-17 
07:21:42 UTC (rev 7506)
@@ -0,0 +1,92 @@
+<?php
+       //include common logic for all templates
+       include("common.php");
+?>
+<div class="identifier-header">
+       <h1><img src="<?php echo ACTIVITYCALENDAR_IMAGE_PATH 
?>images/32x32/custom/contact.png" /><?php echo lang('organization') ?></h1>
+</div>
+<div class="yui-content">
+       <div id="details">
+               <form action="#" method="post">
+                       <input type="hidden" name="id" value="<?php 
if($organization->get_id()){ echo $organization->get_id(); } else { echo '0'; } 
 ?>"/>
+                       <dl class="proplist-col">
+                               <dt><label 
for="orgname">Organisasjonsnavn</label></dt>
+                               <dd><?php echo $organization->get_name();?></dd>
+                               <dt><label 
for="orgno">Organisasjonsnummer</label></dt>
+                               <dd>
+                                       <?php 
+                                       if($editable){?>
+                                               <input type="text" name="orgno" 
value="<?php echo $organization->get_organization_number();?>"/><br/>
+                                       <?php 
+                                       }else{?>
+                                               <?php echo 
$organization->get_organization_number();?>
+                                       <?php }?>
+                               </dd>
+                               <dt><label for="district">Bydel</label></dt>
+                               <dd>
+                               <?php if($editable){?>
+                               <?php $curr_district = 
$organization->get_district();?>
+                                       <select name="org_district">
+                                               <option value="0">Ingen bydel 
valgt</option>
+                                       <?php 
+                                               foreach($districts as $d){?>
+                                                       <option value="<?php 
echo $d['part_of_town_id']?>" <?php echo ($curr_district == 
$d['part_of_town_id'])? 'selected' : '' ?>><?php echo $d['name']?></option>
+                                               <?php }?>
+                                       </select>
+                               <?php }else{?>
+                                       <?php echo 
activitycalendar_soactivity::get_instance()->get_district_from_id($organization->get_district());?>
+                               <?php }?>
+                               </dd>
+                               <dt><label 
for="homepage">Hjemmeside</label></dt>
+                               <dd>
+                               <?php if($editable){?>
+                                       <input type="text" name="homepage" 
value="<?php echo $organization->get_homepage();?>"/><br/>
+                               <?php }else{?>
+                                       <?php echo 
$organization->get_homepage();?>
+                               <?php }?>
+                               </dd>
+                               <dt><label for="email">E-post</label></dt>
+                               <dd>
+                               <?php if($editable){?>
+                                       <input type="text" name="email" 
value="<?php echo $organization->get_email();?>"/>
+                               <?php }else{?>
+                                       <?php echo $organization->get_email();?>
+                               <?php }?>
+                               </dd>
+                               <dt><label for="phone">Telefon</label></dt>
+                               <dd>
+                               <?php if($editable){?>
+                                       <input type="text" name="phone" 
value="<?php echo $organization->get_phone();?>"/>
+                               <?php }else{?>
+                                       <?php echo $organization->get_phone();?>
+                               <?php }?>
+                               </dd>
+                               <dt><label for="street">Adresse</label></dt>
+                               <dd>
+                               <?php if($editable){?>
+                                       <input type="text" name="address" 
value="<?php echo $organization->get_address();?>"/>
+                               <?php }else{?>
+                                       <?php echo 
$organization->get_address();?>
+                               <?php }?>
+                               </dd>
+                               <dt><label 
for="org_description">Beskrivelse</label></dt>
+                               <dd>
+                               <?php if($editable){?>
+                                       <textarea rows="10" cols="100" 
name="org_description"><?php echo $organization->get_description();?></textarea>
+                               <?php }else{?>
+                                       <?php echo 
$organization->get_description();?>
+                               <?php }?>
+                               </dd>
+                       </dl>
+                       <div class="form-buttons">
+                               <?php
+                                       if ($editable) {
+                                               echo '<input type="submit" 
name="save_organization" value="' . lang('save') . '"/>';
+                                               echo '<input type="submit" 
name="store_organization" value="' . lang('store') . '"/>';
+                                       }
+                               ?>
+                       </div>
+               </form>
+       </div>
+</div>
+                               
\ No newline at end of file




reply via email to

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