fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7975] Merge 7969:7974 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7975] Merge 7969:7974 from trunk
Date: Tue, 01 Nov 2011 09:26:16 +0000

Revision: 7975
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7975
Author:   sigurdne
Date:     2011-11-01 09:26:15 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
Merge 7969:7974 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.socontactperson.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.sogroup.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/model/class.group.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/model/class.organization.inc.php
    branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
    branches/Version-1_0-branch/activitycalendar/templates/base/group.php
    branches/Version-1_0-branch/activitycalendar/templates/base/organization.php
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    branches/Version-1_0-branch/rental/inc/class.soparty.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2011-11-01 09:04:09 UTC (rev 7974)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2011-11-01 09:26:15 UTC (rev 7975)
@@ -1162,4 +1162,55 @@
        $result = $this->db->query($sql, __LINE__, __FILE__);
                return isset($result);
        }
+       
+       function get_activities_for_update($org_id, $group = false)
+       {
+               $activities = array();
+               if($group)
+               {
+                       $sql = "SELECT * FROM activity_activity WHERE new_org 
AND group_id={$org_id}";
+               }
+               else
+               {
+                       $sql = "SELECT * FROM activity_activity WHERE new_org 
AND organization_id={$org_id}";
+               }
+               $this->db->query($sql, __LINE__, __FILE__);
+               while ($this->db->next_record())
+               {                       
+               $activity = new activitycalendar_activity((int) $activity_id);
+
+                       
$activity->set_title($this->unmarshal($this->db->f('title'), 'string'));
+                       
$activity->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                       
$activity->set_group_id($this->unmarshal($this->db->f('group_id'), 'int'));
+                       
$activity->set_district($this->unmarshal($this->db->f('district'), 'int'));
+                       
$activity->set_office($this->unmarshal($this->db->f('office'), 'int'));
+                       
$activity->set_category($this->unmarshal($this->db->f('category'), 'int'));
+                       
$activity->set_state($this->unmarshal($this->db->f('state'), 'int'));
+                       
$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')));
+                       
$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'));
+                       
$activity->set_frontend($this->unmarshal($this->db->f('frontend', 'bool')));
+                       
$activity->set_new_org($this->unmarshal($this->db->f('new_org', 'bool')));
+                       
+                       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)
+                       {
+                               $contacts = 
activitycalendar_soorganization::get_instance()->get_contacts($activity->get_organization_id());
+                               $activity->set_contact_persons($contacts);
+                       }
+               }
+       }
 }

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.socontactperson.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.socontactperson.inc.php  
    2011-11-01 09:04:09 UTC (rev 7974)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.socontactperson.inc.php  
    2011-11-01 09:26:15 UTC (rev 7975)
@@ -302,4 +302,54 @@
                }
                return $contact_person;
        }
+       
+       function get_local_contact_persons($id, $group=false)
+       {
+               $result = array();
+       if(isset($id)){
+               if($group)
+               {
+                       $q1="SELECT id, organization_id, group_id, name, phone, 
email FROM activity_contact_person WHERE group_id='{$id}'";
+               }
+               else
+               {
+                       $q1="SELECT id, organization_id, group_id, name, phone, 
email FROM activity_contact_person WHERE organization_id='{$id}'";
+               }
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person($this->db->f('id'), 'int');
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $result[] = $contact_person;
+                       }
+       }
+               return $result;
+       }
+       
+       function update_local_contact_person($contact)
+       {
+               $id = $contact['id'];
+               $name = $contact['name'];
+               $phone = $contact['phone'];
+               $mail = $contact['mail'];
+               $org_id = $contact['org_id'];
+               $group_id = $contact['group_id'];
+               
+               $columns[] = "name='{$name}'";
+               $columns[] = "phone='{$phone}'";
+               $columns[] = "email='{$mail}'";
+               $columns[] = "organization_id={$org_id}";
+               $columns[] = "group_id={$group_id}";
+               $columns[] = "address=''";
+               $columns[] = "zipcode=''"; 
+               $columns[] = "city=''";
+               $cols = implode(',',$columns);
+
+               $sql = "UPDATE activity_contact_person SET {$cols} WHERE 
id={$id}";
+       $result = $this->db->query($sql, __LINE__, __FILE__);
+               return isset($result);
+       }
 }
\ No newline at end of file

Modified: branches/Version-1_0-branch/activitycalendar/inc/class.sogroup.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.sogroup.inc.php      
2011-11-01 09:04:09 UTC (rev 7974)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.sogroup.inc.php      
2011-11-01 09:26:15 UTC (rev 7975)
@@ -104,6 +104,8 @@
                                $columns[] = 'activity_group.name';
                                $columns[] = 'activity_group.description';
                                $columns[] = 'activity_group.organization_id';
+                               $columns[] = 'activity_group.change_type';
+                               $columns[] = 'activity_group.transferred';
                                
                                $dir = $ascending ? 'ASC' : 'DESC';
                                $order = "ORDER BY activity_group.id $dir";
@@ -266,8 +268,71 @@
                        
$group->set_shortname($this->unmarshal($this->db->f('shortname'), 'string'));
                        
$group->set_description($this->unmarshal($this->db->f('description'), 
'string'));
                        
$group->set_show_in_portal($this->unmarshal($this->db->f('show_in_portal'), 
'int'));
+                       
$group->set_change_type($this->unmarshal($this->db->f('change_type'), 
'string'));
+                       
$group->set_transferred($this->unmarshal($this->db->f('transferred')));
                }
                return $group;
        }
+       
+       function update_local($group)
+       {
+               $name = $group->get_name();
+               $orgid = $group->get_organization_id();
+               $description = $group->get_description();
+               $change_type = $group->get_change_type();
+               $transferred = ($group->get_transferred() == 1 || 
$group->get_transferred() == true)?'true':'false';
+               
+               $values[] = "NAME='{$name}'";
+               $values[] = "DESCRIPTION='{$description}'";
+               $values[] = "ORGANIZATION_ID='{$orgid}'";
+               $values[] = "CHANGE_TYPE='{$change_type}'";
+               $values[] = "TRANSFERRED={$transferred}";
+               $vals = implode(',',$values);
+               
+               $sql = "UPDATE activity_group SET {$vals} WHERE 
ID={$group->get_id()}";
+       $result = $this->db->query($sql, __LINE__, __FILE__);
+               if(isset($result))
+               {
+                       return true;
+               }
+               else
+               {
+                       return false;
+               }
+       }
+       
+       function transfer_group($group_info)
+       {
+               $name = $group_info['name'];
+               $orgid = $group_info['organization_id'];
+               $description = $group_info['description'];
+               $activity_id = 0;
+               $show_in_portal = 1; 
+               
+               $columns[] = 'name';
+               $columns[] = 'description';
+               $columns[] = 'organization_id';
+               $columns[] = 'activity_id';
+               $columns[] = 'show_in_portal';
+               $cols = implode(',',$columns);
+               
+               $values[] = "'{$name}'";
+               $values[] = "'{$description}'";
+               $values[] = "'{$orgid}'";
+               $values[] = $this->marshal($activity_id, 'int');
+               $values[] = $show_in_portal;
+               $vals = implode(',',$values);
+               
+               $sql = "INSERT INTO bb_group ({$cols}) VALUES ({$vals})";
+       $result = $this->db->query($sql, __LINE__, __FILE__);
+               if(isset($result))
+               {
+                       return $this->db->get_last_insert_id('bb_group', 'id');
+               }
+               else
+               {
+                       return 0;
+               }
+       }
 }
 ?>

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2011-11-01 09:04:09 UTC (rev 7974)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2011-11-01 09:26:15 UTC (rev 7975)
@@ -139,6 +139,7 @@
                                $columns[] = 'org.address';
                                $columns[] = 'org.district';
                                $columns[] = 'org.change_type';
+                               $columns[] = 'org.transferred';
                                $columns[] = 'org.orgno AS organization_number';
                                
                                $cols = implode(',',$columns);
@@ -313,9 +314,41 @@
         * @param $party the party to be updated
         * @return boolean true if successful, false otherwise
         */
-       function update($party)
+       function update_local($organization)
        {
-               return false;
+               $name = $organization->get_name();
+               $orgnr = $organization->get_organization_number();
+               $homepage = $organization->get_homepage();
+               $phone = $organization->get_phone();
+               $email = $organization->get_email();
+               $description = $organization->get_description();
+               $street = $organization->get_address();
+               $district = $organization->get_district();
+               $change_type = $organization->get_change_type();
+               $transferred = ($organization->get_transferred() == 1 || 
$organization->get_transferred() == true)?'true':'false';
+               
+               $values[] = "NAME='{$name}'";
+               $values[] = "HOMEPAGE='{$homepage}'";
+               $values[] = "PHONE='{$phone}'";
+               $values[] = "EMAIL='{$email}'";
+               $values[] = "DESCRIPTION='{$description}'";
+               $values[] = "ADDRESS='{$street}'";
+               $values[] = "ORGNO='{$orgnr}'";
+               $values[] = "DISTRICT='{$district}'";
+               $values[] = "CHANGE_TYPE='{$change_type}'";
+               $values[] = "TRANSFERRED={$transferred}";
+               $vals = implode(',',$values);
+               
+               $sql = "UPDATE activity_organization SET {$vals} WHERE 
ID={$organization->get_id()}";
+       $result = $this->db->query($sql, __LINE__, __FILE__);
+               if(isset($result))
+               {
+                       return true;
+               }
+               else
+               {
+                       return false;
+               }
        }
 
        public function get_id_field_name($extended_info = false)
@@ -351,6 +384,7 @@
                        
$organization->set_district($this->unmarshal($this->db->f('district'), 
'string'));
                        
$organization->set_description($this->unmarshal($this->db->f('description'), 
'string'));
                        
$organization->set_change_type($this->unmarshal($this->db->f('change_type'), 
'string'));
+                       
$organization->set_transferred($this->unmarshal($this->db->f('transferred'), 
'bool'));
                        
$organization->set_show_in_portal($this->unmarshal($this->db->f('show_in_portal'),
 'int'));
                }
                return $organization;
@@ -466,5 +500,10 @@
                        return 0;
                }
        }
+       
+       function update($organization)
+       {
+               return false;
+       }
 }
 ?>

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2011-11-01 09:04:09 UTC (rev 7974)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2011-11-01 09:26:15 UTC (rev 7975)
@@ -75,35 +75,118 @@
                {
                        //var_dump($type);
                        $so = activitycalendar_sogroup::get_instance();
-                       $group = $so->get(null, null, null, null, null, null, 
array('id' => $id, 'changed_groups' => 'true'));
+                       $so_contact = 
activitycalendar_socontactperson::get_instance();
+                       $so_activity = 
activitycalendar_soactivity::get_instance();
+                       $group_array = $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_group'])) // 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');
+                               $desc = phpgw::get_var('group_description');
+                               $group->set_description($desc);
+                               
+                               $contact1 = array();
+                               $contact1['id'] = phpgw::get_var('contact1_id');
+                               $contact1['name'] = 
phpgw::get_var('contact1_name');
+                               $contact1['phone'] = 
phpgw::get_var('contact1_phone');
+                               $contact1['mail'] = 
phpgw::get_var('contact1_email');
+                               $contact1['org_id'] = 0;
+                               $contact1['group_id'] = $group->get_id();
+                               
+                               $contact2 = array();
+                               $contact2['id'] = phpgw::get_var('contact2_id');
+                               $contact2['name'] = 
phpgw::get_var('contact2_name');
+                               $contact2['phone'] = 
phpgw::get_var('contact2_phone');
+                               $contact2['mail'] = 
phpgw::get_var('contact2_email');
+                               $contact2['org_id'] = 0;
+                               $contact2['group_id'] = $group->get_id();
+                               
+                               if($so->update_local($group))
+                               {
+                                       
$so_contact->update_local_contact_person($contact1);
+                                       
$so_contact->update_local_contact_person($contact2);
+                                       $message = lang('messages_saved_form'); 
+                               }
+                               else
+                               {
+                                       $error = lang('messages_form_error');
+                               }
+                               
                        }
                        else if(isset($_POST['store_group'])) // 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');
+                               $desc = phpgw::get_var('group_description');    
                        
+                               $orgid = $group->get_organization_id();
+                               
+                               $group_info = array();
+                               $group_info['name'] = $group->get_name(); //new
+                               $group_info['organization_id'] = $orgid; 
+                               $group_info['description'] = $desc;
+                               
+                               $contact1_id = phpgw::get_var('contact1_id');
+                               $contact2_id = phpgw::get_var('contact2_id');
+                               
+                               $contact1_name = 
phpgw::get_var('contact1_name');
+                               $contact1_phone = 
phpgw::get_var('contact1_phone');
+                               $contact1_email = 
phpgw::get_var('contact1_email');
+                               
+                               $contact2_name = 
phpgw::get_var('contact2_name');
+                               $contact2_phone = 
phpgw::get_var('contact2_phone');
+                               $contact2_email = 
phpgw::get_var('contact2_email');
+
+                               
+                               $new_group_id = 
$so->transfer_group($group_info);
+                               if($new_group_id)
+                               {
+                                       //update activity with new org id
+                                       //add contact persons to booking
+                                       $contact1 = array();
+                                       $contact1['name'] = $contact1_name;
+                                       $contact1['phone'] = $contact1_phone;
+                                       $contact1['mail'] = $contact1_email;
+                                       $contact1['group_id'] = $new_group_id;
+                                       
$so_activity->add_contact_person_group($contact1);
+                                       
+                                       $contact2 = array();
+                                       $contact2['name'] = $contact2_name;
+                                       $contact2['phone'] = $contact2_phone;
+                                       $contact2['mail'] = $contact_mail_2;
+                                       $contact2['group_id'] = $new_group_id;
+                                       
$so_activity->add_contact_person_group($contact2);
+                                       
+                                       $message = lang('messages_saved_form'); 
+                                       
+                                       //get affected activities and update 
with new org id
+                                       $update_activities = 
$so_activity->get_activities_for_update($new_group_id, true);
+                                       foreach($update_activities as $act)
+                                       {
+                                               
$act->set_group_id($new_group_id);
+                                               $act->set_new_org(false);
+                                               $so_activity->store($act);
+                                       }
+                                       
+                                       //set local group as stored
+                                       $group->set_change_type('added');
+                                       $group->set_transferred(true);
+                                       $so->update_local($group);
+                               }
+                               else
+                               {
+                                       $error = lang('messages_form_error');
+                               }
                        }
                        
+                       $contact_persons = 
$so_contact->get_local_contact_persons($group->get_id(), true);
+                       $cp1 = $contact_persons[0];
+                       $cp2 = $contact_persons[1];
+                       
                        $data = array
                        (
                                'group'         => $group,
+                               'contactperson1' => $cp1,
+                               'contactperson2' => $cp2,
                                'editable' => true,
                                'errorMsgs' => $errorMsgs,
                                'infoMsgs' => $infoMsgs
@@ -134,8 +217,26 @@
                                $org->set_address(phpgw::get_var('address'));
                                
$org->set_description(phpgw::get_var('org_description'));
                                
-                               if($so->update_local_org($org))
+                               $contact1 = array();
+                               $contact1['id'] = phpgw::get_var('contact1_id');
+                               $contact1['name'] = 
phpgw::get_var('contact1_name');
+                               $contact1['phone'] = 
phpgw::get_var('contact1_phone');
+                               $contact1['mail'] = 
phpgw::get_var('contact1_email');
+                               $contact1['org_id'] = $org->get_id();
+                               $contact1['group_id'] = 0;
+                               
+                               $contact2 = array();
+                               $contact2['id'] = phpgw::get_var('contact2_id');
+                               $contact2['name'] = 
phpgw::get_var('contact2_name');
+                               $contact2['phone'] = 
phpgw::get_var('contact2_phone');
+                               $contact2['mail'] = 
phpgw::get_var('contact2_email');
+                               $contact2['org_id'] = $org->get_id();
+                               $contact2['group_id'] = 0;
+                               
+                               if($so->update_local($org))
                                {
+                                       
$so_contact->update_local_contact_person($contact1);
+                                       
$so_contact->update_local_contact_person($contact2);
                                        $message = lang('messages_saved_form'); 
                                }
                                else
@@ -167,12 +268,24 @@
                                $org_info['homepage'] = $homepage;
                                $org_info['phone'] = $phone;
                                $org_info['email'] = $email;
-                               $org_info['description'] = $description;
+                               $org_info['description'] = $desc;
                                $org_info['street'] = $address_array[0];
                                $org_info['zip'] = $address_array[1];
                                $org_info['activity_id'] = '';
                                $org_info['district'] = $district;
                                
+                               $contact1_id = phpgw::get_var('contact1_id');
+                               $contact2_id = phpgw::get_var('contact2_id');
+                               
+                               $contact1_name = 
phpgw::get_var('contact1_name');
+                               $contact1_phone = 
phpgw::get_var('contact1_phone');
+                               $contact1_email = 
phpgw::get_var('contact1_email');
+                               
+                               $contact2_name = 
phpgw::get_var('contact2_name');
+                               $contact2_phone = 
phpgw::get_var('contact2_phone');
+                               $contact2_email = 
phpgw::get_var('contact2_email');
+
+                               
                                $new_org_id = 
$so->transfer_organization($org_info);
                                if($new_org_id)
                                {
@@ -182,16 +295,31 @@
                                        $contact1['name'] = $contact1_name;
                                        $contact1['phone'] = $contact1_phone;
                                        $contact1['mail'] = $contact1_email;
-                                       $contact1['org_id'] = 
$this->decode($new_org_id);
-                                       
$so_contact->add_contact_person_org($contact1);
+                                       $contact1['org_id'] = $new_org_id;
+                                       
$so_activity->add_contact_person_org($contact1);
                                        
                                        $contact2 = array();
                                        $contact2['name'] = $contact2_name;
                                        $contact2['phone'] = $contact2_phone;
                                        $contact2['mail'] = $contact_mail_2;
-                                       $contact2['org_id'] = 
$this->decode($new_org_id);
-                                       
$so_contact->add_contact_person_org($contact2);
+                                       $contact2['org_id'] = $new_org_id;
+                                       
$so_activity->add_contact_person_org($contact2);
+                                       
                                        $message = lang('messages_saved_form'); 
+                                       
+                                       //get affected activities and update 
with new org id
+                                       $update_activities = 
$so_activity->get_activities_for_update($new_org_id);
+                                       foreach($update_activities as $act)
+                                       {
+                                               
$act->set_organization_id($new_org_id);
+                                               $act->set_new_org(false);
+                                               $so_activity->store($act);
+                                       }
+                                       
+                                       //set local organization as stored
+                                       $org->set_change_type("added");
+                                       $org->set_transferred(true);
+                                       $so->update_local($org);
                                }
                                else
                                {
@@ -200,10 +328,16 @@
                                
                        }
                        
+                       $contact_persons = 
$so_contact->get_local_contact_persons($org->get_id());
+                       $cp1 = $contact_persons[0];
+                       $cp2 = $contact_persons[1];
+                       
                        $data = array
                        (
                                'organization'  => $org,
                                'districts'     =>      $districts,
+                               'contactperson1' => $cp1,
+                               'contactperson2' => $cp2,
                                'editable' => true,
                                'errorMsgs' => $errorMsgs,
                                'infoMsgs' => $infoMsgs
@@ -497,6 +631,26 @@
                                }
                                $value['labels'][] = lang('edit');
                                break;
+                       case 'changed_groups':
+                               $value['ajax'][] = false;
+                               if($value['organization_id'] != '' && 
$value['organization_id'] != null){
+                                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.show', 'id' => $value['id'], 'type' => 
'group')));
+                               }
+                               else
+                               {
+                                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.show', 'id' => $value['id'])));
+                               }
+                               $value['labels'][] = lang('show');
+                               $value['ajax'][] = false;
+                               if($value['organization_id'] != '' && 
$value['organization_id'] != null){
+                                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.edit', 'id' => $value['id'], 'type' => 
'group')));
+                               }
+                               else
+                               {
+                                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiorganization.edit', 'id' => $value['id'])));
+                               }
+                               $value['labels'][] = lang('edit');
+                               break;
                }
     }
 }

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/model/class.group.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/model/class.group.inc.php  
2011-11-01 09:04:09 UTC (rev 7974)
+++ branches/Version-1_0-branch/activitycalendar/inc/model/class.group.inc.php  
2011-11-01 09:26:15 UTC (rev 7975)
@@ -12,6 +12,7 @@
                protected $show_in_portal;
                protected $shortname;
                protected $change_type;
+               protected $transferred;
                
                /**
                 * Constructor.  Takes an optional ID.  If a organization is 
created from outside
@@ -73,6 +74,13 @@
                
                public function get_shortname() { return $this->shortname; }
                
+               public function set_transferred($transferred)
+               {
+                       $this->transferred = $transferred;
+               }
+               
+               public function get_transferred() { return $this->transferred; }
+               
                public function serialize()
                {
                        return array(
@@ -82,7 +90,8 @@
                                'shortname' => $this->get_shortname(),
                                'description' => $this->get_description(),
                                'show_in_portal' => $this->get_show_in_portal(),
-                               'change_type' => $this->get_change_type()
+                               'change_type' => $this->get_change_type(),
+                               'transferred' => $this->get_transferred()
                        );
                }
                

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/model/class.organization.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/inc/model/class.organization.inc.php
   2011-11-01 09:04:09 UTC (rev 7974)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/model/class.organization.inc.php
   2011-11-01 09:26:15 UTC (rev 7975)
@@ -16,6 +16,7 @@
                protected $phone;
                protected $address;
                protected $change_type;
+               protected $transferred;
                
                /**
                 * Constructor.  Takes an optional ID.  If a organization is 
created from outside
@@ -105,6 +106,13 @@
                
                public function get_district() { return $this->district; }
                
+               public function set_transferred($transferred)
+               {
+                       $this->transferred = $transferred;
+               }
+               
+               public function get_transferred() { return $this->transferred; }
+               
                public function serialize()
                {
                        $so_org = 
activitycalendar_soorganization::get_instance();

Modified: branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-11-01 09:04:09 UTC (rev 7974)
+++ branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-11-01 09:26:15 UTC (rev 7975)
@@ -391,4 +391,6 @@
 contact_person_2_zip   activitycalendar        no      Poststed for 
kulturkontoret
 active_arena   activitycalendar        no      Aktiv
 inactive_arena activitycalendar        no      Inaktiv
-change_type    activitycalendar        no      Endringstype
\ No newline at end of file
+change_type    activitycalendar        no      Endringstype
+added  activitycalendar        no      Lagt til i organisasjonsregisteret
+store  activitycalendar        no      Overfør til organisasjonsregister
\ No newline at end of file

Modified: branches/Version-1_0-branch/activitycalendar/templates/base/group.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/templates/base/group.php       
2011-11-01 09:04:09 UTC (rev 7974)
+++ branches/Version-1_0-branch/activitycalendar/templates/base/group.php       
2011-11-01 09:26:15 UTC (rev 7975)
@@ -1 +1,63 @@
 <?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('group') ?></h1>
+</div>
+<div class="yui-content">
+       <div id="details">
+               <form action="#" method="post">
+                       <input type="hidden" name="id" value="<?php 
if($group->get_id()){ echo $group->get_id(); } else { echo '0'; }  ?>"/>
+                       <dl class="proplist-col">
+                               <dt><label for="orgname">Gruppenavn</label></dt>
+                               <dd><?php echo $group->get_name();?></dd>
+                               <dt><label 
for="group_description">Beskrivelse</label></dt>
+                               <dd>
+                               <?php if($editable){?>
+                                       <textarea rows="10" cols="100" 
name="group_description"><?php echo $group->get_description();?></textarea>
+                               <?php }else{?>
+                                       <?php echo $group->get_description();?>
+                               <?php }?>
+                               </dd>
+                               <dt><label>Kontaktperson 1</label></dt>
+                               <dd><input type="hidden" name="contact1_id" 
value="<?php echo $contactperson1->get_id();?>"/></dd>
+                               <dt><label for="contact1_name">Navn</label></dt>
+                               <dd>
+                                       <input type="text" name="contact1_name" 
value="<?php echo $contactperson1->get_name();?>"/><br/>
+                               </dd>
+                               <dt><label 
for="contact1_phone">Telefon</label></dt>
+                               <dd>
+                                       <input type="text" 
name="contact1_phone" value="<?php echo $contactperson1->get_phone();?>"/>
+                               </dd>
+                               <dt><label 
for="contact1_mail">E-post</label></dt>
+                               <dd>
+                                       <input type="text" 
name="contact1_email" value="<?php echo $contactperson1->get_email();?>"/>
+                               </dd>
+                               <dt><label>Kontaktperson 2</label></dt>
+                               <dd><input type="hidden" name="contact2_id" 
value="<?php echo $contactperson2->get_id();?>"/></dd>
+                               <dt><label for="contact1_name">Navn</label></dt>
+                               <dd>
+                                       <input type="text" name="contact2_name" 
value="<?php echo $contactperson2->get_name();?>"/><br/>
+                               </dd>
+                               <dt><label 
for="contact1_phone">Telefon</label></dt>
+                               <dd>
+                                       <input type="text" 
name="contact2_phone" value="<?php echo $contactperson2->get_phone();?>"/>
+                               </dd>
+                               <dt><label 
for="contact1_mail">E-post</label></dt>
+                               <dd>
+                                       <input type="text" 
name="contact2_email" value="<?php echo $contactperson2->get_email();?>"/>
+                               </dd>
+                       </dl>
+                       <div class="form-buttons">
+                               <?php
+                                       if ($editable) {
+                                               echo '<input type="submit" 
name="save_group" value="' . lang('save') . '"/>';
+                                               echo '<input type="submit" 
name="store_group" value="' . lang('store') . '"/>';
+                                       }
+                               ?>
+                       </div>
+               </form>
+       </div>
+</div>
+                               
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/activitycalendar/templates/base/organization.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/templates/base/organization.php    
    2011-11-01 09:04:09 UTC (rev 7974)
+++ 
branches/Version-1_0-branch/activitycalendar/templates/base/organization.php    
    2011-11-01 09:26:15 UTC (rev 7975)
@@ -81,6 +81,34 @@
                                        <?php echo 
$organization->get_description();?>
                                <?php }?>
                                </dd>
+                               <dt><label>Kontaktperson 1</label></dt>
+                               <dd><input type="hidden" name="contact1_id" 
value="<?php echo $contactperson1->get_id();?>"/></dd>
+                               <dt><label for="contact1_name">Navn</label></dt>
+                               <dd>
+                                       <input type="text" name="contact1_name" 
value="<?php echo $contactperson1->get_name();?>"/><br/>
+                               </dd>
+                               <dt><label 
for="contact1_phone">Telefon</label></dt>
+                               <dd>
+                                       <input type="text" 
name="contact1_phone" value="<?php echo $contactperson1->get_phone();?>"/>
+                               </dd>
+                               <dt><label 
for="contact1_mail">E-post</label></dt>
+                               <dd>
+                                       <input type="text" 
name="contact1_email" value="<?php echo $contactperson1->get_email();?>"/>
+                               </dd>
+                               <dt><label>Kontaktperson 2</label></dt>
+                               <dd><input type="hidden" name="contact2_id" 
value="<?php echo $contactperson2->get_id();?>"/></dd>
+                               <dt><label for="contact1_name">Navn</label></dt>
+                               <dd>
+                                       <input type="text" name="contact2_name" 
value="<?php echo $contactperson2->get_name();?>"/><br/>
+                               </dd>
+                               <dt><label 
for="contact1_phone">Telefon</label></dt>
+                               <dd>
+                                       <input type="text" 
name="contact2_phone" value="<?php echo $contactperson2->get_phone();?>"/>
+                               </dd>
+                               <dt><label 
for="contact1_mail">E-post</label></dt>
+                               <dd>
+                                       <input type="text" 
name="contact2_email" value="<?php echo $contactperson2->get_email();?>"/>
+                               </dd>
                        </dl>
                        <div class="form-buttons">
                                <?php

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    2011-11-01 09:04:09 UTC (rev 7974)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    2011-11-01 09:26:15 UTC (rev 7975)
@@ -132,7 +132,7 @@
                <h1><?php echo lang('activity') ?></h1>
                <form action="#" method="post">
                        <input type="hidden" name="id" value="<?php 
if($activity->get_id()){ echo $activity->get_id(); } else { echo '0'; }  ?>"/>
-                       <dl class="proplist-col" style="width: 100%;">
+                       <dl class="proplist-col" style="width: 60%">
                                <dt>
                                        <?php if($activity->get_title() || 
$editable) { ?>
                                        <label for="title"><?php echo 
lang('title') ?></label>
@@ -144,7 +144,7 @@
                                        {
                                        ?>
                                                <?php echo 
lang('title_helptext')?><br/>
-                                               <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" />
+                                               <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" size="60"/>
                                        <?php
                                        }
                                        else
@@ -361,7 +361,7 @@
                                        {
                                                ?>
                                                <?php echo 
lang('arena_helptext')?><br/>
-                                               <select name="arena_id">
+                                               <select name="arena_id" 
style="width: 60%">
                                                        <option value="0">Ingen 
arena valgt</option>
                                                        <?php
                                                        foreach($arenas as 
$arena)
@@ -405,6 +405,8 @@
                                        }
                                        ?>
                                </dd>
+                       </dl>
+                       <dl class="proplist-col">
                                <dt>
                                        <?php if($activity->get_category() || 
$editable) { ?>
                                        <label for="category"><?php echo 
lang('category') ?></label>

Modified: branches/Version-1_0-branch/rental/inc/class.soparty.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.soparty.inc.php        
2011-11-01 09:04:09 UTC (rev 7974)
+++ branches/Version-1_0-branch/rental/inc/class.soparty.inc.php        
2011-11-01 09:26:15 UTC (rev 7975)
@@ -410,5 +410,15 @@
                return (int) $this->db->f('count',true);
        }
        
+       public function delete_party($party_id)
+       {
+               if($party_id)
+               {
+                       $sql = "DELETE FROM rental_party WHERE id={$party_id}";
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       return true;
+               }
+       }
+       
 }
 ?>

Modified: branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php        
2011-11-01 09:04:09 UTC (rev 7974)
+++ branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php        
2011-11-01 09:26:15 UTC (rev 7975)
@@ -24,7 +24,8 @@
                        'syncronize_party'      => true,
                        'syncronize_party_name' => true,
                        'create_user_based_on_email' => true,
-                       'get_synchronize_party_info' => true
+                       'get_synchronize_party_info' => true,
+                       'delete_party'          => true
        );
 
        public function __construct()
@@ -166,7 +167,7 @@
                                        $type,                                  
                                                        // [2] The type of query
                                        isset($contract) ? 
$contract->serialize() : null,       // [3] Serialized contract
                                        $editable,                              
                                                        // [4] Editable flag
-                                       $this->type_of_user                     
                                                // [5] User role                
        
+                                       $this->type_of_user                     
                                                // [5] User role
                                )
                        );
                }
@@ -390,6 +391,13 @@
                                        $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 'rental.uiparty.edit', 'id' 
=> $value['id'])));
                                        $value['labels'][] = lang('edit');
                                        
+                                       if(isset($value['is_inactive']) && 
$value['is_inactive'] == true)
+                                       {
+                                               $value['ajax'][] = true;
+                                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'rental.uiparty.delete_party', 'id' => $value['id'])));
+                                               $value['labels'][] = 
lang('delete');
+                                       }
+                                       
                                        if(isset($value['org_enhet_id']) && 
$value['org_enhet_id'] != '')
                                        {
                                                $value['ajax'][] = false;
@@ -735,5 +743,28 @@
                //Redirect to edit mode with error message if user reaches this 
point.
                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'rental.uiparty.edit','id' => $party_id, 'error' => 
lang('error_create_user_based_on_email')));
        }
+       
+       public function delete_party()
+       {
+               $party_id = phpgw::get_var('id');
+               if(($this->isExecutiveOfficer() || $this->isAdministrator()))
+               {
+                       if(isset($party_id) && $party_id > 0)
+                       {
+                               
if(rental_soparty::get_instance()->delete_party($party_id)) // ... delete the 
party
+                               {
+                                       $message = lang('messages_saved_form'); 
+                               }
+                               else
+                               {
+                                       $error = lang('messages_form_error');
+                               } 
+                       }
+               }
+               else
+               {
+                       $this->render('permission_denied.php',array('error' => 
lang('permission_denied_edit')));
+               }
+       }       
 }
 ?>




reply via email to

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