fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7459] Merge 7447:7458 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7459] Merge 7447:7458 from trunk
Date: Sun, 03 Jul 2011 19:39:07 +0000

Revision: 7459
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7459
Author:   sigurdne
Date:     2011-07-03 19:39:07 +0000 (Sun, 03 Jul 2011)
Log Message:
-----------
Merge 7447:7458 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendar/inc/class.menu.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.soactivity.inc.php
    branches/Version-1_0-branch/activitycalendar/inc/class.soarena.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.uiactivities.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/class.uiorganization.inc.php
    
branches/Version-1_0-branch/activitycalendar/inc/model/class.activity.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/setup/setup.inc.php
    branches/Version-1_0-branch/activitycalendar/setup/tables_current.inc.php
    branches/Version-1_0-branch/activitycalendar/setup/tables_update.inc.php
    branches/Version-1_0-branch/activitycalendar/templates/base/activity.php
    
branches/Version-1_0-branch/activitycalendar/templates/base/organization_list_partial.php
    
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
    branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
    branches/Version-1_0-branch/activitycalendarfrontend/setup/setup.inc.php
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    branches/Version-1_0-branch/frontend/js/yahoo/entity.list.js
    branches/Version-1_0-branch/property/inc/class.borequest.inc.php
    branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
    branches/Version-1_0-branch/property/inc/class.uiimport.inc.php
    branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
    
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bilde_bkb
    
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bkb
    
branches/Version-1_0-branch/property/inc/import/default/cvs_import_romdata_bkb
    
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
    branches/Version-1_0-branch/property/js/yahoo/entity.index.js
    branches/Version-1_0-branch/property/setup/phpgw_no.lang
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_current.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/templates/base/config.tpl
    branches/Version-1_0-branch/property/templates/base/request.xsl

Added Paths:
-----------
    branches/Version-1_0-branch/frontend/js/yahoo/entity.view.js
    
branches/Version-1_0-branch/property/inc/import/default/cvs_oppdater_rental_party_bkb

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
   + 
/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

Modified: branches/Version-1_0-branch/activitycalendar/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.menu.inc.php 
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.menu.inc.php 
2011-07-03 19:39:07 UTC (rev 7459)
@@ -38,6 +38,14 @@
                                        'text'  => lang('OrganizationList'),
                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'activitycalendar.uiorganization.index') ),
                            'image'     => array('property', 'location_tenant'),
+                                       'children'      => array(
+                                                               
'changed_organizations' => array
+                                                               (
+                                                                       'text'  
=> lang('changed_org_group'),
+                                                                       'url'   
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'activitycalendar.uiorganization.changed_organizations') ),
+                                                                       'image' 
=> array('property', 'location_tenant')
+                                                               )
+                                                       )
                                )      
                        );
                        

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

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

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

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

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

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

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

Modified: 
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-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/activitycalendar/inc/model/class.group.inc.php  
2011-07-03 19:39:07 UTC (rev 7459)
@@ -11,6 +11,7 @@
                protected $organization_id;
                protected $show_in_portal;
                protected $shortname;
+               protected $change_type;
                
                /**
                 * Constructor.  Takes an optional ID.  If a organization is 
created from outside
@@ -37,6 +38,13 @@
                
                public function get_name() { return $this->name; }
                
+               public function set_change_type($change_type)
+               {
+                       $this->change_type = $change_type;
+               }
+               
+               public function get_change_type() { return $this->change_type; }
+               
                public function set_description($description)
                {
                        $this->description = $description;
@@ -73,7 +81,8 @@
                                'organization_id' => 
$this->get_organization_id(),
                                'shortname' => $this->get_shortname(),
                                'description' => $this->get_description(),
-                               'show_in_portal' => $this->get_show_in_portal()
+                               'show_in_portal' => $this->get_show_in_portal(),
+                               'change_type' => $this->get_change_type()
                        );
                }
                

Modified: 
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-07-03 13:29:48 UTC (rev 7458)
+++ 
branches/Version-1_0-branch/activitycalendar/inc/model/class.organization.inc.php
   2011-07-03 19:39:07 UTC (rev 7459)
@@ -11,6 +11,11 @@
                protected $organization_number;
                protected $show_in_portal;
                protected $district;
+               protected $homepage;
+               protected $email;
+               protected $phone;
+               protected $address;
+               protected $change_type;
                
                /**
                 * Constructor.  Takes an optional ID.  If a organization is 
created from outside
@@ -37,6 +42,41 @@
                
                public function get_name() { return $this->name; }
                
+               public function set_homepage($homepage)
+               {
+                       $this->homepage = $homepage;
+               }
+               
+               public function get_homepage() { return $this->homepage; }
+               
+               public function set_change_type($change_type)
+               {
+                       $this->change_type = $change_type;
+               }
+               
+               public function get_change_type() { return $this->change_type; }
+               
+               public function set_email($email)
+               {
+                       $this->email = $email;
+               }
+               
+               public function get_email() { return $this->email; }
+               
+               public function set_phone($phone)
+               {
+                       $this->phone = $phone;
+               }
+               
+               public function get_phone() { return $this->phone; }
+               
+               public function set_address($address)
+               {
+                       $this->address = $address;
+               }
+               
+               public function get_address() { return $this->address; }
+               
                public function set_description($description)
                {
                        $this->description = $description;
@@ -73,7 +113,12 @@
                                'organization_number' => 
$this->get_organization_number(),
                                'district' => $this->get_district(),
                                'description' => $this->get_description(),
-                               'show_in_portal' => $this->get_show_in_portal()
+                               'homepage'      =>      $this->get_homepage(),
+                               'email' =>      $this->get_email(),
+                               'phone' =>      $this->get_phone(),
+                               'address'       =>      $this->get_address(),
+                               'show_in_portal' => $this->get_show_in_portal(),
+                               'change_type' => $this->get_change_type()
                        );
                }
                

Modified: branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/activitycalendar/setup/phpgw_no.lang    
2011-07-03 19:39:07 UTC (rev 7459)
@@ -379,4 +379,7 @@
 mail_body_state_5      activitycalendar        no      Ditt tips er behandlet, 
men vil ikke bli publisert i kommuneportalen. Mvh %1 kulturkontor
 send_mail      activitycalendar        no      Send e-post
 marked_as      activitycalendar        no      Status
-address_number activitycalendar        no      Nummer
\ No newline at end of file
+address_number activitycalendar        no      Nummer
+changed_organizations_groups   activitycalendar        no      Endrede 
organisasjoner/grupper
+changed_org_group      activitycalendar        no      Endringer
+building       activitycalendar        no      Kommunale bygg
\ No newline at end of file

Modified: branches/Version-1_0-branch/activitycalendar/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/setup/setup.inc.php    
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/activitycalendar/setup/setup.inc.php    
2011-07-03 19:39:07 UTC (rev 7459)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['activitycalendar']['name'] = 'activitycalendar';
-       $setup_info['activitycalendar']['version'] = '0.1.3';
+       $setup_info['activitycalendar']['version'] = '0.1.4';
        $setup_info['activitycalendar']['app_order'] = 60;
        $setup_info['activitycalendar']['enable'] = 1;
        $setup_info['activitycalendar']['app_group']    = 'office';

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

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

Modified: 
branches/Version-1_0-branch/activitycalendar/templates/base/activity.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/templates/base/activity.php    
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/activitycalendar/templates/base/activity.php    
2011-07-03 19:39:07 UTC (rev 7459)
@@ -126,6 +126,36 @@
                                        ?>
                                </dd>
                                <dt>
+                                       <?php 
if($activity->get_internal_arena() || $editable) { ?>
+                                       <label for="arena"><?php echo 
lang('building') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       $current_internal_arena_id = 
$activity->get_internal_arena();
+                                       if ($editable)
+                                       {
+                                               ?>
+                                               <select 
name="internal_arena_id">
+                                                       <option value="0">Ingen 
kommunale bygg valgt</option>
+                                                       <?php
+                                                       foreach($buildings as 
$building_id => $building_name)
+                                                       {
+                                                               echo "<option 
".($current_internal_arena_id == $building_id? 'selected="selected"' : "")." 
value=\"{$building_id}\">".$building_name."</option>";
+                                                       }
+                                                       ?>
+                                               </select>
+                                               <?php
+                                       }
+                                       else
+                                       {
+                                               
if($activity->get_internal_arena()){
+                                                       echo 
activitycalendar_soarena::get_instance()->get_building_name($activity->get_internal_arena());
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
                                        <?php if($activity->get_arena() || 
$editable) { ?>
                                        <label for="arena"><?php echo 
lang('arena') ?></label>
                                        <?php  } ?>

Modified: 
branches/Version-1_0-branch/activitycalendar/templates/base/organization_list_partial.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendar/templates/base/organization_list_partial.php
   2011-07-03 13:29:48 UTC (rev 7458)
+++ 
branches/Version-1_0-branch/activitycalendar/templates/base/organization_list_partial.php
   2011-07-03 19:39:07 UTC (rev 7459)
@@ -81,6 +81,8 @@
 <?php
        if($list_form)
        {
+               if(!$nosearch)
+               {
 ?>
 
 <form id="<?php echo $list_id ?>_form" method="GET">
@@ -93,6 +95,7 @@
        </fieldset>
 </form>
 <?php
+               }
        }
 ?>
 

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2011-07-03 13:29:48 UTC (rev 7458)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2011-07-03 19:39:07 UTC (rev 7459)
@@ -2,9 +2,11 @@
        phpgw::import_class('activitycalendar.uiactivities');
        phpgw::import_class('activitycalendar.soactivity');
        phpgw::import_class('activitycalendar.sogroup');
+       phpgw::import_class('activitycalendar.soarena');
        
        include_class('activitycalendar', 'activity', 'inc/model/');
        include_class('activitycalendar', 'group', 'inc/model/');
+       include_class('activitycalendar', 'organization', 'inc/model/');
 
        class activitycalendarfrontend_uiactivity extends 
activitycalendar_uiactivities
        {
@@ -14,7 +16,8 @@
                        'edit'                  =>      true,
                        'view'                  =>      true,
                        'index'                 =>      true,
-                       'get_organization_groups'       =>      true
+                       'get_organization_groups'       =>      true,
+                       'get_address_search'    => true
                );
                
                /**
@@ -56,6 +59,7 @@
                        $action = phpgw::get_var('action', 'GET');
                        //var_dump($id);
                        $so_activity = 
activitycalendar_soactivity::get_instance();
+                       $so_arena = activitycalendar_soarena::get_instance();
                        //$activity = $so->get_single($id);
                        
                        //var_dump(phpgw::get_var('secret', 'GET'));
@@ -77,7 +81,8 @@
                        $targets = $so_activity->get_targets();
                        $offices = $so_activity->select_district_list();
                        $districts = $so_activity->get_districts();
-                       $arenas = 
activitycalendar_soarena::get_instance()->get(null, null, null, null, null, 
null, null);
+                       $buildings = $so_arena->get_buildings();
+                       $arenas = $so_arena->get(null, null, null, null, null, 
null, null);
                        $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, null, null, 
null, null, null);
                        $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, null);
                        
@@ -101,28 +106,107 @@
                        
                        $g_id = phpgw::get_var('group_id');
                        $o_id = phpgw::get_var('organization_id');
-                       if(isset($g_id) && $g_id > 0)
+                       if(isset($g_id) && is_numeric($g_id) && $g_id > 0)
                        {
-                               $persons = 
activitycalendar_sogroup::get_instance()->get_contacts($g_id);
-                               $desc = 
activitycalendar_sogroup::get_instance()->get_description($g_id);
+                               /*if($g_id == "new_group")
+                               {
+                                       //add new group to internal 
activitycalendar group register
+                               }
+                               else*/ 
+                               //if(is_numeric($g_id) && $g_id > 0)
+                               //{
+                                       $persons = 
activitycalendar_sogroup::get_instance()->get_contacts($g_id);
+                                       $desc = 
activitycalendar_sogroup::get_instance()->get_description($g_id);
+                               //}
                        }
-                       else if(isset($o_id) && $o_id > 0)
+                       else if(isset($o_id))
                        {
-                               $persons = 
activitycalendar_soorganization::get_instance()->get_contacts($o_id);
-                               $desc = 
activitycalendar_soorganization::get_instance()->get_description($o_id);
+                               if($o_id == "new_org")
+                               {
+                                       //add new organization to internal 
activitycalendar organization register
+                                       $org_info['name'] = 
phpgw::get_var('orgname');
+                                       $org_info['orgnr'] = 
phpgw::get_var('orgno');
+                                       $org_info['homepage'] = 
phpgw::get_var('homepage');
+                                       $org_info['phone'] = 
phpgw::get_var('phone');
+                                       $org_info['email'] = 
phpgw::get_var('email');
+                                       $org_info['description'] = 
phpgw::get_var('org_description');
+                                       $org_info['street'] = 
phpgw::get_var('address') . ' ' . phpgw::get_var('number') . ', ' . 
phpgw::get_var('postaddress');
+                                       //$org_info['zip'] = 
phpgw::get_var('postaddress');
+                                       $org_info['district'] = 
phpgw::get_var('org_district'); 
+                                       $o_id = 
$so_activity->add_organization_local($org_info);
+                                       
+                                       //add contact persons
+                                       $contact1 = array();
+                                       $contact1['name'] = 
phpgw::get_var('contact1_name');
+                                       $contact1['phone'] = 
phpgw::get_var('contact1_phone');
+                                       $contact1['mail'] = 
phpgw::get_var('contact1_email');
+                                       $contact1['org_id'] = $o_id;
+                                       $contact1['group_id'] = 0;
+                                       
$so_activity->add_contact_person_local($contact1);
+                                       
+                                       $contact2 = array();
+                                       $contact2['name'] = 
phpgw::get_var('contact2_name');
+                                       $contact2['phone'] = 
phpgw::get_var('contact2_phone');
+                                       $contact2['mail'] = 
phpgw::get_var('contact2_email');
+                                       $contact2['org_id'] = $o_id;
+                                       $contact2['group_id'] = 0;
+                                       
$so_activity->add_contact_person_local($contact2);
+                                       
+                                       $persons = 
activitycalendar_soorganization::get_instance()->get_contacts_local($o_id);
+                                       $desc = 
phpgw::get_var('org_description');
+
+                               }
+                               else if(is_numeric($o_id) && $o_id > 0)
+                               {
+                                       if(isset($g_id) && $g_id == "new_group")
+                                       {
+                                               $group_info['name'] = 
phpgw::get_var('groupname');
+                                               $group_info['organization_id'] 
= $o_id;
+                                               $group_info['description'] = 
phpgw::get_var('group_description');
+                                               $g_id = 
$so_activity->add_group_local($group_info);
+                                               
+                                               //add contact persons
+                                               $contact1 = array();
+                                               $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'] = $g_id;
+                                               
$so_activity->add_contact_person_local($contact1);
+                                               
+                                               $contact2 = array();
+                                               $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'] = $g_id;
+                                               
$so_activity->add_contact_person_local($contact2);
+                                               
+                                               $activity_persons = 
activitycalendar_sogroup::get_instance()->get_contacts_local($g_id);
+                                               $desc = 
phpgw::get_var('group_description');
+                                       }
+                                       else
+                                       {
+                                               $persons = 
activitycalendar_soorganization::get_instance()->get_contacts($o_id);
+                                               $desc = 
activitycalendar_soorganization::get_instance()->get_description($o_id);
+                                       }
+                               }
                        }
                        
                        if(isset($_POST['save_activity'])) // The user has 
pressed the save button
                        {
                                if(isset($activity)) // If an activity object 
is created
                                {
+                                       var_dump("lagre1");
                                        $old_state = $activity->get_state();
                                        $new_state = phpgw::get_var('state');
-       
+       var_dump("lagre2");
                                        // ... set all parameters
                                        
$activity->set_title(phpgw::get_var('title'));
-                                       
$activity->set_organization_id(phpgw::get_var('organization_id'));
-                                       
$activity->set_group_id(phpgw::get_var('group_id'));
+                                       
//$activity->set_organization_id(phpgw::get_var('organization_id'));
+                                       
//$activity->set_group_id(phpgw::get_var('group_id'));
+                                       $activity->set_organization_id($o_id);
+                                       $activity->set_group_id($g_id);
                                        
$activity->set_arena(phpgw::get_var('arena_id'));
                                        $district_array = 
phpgw::get_var('district');
                                        $activity->set_district(implode(",", 
$district_array));
@@ -130,12 +214,13 @@
                                        if($action == 'new_activity')
                                        {
                                                $activity->set_state(1);
-                                               //$new_state=1;
+                                               $new_state=1;
                                        }
                                        else
                                        {
                                                
$activity->set_state($new_state);
                                        }
+                                       var_dump("lagre3");
                                        
$activity->set_category(phpgw::get_var('category'));
                                        $target_array = 
phpgw::get_var('target');
                                        $activity->set_target(implode(",", 
$target_array));
@@ -144,6 +229,8 @@
                                        
$activity->set_contact_persons($persons);
                                        
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
                                        
+                                       var_dump("storing"); 
+                                       
                                        if($so_activity->store($activity)) // 
... and then try to store the object
                                        {
                                                $message = 
lang('messages_saved_form'); 
@@ -179,6 +266,7 @@
                                                        'organizations' => 
$organizations,
                                                        'groups' => $groups,
                                                        'arenas' => $arenas,
+                                                       'buildings' => 
$buildings,
                                                        'categories' => 
$categories,
                                                        'targets' => $targets,
                                                        'districts' => 
$districts,
@@ -207,6 +295,7 @@
                        $returnHTML = "<option value='0'>Ingen gruppe 
valgt</option>";
                        if($org_id)
                        {
+                               $group_html[] = "<option value='new_group'>Ny 
gruppe</option>";
                                $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, array('org_id' => $org_id));
                                foreach ($groups as $group) {
                                        if(isset($group))
@@ -232,4 +321,14 @@
                        return $returnHTML;
                        //return "<option>Ingen gruppe valgt</option>";
                }
+               
+               /**
+                * Public method.
+                */
+               public function get_address_search()
+               {
+                       $search_string = phpgw::get_var('search');
+                       //var_dump($search_string);
+                       return 
activitycalendar_soarena::get_instance()->get_address($search_string);
+               }
        }

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang    
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang    
2011-07-03 19:39:07 UTC (rev 7459)
@@ -52,4 +52,10 @@
 group  activitycalendarfrontend        no      Gruppe
 district       activitycalendarfrontend        no      Bydel
 title  activitycalendarfrontend        no      Tittel
-activity_helptext      activitycalendarfrontend        no      Før ny 
aktivitet kan registreres må du sjekke at organisasjon/gruppe finnes og er 
oppdatert, og at arena finnes og er oppdatert.
\ No newline at end of file
+activity_helptext      activitycalendarfrontend        no      Før ny 
aktivitet kan registreres må du sjekke at organisasjon/gruppe finnes og er 
oppdatert, og at arena finnes og er oppdatert.
+building       activitycalendarfrontend        no      Kommunale bygg
+title_helptext activitycalendarfrontend        no      Skriv inn tittel på 
aktiviteten slik du vil den skal vises i kommuneportalen
+org_helptext   activitycalendarfrontend        no      Velg organisasjon 
aktiviteten skal knyttes til. <br/>Dersom din organisasjon ikke finnes, velg 
"Ny organisasjon" og fyll ut feltene som vises under.
+group_helptext activitycalendarfrontend        no      Velg gruppe/lag 
aktiviteten skal knyttes til. <br/>Dersom gruppen/laget ikke finnes, velg "Ny 
gruppe" og fyll ut feltene som vises under.
+int_arena_helptext     activitycalendarfrontend        no      Dersom 
aktiviteten skal finne sted i et kommunalt bygg velges dette fra listen her.
+arena_helptext activitycalendarfrontend        no      Dersom aktiviteten skal 
finne sted på en ikke-kommunal arena, velges dette her.<br/>Dersom aktiviteten 
finner sted på flere arenaer, velg hovedarena her.
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendarfrontend/setup/setup.inc.php    
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/activitycalendarfrontend/setup/setup.inc.php    
2011-07-03 19:39:07 UTC (rev 7459)
@@ -31,7 +31,7 @@
        
        $setup_info['activitycalendarfrontend']['depends'][] = array(
                'appname' => 'activitycalendar',
-               'versions' => Array('0.1.3')
+               'versions' => Array('0.1.3','0.1.4')
        );
 
        /* The hooks this app includes, needed for hooks registration */

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    2011-07-03 13:29:48 UTC (rev 7458)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity.php
    2011-07-03 19:39:07 UTC (rev 7459)
@@ -18,12 +18,64 @@
        url = 
"index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&amp;phpgw_return_as=json&amp;orgid="
 + org_id;
 <?php }?>
 
-var divcontent_start = "<select name=\"group_id\" id=\"group_id\">";
+       if(org_id != null && org_id == 'new_org')
+       {
+               //alert('new_org');
+               document.getElementById('new_org_group').style.display = 
"block";
+               document.getElementById('new_org_fields').style.display = 
"block";
+       }
+       else
+       {
+               document.getElementById('new_org_group').style.display = "none";
+               document.getElementById('new_org_fields').style.display = 
"none";
+               var divcontent_start = "<select name=\"group_id\" 
id=\"group_id\" onchange=\"javascript:checkNewGroup()\">";
+               var divcontent_end = "</select>";
+               
+               var callback = {
+                       success: function(response){
+                                               div_select.innerHTML = 
divcontent_start + JSON.parse(response.responseText) + divcontent_end; 
+                                       },
+                       failure: function(o) {
+                                                alert("AJAX doesn't work"); 
//FAILURE
+                                        }
+               }
+               var trans = YAHOO.util.Connect.asyncRequest('GET', url, 
callback, null);
+       }
+}
+
+YAHOO.util.Event.onDOMReady(function()
+{
+       get_available_groups();
+});
+
+function checkNewGroup()
+{
+       var group_selected = document.getElementById('group_id').value;
+       if(group_selected == 'new_group')
+       {
+               document.getElementById('new_org_group').style.display = 
"block";
+               document.getElementById('new_group_fields').style.display = 
"block";
+       }
+       else
+       {
+               document.getElementById('new_org_group').style.display = "none";
+               document.getElementById('new_group_fields').style.display = 
"none";
+       }
+}
+
+function get_address_search()
+{
+       var address = document.getElementById('address_txt').value;
+       var div_address = document.getElementById('address_container');
+
+       url = 
"index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
+
+var divcontent_start = "<select name=\"address\" id=\"address\" size\"5\">";
 var divcontent_end = "</select>";
        
        var callback = {
                success: function(response){
-                                       div_select.innerHTML = divcontent_start 
+ JSON.parse(response.responseText) + divcontent_end; 
+                                       div_address.innerHTML = 
divcontent_start + JSON.parse(response.responseText) + divcontent_end; 
                                },
                failure: function(o) {
                                         alert("AJAX doesn't work"); //FAILURE
@@ -33,17 +85,33 @@
        
 }
 
-YAHOO.util.Event.onDOMReady(function()
+function get_address_search_cp2()
 {
-       get_available_groups();
-});
+       var address = document.getElementById('contact2_address_txt').value;
+       var div_address = document.getElementById('contact2_address_container');
 
+       url = 
"index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search="
 + address;
+
+var divcontent_start = "<select name=\"contact2_address\" id=\"address_cp2\" 
size\"5\">";
+var divcontent_end = "</select>";
+       
+       var callback = {
+               success: function(response){
+                                       div_address.innerHTML = 
divcontent_start + JSON.parse(response.responseText) + divcontent_end; 
+                               },
+               failure: function(o) {
+                                        alert("AJAX doesn't work"); //FAILURE
+                                }
+       }
+       var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
+       
+}
+
 </script>
 
 <div class="yui-content">
        <div id="details">
                <h1><?php echo lang('activity') ?></h1>
-               <h4><?php if($editable){echo lang('activity_helptext');}?></h4>
                <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">
@@ -57,6 +125,7 @@
                                        if ($editable)
                                        {
                                        ?>
+                                               <?php echo 
lang('title_helptext')?><br/>
                                                <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" />
                                        <?php
                                        }
@@ -77,8 +146,10 @@
                                        if ($editable)
                                        {
                                                ?>
+                                               <?php echo 
lang('org_helptext')?><br/>
                                                <select name="organization_id" 
id="organization_id" onchange="javascript:get_available_groups();">
                                                        <option value="">Ingen 
organisasjon valgt</option>
+                                                       <option 
value="new_org">Ny organisasjon</option>
                                                        <?php
                                                        foreach($organizations 
as $organization)
                                                        {
@@ -109,6 +180,7 @@
                                        if ($editable)
                                        {
                                                ?>
+                                               <?php echo 
lang('group_helptext')?><br/>
                                                <div id="group_select">
                                                        <select name="group_id" 
id="group_id">
                                                                <option 
value="0">Ingen gruppe valgt</option>
@@ -126,7 +198,103 @@
                                        }
                                        ?>
                                </dd>
+                               <div id="new_org_group" style="display: none;">
+                                       <hr/>
+                                       <div id="new_org_fields" 
style="display: none;">
+                                               <label 
for="orgname">Organisasjonsnavn</label>
+                                               <input type="text" 
name="orgname"/><br/>
+                                               <label 
for="orgno">Organisasjonsnummer</label>
+                                               <input type="text" 
name="orgno"/><br/>
+                                               <label 
for="district">Bydel</label>
+                                                       <select 
name="org_district">
+                                                               <option 
value="0">Ingen distrikt valgt</option>
+                                               <?php 
+                                               foreach($districts as $d)
+                                               {
+                                               ?>
+                                                       <option value="<?php 
echo $d['part_of_town_id']?>"><?php echo $d['name']?></option>
+                                               <?php
+                                               }?>
+                                                       </select>
+                                               <label 
for="homepage">Hjemmeside</label>
+                                               <input type="text" 
name="homepage"/><br/>
+                                               <label 
for="email">E-post</label>
+                                               <input type="text" 
name="email"/><br/>
+                                               <label 
for="phone">Telefon</label>
+                                               <input type="text" 
name="phone"/><br/>
+                                               <label for="street">Gate</label>
+                                               <input type="text" 
name="address_txt" id="address_txt" onkeyup="javascript:get_address_search()"/>
+                                               <div 
id="address_container"></div><br/>
+                                               <label 
for="number">Nummer</label>
+                                               <input type="text" 
name="number"/><br/>
+                                               <label 
for="postaddress">Postnummer / Sted</label>
+                                               <input type="text" 
name="postaddress"/>
+                                               <label 
for="org_description">Beskrivelse</label>
+                                               <textarea rows="10" cols="100" 
name="org_description"></textarea>
+                                       </div>
+                                       <hr/>
+                                       <div id="new_group_fields" 
style="display: none;">
+                                               <label 
for="groupname">Gruppenavn</label>
+                                               <input type="text" 
name="groupname"/><br/>
+                                               <label 
for="group_description">Beskrivelse</label>
+                                               <textarea rows="10" cols="100" 
name="group_description"></textarea>
+                                       </div>
+                                       <hr/>
+                                       <b>Kontaktperson 1</b><br/>
+                                       <label for="contact1_name">Navn</label>
+                                       <input type="text" 
name="contact1_name"/><br/>
+                                       <label 
for="contact1_phone">Telefon</label>
+                                       <input type="text" 
name="contact1_phone"/><br/>
+                                       <label 
for="contact1_mail">E-post</label>
+                                       <input type="text" 
name="contact1_mail"/><br/>
+                                       <b>Kontaktperson 2</b><br/>
+                                       <label for="contact2_name">Navn</label>
+                                       <input type="text" 
name="contact2_name"/><br/>
+                                       <label 
for="contact2_phone">Telefon</label>
+                                       <input type="text" 
name="contact2_phone"/><br/>
+                                       <label 
for="contact2_mail">E-post</label>
+                                       <input type="text" 
name="contact2_mail"/><br/>
+                                       <label 
for="contact2_address">Adresse</label>
+                                       <input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
+                                       <div 
id="contact2_address_container"></div><br/>
+                                       <label 
for="contact2_number">Nummer</label>
+                                       <input type="text" 
name="contact2_number"/><br/>
+                                       <label 
for="contact2_postaddress">Postnummer / Sted</label>
+                                       <input type="text" 
name="contact2_postaddress"/>
+                                       <hr/>
+                               </div>
                                <dt>
+                                       <?php 
if($activity->get_internal_arena() || $editable) { ?>
+                                       <label for="arena"><?php echo 
lang('building') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       $current_internal_arena_id = 
$activity->get_internal_arena();
+                                       if ($editable)
+                                       {
+                                               ?>
+                                               <?php echo 
lang('int_arena_helptext')?><br/>
+                                               <select 
name="internal_arena_id">
+                                                       <option value="0">Ingen 
kommunale bygg valgt</option>
+                                                       <?php
+                                                       foreach($buildings as 
$building_id => $building_name)
+                                                       {
+                                                               echo "<option 
".($current_internal_arena_id == $building_id? 'selected="selected"' : "")." 
value=\"{$building_id}\">".$building_name."</option>";
+                                                       }
+                                                       ?>
+                                               </select>
+                                               <?php
+                                       }
+                                       else
+                                       {
+                                               if($activity->get_arena()){
+                                                       echo 
activitycalendar_soarena::get_instance()->get_building_name($activity->get_internal_arena());
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
                                        <?php if($activity->get_arena() || 
$editable) { ?>
                                        <label for="arena"><?php echo 
lang('arena') ?></label>
                                        <?php  } ?>
@@ -137,6 +305,7 @@
                                        if ($editable)
                                        {
                                                ?>
+                                               <?php echo 
lang('arena_helptext')?><br/>
                                                <select name="arena_id">
                                                        <option value="0">Ingen 
arena valgt</option>
                                                        <?php

Modified: branches/Version-1_0-branch/frontend/js/yahoo/entity.list.js
===================================================================
--- branches/Version-1_0-branch/frontend/js/yahoo/entity.list.js        
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/frontend/js/yahoo/entity.list.js        
2011-07-03 19:39:07 UTC (rev 7459)
@@ -45,42 +45,7 @@
        {
                if(flag_particular_setting=='init')
                {
-                       //category
-/*
-                       index = 
locate_in_array_options(0,"value",path_values.cat_id);
-                       if(index)
-                       {
-                               oMenuButton_0.set("label", ("<em>" + 
array_options[0][index][1] + "</em>"));
-                       }
-*/
-                       //district
-                       index = 
locate_in_array_options(1,"value",path_values.district_id);
-                       if(index)
-                       {
-                               oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
-                       }
 
-                       //status
-                       index = 
locate_in_array_options(2,"value",path_values.status);
-                       if(index)
-                       {
-                               oMenuButton_2.set("label", ("<em>" + 
array_options[2][index][1] + "</em>"));
-                       }
-
-                       //filter
-                       index = 
locate_in_array_options(3,"value",path_values.filter);
-                       if(index)
-                       {
-                               oMenuButton_3.set("label", ("<em>" + 
array_options[3][index][1] + "</em>"));
-                       }
-
-                       //district
-                       index = 
locate_in_array_options(4,"value",path_values.criteria_id);
-                       if(index)
-                       {
-                               oMenuButton_4.set("label", ("<em>" + 
array_options[4][index][1] + "</em>"));
-                       }
-
                        //eliminate "no category" option because is necesary 
have a category in the  PHP query
        //              delete oMenuButton_0.getMenu().itemData[0];
                        //correcting it. now look for value 

Copied: branches/Version-1_0-branch/frontend/js/yahoo/entity.view.js (from rev 
7458, trunk/frontend/js/yahoo/entity.view.js)
===================================================================
--- branches/Version-1_0-branch/frontend/js/yahoo/entity.view.js                
                (rev 0)
+++ branches/Version-1_0-branch/frontend/js/yahoo/entity.view.js        
2011-07-03 19:39:07 UTC (rev 7459)
@@ -0,0 +1,41 @@
+var  myDataSource, myDataTable, myContextMenu;
+var  myPaginator_0, myDataTable_0
+
+
+/********************************************************************************/
+var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+{
+       elCell.innerHTML = "<center>"+oData+"</center>";
+}
+
+/********************************************************************************/
+
+       this.myParticularRenderEvent = function()
+       {
+       }
+
+
+       var show_picture = function(elCell, oRecord, oColumn, oData)
+       {
+               if(oRecord.getData('img_id'))
+               {
+                       var oArgs = {menuaction:'property.uigallery.view_file', 
file:oRecord.getData('directory') + '/' + oRecord.getData('file_name')};
+                       var sUrl = phpGWLink('index.php', oArgs);
+                       elCell.innerHTML =  "<a href=\""+sUrl+"\" 
title=\""+oRecord.getData('file_name')+"\" id=\""+oRecord.getData('img_id')+"\" 
rel=\"colorbox\" target=\"_blank\"><img src=\""+sUrl+"&thumb=1\" 
alt=\""+oRecord.getData('file_name')+"\" /></a>";
+               }
+       }
+
+
+YAHOO.util.Event.addListener(window, "load", function()
+               {
+                       var loader = new YAHOO.util.YUILoader();
+                       loader.addModule({
+                               name: "anyone",
+                               type: "js",
+                           fullpath: property_js
+                           });
+
+                       loader.require("anyone");
+                   loader.insert();
+               });
+

Modified: branches/Version-1_0-branch/property/inc/class.borequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.borequest.inc.php    
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/inc/class.borequest.inc.php    
2011-07-03 19:39:07 UTC (rev 7459)
@@ -239,17 +239,52 @@
                                $conditions = 
$this->so->select_conditions($request_id,$condition_type_list);
                        }
 
-                       for ($i=0;$i<count($condition_type_list);$i++)
+                       $config = CreateObject('phpgwapi.config','property');
+                       $config->read();
+                       $disallow_multiple_condition_types = isset( 
$config->config_data['disallow_multiple_condition_types']) &&  
$config->config_data['disallow_multiple_condition_types'] ? 
(int)$config->config_data['disallow_multiple_condition_types'] : 0;
+
+                       if( !$disallow_multiple_condition_types )
                        {
-                               $values[$i]['degree']                           
= array('options' => $this->select_degree_list($conditions[$i]['degree']));
-                               $values[$i]['probability']                      
= array('options' => 
$this->select_probability_list($conditions[$i]['probability']));
-                               $values[$i]['consequence']                      
= array('options' => 
$this->select_consequence_list($conditions[$i]['consequence']));
-                               $values[$i]['condition_type']           = 
$condition_type_list[$i]['id'];
-                               $values[$i]['condition_type_name']      = 
$condition_type_list[$i]['name'];
-                               $values[$i]['weight']                           
= $condition_type_list[$i]['weight'];
-                               $values[$i]['risk']                             
        = (int)$condition_type_list[$i]['weight'] * 
(int)$conditions[$i]['probability'] * (int)$conditions[$i]['consequence'];
-                               $values[$i]['score']                            
= $values[$i]['risk'] * (int)$conditions[$i]['degree'];
+                               foreach($condition_type_list as $condition_type)
+                               {
+                                       $i = $condition_type['id'];
+                                       $values[] = array
+                                       (
+                                               'degree'                        
        => array('options' => 
$this->select_degree_list($conditions[$i]['degree'])),
+                                               'probability'                   
=> array('options' => 
$this->select_probability_list($conditions[$i]['probability'])),
+                                               'consequence'                   
=> array('options' => 
$this->select_consequence_list($conditions[$i]['consequence'])),
+                                               'condition_type'                
=> $condition_type_list[$i]['id'],
+                                               'condition_type_name'   => 
$condition_type_list[$i]['name'],
+                                               'weight'                        
        => $condition_type_list[$i]['weight'],
+                                               'risk'                          
        => (int)$condition_type_list[$i]['weight'] * 
(int)$conditions[$i]['probability'] * (int)$conditions[$i]['consequence'],
+                                               'score'                         
        => $values[$i]['risk'] * (int)$conditions[$i]['degree']
+                                       );
+                               }
                        }
+                       else
+                       {
+                               $i = 0;
+                               foreach($conditions as $condition_type => 
$condition)
+                               {
+                                       if($condition['condition_type'])
+                                       {
+                                               $i = 
$condition['condition_type'];
+                                               break;
+                                       }
+                               }
+                               $values[] = array
+                               (
+                                       'condition_type_list'   => 
array('options' => $this->bocommon->select_list($i, $condition_type_list)),
+                                       'degree'                                
=> array('options' => $this->select_degree_list($conditions[$i]['degree'])),
+                                       'probability'                   => 
array('options' => 
$this->select_probability_list($conditions[$i]['probability'])),
+                                       'consequence'                   => 
array('options' => 
$this->select_consequence_list($conditions[$i]['consequence'])),
+                                       'condition_type'                => 
$condition_type_list[$i]['id'],
+                                       'condition_type_name'   => 
$condition_type_list[$i]['name'],
+                                       'weight'                                
=> $condition_type_list[$i]['weight'],
+                                       'risk'                                  
=> (int)$condition_type_list[$i]['weight'] * 
(int)$conditions[$i]['probability'] * (int)$conditions[$i]['consequence'],
+                                       'score'                                 
=> $values[$i]['risk'] * (int)$conditions[$i]['degree']
+                               );
+                       }
 
                        return $values;
                }
@@ -387,6 +422,17 @@
                                $values['location_data'] 
=$this->solocation->read_single($values['location_code']);
                        }
 
+                       if(isset($values['planning']) && $values['planning'])
+                       {
+                               foreach ($values['planning'] as &$planning)
+                               {
+                                       $planning['date'] = 
$GLOBALS['phpgw']->common->show_date($planning['date'],'Y');
+                               }
+                       }
+                       else
+                       {
+                               $values['planning'] = array();
+                       }
                        if(isset($values['consume']) && $values['consume'])
                        {
                                foreach ($values['consume'] as &$consume)
@@ -535,6 +581,7 @@
                        $request['location_code']       = implode("-", 
$location);
                        $request['start_date']          = 
phpgwapi_datetime::date_to_timestamp($request['start_date']);
                        $request['end_date']            = 
phpgwapi_datetime::date_to_timestamp($request['end_date']);
+                       $request['planning_date']       = 
phpgwapi_datetime::date_to_timestamp($request['planning_date']);
                        $request['consume_date']        = 
phpgwapi_datetime::date_to_timestamp($request['consume_date']);
 
                        if(is_array($values_attribute))

Modified: branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2011-07-03 19:39:07 UTC (rev 7459)
@@ -143,35 +143,44 @@
 
                function select_condition_type_list()
                {
-                       $this->db->query("SELECT id, descr, priority_key FROM 
fm_request_condition_type ORDER BY id ");
+                       $this->db->query("SELECT id, descr, priority_key FROM 
fm_request_condition_type ORDER BY id",__LINE__,__FILE__);
 
                        $values = array();
                        while ($this->db->next_record())
                        {
-                               $values[] = array
+                               $id = $this->db->f('id');
+                               $values[$id] = array
                                (
-                                       'id'            => $this->db->f('id'),
+                                       'id'            => $id,
                                        'name'          => 
$this->db->f('descr',true),
-                                       'weight'        => 
$this->db->f('priority_key'),                                        
+                                       'weight'        => 
$this->db->f('priority_key')                                 
                                );
                        }
                        return $values;
                }
 
-               function 
select_conditions($request_id='',$condition_type_list='')
+               function select_conditions($request_id, $condition_type_list = 
array())
                {
-                       $conditions = array();
-                       for ($i=0;$i<count($condition_type_list);$i++)
+                       $request_id = (int)$request_id;
+                       $values = array();
+                       foreach($condition_type_list as $condition_type)
                        {
-                               $this->db->query("SELECT 
degree,probability,consequence FROM fm_request_condition WHERE 
request_id=$request_id AND condition_type =" . 
(int)$condition_type_list[$i]['id']);
+                               $i = (int)$condition_type['id'];
+                               $this->db->query("SELECT * FROM 
fm_request_condition WHERE request_id={$request_id} AND condition_type = 
{$i}",__LINE__,__FILE__);
+
                                $this->db->next_record();
-                               $conditions[$i]['request_id']           = 
$request_id;
-                               $conditions[$i]['degree']                       
= $this->db->f('degree');
-                               $conditions[$i]['probability']          = 
$this->db->f('probability');
-                               $conditions[$i]['consequence']          = 
$this->db->f('consequence');
+
+                               $values[$i] = array
+                               (
+                                       'request_id'            => $request_id,
+                                       'condition_type'        => 
$this->db->f('condition_type'),
+                                       'degree'                        => 
$this->db->f('degree'),
+                                       'probability'           => 
$this->db->f('probability'),
+                                       'consequence'           => 
$this->db->f('consequence')
+                               );
                        }
 
-                       return $conditions;
+                       return $values;
                }
 
 
@@ -492,6 +501,21 @@
                                $location_code = $this->db->f('location_code');
                                $request['power_meter']         = 
$this->soproject->get_power_meter($location_code);
 
+                               $sql = "SELECT * FROM fm_request_planning WHERE 
request_id={$request_id} ORDER BY date ASC";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               while($this->db->next_record())
+                               {
+                                       $request['planning'][] = array
+                                       (
+                                               'id'                    => 
$this->db->f('id'),
+                                               'amount'                => 
$this->db->f('amount'),
+                                               'date'                  => 
$this->db->f('date'),
+                                               'user_id'               => 
$this->db->f('user_id'),
+                                               'entry_date'    => 
$this->db->f('entry_date'),
+                                               'descr'                 => 
$this->db->f('descr',true)
+                                       );
+                               }
+
                                $sql = "SELECT * FROM fm_request_consume WHERE 
request_id={$request_id} ORDER BY date ASC";
                                $this->db->query($sql,__LINE__,__FILE__);
                                while($this->db->next_record())
@@ -616,22 +640,25 @@
 
                        $this->db->query("INSERT INTO fm_request ({$cols}) 
VALUES ({$values})",__LINE__,__FILE__);
 
-                       while (is_array($request['condition']) && 
list($condition_type,$value_type) = each($request['condition']))
+                       if(isset($request['condition']) && 
is_array($request['condition']))
                        {
-                               $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
-                                       . "VALUES ('"
-                                       . $id. "','"
-                                       . $condition_type . "',"
-                                       . $value_type['degree']. ","
-                                       . $value_type['probability']. ","
-                                       . $value_type['consequence']. ","
-                                       . $this->account . ","
-                                       . time() . ")",__LINE__,__FILE__);
+                               foreach( $request['condition'] as 
$condition_type => $value_type )
+                               {
+                                       $_condition_type = 
isset($value_type['condition_type']) && $value_type['condition_type'] ? 
$value_type['condition_type'] : $condition_type;
+                                       $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                                               . "VALUES ('"
+                                               . $request['id']. "','"
+                                               . $_condition_type . "',"
+                                               . $value_type['degree']. ","
+                                               . $value_type['probability']. 
","
+                                               . $value_type['consequence']. 
","
+                                               . $this->account . ","
+                                               . time() . 
")",__LINE__,__FILE__);
+                               }
                        }
 
                        $this->update_score($id);
 
-
                        if($request['extra']['contact_phone'] && 
$request['extra']['tenant_id'])
                        {
                                $this->db->query("update fm_tenant set 
contact_phone='". $request['extra']['contact_phone']. "' where id='". 
$request['extra']['tenant_id']. "'",__LINE__,__FILE__);
@@ -680,6 +707,17 @@
                                $this->db->query("UPDATE fm_request SET 
$value_set WHERE id= '{$id}'",__LINE__,__FILE__);
                        }
 
+                       if($request['planning_value'] && 
$request['planning_date'])
+                       {
+                               $this->db->query("INSERT INTO 
fm_request_planning (request_id,amount,date,user_id,entry_date) "
+                                       . "VALUES ('"
+                                       . $id . "','"
+                                       . (int)$request['planning_value'] . "',"
+                                       . (int)$request['planning_date']. ","
+                                       . $this->account . ","
+                                       . time() . ")",__LINE__,__FILE__);
+                       }
+
                        if($request['consume_value'] && 
$request['consume_date'])
                        {
                                $this->db->query("INSERT INTO 
fm_request_consume (request_id,amount,date,user_id,entry_date) "
@@ -791,17 +829,21 @@
                        $this->db->query("UPDATE fm_request SET $value_set 
WHERE id= '{$request['id']}'",__LINE__,__FILE__);
 
                        $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id='{$request['id']}'",__LINE__,__FILE__);
-                       while (is_array($request['condition']) && 
list($condition_type,$value_type) = each($request['condition']))
+                       if(isset($request['condition']) && 
is_array($request['condition']))
                        {
-                               $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
-                                       . "VALUES ('"
-                                       . $request['id']. "','"
-                                       . $condition_type . "',"
-                                       . $value_type['degree']. ","
-                                       . $value_type['probability']. ","
-                                       . $value_type['consequence']. ","
-                                       . $this->account . ","
-                                       . time() . ")",__LINE__,__FILE__);
+                               foreach( $request['condition'] as 
$condition_type => $value_type )
+                               {
+                                       $_condition_type = 
isset($value_type['condition_type']) && $value_type['condition_type'] ? 
$value_type['condition_type'] : $condition_type;
+                                       $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "
+                                               . "VALUES ('"
+                                               . $request['id']. "','"
+                                               . $_condition_type . "',"
+                                               . $value_type['degree']. ","
+                                                       . 
$value_type['probability']. ","
+                                               . $value_type['consequence']. 
","
+                                               . $this->account . ","
+                                               . time() . 
")",__LINE__,__FILE__);
+                               }
                        }
 
                        $this->update_score($request['id']);
@@ -816,6 +858,25 @@
                                
$this->soproject->update_power_meter($request['power_meter'],$request['location_code'],$address);
                        }
 
+                       if($request['planning_value'] && 
$request['planning_date'])
+                       {
+                               $this->db->query("INSERT INTO 
fm_request_planning (request_id,amount,date,user_id,entry_date) "
+                                       . "VALUES ('"
+                                       . $request['id']. "','"
+                                       . (int)$request['planning_value'] . "',"
+                                       . (int)$request['planning_date']. ","
+                                       . $this->account . ","
+                                       . time() . ")",__LINE__,__FILE__);
+                       }
+
+                       if(isset($request['delete_planning']) && 
is_array($request['delete_planning']))
+                       {
+                               foreach ($request['delete_planning'] as 
$delete_planning)
+                               {
+                                       $this->db->query("DELETE FROM 
fm_request_planning WHERE id =" . (int)$delete_planning,__LINE__,__FILE__);     
                          
+                               }
+                       }
+
                        if($request['consume_value'] && 
$request['consume_date'])
                        {
                                $this->db->query("INSERT INTO 
fm_request_consume (request_id,amount,date,user_id,entry_date) "
@@ -865,6 +926,7 @@
                {
                        $request_id = (int) $request_id;
                        $this->db->transaction_begin();
+                       $this->db->query("DELETE FROM fm_request_planning WHERE 
request_id = {$request_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_request_consume WHERE 
request_id = {$request_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id = {$request_id}",__LINE__,__FILE__);
                        $this->db->query("DELETE FROM fm_request_history  WHERE 
 history_record_id = {$request_id}",__LINE__,__FILE__);

Modified: branches/Version-1_0-branch/property/inc/class.uiimport.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiimport.inc.php     
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/inc/class.uiimport.inc.php     
2011-07-03 19:39:07 UTC (rev 7459)
@@ -22,6 +22,9 @@
                protected $account;
                protected $conv_type;
                protected $import_conversion;
+               protected $steps = 0;
+               protected $fields = array();
+               protected $table;
                
                // Label on the import button. Changes as we step through the 
import process.
                protected $import_button_label;
@@ -41,6 +44,7 @@
 //                     $GLOBALS['phpgw']->common->phpgw_header(true);
                        $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->db           = & $GLOBALS['phpgw']->db;
+                       $this->table            = phpgw::get_var('table');
                }
                
 
@@ -57,29 +61,20 @@
                        // If the parameter 'importsubmit' exist (submit button 
in import form), set path
                        if (phpgw::get_var("importsubmit")) 
                        {
-                               // Get the path for user input or use a default 
path
-                               
-                               if($this->file = $_FILES['file']['tmp_name'])
+                               if($GLOBALS['phpgw']->session->is_repost() && 
!phpgw::get_var('debug', 'bool'))
                                {
-                                       $this->csvdata = 
$this->getcsvdata($this->file);
+                                       phpgwapi_cache::session_set('property', 
'import_message', 'Hmm... looks like a repost!');
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction'=>'property.uiimport.index'));
                                }
 
+                               phpgwapi_cache::session_set('property', 
'import_settings', $_POST);
+
                                $this->conv_type        = 
phpgw::get_var('conv_type');
-//_debug_array($this->csvdata);
-                               phpgwapi_cache::session_set('property', 'file', 
$this->file);
-                               phpgwapi_cache::session_set('property', 
'csvdata', $this->csvdata);
-                               phpgwapi_cache::session_set('property', 
'conv_type', $this->conv_type);
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uiimport.index', 'importstep' => 'true'));
-                       } 
-                       else if(phpgw::get_var("importstep"))
-                       {
+
                                $start_time = time(); // Start time of import
                                $start = date("G:i:s",$start_time);
                                echo "<h3>Import started at: {$start}</h3>";
                                echo "<ul>";
-                               $this->file = 
phpgwapi_cache::session_get('property', 'file');
-                               $this->csvdata = 
phpgwapi_cache::session_get('property', 'csvdata');
-                               $this->conv_type = 
phpgwapi_cache::session_get('property', 'conv_type');
 
                                if($this->conv_type)
                                {
@@ -92,31 +87,71 @@
        
                                        if ( is_file($file) )
                                        {
-//_debug_Array($file);die();
                                                require_once $file;
                                                $this->import_conversion = new 
import_conversion;
+                                               $this->import_conversion->debug 
= phpgw::get_var('debug', 'bool');
                                        }
                                }
 
-                               $result = $this->import(); // Do import step, 
result determines if finished for this area
-                               echo '<li class="info">Import: finished step ' 
.$result. '</li>';
-                               while($result != '1')
+
+                               // Get the path for user input or use a default 
path
+
+                               $files = array();
+                               if(isset($_FILES['file']['tmp_name']) && 
$_FILES['file']['tmp_name'])
                                {
-                                       $result = $this->import();
-                                       echo '<li class="info">Import: finished 
step ' .$result. '</li>';
-                                       flush();
+                                       $files[] = array
+                                       (
+                                               'name'  => 
$_FILES['file']['tmp_name'],
+                                               'type'  => 
$_FILES['file']['type']
+                                       );
+                                       
                                }
+                               else
+                               {
+                                       $path = phpgw::get_var('path', 
'string');
+                                       $files = $this->get_files($path);
+                               }
 
+                               if(!$files)
+                               {
+                                       phpgwapi_cache::session_set('property', 
'import_message', 'Ingen filer er valgt');
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction'=>'property.uiimport.index'));
+                               }
+
+                               foreach ($files as $file)
+                               {
+                                       $valid_type = false;
+                                       switch ($file['type'])
+                                       {
+                                               case 'application/vnd.ms-excel':
+                                                       $this->csvdata = 
$this->getexceldata($file['name']);
+                                                       $valid_type = true;
+                                                       break;
+                                               case 'text/csv':
+                                               case 
'text/comma-separated-values':
+                                                       $this->csvdata = 
$this->getcsvdata($file['name']);
+                                                       $valid_type = true;
+                                                       break;
+                                       }
+                                       
+                                       if($valid_type)
+                                       {
+                                               $result = $this->import();
+                                               $this->messages = 
array_merge($this->messages,$this->import_conversion->messages);
+                                               $this->warnings = 
array_merge($this->warnings,$this->import_conversion->warnings);
+                                               $this->errors = 
array_merge($this->errors,$this->import_conversion->errors);
+                                               $this->csvdata = array();
+                                               echo '<li class="info">Import: 
finished step ' .$result. '</li>';
+                                       }
+                               }
+
+
                                echo "</ul>";
                                $end_time = time();
                                $difference = ($end_time - $start_time) / 60;
                                $end = date("G:i:s",$end_time);
                                echo "<h3>Import ended at: {$end}. Import 
lasted {$difference} minutes.";
                                
-                               $this->messages = 
array_merge($this->messages,$this->import_conversion->messages);
-                               $this->warnings = 
array_merge($this->warnings,$this->import_conversion->warnings);
-                               $this->errors = 
array_merge($this->errors,$this->import_conversion->errors);
-
                                if ($this->errors)
                                { 
                                        echo "<ul>";
@@ -148,11 +183,17 @@
                                        }
                                        echo "</ul>";
                                }
+                               echo '<a href="'. 
$GLOBALS['phpgw']->link('/home.php') . '">Home</a>';
+                               echo '</br><a href="'. 
$GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=>'property.uiimport.index')) . '">Import</a>';
+
                        }
                        else
                        {
+                               $import_settings        = 
phpgwapi_cache::session_get('property', 'import_settings');
+                               $import_message         = 
phpgwapi_cache::session_get('property', 'import_message');
 
-                               $conv_list = 
$this->get_import_conv($this->conv_type);
+                               phpgwapi_cache::session_clear('property', 
'import_message');
+                               $conv_list                      = 
$this->get_import_conv($import_settings['conv_type']);
                                
                                $conv_option = '<option value="">' . lang('none 
selected') . '</option>' . "\n";
                                foreach ( $conv_list as $conv)
@@ -167,19 +208,60 @@
                                        <option 
value='{$conv['id']}'{$selected}>{$conv['name']}</option>
 HTML;
                                }                       
+
+                               $tables = $this->db->table_names();
+                               sort($tables);
+
+                               $table_option = '<option value="">' . 
lang('none selected') . '</option>' . "\n";
+                               foreach ( $tables as $table)
+                               {
+                                       $selected = $import_settings['table'] 
== $table ? 'selected =  "selected"' : '';
+                                       $table_option .=  <<<HTML
+                                       <option 
value='{$table}'{$selected}>{$table}</option>
+HTML;
+                               }                       
+
+
+                               $home =  $GLOBALS['phpgw']->link('/home.php');
+                               $action =  
$GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=>'property.uiimport.index'));
+
+                               $debug_checked = 
isset($import_settings['debug']) && $import_settings['debug'] ? 'checked =  
"checked"' : '';
                                $html = <<<HTML
-                               <h1><img 
src="rental/templates/base/images/32x32/actions/document-save.png" /> 
Importer</h1>
-                               <div id="messageHolder"></div>
-                               <form 
action="index.php?menuaction=property.uiimport.index" method="post" 
enctype="multipart/form-data">
+                               <h1><img 
src="rental/templates/base/images/32x32/actions/document-save.png" /> Importer 
( MsExcel / CSV )</h1>
+                               <div id="messageHolder">{$import_message}</div>
+                               <form action="{$action}" method="post" 
enctype="multipart/form-data">
                                        <fieldset>
-                                               <label for="file">Choose 
file:</label> <input type="file" name="file" id="file" />
-                                               <label for="conv_type">Choose 
conversion:</label>
-                                               <select name="conv_type" 
id="conv_type">
-                                               {$conv_option}
+                                               <p>
+                                                       <label 
for="file">Choose file:</label>
+                                                       <input type="file" 
name="file" id="file" title = 'Single file'/>
+                                               </p>
+                                               <p>
+                                                       <label for="path">Local 
path:</label>
+                                                       <input type="text" 
name="path" id="path" value = '{$import_settings['path']}' title = 'Alle filer 
i katalogen'/>
+                                               </p>
+                                               <p>
+                                                       <label 
for="conv_type">Choose conversion:</label>
+                                                       <select 
name="conv_type" id="conv_type">
+                                                       {$conv_option}
                                                </select>
-                                               <input type="submit" 
name="importsubmit" value="{$this->import_button_label}"  />
+                                               </p>
+                                               <p>
+                                                       <label 
for="table">Choose Table:</label>
+                                                       <select name="table" 
id="table">
+                                                       {$table_option}
+                                               </select>
+                                               </p>
+
+                                               <p>
+                                                       <label 
for="debug">Debug:</label>
+                                                       <input type="checkbox" 
name="debug" id="debug" {$debug_checked} value ='1' />
+                                               </p>
+                                               <p>
+                                                       <input type="submit" 
name="importsubmit" value="{$this->import_button_label}"  />
+                                               </p>
                                        </fieldset>
                                </form>
+                               <br><a href='$home'>Home</a>
 HTML;
                                echo $html;
                        }
@@ -196,7 +278,7 @@
                 */
                public function import()
                {
-                       $steps = 1;
+                       $this->steps++;
                        
                        /* Import logic:
                         * 
@@ -206,35 +288,37 @@
                         * 4. Log messages for this step
                         *  
                         */
-                       
-                       $this->messages = array();
-                       $this->warnings = array();
-                       $this->errors = array();
-                       
-                       // Import data if not done before and put them on the 
users session
-                       if (!phpgwapi_cache::session_get('property', 
'data_import'))
-                       {
-                               phpgwapi_cache::session_set('property', 
'data_import', $this->import_data()); 
-                $this->log_messages(1);
-                               return '1';
-                       }
 
-                       // We're done with the import, so clear all session 
variables so we're ready for a new one
-                       phpgwapi_cache::session_clear('property', 
'data_import');
-                       phpgwapi_cache::session_clear('property', 'conv_type');
-                       return '1';
+                       $this->import_data();
+                       $this->log_messages($this->steps);
+                       return $this->steps;
                }
                
                protected function import_data()
                {
+                       $metadata = array();
+                       if($this->table && $this->fields)
+                       {
+                               $metadata = $this->db->metadata($this->table);
+                               
+                               foreach($this->fields as $field)
+                               {
+                                       if(!isset($metadata[$field]))
+                                       {
+                                               throw new Exception("Feltet 
'{$field}' finnes ikke i tabellen '{$this->table}'");
+                                       }
+                               }
+//                             _debug_array($metadata);die();
+                       }
+                       
+                       $this->import_conversion->table = $this->table;
+                       $this->import_conversion->fields = $this->fields;
+                       $this->import_conversion->metadata = $metadata;
+
                        $start_time = time();
                        
                        $datalines = $this->csvdata;
                        
-                       $this->messages[] = "Read 'import_all.csv' file in " . 
(time() - $start_time) . " seconds";
-                       $this->messages[] = "'importfile.csv' contained " . 
count($datalines) . " lines";
-                       
-
                        $ok = true;
                        $_ok = false;
                        $this->db->transaction_begin();
@@ -271,7 +355,7 @@
                        if ($skipfirstline)
                        {
                                // Read the first line to get the headers out 
of the way
-                               $this->getcsv($handle);
+                               $this->fields = $this->getcsv($handle);
                        }
                        
                        $result = array();
@@ -283,9 +367,43 @@
                        
                        fclose($handle);
                        
+                       $this->messages[] = "Read '{$path}' file in " . (time() 
- $start_time) . " seconds";
+                       $this->messages[] = "'{$path}' contained " . 
count($result) . " lines";
+
                        return $result;
                }
+
+               protected function getexceldata($path, $skipfirstline = true)
+               {
+                       $data = CreateObject('phpgwapi.excelreader');
+                       $data->setOutputEncoding('CP1251');
+                       $data->read($path);
+                       $result = array();
+
+                       $start = $skipfirstline ? 2 : 1; // Read the first line 
to get the headers out of the way
+
+                       if ($skipfirstline)
+                       {
+                               $this->fields = 
array_values($data->sheets[0]['cells'][1]);
+                       }
                        
+                       $rows = $data->sheets[0]['numRows']+1;
+
+                       for ($i=$start; $i<$rows; $i++ ) //First data entry on 
row 2
+                       {
+                               foreach($data->sheets[0]['cells'][$i] as 
&$value)
+                               {
+                                       $value = utf8_encode(trim($value));
+                               }
+                               $result[] = 
array_values($data->sheets[0]['cells'][$i]);
+                       }
+
+                       $this->messages[] = "Read '{$path}' file in " . (time() 
- $start_time) . " seconds";
+                       $this->messages[] = "'{$path}' contained " . 
count($result) . " lines";
+
+                       return $result;
+               }
+
                
                /**
                 * Read the next line from the given file handle and parse it 
to CSV according to the rules set up
@@ -302,9 +420,9 @@
 
                private function log_messages($step)
         {
-               sort($this->errors);
-               sort($this->warnings);
-               sort($this->messages);
+        //     sort($this->errors);
+        //     sort($this->warnings);
+        //     sort($this->messages);
                
             $msgs = array_merge(
                array('----------------Errors--------------------'),
@@ -351,4 +469,42 @@
 
                        return $conv_list;
                }
+
+               protected function get_files($dirname)
+               {
+                       // prevent path traversal
+                       if ( preg_match('/\./', $dirname) 
+                        || !is_dir($dirname) )
+                       {
+                               return array();
+                       }
+
+                       $mime_magic = createObject('phpgwapi.mime_magic');
+                       
+                       $file_list = array();
+                       $dir = new DirectoryIterator($dirname); 
+                       if ( is_object($dir) )
+                       {
+                               foreach ( $dir as $file )
+                               {
+                                       if ( $file->isDot()
+                                               || !$file->isFile()
+                                               || !$file->isReadable())
+//                                             || strcasecmp( end( explode( 
".", $file->getPathname() ) ), 'xls' ) != 0 )
+//                                             || strcasecmp( end( explode( 
".", $file->getPathname() ) ), 'csv' ) != 0 ))
+                                       {
+                                               continue;
+                                       }
+
+                                       $file_name = $file->__toString();
+                                       $file_list[] = array
+                                       (
+                                               'name'  => (string) 
"{$dirname}/{$file_name}",
+                                               'type'  => 
$mime_magic->filename2mime($file_name)
+                                       );
+                               }
+                       }
+
+                       return $file_list;
+               }
        }

Modified: branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2011-07-03 19:39:07 UTC (rev 7459)
@@ -973,6 +973,10 @@
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
                                }
+                               if($values['planning_value'] && 
!$values['planning_date'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a date !'));
+                               }
 
 
                                if(isset($values['budget']) && 
$values['budget'] && !ctype_digit($values['budget']))
@@ -1202,6 +1206,7 @@
                        }
 
                        $jscal->add_listener('values_consume_date');
+                       $jscal->add_listener('values_planning_date');
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        $link_file_data = array
@@ -1275,18 +1280,23 @@
 
                        if($this->acl_edit)
                        {
-                               $lang_delete_consume = lang('Check to delete');
+                               $_lang_delete = lang('Check to delete');
                                foreach($values['consume'] as & $consume)
                                {
-                                       $consume['delete'] = "<input 
type='checkbox' name='values[delete_consume][]' value='{$consume['id']}' 
title='{$lang_delete_consume}'>";
+                                       $consume['delete'] = "<input 
type='checkbox' name='values[delete_consume][]' value='{$consume['id']}' 
title='{$_lang_delete}'>";
                                }
+                               foreach($values['planning'] as & $planning)
+                               {
+                                       $planning['delete'] = "<input 
type='checkbox' name='values[delete_planning][]' value='{$planning['id']}' 
title='{$_lang_delete}'>";
+                               }
+
                        }
                        
                        $datavalues[2] = array
                                (
                                        'name'                                  
=> "2",
-                                       'values'                                
=> json_encode($values['consume']),
-                                       'total_records'                 => 
count($values['consume']),
+                                       'values'                                
=> json_encode($values['planning']),
+                                       'total_records'                 => 
count($values['planning']),
                                        'edit_action'                   => "''",
                                        'is_paginator'                  => 0,
                                        'footer'                                
=> 0
@@ -1302,7 +1312,27 @@
                                                                                
                                array('key' => 
'delete','label'=>lang('delete'),'sortable'=>false,'resizeable'=>false)))
                                );
 
+                       $datavalues[3] = array
+                               (
+                                       'name'                                  
=> "3",
+                                       'values'                                
=> json_encode($values['consume']),
+                                       'total_records'                 => 
count($values['consume']),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 0,
+                                       'footer'                                
=> 0
+                               );
 
+
+
+                       $myColumnDefs[3] = array
+                               (
+                                       'name'          => "3",
+                                       'values'        =>      
json_encode(array(      array('key' => 
'amount','label'=>lang('amount'),'sortable'=>true,'resizeable'=>true, 
'formatter' => FormatterRight),
+                                                                               
                                array('key' => 
'date','label'=>lang('date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'delete','label'=>lang('delete'),'sortable'=>false,'resizeable'=>false)))
+                               );
+
+
                        if (isset($values['attributes']) && 
is_array($values['attributes']))
                        {
                                foreach ($values['attributes'] as & $attribute)

Modified: 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bilde_bkb
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bilde_bkb
  2011-07-03 13:29:48 UTC (rev 7458)
+++ 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bilde_bkb
  2011-07-03 19:39:07 UTC (rev 7459)
@@ -9,8 +9,8 @@
                protected $dir = '/u01/kunst/001';
                protected $entity_id = 4;
                protected $cat_id = 1;
+               public $debug = true;
 
-
                public function __construct()
                {
                        set_time_limit(10000); //Set the time limit for this 
request
@@ -23,7 +23,6 @@
 
                public function add($data)
                {
-//                     $debug = true;
                        $error = false;
 //_debug_array($data);
 
@@ -50,7 +49,7 @@
                                {
                                        $this->errors[] ="This file already 
exists: {$to_file}";
                                }
-                               else if (!$debug)
+                               else if (!$this->debug)
                                {
                                        
$this->bofiles->create_document_dir("{$this->category_dir}/{$location[0]}/{$data[0]}");
                                        $this->bofiles->vfs->override_acl = 1;
@@ -74,33 +73,4 @@
 
                        return true;
                }
-
-
-               /**
-                * Convert from the locale encoding to UTF-8 encoding and 
escape single quotes
-                * 
-                * @param string $value The value to convert
-                * @return string
-                */
-               protected function decode($value)
-               {
-                       $converted = mb_convert_encoding($value, 'UTF-8');
-                       if ($this->is_null(trim($converted)))
-                       {
-                               return null;
-                       }
-                       return stripslashes($converted);
-               }
-               
-               /**
-                * Test a value for null according to several formats that can 
exist in the export.
-                * Returns true if the value is null according to these rules, 
false otherwise.
-                * 
-                * @param string $value The value to test
-                * @return bool
-                */
-               protected function is_null($value)
-               {
-                       return ((trim($value) == "") || ($data == "<NULL>") || 
($data == "''"));
-               }
        }

Modified: 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bkb
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bkb
        2011-07-03 13:29:48 UTC (rev 7458)
+++ 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_kunstoversikt_bkb
        2011-07-03 19:39:07 UTC (rev 7459)
@@ -5,6 +5,7 @@
                public $messages = array();
                public $warnings = array();
                public $errors = array();
+               public $debug = true;
 
                public function __construct()
                {
@@ -15,10 +16,9 @@
 
                public function add($data)
                {
-//                     $debug = true;
                        $error = false;
                        $table = 'fm_entity_4_1';
-                       $byggid = $this->decode($data[0]);
+                       $byggid = $data[0];
                        if(!$byggid)
                        {
                                $this->errors[] = "Mangler objekt, hopper over: 
{$data[1]}";
@@ -92,7 +92,7 @@
                                $sql = "INSERT INTO {$table} ({$cols}) VALUES 
({$values})";
                        }
 
-                       if($debug)
+                       if($this->debug)
                        {
                                _debug_array($sql);
                        }
@@ -103,42 +103,14 @@
 
                        if(!$error)
                        {
-                               $this->messages[] = "Successfully imported 
location: Title ({$this->decode($data[1])})";
+                               $this->messages[] = "Successfully imported 
location: Title ({$data[1]})";
                                $ok = true;
                        }
                        else
                        {
-                               $this->errors[] = "Error importing location: 
Title ({$this->decode($data[1])})";
+                               $this->errors[] = "Error importing location: 
Title ({$data[1]})";
                                $ok = false;
                        }
                        return $ok;
                }
-
-               /**
-                * Convert from the locale encoding to UTF-8 encoding and 
escape single quotes
-                * 
-                * @param string $value The value to convert
-                * @return string
-                */
-               protected function decode($value)
-               {
-                       $converted = mb_convert_encoding($value, 'UTF-8');
-                       if ($this->is_null(trim($converted)))
-                       {
-                               return null;
-                       }
-                       return stripslashes($converted);
-               }
-               
-               /**
-                * Test a value for null according to several formats that can 
exist in the export.
-                * Returns true if the value is null according to these rules, 
false otherwise.
-                * 
-                * @param string $value The value to test
-                * @return bool
-                */
-               protected function is_null($value)
-               {
-                       return ((trim($value) == "") || ($data == "<NULL>") || 
($data == "''"));
-               }
        }

Modified: 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_romdata_bkb
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_romdata_bkb  
    2011-07-03 13:29:48 UTC (rev 7458)
+++ 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_romdata_bkb  
    2011-07-03 19:39:07 UTC (rev 7459)
@@ -5,7 +5,7 @@
                public $messages = array();
                public $warnings = array();
                public $errors = array();
-               protected $debug = false;
+               protected $debug = true;
 
                public function __construct()
                {

Modified: 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
     2011-07-03 13:29:48 UTC (rev 7458)
+++ 
branches/Version-1_0-branch/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
     2011-07-03 19:39:07 UTC (rev 7459)
@@ -5,7 +5,7 @@
                public $messages = array();
                public $warnings = array();
                public $errors = array();
-
+               public $debug = true;
                public function __construct()
                {
                        set_time_limit(10000); //Set the time limit for this 
request oto 3000 seconds
@@ -16,10 +16,10 @@
                public function add($data)
                {
 
-                       $debug = true;
+                       $debug = $this->debug;
                        $error = false;
-                       $type = $this->decode($data[0]);
-                       $location_code = $this->decode($data[1]);
+                       $type = $data[0];
+                       $location_code = $data[1];
 
                        $location_data = 
execMethod('property.solocation.read_single', $location_code );
 _debug_array($data);
@@ -304,42 +304,14 @@
 
                        if(!$error)
                        {
-                               $this->messages[] = "Successfully imported 
location: Title ({$this->decode($data[1])})";
+                               $this->messages[] = "Successfully imported 
location: Title ({$data[1]})";
                                $ok = true;
                        }
                        else
                        {
-                               $this->errors[] = "Error importing location: 
Title ({$this->decode($data[1])})";
+                               $this->errors[] = "Error importing location: 
Title ({$data[1]})";
                                $ok = false;
                        }
                        return $ok;
                }
-
-               /**
-                * Convert from the locale encoding to UTF-8 encoding and 
escape single quotes
-                * 
-                * @param string $value The value to convert
-                * @return string
-                */
-               protected function decode($value)
-               {
-                       $converted = mb_convert_encoding($value, 'UTF-8');
-                       if ($this->is_null(trim($converted)))
-                       {
-                               return null;
-                       }
-                       return stripslashes($converted);
-               }
-               
-               /**
-                * Test a value for null according to several formats that can 
exist in the export.
-                * Returns true if the value is null according to these rules, 
false otherwise.
-                * 
-                * @param string $value The value to test
-                * @return bool
-                */
-               protected function is_null($value)
-               {
-                       return ((trim($value) == "") || ($data == "<NULL>") || 
($data == "''"));
-               }
        }

Copied: 
branches/Version-1_0-branch/property/inc/import/default/cvs_oppdater_rental_party_bkb
 (from rev 7458, 
trunk/property/inc/import/default/cvs_oppdater_rental_party_bkb)
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/cvs_oppdater_rental_party_bkb
                               (rev 0)
+++ 
branches/Version-1_0-branch/property/inc/import/default/cvs_oppdater_rental_party_bkb
       2011-07-03 19:39:07 UTC (rev 7459)
@@ -0,0 +1,117 @@
+<?php
+       class import_conversion
+       {
+               protected $db;
+               public $messages = array();
+               public $warnings = array();
+               public $errors = array();
+               public $debug = true;
+               public $fields = array();
+               public $table;
+               public $metadata = array();
+
+               public function __construct()
+               {
+                       set_time_limit(10000); //Set the time limit for this 
request
+                       $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->db           = & $GLOBALS['phpgw']->db;
+               }
+
+               public function add($data)
+               {
+                       $error = false;
+                       $table = $this->table;
+                       $fields =  $this->fields;
+
+                       if(!$table)
+                       {
+                               throw new Exception("Tabell er ikke angitt");
+                       }
+
+                       if(!$fields)
+                       {
+                               throw new Exception("Felter er ikke definert");
+                       }
+
+                       $id = (int)$data[array_search('id', $fields)];
+                       
+                       if(!$id)
+                       {
+                               throw new Exception("Fant ikke verdi for feltet 
'id'");
+                       }
+
+                       $value_set = array();
+                       foreach ($fields as $key => $field)
+                       {
+                               $value_set[$field]      = 
$this->validate_value($data[$key], $field);
+                       }
+                       unset($value_set['id']);
+               
+                       $this->db->query("SELECT id FROM {$table} WHERE id = 
{$id}",__LINE__,__FILE__);
+                       if($this->db->next_record())
+                       {
+                               $this->warnings[] = "ID finnes fra før: {$id}, 
oppdaterer";
+                               $value_set      = 
$this->db->validate_update($value_set);
+                               $sql = "UPDATE {$table} SET {$value_set} WHERE 
id = {$id}";
+                       }
+                       else
+                       {
+                               $this->warnings[] = "ID fantes ikke fra før: 
{$id}";
+                       }
+
+                       if($this->debug)
+                       {
+                               _debug_array($sql);
+                       }
+                       else
+                       {
+                               $request_ok = 
$this->db->query($sql,__LINE__,__FILE__);
+                       }
+
+                       if(!$error)
+                       {
+                               $this->messages[] = "Successfully updated 
party: Title ({$data[7]})";
+                               $ok = true;
+                       }
+                       else
+                       {
+                               $this->errors[] = "Error updating location: 
Title ({$data[7]})";
+                               $ok = false;
+                       }
+                       return $ok;
+               }
+
+               
+               /**
+                * Test a value for null according to several formats that can 
exist in the export.
+                * Returns true if the value is null according to these rules, 
false otherwise.
+                * 
+                * @param string $value The value to test
+                * @return bool
+                */
+               protected function is_null($value)
+               {
+                       return ((trim($value) == "") || ($data == "<NULL>") || 
($data == "''"));
+               }
+
+               protected function validate_value($value,$field)
+               {
+                       $datatype = $this->metadata[$field]->type;
+                       switch ($datatype)
+                       {
+                               case 'char':
+                               case 'varchar':
+                               case 'text':
+                                       $ret = $this->db->db_addslashes($value);
+                                       break;
+                               case 'bool':
+                                       $ret = $value ? 'True' : 'False';
+                                       break;
+                               default:
+                                       $ret = $value;
+                       }
+
+                       return $ret;
+               }
+
+       }

Modified: branches/Version-1_0-branch/property/js/yahoo/entity.index.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/entity.index.js       
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/js/yahoo/entity.index.js       
2011-07-03 19:39:07 UTC (rev 7459)
@@ -45,6 +45,7 @@
        {
                if(flag_particular_setting=='init')
                {
+
                        //category
 /*
                        index = 
locate_in_array_options(0,"value",path_values.cat_id);
@@ -54,33 +55,45 @@
                        }
 */
                        //district
-                       index = 
locate_in_array_options(1,"value",path_values.district_id);
-                       if(index)
+                       
+                       if(selectsButtons[1])
                        {
-                               oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                               index = 
locate_in_array_options(1,"value",path_values.district_id);
+                               if(index)
+                               {
+                                       oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                               }
                        }
 
                        //status
-                       index = 
locate_in_array_options(2,"value",path_values.status);
-                       if(index)
+                       if(selectsButtons[2])
                        {
-                               oMenuButton_2.set("label", ("<em>" + 
array_options[2][index][1] + "</em>"));
+                               index = 
locate_in_array_options(2,"value",path_values.status);
+                               if(index)
+                               {
+                                       oMenuButton_2.set("label", ("<em>" + 
array_options[2][index][1] + "</em>"));
+                               }
                        }
 
                        //filter
-                       index = 
locate_in_array_options(3,"value",path_values.filter);
-                       if(index)
+                       if(selectsButtons[3])
                        {
-                               oMenuButton_3.set("label", ("<em>" + 
array_options[3][index][1] + "</em>"));
+                               index = 
locate_in_array_options(3,"value",path_values.filter);
+                               if(index)
+                               {
+                                       oMenuButton_3.set("label", ("<em>" + 
array_options[3][index][1] + "</em>"));
+                               }
                        }
 
                        //district
-                       index = 
locate_in_array_options(4,"value",path_values.criteria_id);
-                       if(index)
+                       if(selectsButtons[4])
                        {
-                               oMenuButton_4.set("label", ("<em>" + 
array_options[4][index][1] + "</em>"));
+                               index = 
locate_in_array_options(4,"value",path_values.criteria_id);
+                               if(index)
+                               {
+                                       oMenuButton_4.set("label", ("<em>" + 
array_options[4][index][1] + "</em>"));
+                               }
                        }
-
                        //eliminate "no category" option because is necesary 
have a category in the  PHP query
        //              delete oMenuButton_0.getMenu().itemData[0];
                        //correcting it. now look for value 

Modified: branches/Version-1_0-branch/property/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/property/setup/phpgw_no.lang    2011-07-03 
13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/setup/phpgw_no.lang    2011-07-03 
19:39:07 UTC (rev 7459)
@@ -353,6 +353,11 @@
 consume date   property        no      Dato historisk forbruk
 consume value  property        no      Beløp historisk forbruk
 consume history        property        no      Historisk forbruk
+planning       property        no      Planlagt
+planning date  property        no      Dato planagt disponering
+planning value property        no      Beløp planagt disponering
+planning serie property        no      Planagt disponering
+
 check to delete        property        no      Merk for å slette
 contact        property        no      Kontakt
 contact email  property        no      Epost

Modified: branches/Version-1_0-branch/property/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/setup.inc.php    2011-07-03 
13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/setup/setup.inc.php    2011-07-03 
19:39:07 UTC (rev 7459)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.619';
+       $setup_info['property']['version']              = '0.9.17.620';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -117,6 +117,7 @@
                'fm_request_status',
                'fm_request_history',
                'fm_request_consume',
+               'fm_request_planning',
                'fm_template',
                'fm_template_hours',
                'fm_chapter',

Modified: branches/Version-1_0-branch/property/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2011-07-03 19:39:07 UTC (rev 7459)
@@ -850,6 +850,21 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_request_planning' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto','nullable' => 
False),
+                               'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'amount' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'date' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => true),
+                               'entry_date' => array('type' => 
'int','precision' => '4','nullable' => true),
+                               'descr' => array('type' => 'text','nullable' => 
True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array('fm_request' => array('request_id' => 
'id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_ns3420' => array(
                        'fd' => array(
                                'id' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),

Modified: branches/Version-1_0-branch/property/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2011-07-03 19:39:07 UTC (rev 7459)
@@ -5309,7 +5309,42 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.619 to 0.9.17.620
+       * Add tentative planning to request
+       * 
+       */
 
+       $test[] = '0.9.17.619';
+       function property_upgrade0_9_17_619()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_request_planning', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'auto','nullable' => False),
+                                       'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'amount' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'date' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'user_id' => array('type' => 
'int','precision' => '4','nullable' => true),
+                                       'entry_date' => array('type' => 
'int','precision' => '4','nullable' => true),
+                                       'descr' => array('type' => 
'text','nullable' => True)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array('fm_request' => 
array('request_id' => 'id')),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.620';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
        /**
        * Update property version from 0.9.17.607 to 0.9.17.608
        * Add more room for address at tickets

Modified: branches/Version-1_0-branch/property/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/config.tpl      
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/templates/base/config.tpl      
2011-07-03 19:39:07 UTC (rev 7459)
@@ -455,6 +455,17 @@
                                </select>
                        </td>
                </tr>
+
+               <tr class="row_off">
+                       
<td>{lang_disallow_multiple_condition_types_at_demands}.</td>
+                       <td>
+                               <select 
name="newsettings[disallow_multiple_condition_types]">
+                                       <option value="" 
{selected_disallow_multiple_condition_types_}>NO</option>
+                                       <option value="1" 
{selected_disallow_multiple_condition_types_1}>YES</option>
+                               </select>
+                       </td>
+               </tr>
+
                <tr class="row_on">
                        <td valign = 'top'>{lang_list_location_level}:</td>
                        <td>

Modified: branches/Version-1_0-branch/property/templates/base/request.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/request.xsl     
2011-07-03 13:29:48 UTC (rev 7458)
+++ branches/Version-1_0-branch/property/templates/base/request.xsl     
2011-07-03 19:39:07 UTC (rev 7459)
@@ -417,6 +417,42 @@
 
                                                        <tr>
                                                                <td 
valign="top">
+                                                                               
<xsl:value-of select="php:function('lang', 'planning date')" />
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" id="values_planning_date" name="values[planning_date]" size="10" 
value="" readonly="readonly" >
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'planning date')" />
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                                       <img 
id="values_planning_date-trigger" src="{img_cal}" alt="{lang_datetitle}" 
title="{lang_datetitle}" style="cursor:pointer; cursor:hand;" />
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td 
valign="top">
+                                                                               
<xsl:value-of select="php:function('lang', 'planning value')" />
+                                                               </td>
+                                                               <td>
+                                                                       <input 
type="text" id="values_planning_value" name="values[planning_value]" size="10" 
value="{value_planning}" >
+                                                                               
<xsl:attribute name="title">
+                                                                               
        <xsl:value-of select="php:function('lang', 'planning value')" />
+                                                                               
</xsl:attribute>
+                                                                       </input>
+                                                                       
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+                                                               </td>
+                                                       </tr>
+
+                                                       <tr>
+                                                               <td width="19%" 
align="left" valign="top">
+                                                                       
<xsl:value-of select="php:function('lang', 'planning serie')" />
+                                                               </td>
+                                                               <td>
+                                                                       <div 
id="datatable-container_2"></div>
+                                                               </td>
+                                                       </tr>
+
+                                                       <tr>
+                                                               <td 
valign="top">
                                                                                
<xsl:value-of select="php:function('lang', 'consume date')" />
                                                                </td>
                                                                <td>
@@ -442,14 +478,14 @@
                                                                </td>
                                                        </tr>
 
-                                                                       <tr>
-                                                                               
<td width="19%" align="left" valign="top">
-                                                                               
        <xsl:value-of select="php:function('lang', 'consume history')" />
-                                                                               
</td>
-                                                                               
<td>
-                                                                               
        <div id="datatable-container_2"></div>
-                                                                               
</td>
-                                                                       </tr>
+                                                       <tr>
+                                                               <td width="19%" 
align="left" valign="top">
+                                                                       
<xsl:value-of select="php:function('lang', 'consume history')" />
+                                                               </td>
+                                                               <td>
+                                                                       <div 
id="datatable-container_3"></div>
+                                                               </td>
+                                                       </tr>
 
 <!--
                                                        <tr>
@@ -710,22 +746,20 @@
 
        <xsl:template match="condition_list">
                <tr>
-                       <xsl:attribute name="class">
+                       <td class="small_text" align="left">
                                <xsl:choose>
-                                       <xsl:when test="@class">
-                                               <xsl:value-of select="@class"/>
+                                       <xsl:when test="condition_type_list != 
''">
+                                               <xsl:variable 
name="lang_degree_statustext"><xsl:value-of 
select="//lang_degree_statustext"/></xsl:variable>
+                                               <select 
name="values[condition][{condition_type}][condition_type]" class="forms" 
title="{$lang_degree_statustext}">
+                                                       <xsl:apply-templates 
select="condition_type_list/options"/>
+                                               </select>
                                        </xsl:when>
-                                       <xsl:when test="position() mod 2 = 0">
-                                               <xsl:text>row_off</xsl:text>
-                                       </xsl:when>
                                        <xsl:otherwise>
-                                               <xsl:text>row_on</xsl:text>
+                                               <xsl:value-of 
select="condition_type_name"/>
                                        </xsl:otherwise>
                                </xsl:choose>
-                       </xsl:attribute>
-                       <td class="small_text" align="left">
-                               <xsl:value-of select="condition_type_name"/>
                        </td>
+
                        <td class="small_text" align="center">
                                <xsl:variable 
name="lang_degree_statustext"><xsl:value-of 
select="//lang_degree_statustext"/></xsl:variable>
                                <select 
name="values[condition][{condition_type}][degree]" class="forms" 
title="{$lang_degree_statustext}">




reply via email to

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