fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7130] Merge 7125:7129 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7130] Merge 7125:7129 from trunk
Date: Thu, 17 Mar 2011 14:16:53 +0000

Revision: 7130
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7130
Author:   sigurdne
Date:     2011-03-17 14:16:53 +0000 (Thu, 17 Mar 2011)
Log Message:
-----------
Merge 7125:7129 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/hrm/inc/class.bojob.inc.php
    branches/Version-1_0-branch/hrm/inc/class.sojob.inc.php
    branches/Version-1_0-branch/hrm/inc/class.uijob.inc.php
    branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
    branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.uis_agreement.inc.php
    branches/Version-1_0-branch/property/js/yahoo/uis_agreement.edit.js
    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

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

Modified: branches/Version-1_0-branch/hrm/inc/class.bojob.inc.php
===================================================================
--- branches/Version-1_0-branch/hrm/inc/class.bojob.inc.php     2011-03-17 
14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/hrm/inc/class.bojob.inc.php     2011-03-17 
14:16:53 UTC (rev 7130)
@@ -18,7 +18,7 @@
 
        class hrm_bojob
        {
-               var $start;
+               var $start = 0;
                var $query;
                var $filter;
                var $sort;
@@ -70,7 +70,7 @@
                                $this->use_session = true;
                        }
 
-                       $this->start    = phpgw::get_var('start', 'int');
+                       $this->start    = (int)phpgw::get_var('start', 'int');
                        $this->query    = phpgw::get_var('query');
                        $this->sort             = phpgw::get_var('sort');
                        $this->order    = phpgw::get_var('order');

Modified: branches/Version-1_0-branch/hrm/inc/class.sojob.inc.php
===================================================================
--- branches/Version-1_0-branch/hrm/inc/class.sojob.inc.php     2011-03-17 
14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/hrm/inc/class.sojob.inc.php     2011-03-17 
14:16:53 UTC (rev 7130)
@@ -18,12 +18,14 @@
 
        class hrm_sojob
        {
+               var $total_records = 0;
+               
                /**
                * @var array $move_child the children to be moved
                * @internal I don't think this is really needed - skwashd nov07
                */
                private $move_child = array();
-
+               
                public function __construct()
                {
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
@@ -138,23 +140,12 @@
 
                        }
 
-                       if (!$allrows)
+                       if(!$allrows)
                        {
-                               $max = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                               $max = $max + $start;
-
-                               $sjobs = array();
-                               foreach ( $jobs as $job )
-                               {
-                                       if ( isset($job) && is_array($job) )
-                                       {
-                                               $sjobs[] = $job;
-                                       }
-                               }
-                               if ( count($sjobs) )
-                               {
-                                       $jobs = $sjobs;
-                               }
+                               $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'])?intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']):15;
+                               $page = ceil( ( $start / $this->total_records ) 
* ($this->total_records/ $num_rows) );
+                               $out = array_chunk($jobs, $num_rows);
+                               $jobs = $out[$page];
                        }
 
                        $sql = "SELECT count(*) as quali_count,job_id FROM 
phpgw_hrm_quali GROUP BY job_id";
@@ -177,8 +168,8 @@
                        {
                                foreach ( $jobs as &$job )
                                {
-                                       $job['quali_count'] = (int) 
isset($quali[$job['id']]) ? $quali[$job['id']] : null;
-                                       $job['task_count']  = (int) 
isset($task[$job['id']]) ? $task[$job['id']] : null;
+                                       $job['quali_count'] =  
isset($quali[$job['id']]) ? $quali[$job['id']] : 0;
+                                       $job['task_count']  =  
isset($task[$job['id']]) ? $task[$job['id']] : 0;
                                }
 
                        }

Modified: branches/Version-1_0-branch/hrm/inc/class.uijob.inc.php
===================================================================
--- branches/Version-1_0-branch/hrm/inc/class.uijob.inc.php     2011-03-17 
14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/hrm/inc/class.uijob.inc.php     2011-03-17 
14:16:53 UTC (rev 7130)
@@ -70,7 +70,7 @@
 
                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
-                       $this->sort                             = 
$this->bo->sort;
+                       $this->sort                                     = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
                        $this->allrows                          = 
$this->bo->allrows;
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'hrm::job';

Modified: branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2011-03-17 14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2011-03-17 14:16:53 UTC (rev 7130)
@@ -2041,7 +2041,7 @@
                        $split_values = array ();                       
                        foreach ($array as $value)
                        {
-                               array_push($split_values,array ('text' => 
$value['id'], 'value' => $value['id'], 'onclick' => array('fn' => 
'onDateClick', 'obj' => array ('id_button'=>$id_buttons, 'opt'=>$value['id'], 
'hidden_name'=>$name_hidden))));
+                               array_push($split_values,array ('text' => 
"{$value['id']}", 'value' => $value['id'], 'onclick' => array('fn' => 
'onDateClick', 'obj' => array ('id_button'=>$id_buttons, 'opt'=>$value['id'], 
'hidden_name'=>$name_hidden))));
                        }       
                        return  $split_values;  
                }

Modified: branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php    
2011-03-17 14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php    
2011-03-17 14:16:53 UTC (rev 7130)
@@ -198,7 +198,16 @@
 
                public function get_list($data)
                {
-                       $values = $this->so->get_list($data);
+
+                       if(isset($data['role']) && $data['role'] == 'parent')
+                       {
+                               $values = $this->so->get_tree2($data);
+                       }
+                       else
+                       {
+                               $values = $this->so->get_list($data);
+                       }
+
                        if(isset($data['selected']) && 
is_array($data['selected']))
                        {
                                foreach ($values as &$entry)
@@ -220,4 +229,9 @@
                {
                        $this->so->delete($id);
                }
+
+               public function get_children2($id, $level, $reset = false)
+               {
+                       return $this->so->get_children2($id, $level, $reset);
+               }
        }

Modified: branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php       
2011-03-17 14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php       
2011-03-17 14:16:53 UTC (rev 7130)
@@ -352,7 +352,7 @@
                }
 
                /**
-                * used for retrive the pathe for a particular node from a 
hierarchy
+                * used for retrive the path for a particular node from a 
hierarchy
                 *
                 * @param integer $entity_id Entity id
                 * @param integer $node is the id of the node we want the path 
of

Modified: branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php    
2011-03-17 14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php    
2011-03-17 14:16:53 UTC (rev 7130)
@@ -37,6 +37,8 @@
                var $type;
                var $type_id;
                var $location_info = array();
+               var $tree = array();
+               protected $table;
 
                function __construct()
                {
@@ -1573,9 +1575,26 @@
                                                (
                                                        array
                                                        (
+                                                               'name'          
        => 'parent_id',
+                                                               'descr'         
        => lang('parent'),
+                                                               'type'          
        => 'select',
+                                                               'sortable'      
        => true,
+                                                               'nullable'      
        => true,
+                                                               'filter'        
        => false,
+                                                               'role'          
        => 'parent',
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.bogeneric.get_list',
+                                                                       
'method_input'  => array('type' => 'regulations', 'role' => 'parent', 
'selected' => '##parent_id##')
+                                                               )
+                                                       ),
+                                                       array
+                                                       (
                                                                'name' => 
'name',
                                                                'descr' => 
lang('name'),
-                                                               'type' => 
'varchar'
+                                                               'type' => 
'varchar',
+                                                               'sortable'      
=> true,
                                                        ),
                                                        array
                                                        (
@@ -2268,6 +2287,9 @@
                        {
                                $value_set = array_merge($value_set, 
$data_attribute['value_set']);
                        }
+
+                       $has_to_move = array();
+
                        foreach($this->location_info['fields'] as $field)
                        {
                                if (isset($field['filter']) && $field['filter'])
@@ -2278,6 +2300,26 @@
                                        }
                                }
                                $value_set[$field['name']] = 
$this->_db->db_addslashes($data[$field['name']]);
+
+                               // keep hierarchy in order
+                               if(isset($field['role']) && $field['role'] == 
'parent')
+                               {
+                                       //FIXME                         
+                                       $this->_db->query("SELECT parent_id 
FROM $table WHERE 
{$this->location_info['id']['name']}='{$data['id']}'",__LINE__,__FILE__);
+                                       $this->_db->next_record();
+                                       $orig_parent_id = 
$this->_db->f('parent_id');
+                                       
+                                       if($orig_parent_id && 
(int)$orig_parent_id != (int)$data['parent_id'])
+                                       {
+
+                                               $this->_db->query("SELECT 
{$this->location_info['id']['name']} as id FROM $table WHERE parent_id 
='{$data['id']}'",__LINE__,__FILE__);
+
+                                               while($this->_db->next_record())
+                                               {
+                                                       $has_to_move[] = 
$this->_db->f('id');
+                                               }
+                                       }
+                               }
                        }
 
                        if(isset($this->location_info['default']) && 
is_array($this->location_info['default']))
@@ -2293,8 +2335,15 @@
 
                        $value_set      = 
$this->_db->validate_update($value_set);
                        $this->_db->transaction_begin();
-                       $this->_db->query("UPDATE $table SET {$value_set} WHERE 
{$this->location_info['id']['name']}='" . $data['id']. "'",__LINE__,__FILE__);
+                       $this->_db->query("UPDATE $table SET {$value_set} WHERE 
{$this->location_info['id']['name']} = '{$data['id']}'",__LINE__,__FILE__);
 
+                       // keep hierarchy in order
+                       foreach($has_to_move as $id)
+                       {
+                               $value_set      = 
$this->_db->validate_update(array('parent_id' => $orig_parent_id));
+                               $this->_db->query("UPDATE $table SET 
{$value_set} WHERE {$this->location_info['id']['name']} = 
'{$id}'",__LINE__,__FILE__);
+                       }
+
 /*                     //FIXME
                        if (isset($data_attribute['history_set']) && 
is_array($data_attribute['history_set']))
                        {
@@ -2319,7 +2368,206 @@
                        {
                                return false;
                        }
+
+                       $has_to_move = array();
+
+                       $this->_db->transaction_begin();
+
+                       foreach($this->location_info['fields'] as $field)
+                       {
+                               // keep hierarchy in order
+                               if(isset($field['role']) && $field['role'] == 
'parent')
+                               {
+                                       $this->_db->query("SELECT parent_id 
FROM $table WHERE 
{$this->location_info['id']['name']}='{$id}'",__LINE__,__FILE__);
+                                       $this->_db->next_record();
+                                       $orig_parent_id = 
$this->_db->f('parent_id');
+                                       
+                                       $this->_db->query("SELECT 
{$this->location_info['id']['name']} as id FROM $table WHERE parent_id 
='{$id}'",__LINE__,__FILE__);
+
+                                       while($this->_db->next_record())
+                                       {
+                                               $has_to_move[] = 
$this->_db->f('id');
+                                       }
+                               }
+                       }
+
                        $this->_db->query("DELETE FROM $table WHERE 
{$this->location_info['id']['name']}='{$id}'",__LINE__,__FILE__);
+
+                       // keep hierarchy in order
+                       foreach($has_to_move as $id)
+                       {
+                               $value_set      = 
$this->_db->validate_update(array('parent_id' => $orig_parent_id));
+                               $this->_db->query("UPDATE $table SET 
{$value_set} WHERE {$this->location_info['id']['name']} = 
'{$id}'",__LINE__,__FILE__);
+                       }
+
+                       $this->_db->transaction_commit();
                }
+
+
+               public function get_tree2($data)
+               {
+                       $values = array();
+
+                       $this->get_location_info($data['type'], 
$data['type_id']);
+
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return $values;
+                       }
+                       $this->table = $table;
+
+                       $filtermthod = 'WHERE (parent_id = 0 OR parent_id IS 
NULL)';
+
+                       if (isset($data['filter']) && is_array($data['filter']))
+                       {
+                               $_filter = array();
+                               foreach ($data['filter'] as $_field => $_value)
+                               {
+                                       $_filter[] = "{$_field} = '{$_value}'";
+                               }
+                               if($_filter)
+                               {
+                                       $filtermthod .= implode(' AND ', 
$_filter);
+                               }
+                       }
+
+                       $order          = isset($data['order']) && 
$data['order'] ? $data['order'] :'';
+
+                       if ($order)
+                       {
+                               $ordermethod = " ORDER BY {$table}.{$order} 
{$sort}";
+                       }
+                       else
+                       {
+                               $ordermethod = " ORDER BY 
{$table}.{$this->location_info['id']['name']} ASC";
+                       }
+
+                       foreach ($this->location_info['fields'] as $field)
+                       {
+                               $fields[] = $field['name'];
+                       }
+
+                       // Add extra info to name
+                       if(isset($data['id_in_name']) && $data['id_in_name'])
+                       {
+                               $id_in_name = 'id';     
+                               if (in_array($data['id_in_name'], $fields))
+                               {
+                                       $id_in_name = $data['id_in_name'];
+                               }
+                       }
+
+                       $fields = implode(',', $fields);
+
+                       $this->_db->query("SELECT id, {$fields} FROM {$table} 
{$filtermthod} {$ordermethod}",__LINE__,__FILE__);
+
+                       $return_fields = isset($data['fields']) && 
$data['fields'] && is_array($data['fields']) ? $data['fields'] : array();
+//-----------
+
+
+                       $values = array();
+                       $i = 0;
+                       while ($this->_db->next_record())
+                       {
+                               $_extra = $this->_db->f($id_in_name);
+                               $id             = $this->_db->f('id');
+                               if(!$name = $this->_db->f('name', true))
+                               {
+                                       $name   = $this->_db->f('descr', true);
+                               }
+
+                               if($_extra)
+                               {
+                                       $name = "{$_extra} - {$name}";
+                               }
+
+                               $values[$i] = array
+                               (
+                                       'id'            => $id,
+                                       'name'          => $name,
+                                       'parent_id'     => 0
+                               );
+
+                               foreach ($return_fields as $return_field)
+                               {
+                                       $values[$i][$return_field] = 
$this->_db->f($return_field, true);
+                               }
+
+                               $i++;
+                       }
+
+
+                       $this->tree = array();
+
+                       foreach($values as $value)
+                       {
+                               $this->tree[] = $value;
+                               $this->get_children2($value['id'], 1);
+                       }
+                       return $this->tree;
+               }
+
+               public function get_children2($parent, $level, $reset = false)
+               {
+                       if($reset)
+                       {
+                               $this->tree = array();
+                       }
+                       $db = clone($this->_db);
+                       if(!$table = $this->table)
+                       {
+                               return $this->tree;
+                       }
+                       $sql = "SELECT * FROM {$table} WHERE parent_id = 
{$parent} ORDER BY name ASC";
+                       $db->query($sql,__LINE__,__FILE__);
+
+                       while ($db->next_record())
+                       {
+                               $id     = $db->f('id');
+                               $this->tree[] = array
+                               (
+                                       'id'            => $id,
+                                       'name'          => 
str_repeat('..',$level) . $db->f('name',true),
+                                       'parent_id'     => $db->f('parent_id')
+                               );
+                               $this->get_children2($id, $level+1);
+                       }
+                       return $this->tree;
+               } 
+
+               /**
+                * used for retrive the path for a particular node from a 
hierarchy
+                *
+                * @param integer $node is the id of the node we want the path 
of
+                * @return array $path Path
+                */
+
+               public function get_path($data)
+               {
+                       $this->get_location_info($data['type'], 
$data['type_id']);
+
+                       if (!isset($this->location_info['table']) || !$table = 
$this->location_info['table'])
+                       {
+                               return array();
+                       }
+                       $this->table = $table;
+
+                       $sql = "SELECT name, parent_id FROM {$table} WHERE id = 
'{$data['id']}'";
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       $this->_db->next_record();
+
+                       $parent_id = $this->_db->f('parent_id');
+
+                       $name = $this->_db->f('name', true);
+
+                       $path = array($name);
+
+                       if ($parent_id)
+                       {
+                               $path = 
array_merge($this->get_path(array('type' => $data['type'], 'id' => 
$parent_id)), $path);
+                       }
+                       return $path;
+               }
        }
 

Modified: branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php    
2011-03-17 14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php    
2011-03-17 14:16:53 UTC (rev 7130)
@@ -792,6 +792,27 @@
 
                                                $field['valueset'] = 
execMethod($field['values_def']['method'],$method_input);
                                        }
+
+                                       if(isset($values['id']) && 
$values['id'] && isset($field['role']) && $field['role'] == 'parent')
+                                       {
+                                               // can not select it self as 
parent.
+                                               $exclude = array($values['id']);
+                                               $children = 
$this->bo->get_children2($values['id'], 0,true);
+
+                                               foreach($children as $child)
+                                               {
+                                                       $exclude[] = 
$child['id']; 
+                                               }
+
+                                               $k = count($field['valueset']);
+                                               for ($i=0; $i<$k; $i++)
+                                               {
+                                                       if 
(in_array($field['valueset'][$i]['id'],$exclude))
+                                                       {
+                                                               
unset($field['valueset'][$i]);
+                                                       }
+                                               }
+                                       }
                                }
                        }
 

Modified: branches/Version-1_0-branch/property/inc/class.uis_agreement.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uis_agreement.inc.php        
2011-03-17 14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/inc/class.uis_agreement.inc.php        
2011-03-17 14:16:53 UTC (rev 7130)
@@ -926,12 +926,11 @@
                                }
                        }
 
-                       $s_agreement = 
$this->bo->read_single(array('s_agreement_id'=>$id));
 
                        /* Preserve attribute values from post */
                        if(isset($receipt['error']) && (isset( 
$values_attribute) && is_array( $values_attribute)))
                        {
-                               $s_agreement = 
$this->bocommon->preserve_attribute_values($s_agreement,$values_attribute);
+                               $values = 
$this->bocommon->preserve_attribute_values($values,$values_attribute);
                        }
 
                        $jscal = CreateObject('phpgwapi.jscalendar');
@@ -939,10 +938,13 @@
                        $jscal->add_listener('values_end_date');
                        $jscal->add_listener('values_termination_date');
 
+                       $this->member_id = $values['member_of'] ? 
$values['member_of'] : $this->member_id;
+
                        if ($id)
                        {
-                               $this->cat_id = 
($s_agreement['cat_id']?$s_agreement['cat_id']:$this->cat_id);
-                               $this->member_id = 
($s_agreement['member_of']?$s_agreement['member_of']:$this->member_id);
+                               $values = 
$this->bo->read_single(array('s_agreement_id'=>$id));
+                               $this->cat_id = 
($values['cat_id']?$values['cat_id']:$this->cat_id);
+                               $this->member_id = $values['member_of'] ? 
$values['member_of'] : $this->member_id;
                                $list = $this->bo->read_details($id);
 
                                $uicols         = $this->bo->uicols;
@@ -961,11 +963,11 @@
                                        $table_update[] = array
                                                (
                                                        'img_cal'               
                        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
-                                                       'lang_datetitle'        
        => lang('Select date'),
-                                                       'lang_new_index'        
        => lang('New index'),
+                                                       'lang_datetitle'        
                => lang('Select date'),
+                                                       'lang_new_index'        
                => lang('New index'),
                                                        
'lang_new_index_statustext'     => lang('Enter a new index'),
                                                        'lang_date_statustext'  
        => lang('Select the date for the update'),
-                                                       'lang_update'           
        => lang('Update'),
+                                                       'lang_update'           
                => lang('Update'),
                                                        
'lang_update_statustext'        => lang('update selected investments')
                                                );
                                }
@@ -981,18 +983,18 @@
 
                        
$vendor_data=$this->bocommon->initiate_ui_vendorlookup(array
                                (
-                                       'vendor_id'     => 
$s_agreement['vendor_id'],
-                                       'vendor_name'   => 
$s_agreement['vendor_name']));
+                                       'vendor_id'     => $values['vendor_id'],
+                                       'vendor_name'   => 
$values['vendor_name']));
 
                        
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array
                                (
-                                       'b_account_id'          => 
$s_agreement['b_account_id'],
-                                       'b_account_name'        => 
$s_agreement['b_account_name']));
+                                       'b_account_id'          => 
$values['b_account_id'],
+                                       'b_account_name'        => 
$values['b_account_name']));
 
                        
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array
                                (
-                                       'ecodimb'                       => 
$s_agreement['ecodimb'],
-                                       'ecodimb_descr'         => 
$s_agreement['ecodimb_descr']));
+                                       'ecodimb'                       => 
$values['ecodimb'],
+                                       'ecodimb_descr'         => 
$values['ecodimb_descr']));
 
                        $alarm_data=$this->bocommon->initiate_ui_alarm(array
                                (
@@ -1028,10 +1030,10 @@
                        $config->read();
                        $link_to_files = $config->config_data['files_url'];
 
-                       $j      = count($s_agreement['files']);
+                       $j      = count($values['files']);
                        for ($i=0;$i<$j;$i++)
                        {
-                               
$s_agreement['files'][$i]['file_name']=urlencode($s_agreement['files'][$i]['name']);
+                               
$values['files'][$i]['file_name']=urlencode($values['files'][$i]['name']);
                        }
 
                        $link_download = array
@@ -1045,7 +1047,7 @@
 
                        $tabs = array();
 
-                       if (isset($s_agreement['attributes']) && 
is_array($s_agreement['attributes']))
+                       if (isset($values['attributes']) && 
is_array($values['attributes']))
                        {
 
                /*              foreach ($values['attributes'] as & $attribute)
@@ -1069,7 +1071,7 @@
                                $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
 
                                $location = $this->acl_location;
-                               $attributes_groups = 
$this->bo->get_attribute_groups($location, $s_agreement['attributes']);
+                               $attributes_groups = 
$this->bo->get_attribute_groups($location, $values['attributes']);
 
                                $attributes = array();
                                foreach ($attributes_groups as $group)
@@ -1080,7 +1082,7 @@
                                        }
                                }
                                unset($attributes_groups);
-                               unset($s_agreement['attributes']);
+                               unset($values['attributes']);
 
                                $tabs['items']  = array('label' => 
lang('items'), 'link' => '#items');
                        }
@@ -1311,7 +1313,7 @@
                        $myButtons[1] = array
                                (
                                        'name'   => "1",
-                                       'values'  => json_encode(array( 
array(id =>'values[time][days]', 'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['day_list'],"1_0",'values[time][days]'
 ), 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
+                                       'values'  => json_encode(array( 
array('id' =>'values[time][days]', 'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['day_list'],"1_0",'values[time][days]'
 ), 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
                                                                                
                        array('id' =>'values[time][hours]', 'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['hour_list'],"1_1",'values[time][hours]'),
 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
                                                                                
                        array('id' =>'values[time][mins]', 'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['minute_list'],"1_2",'values[time][mins]'),
 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
                                                                                
                        array('id' =>'values[user_id]',  'type'=>'menu',  
'value'=>$this->bocommon->make_menu_user($alarm_data['add_alarm']['user_list'],"1_3",'values[user_id]'),
 
'label'=>$this->bocommon->choose_select($alarm_data['add_alarm']['user_list'],"name"),'classname'=>
 'actionsFilter', 
'value_hidden'=>$this->bocommon->choose_select($alarm_data['add_alarm']['user_list'],"id")),
@@ -1319,7 +1321,14 @@
                                ))
                        );
 
-
+/*
+_debug_array(array( array('id' =>'values[time][days]', 'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['day_list'],"1_0",'values[time][days]'
 ), 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
+                                                                               
                        array('id' =>'values[time][hours]', 'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['hour_list'],"1_1",'values[time][hours]'),
 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
+                                                                               
                        array('id' =>'values[time][mins]', 'type'=>'menu',  
'value'=>$this->bocommon->make_menu_date($alarm_data['add_alarm']['minute_list'],"1_2",'values[time][mins]'),
 'label'=>"0", 'classname'=> 'actionsFilter', 'value_hidden'=>"0"),
+                                                                               
                        array('id' =>'values[user_id]',  'type'=>'menu',  
'value'=>$this->bocommon->make_menu_user($alarm_data['add_alarm']['user_list'],"1_3",'values[user_id]'),
 
'label'=>$this->bocommon->choose_select($alarm_data['add_alarm']['user_list'],"name"),'classname'=>
 'actionsFilter', 
'value_hidden'=>$this->bocommon->choose_select($alarm_data['add_alarm']['user_list'],"id")),
+                                                                               
                        array('id' =>'values[add_alarm]',  'type'=>'buttons', 
'value'=>'Add',  'label'=>$alarm_data['add_alarm']['lang_add'],   'funct'=> 
'onAddClick' , 'classname'=> 'actionButton', 'value_hidden'=>"")));
+die();
+*/
                        //---------items------------------------------------
                        $datavalues[1] = array
                                (
@@ -1371,22 +1380,24 @@
                                (
                                        'name'                  => "2",
                                        'values'                =>      
json_encode(array(      array('type'=>'text', 'label'=>' New index:', 
'classname'=> 'index-opt'),
-                                                                               
                                        array('id' =>'values[new_index]', 
'type'=>'inputText', size=>12, 'classname'=> 'index-opt'),
-                                                                               
                                        array('id' 
=>'values[update]','type'=>'buttons',        'value'=>'Update',      
'label'=>'Update',      funct=> onUpdateClick , 'classname'=> '')
+                                                                               
                                        array('id' =>'values[new_index]', 
'type'=>'inputText', 'size'=>12, 'classname'=> 'index-opt'),
+                                                                               
                                        array('id' 
=>'values[update]','type'=>'buttons',        'value'=>'Update',      
'label'=>'Update',      'funct'=> 'onUpdateClick' , 'classname'=> '')
                                ))
                        );
 
                        $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
 
-                       for($z=0; $z<count($s_agreement['files']); $z++)
+                       for($z=0; $z<count($values['files']); $z++)
                        {
-                               if ($link_to_files != '') {
-                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_to_files.'/'.$s_agreement['files'][$z]['directory'].'/'.$s_agreement['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$s_agreement['files'][$z]['name'].'</a>';
+                               if ($link_to_files != '')
+                               {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_to_files.'/'.$values['files'][$z]['directory'].'/'.$values['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$values['files'][$z]['name'].'</a>';
                                }
-                               else {
-                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$s_agreement['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$s_agreement['files'][$z]['name'].'</a>';
+                               else
+                               {
+                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$values['files'][$z]['file_name'].'" 
target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$values['files'][$z]['name'].'</a>';
                                }
-                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$s_agreement['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'" style="cursor:help">';
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$values['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'" style="cursor:help">';
                        }
 
                        $datavalues[2] = array
@@ -1461,7 +1472,7 @@
                                        'fileupload'                            
                => true,
                                        'link_view_file'                        
                => $GLOBALS['phpgw']->link('/index.php',$link_file_data),
                                        'link_to_files'                         
                => $link_to_files,
-                                       'files'                                 
                        => $s_agreement['files'],
+                                       'files'                                 
                        => $values['files'],
                                        'lang_files'                            
                => lang('files'),
                                        'lang_filename'                         
                => lang('Filename'),
                                        'lang_file_action'                      
                => lang('Delete file'),
@@ -1478,7 +1489,7 @@
                                        'lang_save'                             
                        => lang('save'),
                                        'lang_cancel'                           
                => lang('cancel'),
                                        'lang_apply'                            
                => lang('apply'),
-                                       'value_cat'                             
                        => $s_agreement['cat'],
+                                       'value_cat'                             
                        => $values['cat'],
                                        'lang_apply_statustext'                 
        => lang('Apply the values'),
                                        'lang_cancel_statustext'                
        => lang('Leave the service agreement untouched and return back to the 
list'),
                                        'lang_save_statustext'                  
        => lang('Save the service agreement and return back to the list'),
@@ -1492,7 +1503,7 @@
                                        'member_of_list'                        
                => $member_of_data['cat_list'],
 
                                        'attributes_group'                      
                => $attributes,
-                                       'lookup_functions'                      
                => $s_agreement['lookup_functions'],
+                                       'lookup_functions'                      
                => $values['lookup_functions'],
                                        'dateformat'                            
                => $dateformat,
 
                                        'img_cal'                               
                        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
@@ -1500,39 +1511,39 @@
 
                                        'lang_start_date_statustext'            
=> lang('Select the estimated end date for the Project'),
                                        'lang_start_date'                       
                => lang('start date'),
-                                       'value_start_date'                      
                => $s_agreement['start_date'],
+                                       'value_start_date'                      
                => $values['start_date'],
 
                                        'lang_end_date_statustext'              
        => lang('Select the estimated end date for the Project'),
                                        'lang_end_date'                         
                => lang('end date'),
-                                       'value_end_date'                        
                => $s_agreement['end_date'],
+                                       'value_end_date'                        
                => $values['end_date'],
 
                                        'lang_termination_date_statustext'      
=> lang('Select the estimated termination date'),
                                        'lang_termination_date'                 
        => lang('termination date'),
-                                       'value_termination_date'                
        => $s_agreement['termination_date'],
+                                       'value_termination_date'                
        => $values['termination_date'],
 
                                        'vendor_data'                           
                => $vendor_data,
 
                                        'lang_budget'                           
                => lang('Budget'),
                                        'lang_budget_statustext'                
        => lang('Budget for selected year'),
-                                       'value_budget'                          
                => $s_agreement['budget'],
+                                       'value_budget'                          
                => $values['budget'],
                                        'currency'                              
                        => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
 
                                        'lang_year'                             
                        => lang('year'),
                                        'lang_year_statustext'                  
        => lang('Budget year'),
-                                       'year'                                  
                        => 
$this->bocommon->select_list($s_agreement['year'],$this->bo->get_year_list($id)),
+                                       'year'                                  
                        => 
$this->bocommon->select_list($values['year'],$this->bo->get_year_list($id)),
 
                                        'b_account_data'                        
                => $b_account_data,
                                        'ecodimb_data'                          
                => $ecodimb_data,
                                        'lang_category'                         
                => lang('category'),
                                        'lang_no_cat'                           
                => lang('Select category'),
-                                       'cat_select'                            
                => $this->cats->formatted_xslt_list(array('select_name' => 
'values[order_category]','selected' => $s_agreement['order_category'])),
+                                       'cat_select'                            
                => $this->cats->formatted_xslt_list(array('select_name' => 
'values[order_category]','selected' => $values['order_category'])),
 
                                        'lang_name'                             
                        => lang('name'),
                                        'lang_name_statustext'                  
        => lang('name'),
-                                       'value_name'                            
                => $s_agreement['name'],
+                                       'value_name'                            
                => $values['name'],
                                        'lang_descr'                            
                => lang('descr'),
                                        'lang_descr_statustext'                 
        => lang('descr'),
-                                       'value_descr'                           
                => $s_agreement['descr'],
+                                       'value_descr'                           
                => $values['descr'],
                                        'table_add'                             
                        => $table_add,
                                        'values'                                
                        => $content,
                                        'table_header'                          
                => $table_header,

Modified: branches/Version-1_0-branch/property/js/yahoo/uis_agreement.edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/uis_agreement.edit.js 
2011-03-17 14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/js/yahoo/uis_agreement.edit.js 
2011-03-17 14:16:53 UTC (rev 7130)
@@ -185,7 +185,7 @@
        {
                //Create ROW
                newTR = document.createElement('tr');
-               //RowChecked
+               //RowChecked
                td_empty(td_count);
                CreateRowChecked("mychecks_update");
 

Modified: branches/Version-1_0-branch/property/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/setup.inc.php    2011-03-17 
14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/setup/setup.inc.php    2011-03-17 
14:16:53 UTC (rev 7130)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.613';
+       $setup_info['property']['version']              = '0.9.17.614';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: branches/Version-1_0-branch/property/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2011-03-17 14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2011-03-17 14:16:53 UTC (rev 7130)
@@ -2221,6 +2221,7 @@
                'fm_regulations' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
4,'nullable' => False),
+                               'parent_id' => array('type' => 
'int','precision' => 4,'nullable' => True),
                                'name' =>  array('type' => 
'varchar','precision' => 255,'nullable' => False),
                                'descr' => array('type' => 'text','nullable' => 
True),
                                'external_ref' =>  array('type' => 
'varchar','precision' => 255,'nullable' => True),

Modified: branches/Version-1_0-branch/property/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2011-03-17 14:12:18 UTC (rev 7129)
+++ branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2011-03-17 14:16:53 UTC (rev 7130)
@@ -5145,7 +5145,27 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.613 to 0.9.17.614
+       * Add parent to regulations
+       * 
+       */
 
+       $test[] = '0.9.17.613';
+       function property_upgrade0_9_17_613()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_regulations','parent_id', 
array('type' => 'int','precision' => 4,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.614';
+                       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




reply via email to

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