fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10401] property: condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [10401] property: condition survey
Date: Wed, 31 Oct 2012 14:48:24 +0000

Revision: 10401
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10401
Author:   sigurdne
Date:     2012-10-31 14:48:23 +0000 (Wed, 31 Oct 2012)
Log Message:
-----------
property: condition survey

Modified Paths:
--------------
    trunk/property/inc/class.bocondition_survey.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.soadmin_location.inc.php
    trunk/property/inc/class.socondition_survey.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/setup/default_records.inc.php
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php

Modified: trunk/property/inc/class.bocondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.bocondition_survey.inc.php 2012-10-31 14:42:59 UTC 
(rev 10400)
+++ trunk/property/inc/class.bocondition_survey.inc.php 2012-10-31 14:48:23 UTC 
(rev 10401)
@@ -43,7 +43,7 @@
                var $location_info = array();
                var $appname;
                var $allrows;
-               public $acl_location = '.project.bocondition_survey';
+               public $acl_location = '.project.condition_survey';
 
                function __construct($session=false)
                {
@@ -125,25 +125,10 @@
                        return $column_list;
                }
 
-               public function read($filter = array())
+               public function read($data = array())
                {
-                       if (! $filter )
-                       {
-                               foreach ( $this->location_info['fields'] as 
$field )
-                               {
-                                       if (isset($field['filter']) && 
$field['filter'])
-                                       {
-                                               $filter[$field['name']] = 
phpgw::get_var($field['name']);
-                                       }
-                               }
-                       }
-
-                       $values = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                               'allrows'=>$this->allrows),$filter);
-
+                       $values = $this->so->read($data);
                        $this->total_records = $this->so->total_records;
-                       $this->uicols = $this->so->uicols;
-
                        return $values;
                }
 

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2012-10-31 14:42:59 UTC (rev 
10400)
+++ trunk/property/inc/class.menu.inc.php       2012-10-31 14:48:23 UTC (rev 
10401)
@@ -482,6 +482,16 @@
                                                        'text'  => 
lang('Request condition_type'),
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'r_condition_type') )
                                                ),
+                                               'condition_survey_cats' => array
+                                               (
+                                                       'text'  => 
lang('condition survey Categories'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.uicategories.index', 'appname' => 'property', 'location' => 
'.project.condition_survey', 'global_cats' => 'true', 'menu_selection' => 
'admin::property::condition_survey_cats') )
+                                               ),
+                                               'condition_survey_status'       
=> array
+                                               (
+                                                       'text'  => 
lang('condition survey status'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'condition_survey_status') )
+                                               ),
                                                'authorities_demands'   => array
                                                (
                                                        'text'  => 
lang('authorities demands'),
@@ -794,7 +804,7 @@
                                                        (
                                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uicondition_survey.index')),
                                                                'text'  => 
lang('condition survey'),
-                                                               'image'         
=> array('property', 'project_request')
+                                                               'image'         
=> array('property', 'condition_survey')
                                                        ),
                                                        'request'       => array
                                                        (

Modified: trunk/property/inc/class.soadmin_location.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_location.inc.php   2012-10-31 14:42:59 UTC 
(rev 10400)
+++ trunk/property/inc/class.soadmin_location.inc.php   2012-10-31 14:48:23 UTC 
(rev 10401)
@@ -476,7 +476,16 @@
 
                function get_tables_to_alter()
                {
-                       $tables = 
array('fm_project','fm_tts_tickets','fm_request','fm_document','fm_investment');
+                       $tables = array
+                       (
+                               'fm_project',
+                               'fm_tts_tickets',
+                               'fm_request',
+                               'fm_document',
+                               'fm_investment',
+                               'fm_condition_survey'
+                       );
+
                        $entity                 = 
CreateObject('property.soadmin_entity');
                        $entity_list    = $entity->read(array('allrows' => 
true));
                        foreach($entity_list as $entry)

Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2012-10-31 14:42:59 UTC 
(rev 10400)
+++ trunk/property/inc/class.socondition_survey.inc.php 2012-10-31 14:48:23 UTC 
(rev 10401)
@@ -42,19 +42,17 @@
                        $this->like             = & $this->db->like;
                }
 
-               function read($data)
+               function read($data = array())
                {
-                       if(is_array($data))
-                       {
-                               $start  = 
(isset($data['start'])?$data['start']:0);
-                               $filter = 
(isset($data['filter'])?$data['filter']:'none');
-                               $query = 
(isset($data['query'])?$data['query']:'');
-                               $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
-                               $order = 
(isset($data['order'])?$data['order']:'');
-                               $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
-                       }
+                       $start          = isset($data['start'])  ? (int) 
$data['start'] : 0;
+                       $filter         = isset($data['filter']) ? 
$data['filter'] : 'none';
+                       $query          = isset($data['query']) ? 
$data['query'] : '';
+                       $sort           = isset($data['sort']) ? $data['sort'] 
: 'DESC';
+                       $order          = isset($data['order']) ? 
$data['order'] : '' ;
+                       $cat_id         = isset($data['cat_id']) ? 
(int)$data['cat_id'] : 0;
+                       $allrows        = isset($data['allrows']) ? 
$data['allrows'] : '';
 
+                       $table = 'fm_condition_survey';
                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
@@ -65,19 +63,19 @@
                        }
 
                        $where = 'WHERE';
-                       if ($cat_id > 0)
+                       if ($cat_id)
                        {
-                               $filtermethod .= " $where category='$cat_id' ";
+                               $filtermethod .= " {$where} category = 
{$cat_id}";
                                $where = 'AND';
                        }
 
                        if($query)
                        {
                                $query                  = 
$this->db->db_addslashes($query);
-                               $querymethod    = " $where name $this->like 
'%$query%'";
+                               $querymethod    = " {$where} name {$this->like} 
'%{$query}%'";
                        }
 
-                       $sql = "SELECT * FROM fm_custom $filtermethod 
$querymethod";
+                       $sql = "SELECT * FROM {$table} $filtermethod 
$querymethod";
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2012-10-31 14:42:59 UTC (rev 
10400)
+++ trunk/property/inc/class.sogeneric.inc.php  2012-10-31 14:48:23 UTC (rev 
10401)
@@ -1139,6 +1139,54 @@
                                                'menu_selection'        => 
'admin::property::accounting::dimb_role'
                                        );
                                break;
+                       case 'condition_survey_status':
+                               $info = array
+                                       (
+                                               'table'                         
=> 'fm_condition_survey_status',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'int'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'descr',
+                                                               'descr' => 
lang('descr'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'sorting',
+                                                               'descr' => 
lang('sorting'),
+                                                               'type' => 
'integer',
+                                                               'sortable'=> 
true
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'in_progress',
+                                                               'descr' => 
lang('In progress'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'delivered',
+                                                               'descr' => 
lang('delivered'),
+                                                               'type' => 
'checkbox'
+                                                       ),
+                                                       array
+                                                       (
+                                                               'name' => 
'closed',
+                                                               'descr' => 
lang('closed'),
+                                                               'type' => 
'checkbox'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit status'),
+                                               'add_msg'                       
=> lang('add status'),
+                                               'name'                          
=> lang('request status'),
+                                               'acl_app'                       
=> 'property',
+                                               'acl_location'          => 
'.admin',
+                                               'menu_selection'        => 
'admin::property::condition_survey_status'
+                                       );
+                               break;
+
                                //-------- ID type varchar
                        case 'project_status':
                                $info = array

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-10-31 14:42:59 UTC 
(rev 10400)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-10-31 14:48:23 UTC 
(rev 10401)
@@ -71,7 +71,29 @@
                        phpgwapi_yui::load_widget('datatable');
                        phpgwapi_yui::load_widget('paginator');
 
+                       $cats   = CreateObject('phpgwapi.categories', -1, 
'property', $this->acl_location);
+                       $cats->supress_info     = true;
+
+                       $categories = 
$cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->cat_id,'globals' => true,'use_acl' => $this->_category_acl));
+                       $default_value = array ('cat_id'=>'','name'=> lang('no 
category'));
+                       array_unshift ($categories['cat_list'],$default_value);
+                       
+                       foreach ($categories['cat_list'] as & $_category)
+                       {
+                               $_category['id'] = $_category['cat_id'];
+                       }
+
                        $survey_type_array = array();
+                       $survey_type_array[] = array
+                       (
+                               'id'    => 0,
+                               'name'  => 'Select'
+                       );
+                       $survey_type_array[] = array
+                       (
+                               'id'    => 1,
+                               'name'  => 'type 1'
+                       );
 
                        $data = array(
                                'datatable_name'        => lang('condition 
survey'),
@@ -79,9 +101,9 @@
                                        'toolbar' => array(
                                                'item' => array(
                                                        array('type' => 
'filter',
-                                                               'name' => 
'project_type',
-                                                               'text' => 
lang('Project_type') . ':',
-                                                               'list' => 
$survey_type_array,
+                                                               'name' => 
'cat_id',
+                                                               'text' => 
lang('category') . ':',
+                                                               'list' => 
$categories['cat_list'],
                                                        ),
                                                        array('type' => 'text',
                                                                'text' => 
lang('search'),
@@ -94,10 +116,22 @@
                                                        ),
                                                        array(
                                                                'type' => 
'link',
-                                                               'value' => 
lang('t_new_project'),
+                                                               'value' => 
lang('new survey'),
                                                                'href' => 
self::link(array('menuaction' => 'property.uicondition_survey.add')),
                                                                'class' => 
'new_item'
                                                        ),
+                                                       array(
+                                                               'type' => 
'link',
+                                                               'value' => 
lang('download'),
+                                                               'href' => 
self::link(array('menuaction' => 'property.uicondition_survey.index', 'export' 
=> true, 'allrows' => true)),
+                                                               'class' => 
'new_item'
+                                                       ),
+                                                       array(
+                                                               'type' => 
'link',
+                                                               'value' => 
$_SESSION['allrows'] ? lang('Show only active') : lang('Show all'),
+                                                               'href' => 
self::link(array('menuaction' => 'property.uicondition_survey.index', 'allrows' 
=> true))
+                                                       ),
+
                                                ),
                                        ),
                                ),
@@ -105,25 +139,25 @@
                                        'source' => 
self::link(array('menuaction' => 'property.uicondition_survey.index', 
'phpgw_return_as' => 'json')),
                                        'field' => array(
                                                array(
-                                                       'key' => 'name',
-                                                       'label' => 
lang('Project name'),
-                                                       'sortable' => true
-                                               ),
-                                               array(
                                                        'key' => 'id',
                                                        'label' => lang('ID'),
                                                        'sortable' => true,
                                                        'formatter' => 
'YAHOO.portico.formatLink'
                                                ),
                                                array(
+                                                       'key' => 'name',
+                                                       'label' => lang('name'),
+                                                       'sortable' => true
+                                               ),
+                                               array(
                                                        'key' => 'description',
-                                                       'label' => 
lang('Project description'),
+                                                       'label' => 
lang('description'),
                                                        'sortable' => false,
                                                        'editor' => 'new 
YAHOO.widget.TextboxCellEditor({disableBtns:true})'
                                                ),
                                                array(
-                                                       'key' => 
'project_type_label',
-                                                       'label' => 
lang('Project type'),
+                                                       'key' => 
'survey_type_label',
+                                                       'label' => lang('type'),
                                                        'sortable' => false
                                                ),
                                                array(
@@ -140,7 +174,7 @@
                                        (
                                                array
                                                (
-                                                       'name'          => 
'project_id',
+                                                       'name'          => 
'survey_id',
                                                        'source'        => 'id'
                                                ),
                                        )
@@ -148,8 +182,8 @@
 
                        $data['datatable']['actions'][] = array
                                        (
-                                               'my_name'               => 
'new_activity',
-                                               'text'                  => 
lang('t_new_activity'),
+                                               'my_name'               => 
'edit_survey',
+                                               'text'                  => 
lang('edit'),
                                                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                (
                                                        'menuaction'    => 
'logistic.uiactivity.edit'
@@ -157,6 +191,8 @@
                                                'parameters'    => 
json_encode($parameters)
                                        );
 
+                       
$GLOBALS['phpgw']->css->add_external_file('logistic/templates/base/css/base.css');
+
                        self::render_template_xsl('datatable_common', $data);
                }
 
@@ -165,11 +201,12 @@
                {
                        $params = array(
                                'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
-                               'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
+                               'results' => phpgw::get_var('results', 'int', 
'REQUEST', 0),
                                'query' => phpgw::get_var('query'),
                                'sort' => phpgw::get_var('sort'),
                                'dir' => phpgw::get_var('dir'),
-                               'filters' => $filters
+                               'cat_id' => phpgw::get_var('dir', 'int', 
'REQUEST', 0),
+                               'allrows' => phpgw::get_var('allrows', 'bool')
                        );
 
                        if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
@@ -180,62 +217,18 @@
                        {
                                $user_rows_per_page = 10;
                        }
-                       // YUI variables for paging and sorting
-                       $start_index = phpgw::get_var('startIndex', 'int');
-                       $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
-                       $sort_field = phpgw::get_var('sort');
-                       $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
-                       // Form variables
-                       $search_for = phpgw::get_var('query');
-                       $search_type = phpgw::get_var('search_option');
                        // Create an empty result set
                        $result_objects = array();
                        $result_count = 0;
 
-                       //Retrieve a project identifier and load corresponding 
project
-                       $project_id = phpgw::get_var('project_id');
+                       $export = phpgw::get_var('export');
 
-                       $exp_param = phpgw::get_var('export');
-                       $export = false;
-                       if (isset($exp_param))
-                       {
-                               $export = true;
-                               $num_of_objects = null;
-                       }
+                       $values = $this->bo->read($params);
 
-                       //Retrieve the type of query and perform type specific 
logic
-                       $query_type = phpgw::get_var('type');
-                       //var_dump($query_type);
-                       switch ($query_type)
-                       {
-                               case 'project_type':
-                                       phpgwapi_cache::session_set('logistic', 
'project_type_query', $search_for);
-                                       $search_type = 'project_type';
-                                       $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);
-                                       $object_count = 
$this->so->get_count($search_for, $search_type, $filters);
-                                       break;
-                               default: // ... all composites, filters (active 
and vacant)
-                                       phpgwapi_cache::session_set('logistic', 
'project_query', $search_for);
-                                       $filters = array('project_type' => 
phpgw::get_var('project_type'));
-                                       $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);
-                                       $object_count = 
$this->so->get_count($search_for, $search_type, $filters);
-                                       break;
-                       }
-                       //var_dump($result_objects);
-                       //Create an empty row set
-                       $rows = array();
-                       foreach ($result_objects as $result)
-                       {
-                               if (isset($result))
-                               {
-                                       $rows[] = $result->serialize();
-                               }
-                       }
-
                        // ... add result data
-                       $result_data = array('results' => $rows);
+                       $result_data = array('results' => $values);
 
-                       $result_data['total_records'] = $object_count;
+                       $result_data['total_records'] = 
$this->bo->total_records;
                        $result_data['start'] = $params['start'];
                        $result_data['sort'] = $params['sort'];
                        $result_data['dir'] = $params['dir'];
@@ -245,16 +238,7 @@
                        if (!$export)
                        {
                                //Add action column to each row in result table
-                               if ($search_type && $search_type == 
'project_type')
-                               {
-                                       array_walk(
-                                                                       
$result_data['results'], array($this, '_add_links'), 
"property.uicondition_survey.view_project_type");
-                               }
-                               else
-                               {
-                                       array_walk(
-                                                                       
$result_data['results'], array($this, '_add_links'), 
"property.uicondition_survey.view");
-                               }
+                               array_walk(     $result_data['results'], 
array($this, '_add_links'), "property.uicondition_survey.view" );
                        }
                        return $this->yui_results($result_data);
                }
@@ -262,34 +246,12 @@
 
                public function view()
                {
-                       $project_id = phpgw::get_var('id');
-                       if (isset($_POST['edit_project']))
+                       if(!$this->acl_read)
                        {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uicondition_survey.edit', 'id' => $project_id));
+                               $this->bocommon->no_access();
+                               return;
                        }
-                       else if (isset($_POST['new_activity']))
-                       {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiactivity.edit', 'project_id' => $project_id));
-                       }
-                       else
-                       {
-                               if ($project_id && is_numeric($project_id))
-                               {
-                                       $project = 
$this->so->get_single($project_id);
-                               }
-
-                               $project_array = $project->toArray();
-
-                               $data = array
-                                       (
-                                       'value_id' => !empty($project) ? 
$project->get_id() : 0,
-                                       'project' => $project,
-                                       'view' => 'view_project'
-                               );
-
-                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('logistic') . '::' . lang('Project');
-                               
self::render_template_xsl(array('project/project_item'), $data);
-                       }
+                       $this->edit($mode = 'view');
                }
 
                public function add()
@@ -355,11 +317,11 @@
                        );
 
                        $this->use_yui_editor('description');
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('logistic') . '::' . lang('Project type');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . '::' . lang('condition survey');
                        
                        phpgwapi_jquery::load_widget('core');
-                       self::add_javascript('logistic', 'logistic', 
'project.js');
-                       
self::render_template_xsl(array('project/project_item'), $data);
+                       self::add_javascript('project', 'yahoo', 
'condition_survey.edit.js');
+                       self::render_template_xsl(array('condition_survey'), 
$data);
                }
                
                public function save()

Modified: trunk/property/setup/default_records.inc.php
===================================================================
--- trunk/property/setup/default_records.inc.php        2012-10-31 14:42:59 UTC 
(rev 10400)
+++ trunk/property/setup/default_records.inc.php        2012-10-31 14:48:23 UTC 
(rev 10401)
@@ -73,6 +73,7 @@
 
 $GLOBALS['phpgw']->locations->add('.invoice.dimb', 'A dimension for 
accounting', 'property');
 $GLOBALS['phpgw']->locations->add('.scheduled_events', 'Scheduled events', 
'property');
+$GLOBALS['phpgw']->locations->add('.project.condition_survey', 'Condition 
Survey', 'property', true, 'fm_condition_survey', true);
 
 $locations = array
 (

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2012-10-31 14:42:59 UTC (rev 10400)
+++ trunk/property/setup/setup.inc.php  2012-10-31 14:48:23 UTC (rev 10401)
@@ -112,6 +112,9 @@
                'fm_wo_h_deviation',
                'fm_key_loc',
                'fm_authorities_demands',
+               'fm_condition_survey_status',
+               'fm_condition_survey_history',
+               'fm_condition_survey',
                'fm_request',
                'fm_request_condition_type',
                'fm_request_condition',

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2012-10-31 14:42:59 UTC (rev 
10400)
+++ trunk/property/setup/tables_current.inc.php 2012-10-31 14:48:23 UTC (rev 
10401)
@@ -773,9 +773,72 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+
+               'fm_condition_survey_status' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'closed' => array('type' => 'int','precision' 
=> '2','nullable' => True),
+                               'in_progress' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'delivered' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'sorting' => array('type' => 'int','precision' 
=> '4','nullable' => True)
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_condition_survey' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'title' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                               'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                               'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'p_cat_id' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                               'loc1' => array('type' => 'varchar','precision' 
=> '6','nullable' => True),
+                               'loc2' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
+                               'descr' => array('type' => 'text','nullable' => 
True),
+                               'status' => array('type' => 'int','precision' 
=> '4','nullable' => false),
+                               'category' => array('type' => 'int','precision' 
=> '4','nullable' => True),
+                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'vendor_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'report_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
+                               'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'modified_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+               'fm_condition_survey_history' => array(
+                       'fd' => array(
+                               'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                               'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
+                               'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                               'history_new_value' => array('type' => 
'text','nullable' => False),
+                               'history_old_value' => array('type' => 
'text','nullable' => true),
+                               'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
+                       ),
+                       'pk' => array('history_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
+
                'fm_request' => array(
                        'fd' => array(
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'condition_survey_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'title' => array('type' => 
'varchar','precision' => '100','nullable' => True),
                                'project_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2012-10-31 14:42:59 UTC (rev 
10400)
+++ trunk/property/setup/tables_update.inc.php  2012-10-31 14:48:23 UTC (rev 
10401)
@@ -1474,7 +1474,7 @@
                        }
 
                        $db2->query("INSERT INTO phpgw_acl (acl_appname, 
acl_location, acl_account, acl_rights, acl_grantor,acl_type) VALUES ("
-                       . "'property','" 
+                       . "'property','"
                        . $GLOBALS['phpgw_setup']->oProc->f('acl_location') . 
"','"
                        . $GLOBALS['phpgw_setup']->oProc->f('acl_account') . 
"','"
                        . $GLOBALS['phpgw_setup']->oProc->f('acl_rights') . "',"
@@ -2092,7 +2092,7 @@
                        $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
phpgw_cust_attribute (' . implode(',',array_keys($entry)) . ') VALUES (' . 
$GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($entry)) . ')');
                }
 
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_agreement_choice"); 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_agreement_choice");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
@@ -2103,7 +2103,7 @@
                        );
                }
 
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_r_agreement_choice"); 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_r_agreement_choice");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
@@ -2114,7 +2114,7 @@
                        );
                }
 
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_s_agreement_choice"); 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_s_agreement_choice");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
@@ -2125,7 +2125,7 @@
                        );
                }
 
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_owner_choice"); 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_owner_choice");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
@@ -2136,7 +2136,7 @@
                        );
                }
 
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_tenant_choice"); 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_tenant_choice");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
@@ -2147,7 +2147,7 @@
                        );
                }
 
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_vendor_choice"); 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_vendor_choice");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
@@ -2210,7 +2210,7 @@
                }
 
                $choice = array();
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_entity_choice"); 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_entity_choice");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
@@ -2255,7 +2255,7 @@
 //---------------
 //--------------- custom functions
                $custom = array();
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_custom_function"); 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_custom_function");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $custom[]=array(
@@ -2312,7 +2312,7 @@
                }
 
                $choice = array();
-               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_location_choice"); 
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_location_choice");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
                        $choice[]=array(
@@ -2397,8 +2397,8 @@
                        @rename($files_dir . $change_from, $files_dir . 
$change_to);
                }
 
-               $change_from = array_keys($change); 
-        $change_to = array_values($change); 
+               $change_from = array_keys($change);
+        $change_to = array_values($change);
 
                $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM phpgw_vfs 
WHERE app = 'property'");
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
@@ -3045,7 +3045,7 @@
 
        /**
        * Update property version from 0.9.17.552 to 0.9.17.553
-       * 
+       *
        */
 
        $test[] = '0.9.17.552';
@@ -3104,7 +3104,7 @@
 
        /**
        * Update property version from 0.9.17.553 to 0.9.17.554
-       * 
+       *
        */
 
        $test[] = '0.9.17.553';
@@ -3136,7 +3136,7 @@
 
        /**
        * Update property version from 0.9.17.554 to 0.9.17.555
-       * 
+       *
        */
 
        $test[] = '0.9.17.554';
@@ -3157,7 +3157,7 @@
        /**
        * Update property version from 0.9.17.555 to 0.9.17.556
        * Scheduling capabilities by custom fields and asyncservice
-       * 
+       *
        */
 
        $test[] = '0.9.17.555';
@@ -3240,7 +3240,7 @@
        /**
        * Update property version from 0.9.17.556 to 0.9.17.557
        * Scheduling capabilities by custom fields and asyncservice
-       * 
+       *
        */
 
        $test[] = '0.9.17.556';
@@ -3274,7 +3274,7 @@
        /**
        * Update property version from 0.9.17.557 to 0.9.17.558
        * Rename reserved fieldname (mysql)
-       * 
+       *
        */
 
        $test[] = '0.9.17.557';
@@ -3297,7 +3297,7 @@
        /**
        * Update property version from 0.9.17.558 to 0.9.17.559
        * change the priority for the helpdest (from 10-1 to 1-3)
-       * 
+       *
        */
 
        $test[] = '0.9.17.558';
@@ -3322,7 +3322,7 @@
        /**
        * Update property version from 0.9.17.559 to 0.9.17.560
        * Add location to the budget.basis
-       * 
+       *
        */
 
        $test[] = '0.9.17.559';
@@ -3341,7 +3341,7 @@
        /**
        * Update property version from 0.9.17.560 to 0.9.17.561
        * Add ability to upload jasper reports
-       * 
+       *
        */
 
        $test[] = '0.9.17.560';
@@ -3361,7 +3361,7 @@
        /**
        * Update property version from 0.9.17.561 to 0.9.17.562
        * Add variants of closed-status for tickets
-       * 
+       *
        */
 
        $test[] = '0.9.17.561';
@@ -3381,7 +3381,7 @@
        /**
        * Update property version from 0.9.17.562 to 0.9.17.563
        * Separate project status from workorder status
-       * 
+       *
        */
 
        $test[] = '0.9.17.562';
@@ -3428,7 +3428,7 @@
        /**
        * Update property version from 0.9.17.563 to 0.9.17.564
        * Add area information as standard fields to each level in the location 
hierarchy
-       * 
+       *
        */
 
        $test[] = '0.9.17.563';
@@ -3518,7 +3518,7 @@
        /**
        * Update property version from 0.9.17.564 to 0.9.17.565
        * alter datatype for spvend_code
-       * 
+       *
        */
 
        $test[] = '0.9.17.564';
@@ -3558,7 +3558,7 @@
        /**
        * Update property version from 0.9.17.565 to 0.9.17.566
        * Add field to reference origin of invoices if imported from external 
system
-       * 
+       *
        */
 
        $test[] = '0.9.17.565';
@@ -3579,7 +3579,7 @@
        /**
        * Update property version from 0.9.17.566 to 0.9.17.567
        * Add a general approval scheme for items across the system
-       * 
+       *
        */
 
        $test[] = '0.9.17.566';
@@ -3618,7 +3618,7 @@
        /**
        * Update property version from 0.9.17.567 to 0.9.17.568
        * Extend the approval scheme to include general actions
-       * 
+       *
        */
 
        $test[] = '0.9.17.567';
@@ -3683,7 +3683,7 @@
        /**
        * Update property version from 0.9.17.568 to 0.9.17.569
        * Add variants of closed and approved-status for projects and workorders
-       * 
+       *
        */
 
        $test[] = '0.9.17.568';
@@ -3708,7 +3708,7 @@
        /**
        * Update property version from 0.9.17.569 to 0.9.17.570
        * Add custom fields to projects, workorders and tickets
-       * 
+       *
        */
 
        $test[] = '0.9.17.569';
@@ -3737,7 +3737,7 @@
        /**
        * Update property version from 0.9.17.570 to 0.9.17.571
        * Add custom fields to projects, workorders and tickets
-       * 
+       *
        */
 
        $test[] = '0.9.17.570';
@@ -3757,7 +3757,7 @@
        /**
        * Update property version from 0.9.17.571 to 0.9.17.572
        * Add event workorders
-       * 
+       *
        */
 
        $test[] = '0.9.17.571';
@@ -3784,7 +3784,7 @@
        /**
        * Update property version from 0.9.17.572 to 0.9.17.573
        * Add ticket order - an ad hock order without using the project module
-       * 
+       *
        */
 
        $test[] = '0.9.17.572';
@@ -3811,7 +3811,7 @@
        /**
        * Update property version from 0.9.17.573 to 0.9.17.574
        * Alter field definition
-       * 
+       *
        */
 
        $test[] = '0.9.17.573';
@@ -3834,7 +3834,7 @@
        /**
        * Update property version from 0.9.17.574 to 0.9.17.575
        * Add variants of closed and approved-status for tickets
-       * 
+       *
        */
 
        $test[] = '0.9.17.574';
@@ -3857,7 +3857,7 @@
        /**
        * Update property version from 0.9.17.575 to 0.9.17.576
        * Add contact_email to tickets
-       * 
+       *
        */
 
        $test[] = '0.9.17.575';
@@ -3878,7 +3878,7 @@
        /**
        * Update property version from 0.9.17.576 to 0.9.17.577
        * Add sorting to ticket status
-       * 
+       *
        */
 
        $test[] = '0.9.17.576';
@@ -3899,7 +3899,7 @@
        /**
        * Update property version from 0.9.17.577 to 0.9.17.578
        * Add order categories to ticket ad hoc orders
-       * 
+       *
        */
 
        $test[] = '0.9.17.577';
@@ -3919,7 +3919,7 @@
        /**
        * Update property version from 0.9.17.578 to 0.9.17.579
        * Add custom dimension for orders
-       * 
+       *
        */
 
        $test[] = '0.9.17.578';
@@ -3954,7 +3954,7 @@
        /**
        * Update property version from 0.9.17.579 to 0.9.17.580
        * Add optional publishing flag on ticket notes
-       * 
+       *
        */
 
        $test[] = '0.9.17.579';
@@ -3976,7 +3976,7 @@
        /**
        * Update property version from 0.9.17.580 to 0.9.17.581
        * Add optional hierarchy on entities
-       * 
+       *
        */
 
        $test[] = '0.9.17.580';
@@ -3997,7 +3997,7 @@
        /**
        * Update property version from 0.9.17.581 to 0.9.17.582
        * Add templates to Ad Hoc Orders
-       * 
+       *
        */
 
        $test[] = '0.9.17.581';
@@ -4034,7 +4034,7 @@
        /**
        * Update property version from 0.9.17.582 to 0.9.17.583
        * Grant rights on actors
-       * 
+       *
        */
 
        $test[] = '0.9.17.582';
@@ -4062,7 +4062,7 @@
        /**
        * Update property version from 0.9.17.583 to 0.9.17.584
        * Add schedule to event
-       * 
+       *
        */
 
        $test[] = '0.9.17.583';
@@ -4117,7 +4117,7 @@
        /**
        * Update property version from 0.9.17.583 to 0.9.17.584
        * Use locations for categories
-       * 
+       *
        */
 
        $test[] = '0.9.17.584';
@@ -4199,7 +4199,7 @@
        /**
        * Update property version from 0.9.17.585 to 0.9.17.586
        * Use budget account groups on project level
-       * 
+       *
        */
 
        $test[] = '0.9.17.585';
@@ -4238,7 +4238,7 @@
        /**
        * Update property version from 0.9.17.586 to 0.9.17.587
        * restore field
-       * 
+       *
        */
 
        $test[] = '0.9.17.586';
@@ -4263,7 +4263,7 @@
        /**
        * Update property version from 0.9.17.587 to 0.9.17.588
        * add billable_hours to workorders
-       * 
+       *
        */
 
        $test[] = '0.9.17.587';
@@ -4283,7 +4283,7 @@
        /**
        * Update property version from 0.9.17.588 to 0.9.17.589
        * Better precision to period (month) for payment-info
-       * 
+       *
        */
 
        $test[] = '0.9.17.588';
@@ -4306,7 +4306,7 @@
 //                     $sql = "UPDATE {$table} SET periode_old = periode";
 //                     $db->query($sql,__LINE__,__FILE__);
 
-                       $sql = 'SELECT count (*), bilagsnr, EXTRACT(YEAR from 
fakturadato ) as aar ,' 
+                       $sql = 'SELECT count (*), bilagsnr, EXTRACT(YEAR from 
fakturadato ) as aar ,'
                        . ' EXTRACT(MONTH from fakturadato ) as month, periode'
                        . " FROM {$table} "
                        . ' GROUP BY bilagsnr, EXTRACT(YEAR from fakturadato ), 
EXTRACT(MONTH from fakturadato ), periode'
@@ -4360,7 +4360,7 @@
        /**
        * Update property version from 0.9.17.589 to 0.9.17.590
        * add generic support for JasperReport
-       * 
+       *
        */
 
        $test[] = '0.9.17.589';
@@ -4458,7 +4458,7 @@
        /**
        * Update property version from 0.9.17.590 to 0.9.17.591
        * Add datatypes for user input at JasperReport
-       * 
+       *
        */
 
        $test[] = '0.9.17.590';
@@ -4481,7 +4481,7 @@
        /**
        * Update property version from 0.9.17.591 to 0.9.17.592
        * Add integration settings on entities
-       * 
+       *
        */
 
        $test[] = '0.9.17.591';
@@ -4503,7 +4503,7 @@
        /**
        * Update property version from 0.9.17.592 to 0.9.17.593
        * More on integration settings on entities
-       * 
+       *
        */
 
        $test[] = '0.9.17.592';
@@ -4526,7 +4526,7 @@
        /**
        * Update property version from 0.9.17.593 to 0.9.17.594
        * Convert integration settings to generic config on locations
-       * 
+       *
        */
 
        $test[] = '0.9.17.593';
@@ -4550,7 +4550,7 @@
        /**
        * Update property version from 0.9.17.594 to 0.9.17.595
        * Add custom dimension for orders
-       * 
+       *
        */
 
        $test[] = '0.9.17.594';
@@ -4570,7 +4570,7 @@
        /**
        * Update property version from 0.9.17.595 to 0.9.17.596
        * Alter datatype
-       * 
+       *
        */
 
        $test[] = '0.9.17.595';
@@ -4611,7 +4611,7 @@
        /**
        * Update property version from 0.9.17.596 to 0.9.17.597
        * Add responsibility roles
-       * 
+       *
        */
 
        $test[] = '0.9.17.596';
@@ -4648,7 +4648,7 @@
        /**
        * Update property version from 0.9.17.597 to 0.9.17.598
        * Rename column
-       * 
+       *
        */
 
        $test[] = '0.9.17.597';
@@ -4668,7 +4668,7 @@
        /**
        * Update property version from 0.9.17.598 to 0.9.17.599
        * Add columns to fm_b_account
-       * 
+       *
        */
 
        $test[] = '0.9.17.598';
@@ -4707,7 +4707,7 @@
        /**
        * Update property version from 0.9.17.599 to 0.9.17.600
        * Add responsibility roles
-       * 
+       *
        */
 
        $test[] = '0.9.17.599';
@@ -4744,7 +4744,7 @@
        /**
        * Update property version from 0.9.17.600 to 0.9.17.601
        * Add custom fields to request
-       * 
+       *
        */
 
        $test[] = '0.9.17.600';
@@ -4766,7 +4766,7 @@
        /**
        * Update property version from 0.9.17.601 to 0.9.17.602
        * Add fields voucher handling
-       * 
+       *
        */
 
        $test[] = '0.9.17.601';
@@ -4805,7 +4805,7 @@
        /**
        * Update property version from 0.9.17.602 to 0.9.17.603
        * Add templates to response from helpdesk
-       * 
+       *
        */
 
        $test[] = '0.9.17.602';
@@ -4840,7 +4840,7 @@
        /**
        * Update property version from 0.9.17.603 to 0.9.17.604
        * convert data for datatype CH: from serialized array to comma 
separated list
-       * 
+       *
        */
 
        $test[] = '0.9.17.603';
@@ -4925,7 +4925,7 @@
        /**
        * Update property version from 0.9.17.604 to 0.9.17.605
        * Add columns to  table fm_tts_tickets and fm_tts_status
-       * 
+       *
        */
 
        $test[] = '0.9.17.604';
@@ -4945,7 +4945,7 @@
        /**
        * Update property version from 0.9.17.605 to 0.9.17.606
        * Add authorities demands type to request
-       * 
+       *
        */
 
        $test[] = '0.9.17.605';
@@ -4980,7 +4980,7 @@
        /**
        * Update property version from 0.9.17.606 to 0.9.17.607
        * Add authorities demands type to request
-       * 
+       *
        */
 
        $test[] = '0.9.17.606';
@@ -5002,7 +5002,7 @@
        /**
        * Update property version from 0.9.17.607 to 0.9.17.608
        * Add location_link_level
-       * 
+       *
        */
 
        $test[] = '0.9.17.607';
@@ -5025,7 +5025,7 @@
        /**
        * Update property version from 0.9.17.608 to 0.9.17.609
        * Add location_link_level
-       * 
+       *
        */
 
        $test[] = '0.9.17.608';
@@ -5048,7 +5048,7 @@
        /**
        * Update property version from 0.9.17.609 to 0.9.17.610
        * Add location_link_level
-       * 
+       *
        */
 
        $test[] = '0.9.17.609';
@@ -5070,7 +5070,7 @@
        /**
        * Update property version from 0.9.17.610 to 0.9.17.611
        * Add budget to project group
-       * 
+       *
        */
 
        $test[] = '0.9.17.610';
@@ -5090,7 +5090,7 @@
        /**
        * Update property version from 0.9.17.611 to 0.9.17.612
        * Add contract sum to orders
-       * 
+       *
        */
 
        $test[] = '0.9.17.611';
@@ -5110,7 +5110,7 @@
        /**
        * Update property version from 0.9.17.612 to 0.9.17.613
        * Add regulations
-       * 
+       *
        */
 
        $test[] = '0.9.17.612';
@@ -5148,7 +5148,7 @@
        /**
        * Update property version from 0.9.17.613 to 0.9.17.614
        * Add parent to regulations
-       * 
+       *
        */
 
        $test[] = '0.9.17.613';
@@ -5168,7 +5168,7 @@
        /**
        * Update property version from 0.9.17.614 to 0.9.17.615
        * Add historical consume to request
-       * 
+       *
        */
 
        $test[] = '0.9.17.614';
@@ -5204,7 +5204,7 @@
        /**
        * Update property version from 0.9.17.615 to 0.9.17.616
        * Enable hierarchy to custom menu
-       * 
+       *
        */
 
        $test[] = '0.9.17.615';
@@ -5224,7 +5224,7 @@
        /**
        * Update property version from 0.9.17.616 to 0.9.17.617
        * rename field, add customized url-target
-       * 
+       *
        */
 
        $test[] = '0.9.17.616';
@@ -5246,7 +5246,7 @@
        /**
        * Update property version from 0.9.17.616 to 0.9.17.617
        * Sync fm_locations with fm_locationX
-       * 
+       *
        */
 
        $test[] = '0.9.17.617';
@@ -5312,7 +5312,7 @@
        /**
        * Update property version from 0.9.17.619 to 0.9.17.620
        * Add tentative planning to request
-       * 
+       *
        */
 
        $test[] = '0.9.17.619';
@@ -5348,7 +5348,7 @@
 
        /**
        * Update property version from 0.9.17.620 to 0.9.17.621
-       * 
+       *
        */
 
        $test[] = '0.9.17.620';
@@ -5372,7 +5372,7 @@
        /**
        * Update property version from 0.9.17.621 to 0.9.17.622
        * Add locations missing from clean install
-       * 
+       *
        */
 
        $test[] = '0.9.17.621';
@@ -5409,7 +5409,7 @@
        /**
        * Update property version from 0.9.17.622 to 0.9.17.623
        * Allow filtering of buildingparts depending of type of use
-       * 
+       *
        */
 
        $test[] = '0.9.17.622';
@@ -5433,7 +5433,7 @@
        /**
        * Update property version from 0.9.17.623 to 0.9.17.624
        * Add column missing from fresh install.
-       * 
+       *
        */
 
        $test[] = '0.9.17.623';
@@ -5765,7 +5765,7 @@
        function property_upgrade0_9_17_630()
        {
                $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-               $sql = 'CREATE OR REPLACE VIEW fm_open_workorder_view AS' 
+               $sql = 'CREATE OR REPLACE VIEW fm_open_workorder_view AS'
                        . ' SELECT fm_workorder.id, fm_workorder.project_id, 
fm_workorder_status.descr FROM fm_workorder'
                        . ' JOIN fm_workorder_status ON fm_workorder.status = 
fm_workorder_status.id WHERE fm_workorder_status.delivered IS NULL AND 
fm_workorder_status.closed IS NULL';
 
@@ -6006,7 +6006,7 @@
        /**
        * Update property version from 0.9.17.635 to 0.9.17.636
        * Add percent value to tax-code
-       * 
+       *
        */
        $test[] = '0.9.17.635';
        function property_upgrade0_9_17_635()
@@ -6025,7 +6025,7 @@
        /**
        * Update property version from 0.9.17.636 to 0.9.17.637
        * Add approve tag and mail recipients to workorders
-       * 
+       *
        */
        $test[] = '0.9.17.636';
        function property_upgrade0_9_17_636()
@@ -6045,7 +6045,7 @@
        /**
        * Update property version from 0.9.17.637 to 0.9.17.638
        * Modified timestamp til tickets
-       * 
+       *
        */
        $test[] = '0.9.17.637';
        function property_upgrade0_9_17_637()
@@ -6098,7 +6098,7 @@
        /**
        * Update property version from 0.9.17.638 to 0.9.17.639
        * Add relation contact-location
-       * 
+       *
        */
        $test[] = '0.9.17.638';
        function property_upgrade0_9_17_638()
@@ -6132,7 +6132,7 @@
        /**
        * Update property version from 0.9.17.638 to 0.9.17.639
        * Add fm_ecobilag_process_log
-       * 
+       *
        */
        $test[] = '0.9.17.639';
        function property_upgrade0_9_17_639()
@@ -6818,3 +6818,108 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.654 to 0.9.17.655
+       * Add Condition Survey as a referencing level to requests
+       */
+       $test[] = '0.9.17.654';
+       function property_upgrade0_9_17_654()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_request','condition_survey_id',array(
+                       'type'          => 'int',
+                       'precision'     => 4,
+                       'nullable'      => true
+                       )
+               );
+
+               $GLOBALS['phpgw']->locations->add('.project.condition_survey', 
'Condition Survey', 'property', true, 'fm_condition_survey', true);
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_condition_survey', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'title' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                                       'p_num' => array('type' => 
'varchar','precision' => '15','nullable' => True),
+                                       'p_entity_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                                       'p_cat_id' => array('type' => 
'int','precision' => '4','nullable' => True),
+                                       'location_code' => array('type' => 
'varchar','precision' => '20','nullable' => True),
+                                       'loc1' => array('type' => 
'varchar','precision' => '6','nullable' => True),
+                                       'loc2' => array('type' => 
'varchar','precision' => '4','nullable' => True),
+                                       'loc3' => array('type' => 
'varchar','precision' => '4','nullable' => True),
+                                       'loc4' => array('type' => 
'varchar','precision' => '4','nullable' => True),
+                                       'descr' => array('type' => 
'text','nullable' => True),
+                                       'status' => array('type' => 
'int','precision' => '4','nullable' => false),
+                                       'category' => array('type' => 
'int','precision' => '4','nullable' => True),
+                                       'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
+                                       'vendor_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'report_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'user_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                                       'modified_date' => array('type' => 
'int', 'precision' => 4,'nullable' => True),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT count(*) as cnt 
FROM fm_location_type");
+               $GLOBALS['phpgw_setup']->oProc->next_record();
+               $levels = $GLOBALS['phpgw_setup']->oProc->f('cnt');
+
+               for ($level=5; $level<($levels+1); $level++)
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_condition_survey',"loc{$level}",array(
+                               'type'          => 'varchar',
+                               'precision'     => 4,
+                               'nullable'      => true
+                               )
+                       );
+               }
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_condition_survey_status', array(
+                               'fd' => array(
+                                       'id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'descr' => array('type' => 
'varchar','precision' => '255','nullable' => False),
+                                       'closed' => array('type' => 
'int','precision' => '2','nullable' => True),
+                                       'in_progress' => array('type' => 
'int','precision' => '2','nullable' => True),
+                                       'delivered' => array('type' => 
'int','precision' => '2','nullable' => True),
+                                       'sorting' => array('type' => 
'int','precision' => '4','nullable' => True)
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_condition_survey_history', array(
+                               'fd' => array(
+                                       'history_id' => array('type' => 
'auto','precision' => '4','nullable' => False),
+                                       'history_record_id' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'history_appname' => array('type' => 
'varchar','precision' => '64','nullable' => False),
+                                       'history_owner' => array('type' => 
'int','precision' => '4','nullable' => False),
+                                       'history_status' => array('type' => 
'char','precision' => '2','nullable' => False),
+                                       'history_new_value' => array('type' => 
'text','nullable' => False),
+                                       'history_old_value' => array('type' => 
'text','nullable' => true),
+                                       'history_timestamp' => array('type' => 
'timestamp','nullable' => False,'default' => 'current_timestamp')
+                               ),
+                               'pk' => array('history_id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.655';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }




reply via email to

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