fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [13669] Syncromind: Merge 13655:13668 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [13669] Syncromind: Merge 13655:13668 from trunk
Date: Wed, 15 Jul 2015 13:46:42 +0000

Revision: 13669
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13669
Author:   sigurdne
Date:     2015-07-15 13:46:42 +0000 (Wed, 15 Jul 2015)
Log Message:
-----------
Syncromind: Merge 13655:13668 from trunk

Modified Paths:
--------------
    branches/dev-syncromind/property/inc/class.boevent.inc.php
    branches/dev-syncromind/property/inc/class.boresponsible.inc.php
    branches/dev-syncromind/property/inc/class.solocation.inc.php
    branches/dev-syncromind/property/inc/class.soresponsible.inc.php
    branches/dev-syncromind/property/inc/class.uievent.inc.php
    branches/dev-syncromind/property/inc/class.uilocation.inc.php
    branches/dev-syncromind/property/setup/setup.inc.php
    branches/dev-syncromind/property/setup/tables_current.inc.php
    branches/dev-syncromind/property/setup/tables_update.inc.php

Property Changed:
----------------
    branches/dev-syncromind/


Property changes on: branches/dev-syncromind
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602,13604-13653
   + /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602,13604-13653,13656-13668

Modified: branches/dev-syncromind/property/inc/class.boevent.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.boevent.inc.php  2015-07-15 
13:29:43 UTC (rev 13668)
+++ branches/dev-syncromind/property/inc/class.boevent.inc.php  2015-07-15 
13:46:42 UTC (rev 13669)
@@ -379,7 +379,7 @@
 
                        //$times['min']= '*'; // for testing the  - every minute
 
-                       $account_id = 
execMethod('property.soresponsible.get_responsible_user_id', 
$data['responsible']);
+                       $account_id = 
execMethod('property.soresponsible.get_contact_user_id', $data['contact_id']);
 
                        $timer_data = array
                                (
@@ -389,7 +389,7 @@
                                        'enabled'               => !! 
$data['enabled'],
 //                                     'action'                => 
$action['action'],
                                        'action'                => 
$this->event_functions[$data['action']]['action'],
-                                       'action_data'   => 
array('responsible_id' => $data['responsible_id'])
+                                       'action_data'   => array('contact_id' 
=> $data['contact_id'])
                                );
 
                        if($data['end_date'])
@@ -531,7 +531,6 @@
                        $values = $responsible->read_type(array('start' => 0, 
'query' =>'', 'sort' => '',
                                'order' => '', 'location' => $location, 
'allrows'=>true,
                                'filter' => ''));
-
                        $list = array(0 => lang('none'));
                        foreach($values as $entry)
                        {
@@ -565,15 +564,15 @@
                        $interlink      = CreateObject('property.interlink');
                        $relation_link = 
$interlink->get_relation_link(".{$location_arr[1]}", $id, 'view', true);
 
-                       $responsible_id = 
isset($data['action_data']['responsible_id']) ? 
$data['action_data']['responsible_id'] : 0;
-                       if(!$responsible_id)
+                       $contact_id = isset($data['action_data']['contact_id']) 
? $data['action_data']['contact_id'] : 0;
+                       if(!$contact_id)
                        {
                                return false;
                        }
 
-                       $comms = 
execMethod('addressbook.boaddressbook.get_comm_contact_data',$responsible_id);
+                       $comms = 
execMethod('addressbook.boaddressbook.get_comm_contact_data',$contact_id);
 
-                       $number = $comms[$responsible_id]['mobile (cell) 
phone'];
+                       $number = $comms[$contact_id]['mobile (cell) phone'];
                        $subject = lang('reminder');
                        $message = "<a href =\"{$relation_link}\">" . 
lang('record').' #' .$id .'</a>'."\n";
 
@@ -597,17 +596,17 @@
                        $interlink      = CreateObject('property.interlink');
                        $relation_link = 
$interlink->get_relation_link(".{$location_arr[1]}", $id, 'view', true);
 
-                       $responsible_id = 
isset($data['action_data']['responsible_id']) ? 
$data['action_data']['responsible_id'] : 0;
-                       if(!$responsible_id)
+                       $contact_id = isset($data['action_data']['contact_id']) 
? $data['action_data']['contact_id'] : 0;
+                       if(!$contact_id)
                        {
                                return false;
                        }
 
-                       $account_id = 
$GLOBALS['phpgw']->accounts->search_person($responsible_id);
+                       $account_id = 
$GLOBALS['phpgw']->accounts->search_person($contact_id);
                        $socommon       = CreateObject('property.socommon');
                        $prefs          = 
$socommon->create_preferences('property',$account_id);
-                       $comms          = 
execMethod('addressbook.boaddressbook.get_comm_contact_data',$responsible_id);
-                       $_address       = isset($comms[$responsible_id]['work 
email']) && $comms[$responsible_id]['work email'] ? 
$comms[$responsible_id]['work email'] :$prefs['email'];
+                       $comms          = 
execMethod('addressbook.boaddressbook.get_comm_contact_data',$contact_id);
+                       $_address       = isset($comms[$contact_id]['work 
email']) && $comms[$contact_id]['work email'] ? $comms[$contact_id]['work 
email'] :$prefs['email'];
 
                        $subject = lang('reminder');
                        $message = "<a href =\"{$relation_link}\">" . 
lang('record').' #' .$id .'</a>'."\n";

Modified: branches/dev-syncromind/property/inc/class.boresponsible.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.boresponsible.inc.php    
2015-07-15 13:29:43 UTC (rev 13668)
+++ branches/dev-syncromind/property/inc/class.boresponsible.inc.php    
2015-07-15 13:46:42 UTC (rev 13669)
@@ -358,12 +358,12 @@
                                        {
                                                $to_edit[] = array
                                                        (
-                                                               'id'            
                => $responsible_item,
-                                                               'active_from'   
        => time(),
-                                                               'contact_id'    
        => $values['contact_id'],
-                                                               'location_code' 
        => $location_code,
-                                                               
'responsibility_id'     => $values['responsibility_id'],
-                                                               'remark'        
                => 'from role assignment'
+                                                               'id'            
                                => $responsible_item,
+                                                               'active_from'   
                        => time(),
+                                                               'contact_id'    
                        => $values['contact_id'],
+                                                               'location_code' 
                        => $location_code,
+                                                               
'responsibility_role_id'        => $values['responsibility_role_id'],
+                                                               'remark'        
                                => 'from role assignment'
                                                        );
                                        }
                                }
@@ -381,7 +381,7 @@
                                        $receipt['error'][] = array('msg'=> 
lang('missing contact'));
                                }
 
-                               if(!$values['responsibility_id'])
+                               if(!$values['responsibility_role_id'])
                                {
                                        $receipt['error'][] = array('msg'=> 
lang('Role is not related to responsibility'));
                                }
@@ -395,7 +395,7 @@
                                        (
                                                'location'                      
=> explode('-', $location_code),
                                                'active_from'           => 
time(),
-                                               'responsibility_id'     => 
$values['responsibility_id'],
+                                               'responsibility_role_id'        
=> $values['responsibility_role_id'],
                                                'contact_id'            => 
$values['contact_id'],
                                                'remark'                        
=> 'from role assignment'
                                        );

Modified: branches/dev-syncromind/property/inc/class.solocation.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.solocation.inc.php       
2015-07-15 13:29:43 UTC (rev 13668)
+++ branches/dev-syncromind/property/inc/class.solocation.inc.php       
2015-07-15 13:46:42 UTC (rev 13669)
@@ -554,10 +554,8 @@
                                {
                                        $joinmethod .= " {$this->join} 
fm_responsibility_contact ON ( fm_location{$type_id}.location_code = 
fm_responsibility_contact.location_code))";
                                        $paranthesis .='(';
-                                       $joinmethod .= " {$this->join} 
fm_responsibility ON ( fm_responsibility_contact.responsibility_id = 
fm_responsibility.id))";
+                                       $joinmethod .= " {$this->join} 
fm_responsibility_role ON ( fm_responsibility_contact.id = 
fm_responsibility_role.responsibility_role_id))";
                                        $paranthesis .='(';
-                                       $joinmethod .= " {$this->join} 
fm_responsibility_role ON ( fm_responsibility.id = 
fm_responsibility_role.responsibility_id))";
-                                       $paranthesis .='(';
 
                                        $cols.= ',fm_responsibility_role.id as 
role_id';
                                        $cols_return[]  = 'role_id';

Modified: branches/dev-syncromind/property/inc/class.soresponsible.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.soresponsible.inc.php    
2015-07-15 13:29:43 UTC (rev 13668)
+++ branches/dev-syncromind/property/inc/class.soresponsible.inc.php    
2015-07-15 13:46:42 UTC (rev 13669)
@@ -87,29 +87,16 @@
 
                        if ($order)
                        {
-                               $ordermethod = " order by 
fm_responsibility.$order $sort";
+                               $ordermethod = " ORDER BY 
fm_responsibility.$order $sort";
                        }
                        else
                        {
-                               $ordermethod = ' order by fm_responsibility.id 
DESC';
+                               $ordermethod = ' ORDER BY fm_responsibility.id 
DESC';
                        }
 
                        $where= 'WHERE';
                        $filtermethod = '';
 
-/*
-                       if(is_array($filter) && $location)
-                       {
-                               $filtermethod .= " $where cat_id IN (" . 
implode(',', $filter) . ')';
-                               $where = 'AND';
-                       }
-
-                       if($location)
-                       {
-                               $filtermethod .= " $where 
fm_responsibility_module.location_id =" . 
$GLOBALS['phpgw']->locations->get_id($this->appname, $location);
-                               $where = 'AND';
-                       }
- */
                        $querymethod = '';
                        if($query)
                        {
@@ -117,11 +104,7 @@
                        }
 
                        $sql = "SELECT fm_responsibility.* FROM 
fm_responsibility"
-//                     . " {$this->join} fm_responsibility_module ON 
fm_responsibility.id = fm_responsibility_module.responsibility_id"
-//                     . " {$this->join} phpgw_locations ON 
fm_responsibility_module.location_id = phpgw_locations.location_id"
-//                     . " {$this->join} phpgw_applications ON 
phpgw_locations.app_id = phpgw_applications.app_id"
                        . " {$filtermethod} {$querymethod}";
-//                     . " WHERE app_name = '{$appname}' $filtermethod 
$querymethod";
 
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->total_records = $this->db->num_rows();
@@ -144,18 +127,13 @@
                                        'id'                    => 
$this->db->f('id'),
                                        'name'                  => 
$this->db->f('name', true),
                                        'descr'                 => 
$this->db->f('descr', true),
-                                       'active'                => 
$this->db->f('active'),
-                                       'location'              => 
$this->db->f('location'),
-                                       'cat_id'                => 
$this->db->f('cat_id'),
-                                       'created_by'    => 
$this->db->f('created_by'),
-                                       'created_on'    => 
$this->db->f('created_on'),
                                );
                        }
 
                        $cats   = CreateObject('phpgwapi.categories', -1);
                        foreach($values as &$entry)
                        {
-                               $sql = "SELECT location_id, cat_id FROM 
fm_responsibility_module WHERE responsibility_id = {$entry['id']}";
+                               $sql = "SELECT * FROM fm_responsibility_module 
WHERE responsibility_id = {$entry['id']}";
                                $this->db->query($sql, __LINE__, __FILE__);     
                
                                $locations = array();
                                while ($this->db->next_record())
@@ -163,6 +141,10 @@
                                        $location_id = 
$this->db->f('location_id');
                                        $cat_id = $this->db->f('cat_id');
                                        $locations["{$location_id}_{$cat_id}"] 
= true;
+                                       $entry['active']                = 
$this->db->f('active');
+                                       $entry['created_by']    = 
$this->db->f('created_by');
+                                       $entry['created_on']    = 
$this->db->f('created_on');
+
                                }               
                                $__location_info = array();
                                foreach($locations as $location => $dummy)
@@ -348,7 +330,6 @@
                                        'id'                    => 
$this->db->f('id'),
                                        'name'                  => 
$this->db->f('name', true),
                                        'descr'                 => 
$this->db->f('descr', true),
-                                       'active'                => 
$this->db->f('active'),
                                        'cat_id'                => 
$this->db->f('cat_id'),
                                        'created_by'    => 
$this->db->f('created_by'),
                                        'created_on'    => 
$this->db->f('created_on'),
@@ -367,7 +348,8 @@
 
                public function read_single_role($id)
                {
-                       $sql = 'SELECT * FROM fm_responsibility_role WHERE id= 
' . (int) $id;
+                       $id = (int) $id;
+                       $sql = "SELECT * FROM fm_responsibility_role WHERE id= 
{$id}";
 
                        $this->db->query($sql, __LINE__, __FILE__);
 
@@ -430,10 +412,10 @@
                {
                        $receipt = array();
 
-                       $value_set['name']                                      
=$this->db->db_addslashes($data['name']);
+                       $value_set['name']                                      
= $this->db->db_addslashes($data['name']);
                        $value_set['remark']                            = 
$this->db->db_addslashes($data['remark']);
                        $value_set['responsibility_id']         = 
$data['responsibility_id'];
-                       $value_set['location_level']                            
= implode(',', $data['location_level']);
+                       $value_set['location_level']            = implode(',', 
$data['location_level']);
                        $value_set['modified_date']                     = 
time();
 
 
@@ -480,8 +462,6 @@
                                        'id'                    => 
$this->db->f('id'),
                                        'name'                  => 
$this->db->f('name', true),
                                        'descr'                 => 
$this->db->f('descr', true),
-                                       'active'                => 
$this->db->f('active'),
-                                       'cat_id'                => 
$this->db->f('cat_id'),
                                        'created_by'    => 
$this->db->f('created_by'),
                                        'created_on'    => 
$this->db->f('created_on'),
                                );
@@ -515,10 +495,23 @@
 
                function delete_type($id)
                {
+                       $id = (int)$id;
                        $this->db->transaction_begin();
-                       $this->db->query('DELETE FROM fm_responsibility_module 
WHERE responsibility_id='  . (int) $id, __LINE__, __FILE__);
-                       $this->db->query('DELETE FROM fm_responsibility_contact 
WHERE responsibility_id='  . (int) $id, __LINE__, __FILE__);
-                       $this->db->query('DELETE FROM fm_responsibility WHERE 
id='  . (int) $id, __LINE__, __FILE__);
+
+                       $this->db->query("SELECT id FROM fm_responsibility_role 
WHERE responsibility_id = {$id}", __LINE__, __FILE__);
+
+                       $responsibility_role_ids = array();
+                       while ($this->db->next_record())
+                       {
+                               $responsibility_role_ids[] = $this->db->f('id');
+                       }
+                       if($responsibility_role_ids)
+                       {
+                               $this->db->query('DELETE FROM 
fm_responsibility_contact WHERE responsibility_role_id IN(' . implode(',', 
$responsibility_role_ids) . ')', __LINE__, __FILE__);
+                       }
+                       $this->db->query("DELETE FROM fm_responsibility_role 
WHERE responsibility_id = {$id}", __LINE__, __FILE__);
+                       $this->db->query("DELETE FROM fm_responsibility_module 
WHERE responsibility_id = {$id}", __LINE__, __FILE__);
+                       $this->db->query("DELETE FROM fm_responsibility WHERE 
id = {$id}", __LINE__, __FILE__);
                        $this->db->transaction_commit();
                }
 
@@ -541,31 +534,39 @@
                                $order          = isset($data['order']) ? 
$this->db->db_addslashes($data['order']) : '';
                                $allrows        = isset($data['allrows']) ? 
!!$data['allrows'] : '';
                                $type_id                = 
isset($data['type_id']) && $data['type_id'] ? (int) $data['type_id'] : 0;
+                               $role_id                = 
isset($data['role_id']) && $data['role_id'] ? (int) $data['role_id'] : 0;
                        }
 
                        if ($order)
                        {
-                               $ordermethod = " order by $order $sort";
+                               $ordermethod = "ORDER BY $order $sort";
                        }
                        else
                        {
-                               $ordermethod = ' order by responsibility_id 
DESC';
+                               $ordermethod = 'ORDER BY responsibility_role_id 
DESC';
                        }
 
-                       $filtermethod = ' WHERE expired_on IS NULL';
+                       $filtermethod = 'WHERE expired_on IS NULL';
                        $where = 'AND';
 
                        if($type_id > 0)
                        {
-                               $filtermethod .= " $where responsibility_id = 
$type_id";
+                               $filtermethod .= " {$where} responsibility_id = 
{$type_id}";
                        }
+                       if($role_id > 0)
+                       {
+                               $filtermethod .= " {$where} 
responsibility_role_id = {$type_id}";
+                       }
+
                        $querymethod = '';
                        if($query)
                        {
                                $querymethod = "$where (remark $this->like 
'%$query%')";
                        }
 
-                       $sql = "SELECT * FROM fm_responsibility_contact 
$filtermethod $querymethod";
+                       $sql = "SELECT fm_responsibility_contact.* , 
fm_responsibility_role.responsibility_id FROM fm_responsibility_contact"
+                       . " $this->join fm_responsibility_role ON 
fm_responsibility_contact.responsibility_role_id = fm_responsibility_role.id"
+                       . " $filtermethod $querymethod";
 
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->total_records = $this->db->num_rows();
@@ -585,22 +586,23 @@
                        {
                                $values[] = array
                                        (
-                                               'id'                            
=> $this->db->f('id'),
-                                               'responsibility_id'     => 
$this->db->f('responsibility_id'),
-                                               'contact_id'            => 
$this->db->f('contact_id'),
-                                               'location_code'         => 
$this->db->f('location_code'),
-                                               'priority'                      
=> $this->db->f('priority'),
-                                               'active_from'           => 
$this->db->f('active_from'),
-                                               'active_to'                     
=> $this->db->f('active_to'),
-                                               'created_on'            => 
$this->db->f('created_on'),
-                                               'created_by'            => 
$this->db->f('created_by'),
-                                               'expired_on'            => 
$this->db->f('expired_on'), // historical records
-                                               'expired_by'            => 
$this->db->f('expired_by'),
-                                               'p_num'                         
=> $this->db->f('p_num', true),
-                                               'p_entity_id'           => 
$this->db->f('p_entity_id'),
-                                               'p_cat_id'                      
=> $this->db->f('p_cat_id'),
-                                               'ecodimb'                       
=> $this->db->f('ecodimb'),
-                                               'remark'                        
=> $this->db->f('remark', true),
+                                               'id'                            
                => $this->db->f('id'),
+                                               'responsibility_id'             
        => $this->db->f('responsibility_id'),
+                                               'responsibility_role_id'        
=> $this->db->f('responsibility_role_id'),
+                                               'contact_id'                    
        => $this->db->f('contact_id'),
+                                               'location_code'                 
        => $this->db->f('location_code'),
+                                               'priority'                      
                => $this->db->f('priority'),
+                                               'active_from'                   
        => $this->db->f('active_from'),
+                                               'active_to'                     
                => $this->db->f('active_to'),
+                                               'created_on'                    
        => $this->db->f('created_on'),
+                                               'created_by'                    
        => $this->db->f('created_by'),
+                                               'expired_on'                    
        => $this->db->f('expired_on'), // historical records
+                                               'expired_by'                    
        => $this->db->f('expired_by'),
+                                               'p_num'                         
                => $this->db->f('p_num', true),
+                                               'p_entity_id'                   
        => $this->db->f('p_entity_id'),
+                                               'p_cat_id'                      
                => $this->db->f('p_cat_id'),
+                                               'ecodimb'                       
                => $this->db->f('ecodimb'),
+                                               'remark'                        
                => $this->db->f('remark', true),
                                        );
                        }
 
@@ -623,7 +625,7 @@
 
                        $insert_values = array
                                (
-                                       (int) $values['responsibility_id'],
+                                       (int) $values['responsibility_role_id'],
                                        (int) $values['contact_id'],
                                        @implode('-', $values['location']),
                                        (int) $values['active_from'],
@@ -641,7 +643,7 @@
 
                        $this->db->transaction_begin();
 
-                       $this->db->query("INSERT INTO fm_responsibility_contact 
(responsibility_id, contact_id,"
+                       $this->db->query("INSERT INTO fm_responsibility_contact 
(responsibility_role_id, contact_id,"
                                ." location_code, active_from, active_to, 
p_num, p_entity_id, p_cat_id, ecodimb, remark, created_by, created_on)"
                                ." VALUES ($insert_values)", __LINE__, 
__FILE__);
 
@@ -728,9 +730,10 @@
 
                public function read_single_contact($id)
                {
-                       $sql = "SELECT fm_responsibility_contact.*,  
fm_responsibility.name as responsibility_name"
+                       $sql = "SELECT fm_responsibility_contact.*, 
fm_responsibility.id as responsibility_id,  fm_responsibility.name AS 
responsibility_name, fm_responsibility_role.name AS role_name"
                                . " FROM fm_responsibility_contact"
-                               . " {$this->join} fm_responsibility ON 
fm_responsibility_contact.responsibility_id = fm_responsibility.id" 
+                               . " {$this->join} fm_responsibility_role ON 
fm_responsibility_contact.responsibility_role_id = fm_responsibility_role.id"
+                               . " {$this->join} fm_responsibility ON 
fm_responsibility_role.responsibility_id = fm_responsibility.id"
                                . ' WHERE fm_responsibility_contact.id='  . 
(int) $id;
 
                        $this->db->query($sql, __LINE__, __FILE__);
@@ -740,23 +743,25 @@
                        $this->db->next_record();
                        $values = array
                                (
-                                       'id'                            => 
$this->db->f('id'),
-                                       'responsibility_id'     => 
$this->db->f('responsibility_id'),
-                                       'responsibility_name'=> 
$this->db->f('responsibility_name'),
-                                       'contact_id'            => 
$this->db->f('contact_id'),
-                                       'location_code'         => 
$this->db->f('location_code'),
-                                       'p_num'                         => 
$this->db->f('p_num'),
-                                       'p_entity_id'           => 
$this->db->f('p_entity_id'),
-                                       'p_cat_id'                      => 
$this->db->f('p_cat_id'),
-                                       'remark'                        => 
$this->db->f('remark', true),
-                                       'active_from'           => 
$this->db->f('active_from'),
-                                       'active_to'                     => 
$this->db->f('active_to'),
-                                       'created_by'            => 
$this->db->f('created_by'),
-                                       'created_on'            => 
$this->db->f('created_on'),
-                                       'expired_by'            => 
$this->db->f('expired_by'),
-                                       'expired_on'            => 
$this->db->f('expired_on'),
-                                       'priority'                      => 
$this->db->f('priority'), // FIXME - evaluate the need for this one
-                                       'ecodimb'                       => 
$this->db->f('ecodimb')
+                                       'id'                                    
        => $this->db->f('id'),
+                                       'responsibility_id'                     
=> $this->db->f('responsibility_id'),
+                                       'responsibility_role_id'        => 
$this->db->f('responsibility_role_id'),
+                                       'responsibility_name'           => 
$this->db->f('responsibility_name'),
+                                       'role_name'                             
        => $this->db->f('role_name'),
+                                       'contact_id'                            
=> $this->db->f('contact_id'),
+                                       'location_code'                         
=> $this->db->f('location_code'),
+                                       'p_num'                                 
        => $this->db->f('p_num'),
+                                       'p_entity_id'                           
=> $this->db->f('p_entity_id'),
+                                       'p_cat_id'                              
        => $this->db->f('p_cat_id'),
+                                       'remark'                                
        => $this->db->f('remark', true),
+                                       'active_from'                           
=> $this->db->f('active_from'),
+                                       'active_to'                             
        => $this->db->f('active_to'),
+                                       'created_by'                            
=> $this->db->f('created_by'),
+                                       'created_on'                            
=> $this->db->f('created_on'),
+                                       'expired_by'                            
=> $this->db->f('expired_by'),
+                                       'expired_on'                            
=> $this->db->f('expired_on'),
+                                       'priority'                              
        => $this->db->f('priority'), // FIXME - evaluate the need for this one
+                                       'ecodimb'                               
        => $this->db->f('ecodimb')
                                );
 
                        return $values;
@@ -809,8 +814,7 @@
                        $time = time() +1;
 
                        $sql = "SELECT fm_responsibility_contact.id, contact_id 
FROM fm_responsibility_contact"
-                               . " {$this->join} fm_responsibility ON 
fm_responsibility_contact.responsibility_id = fm_responsibility.id"
-                               . " {$this->join} fm_responsibility_role ON 
fm_responsibility.id = fm_responsibility_role.responsibility_id"
+                               . " {$this->join} fm_responsibility_role ON 
fm_responsibility_contact.responsibility_role_id = fm_responsibility_role.id"
                                . " WHERE fm_responsibility_role.id ={$role_id}"
                                . " AND fm_responsibility_contact.location_code 
='{$location_code}'"
                                . " AND active_from < {$time} AND (active_to > 
{$time} OR active_to = 0) AND expired_on IS NULL";
@@ -893,7 +897,8 @@
                        }
 
                        $sql = "SELECT contact_id FROM 
fm_responsibility_contact"
-                               . " {$this->join} fm_responsibility ON 
fm_responsibility_contact.responsibility_id = fm_responsibility.id"
+                               . " {$this->join} fm_responsibility_role ON 
fm_responsibility_contact.responsibility_role_id = fm_responsibility_role.id"
+                               . " {$this->join} fm_responsibility ON 
fm_responsibility_role.responsibility_id = fm_responsibility.id"
                                . " {$this->join} fm_responsibility_module ON 
fm_responsibility.id = fm_responsibility_module.responsibility_id"
                                . ' WHERE cat_id =' . (int) $data['cat_id']
                                . ' AND active = 1 AND active_from < ' . time() 
. ' AND (active_to > ' . time() . ' OR active_to = 0) AND expired_on IS NULL'
@@ -939,13 +944,12 @@
 
                public function get_responsible_user_id($data = array())
                {
-                       $responsibility_id = (int)$data['responsibility_id'];
+                       $responsibility_role_id = 
(int)$data['responsibility_role_id'];
                        $location_code = $data['location_code'];
                        $now = time();
 
                        $sql = "SELECT contact_id FROM 
fm_responsibility_contact"
-                               . " {$this->join} fm_responsibility ON 
fm_responsibility_contact.responsibility_id = fm_responsibility.id"
-                               . " WHERE fm_responsibility.id = 
{$responsibility_id}"
+                               . " WHERE responsibility_role_id = 
{$responsibility_role_id}"
                                . " AND active_from < {$now}"
                                . " AND expired_on IS NULL"
                                . " AND location_code = '{$location_code}'";

Modified: branches/dev-syncromind/property/inc/class.uievent.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uievent.inc.php  2015-07-15 
13:29:43 UTC (rev 13668)
+++ branches/dev-syncromind/property/inc/class.uievent.inc.php  2015-07-15 
13:46:42 UTC (rev 13669)
@@ -472,7 +472,7 @@
                        $item_id                                        = 
phpgw::get_var('item_id');//might be bigint
                        $id                                                     
= phpgw::get_var('id', 'int');
                        $values                                         = 
phpgw::get_var('values');
-                       $values['responsible_id']       = 
phpgw::get_var('contact', 'int', 'POST');
+                       $values['contact_id']   = phpgw::get_var('contact', 
'int', 'POST');
 
                        //                      
$GLOBALS['phpgw_info']['apps']['manual']['section'] = 'general.edit.' . $type;
 
@@ -493,7 +493,7 @@
                                        {
                                                
$receipt['error'][]=array('msg'=>lang('Please enter a description'));
                                        }
-                                       if(!isset($values['responsible_id']) || 
!$values['responsible_id'])
+                                       if(!isset($values['contact_id']) || 
!$values['contact_id'])
                                        {
                                                
$receipt['error'][]=array('msg'=>lang('Please select a responsible'));
                                        }
@@ -611,7 +611,7 @@
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
                        
$contact_data=$this->bocommon->initiate_ui_contact_lookup(array(
-                               'contact_id'            => 
$values['responsible_id'],
+                               'contact_id'            => 
$values['contact_id'],
                                'field'                         => 'contact',
                                'type'                          => 'form'));
 
@@ -640,9 +640,6 @@
                                        'value_repeat_interval'                 
=> isset($values['repeat_interval']) ? $values['repeat_interval'] : 0,
                                        'lang_repeat_interval_statustext'=> 
lang('interval'),
 
-                                       'lang_responsible'                      
        => lang('responsible'),
-                                       'responsible'                           
        => $this->bo->get_responsible(isset($values['responsible']) ? 
$values['responsible'] : ''),
-
                                        'lang_action'                           
        => lang('action'),
                                        'action'                                
                => $this->bo->get_action(isset($values['action']) ? 
$values['action'] : ''),
 

Modified: branches/dev-syncromind/property/inc/class.uilocation.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uilocation.inc.php       
2015-07-15 13:29:43 UTC (rev 13668)
+++ branches/dev-syncromind/property/inc/class.uilocation.inc.php       
2015-07-15 13:46:42 UTC (rev 13669)
@@ -205,8 +205,8 @@
 
                        $role_id = phpgw::get_var('role_id', 'int');
                        //$receipt = array();
-                       $_role = CreateObject('property.sogeneric');
-                       $_role->get_location_info('responsibility_role','');
+//                     $_role = CreateObject('property.sogeneric');
+//                     $_role->get_location_info('responsibility_role','');
 
                        //$this->save_sessiondata();
 
@@ -225,11 +225,12 @@
                                }
                                else
                                {
-                                       $role = 
$_role->read_single($data=array('id' => $role_id));
-                                       $values['contact_id']                   
= $contact_id;
-                                       $values['responsibility_id']    = 
$role['responsibility_id'];
-                                       $values['assign']                       
        = $assign;
-                                       $values['assign_orig']                  
= $assign_orig;
+//                                     $role = 
$_role->read_single($data=array('id' => $role_id));
+                                       $values['contact_id']                   
        = $contact_id;
+//                                     $values['responsibility_id']            
= $role['responsibility_id'];
+                                       $values['responsibility_role_id']       
= $role_id;
+                                       $values['assign']                       
                = $assign;
+                                       $values['assign_orig']                  
        = $assign_orig;
                                        $boresponsible = 
CreateObject('property.boresponsible');
                                        $result = 
$boresponsible->update_role_assignment($values);
                                }

Modified: branches/dev-syncromind/property/setup/setup.inc.php
===================================================================
--- branches/dev-syncromind/property/setup/setup.inc.php        2015-07-15 
13:29:43 UTC (rev 13668)
+++ branches/dev-syncromind/property/setup/setup.inc.php        2015-07-15 
13:46:42 UTC (rev 13669)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.691';
+       $setup_info['property']['version']              = '0.9.17.692';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: branches/dev-syncromind/property/setup/tables_current.inc.php
===================================================================
--- branches/dev-syncromind/property/setup/tables_current.inc.php       
2015-07-15 13:29:43 UTC (rev 13668)
+++ branches/dev-syncromind/property/setup/tables_current.inc.php       
2015-07-15 13:46:42 UTC (rev 13669)
@@ -2525,7 +2525,7 @@
                'fm_responsibility_contact' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto','precision' => 
'4','nullable' => False),
-                               'responsibility_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'responsibility_role_id' => array('type' => 
'int', 'precision' => 4,'nullable' => False),
                                'contact_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'location_code' => array('type' => 'varchar', 
'precision' => 20,'nullable' => True),
                                'p_num' => array('type' => 'varchar', 
'precision' => 15,'nullable' => True),
@@ -2543,7 +2543,7 @@
                        ),
                        'pk' => array('id'),
                        'fk' => array(
-                               'fm_responsibility' => 
array('responsibility_id' => 'id'),
+                               'fm_responsibility_role' => 
array('responsibility_role_id' => 'id'),
                                'phpgw_contact' => array('contact_id' => 
'contact_id')
                        ),
                        'ix' => array('location_code'),

Modified: branches/dev-syncromind/property/setup/tables_update.inc.php
===================================================================
--- branches/dev-syncromind/property/setup/tables_update.inc.php        
2015-07-15 13:29:43 UTC (rev 13668)
+++ branches/dev-syncromind/property/setup/tables_update.inc.php        
2015-07-15 13:46:42 UTC (rev 13669)
@@ -8531,4 +8531,35 @@
                        $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.691';
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
+       }
+
+       /**
+       * Update property version from 0.9.17.691 to 0.9.17.692
+       * Alter field name.
+       */
+       $test[] = '0.9.17.691';
+       function property_upgrade0_9_17_691()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $MetaForeignKeys = 
$GLOBALS['phpgw_setup']->oProc->m_odb->MetaForeignKeys('fm_responsibility_contact');
+
+               if(isset($MetaForeignKeys['fm_responsibility']) && 
$MetaForeignKeys['fm_responsibility'])
+               {
+                       $GLOBALS['phpgw_setup']->oProc->query("ALTER TABLE 
fm_responsibility_contact DROP CONSTRAINT 
fm_responsibility_contact_responsibility_id_fkey");
+               }
+
+               
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_responsibility_contact','responsibility_id','responsibility_role_id');
+
+               $GLOBALS['phpgw_setup']->oProc->query("ALTER TABLE 
fm_responsibility_contact"
+               . " ADD CONSTRAINT 
fm_responsibility_contact_responsibility_role_id_fkey"
+               . " FOREIGN KEY (responsibility_role_id)"
+               . " REFERENCES fm_responsibility_role (id) MATCH SIMPLE"
+               . " ON UPDATE NO ACTION ON DELETE NO ACTION"
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.692';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
        }
\ No newline at end of file




reply via email to

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