fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10592] property: more on condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [10592] property: more on condition survey
Date: Thu, 13 Dec 2012 12:02:50 +0000

Revision: 10592
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10592
Author:   sigurdne
Date:     2012-12-13 12:02:50 +0000 (Thu, 13 Dec 2012)
Log Message:
-----------
property: more on condition survey

Modified Paths:
--------------
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/class.borequest.inc.php
    trunk/property/inc/class.socondition_survey.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/setup/phpgw_no.lang
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/condition_survey_import.xsl

Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php   2012-12-12 14:52:35 UTC (rev 
10591)
+++ trunk/property/inc/class.bocommon.inc.php   2012-12-13 12:02:50 UTC (rev 
10592)
@@ -1419,10 +1419,8 @@
                                        break;
                        }
 
-                       $sogeneric = CreateObject('property.sogeneric');
+                       $categories = 
execMethod('property.sogeneric.get_list',$data);
 
-                       $categories= $sogeneric->get_list($data);
-
                        return 
$this->select_list($data['selected'],$categories);
                }
 

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2012-12-12 14:52:35 UTC (rev 
10591)
+++ trunk/property/inc/class.borequest.inc.php  2012-12-13 12:02:50 UTC (rev 
10592)
@@ -159,13 +159,13 @@
                {
                        if ($this->use_session)
                        {
-                               
$GLOBALS['phpgw']->session->appsession('session_data','request',$data);
+                               
phpgwapi_cache::session_set('property.request','session_data', $data);
                        }
                }
 
                function read_sessiondata()
                {
-                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data','request');
+                       $data = 
phpgwapi_cache::session_get('property.request','session_data', $data);
 
                        $this->start                    = $data['start'];
                        $this->query                    = $data['query'];

Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2012-12-12 14:52:35 UTC 
(rev 10591)
+++ trunk/property/inc/class.socondition_survey.inc.php 2012-12-13 12:02:50 UTC 
(rev 10592)
@@ -37,40 +37,12 @@
 
        class property_socondition_survey extends property_socommon_core
        {
-               /**
-               * @var int $_total_records total number of records found
-               */
-               protected $_total_records = 0;
 
-
-               /**
-               * @var int $_receipt feedback on actions
-               */
-               protected $_receipt = array();
-
-
-               /**
-                * @var object $_db reference to the global database object
-                */
-               protected $_db;
-
-               /**
-                * @var string $_join SQL JOIN statement
-                */
-               protected $_join;
-
-               /**
-                * @var string $_like SQL LIKE statement
-                */
-               protected $_like;
-
-
                public function __construct()
                {
                        parent::__construct();
                }
 
-
                function read($data = array())
                {
                        $start          = isset($data['start'])  ? (int) 
$data['start'] : 0;
@@ -104,8 +76,11 @@
                                $querymethod    = " {$where} title 
{$this->_like} '%{$query}%'";
                        }
 
-                       $sql = "SELECT * FROM {$table} $filtermethod 
$querymethod";
+                       $groupmethod = "GROUP BY 
$table.id,$table.title,$table.descr,$table.address,$table.entry_date,$table.user_id";
+                       $sql = "SELECT DISTINCT 
$table.id,$table.title,$table.descr,$table.address,$table.entry_date,$table.user_id
 , count(condition_survey_id) AS cnt"
+                       . " FROM {$table} {$this->_left_join} fm_request ON 
{$table}.id =fm_request.condition_survey_id {$filtermethod} {$querymethod} 
{$groupmethod}";
 
+       
                        $this->_db->query($sql,__LINE__,__FILE__);
                        $this->_total_records = $this->_db->num_rows();
 
@@ -128,7 +103,8 @@
                                        'descr'                 => 
$this->_db->f('descr',true),
                                        'address'               => 
$this->_db->f('address',true),
                                        'entry_date'    => 
$this->_db->f('entry_date'),
-                                       'user'                  => 
$this->_db->f('user_id')
+                                       'user'                  => 
$this->_db->f('user_id'),
+                                       'cnt'                   => 
$this->_db->f('cnt'),
                                );
                        }
 
@@ -335,6 +311,15 @@
                );
 
 */
+                       $_update_buildingpart = array();
+                       $filter_buildingpart = 
isset($config->config_data['filter_buildingpart']) ? 
$config->config_data['filter_buildingpart'] : array();
+                       
+                       if($filter_key = array_search('.project.request', 
$filter_buildingpart))
+                       {
+                               $_update_buildingpart = 
array("filter_{$filter_key}" => 1);
+                       }
+
+
                        foreach ($import_data as $entry)
                        {
 
@@ -369,7 +354,7 @@
                                                $request['cat_id'] = 
(int)$categories[0]['id'];
                                        }
 
-                                       
$this->_check_building_part($entry['building_part']);
+                                       
$this->_check_building_part($entry['building_part'],$_update_buildingpart);
 
 
                                        $request['condition_survey_id'] = 
$survey['id'];
@@ -385,8 +370,8 @@
                                        $request['coordinator']                 
= $survey['coordinator_id'];
                                        $request['status']                      
        = $config->config_data['condition_survey_initial_status'];
                                        $request['budget']                      
        = $entry['amount'];
-                                       $request['planning_date']               
= mktime(13,0,0,7,1, $entry['due_year']?$entry['due_year']:date('Y'));
                                        $request['planning_value']              
= $entry['amount'];
+                                       $request['planning_date']               
= mktime(13,0,0,7,1, $entry['due_year']?$entry['due_year']:date('Y'));
                                        $request['condition']                   
= array
                                        (
                                                array
@@ -398,7 +383,6 @@
                                                )
                                        );
 
-//_debug_array($request);
                                        $sorequest->add($request, 
$values_attribute = array());
                                        if($entry['amount_extra'] > 0)
                                        {
@@ -406,19 +390,17 @@
                                                {
                                                        $request['cat_id'] = 
(int)$config->config_data['condition_survey_import_cat'][4];
                                                }
-
                                                $request['planning_value']      
=$entry['amount_extra'];
-                                               $request['cat_id']              
                = 13; //???? FIXME
+                                               $request['budget']              
        =$entry['amount_extra'];
                                                $sorequest->add($request, 
$values_attribute = array());
                                        }
                                }
                        }
-//             die();
 
                        $this->_db->transaction_commit();
                }
 
-               private function _check_building_part($id)
+               private function _check_building_part($id, 
$_update_buildingpart)
                {
                        $sql = "SELECT id FROM fm_building_part WHERE id = 
'{$id}'";
                        $this->_db->query($sql,__LINE__,__FILE__);
@@ -427,6 +409,12 @@
                                $sql = "INSERT INTO fm_building_part (id, 
descr) VALUES ('{$id}', '{$id}::__')";
                                $this->_db->query($sql,__LINE__,__FILE__);
                        }
+
+                       if($_update_buildingpart)
+                       {
+                               $value_set      = 
$this->_db->validate_update($_update_buildingpart);
+                               $this->_db->query("UPDATE fm_building_part SET 
{$value_set} WHERE id = '{$id}'",__LINE__,__FILE__);
+                       }
                }
 
                public function get_summation($id)

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-12-12 14:52:35 UTC 
(rev 10591)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-12-13 12:02:50 UTC 
(rev 10592)
@@ -159,6 +159,11 @@
                                                        'sortable' => true
                                                ),
                                                array(
+                                                       'key' => 'cnt',
+                                                       'label' => 
lang('count'),
+                                                       'sortable' => false,
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -301,6 +306,8 @@
                                }
                        }
 
+                       
phpgwapi_cache::session_clear('property.request','session_data');
+
                        phpgwapi_yui::tabview_setup('survey_edit_tabview');
                        $tabs = array();
                        $tabs['generic']        = array('label' => 
lang('generic'), 'link' => '#generic');
@@ -796,6 +803,16 @@
                        
                        $sheet_id = $sheet_id ? $sheet_id : 
phpgw::get_var('selected_sheet_id', 'int', 'REQUEST');
 
+                       if(!$step )
+                       {
+                               if($cached_file = 
phpgwapi_cache::session_get('property', 'condition_survey_import_file'))
+                               {
+                                       
phpgwapi_cache::session_clear('property', 'condition_survey_import_file');
+                                       unlink($cached_file);
+                                       unset($cached_file);
+                               }
+                       }
+
                        if($start_line  = phpgw::get_var('start_line', 'int', 
'REQUEST'))
                        {
                                phpgwapi_cache::system_set('property', 
'import_sheet_start_line', $start_line);

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2012-12-12 14:52:35 UTC (rev 10591)
+++ trunk/property/setup/phpgw_no.lang  2012-12-13 12:02:50 UTC (rev 10592)
@@ -1295,6 +1295,7 @@
 probability    property        no      Sannsynlighet
 project        property        no      prosjekt
 .project       property        no      Prosjekt
+project.condition_survey       property        no      Tilstandsanalyse
 project.workorder      property        no      Prosjekt::Bestilling
 project %1 has been edited     property        no      Prosjekt %1 er oppdatert
 project %1 has been saved      property        no      Prosjekt %1 er lagret

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2012-12-12 14:52:35 UTC (rev 10591)
+++ trunk/property/setup/setup.inc.php  2012-12-13 12:02:50 UTC (rev 10592)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.656';
+       $setup_info['property']['version']              = '0.9.17.657';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2012-12-12 14:52:35 UTC (rev 
10591)
+++ trunk/property/setup/tables_current.inc.php 2012-12-13 12:02:50 UTC (rev 
10592)
@@ -493,8 +493,8 @@
                                'category' => array('type' => 'int','precision' 
=> '4','nullable' => True),
                                'chapter_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'entry_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'start_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'end_date' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'start_date' => array('type' => 
'int','precision' => '8','nullable' => False),
+                               'end_date' => array('type' => 'int','precision' 
=> '8','nullable' => False),
                                'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'vendor_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'status' => array('type' => 
'varchar','precision' => '20','nullable' => False,'default' => 'active'),
@@ -865,8 +865,8 @@
                                'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'authorities_demands' => array('type' => 
'int','precision' => '2','default' => '0','nullable' => True),
                                'score' => array('type' => 'int','precision' => 
'4','default' => '0','nullable' => True),
-                               'start_date' => array('type' => 
'int','precision' => '4','default' => '0','nullable' => True),
-                               'end_date' => array('type' => 'int','precision' 
=> '4','default' => '0','nullable' => True),
+                               'start_date' => array('type' => 
'int','precision' => '8','default' => '0','nullable' => True),
+                               'end_date' => array('type' => 'int','precision' 
=> '8','default' => '0','nullable' => True),
                                'building_part'=> array('type' => 
'varchar','precision' => 4,'nullable' => True),
                                'closed_date' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'in_progress_date' => array('type' => 
'int','precision' => '4','nullable' => True),
@@ -913,7 +913,7 @@
                                'id' => array('type' => 'auto','nullable' => 
False),
                                'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'amount' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'date' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'date' => array('type' => 'int','precision' => 
'8','nullable' => False),
                                'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => true),
                                'entry_date' => array('type' => 
'int','precision' => '4','nullable' => true),
                                'descr' => array('type' => 'text','nullable' => 
True)
@@ -928,7 +928,7 @@
                                'id' => array('type' => 'auto','nullable' => 
False),
                                'request_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'amount' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'date' => array('type' => 'int','precision' => 
'4','nullable' => False),
+                               'date' => array('type' => 'int','precision' => 
'8','nullable' => False),
                                'user_id' => array('type' => 'int','precision' 
=> '4','nullable' => true),
                                'entry_date' => array('type' => 
'int','precision' => '4','nullable' => true),
                                'descr' => array('type' => 'text','nullable' => 
True)
@@ -1486,8 +1486,8 @@
                                'access' => array('type' => 
'varchar','precision' => '7','nullable' => True),
                                'category' => array('type' => 'int','precision' 
=> '4','nullable' => true),
                                'entry_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'start_date' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'end_date' => array('type' => 'int','precision' 
=> '4','nullable' => False),
+                               'start_date' => array('type' => 
'int','precision' => '8','nullable' => False),
+                               'end_date' => array('type' => 'int','precision' 
=> '8','nullable' => False),
                                'coordinator' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'status' => array('type' => 
'varchar','precision' => '20','nullable' => False,'default' => 'active'),
                                'descr' => array('type' => 'text','nullable' => 
True),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2012-12-12 14:52:35 UTC (rev 
10591)
+++ trunk/property/setup/tables_update.inc.php  2012-12-13 12:02:50 UTC (rev 
10592)
@@ -6947,3 +6947,67 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.656 to 0.9.17.657
+       * Alter planing dates to hold bigint
+       */
+       $test[] = '0.9.17.656';
+       function property_upgrade0_9_17_656()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_project','start_date',array(
+                       'type'          => 'int',
+                       'precision'     => 8,
+                       'nullable'      => false
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_project','end_date',array(
+                       'type'          => 'int',
+                       'precision'     => 8,
+                       'nullable'      => false
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_workorder','start_date',array(
+                       'type'          => 'int',
+                       'precision'     => 8,
+                       'nullable'      => false
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_workorder','end_date',array(
+                       'type'          => 'int',
+                       'precision'     => 8,
+                       'nullable'      => false
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','start_date',array(
+                       'type'          => 'int',
+                       'precision'     => 8,
+                       'nullable'      => true
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','end_date',array(
+                       'type'          => 'int',
+                       'precision'     => 8,
+                       'nullable'      => true
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request_consume','date',array(
+                       'type'          => 'int',
+                       'precision'     => 8,
+                       'nullable'      => false
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request_planning','date',array(
+                       'type'          => 'int',
+                       'precision'     => 8,
+                       'nullable'      => false
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.657';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: trunk/property/templates/base/condition_survey_import.xsl
===================================================================
--- trunk/property/templates/base/condition_survey_import.xsl   2012-12-12 
14:52:35 UTC (rev 10591)
+++ trunk/property/templates/base/condition_survey_import.xsl   2012-12-13 
12:02:50 UTC (rev 10592)
@@ -54,39 +54,46 @@
                                                <xsl:when test="step=1">
                                                        <xsl:call-template 
name="import_step_1"/>
                                                </xsl:when>
-                                       </xsl:choose>
-
-                                       <xsl:choose>
                                                <xsl:when test="step=2">
                                                        <xsl:call-template 
name="import_step_2"/>
                                                </xsl:when>
-                                       </xsl:choose>
-                                       <xsl:choose>
                                                <xsl:when test="step=3">
                                                        <xsl:call-template 
name="import_step_3"/>
                                                </xsl:when>
-                                       </xsl:choose>
-                                       <xsl:choose>
                                                <xsl:when test="step=4">
                                                        <xsl:call-template 
name="import_step_4"/>
                                                </xsl:when>
+                                               <xsl:otherwise>
+                                                       <dl 
class="proplist-col">
+                                                               <dt>
+                                                                       
<label><xsl:value-of select="php:function('lang', 'finished')" /></label>
+                                                               </dt>
+                                                       </dl>
+                                               </xsl:otherwise>
                                        </xsl:choose>
-
                                </div>
 
                                <dl class="proplist-col">
                                        <div class="form-buttons">
                                                <xsl:variable 
name="lang_submit"><xsl:value-of select="lang_submit"/></xsl:variable>
                                                <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
-                                               <input type="submit" 
name="submit_step" value="{$lang_submit}" title = "{$lang_submit}" />
+                                               <xsl:choose>
+                                                       <xsl:when 
test="$lang_submit != ''">
+                                                               <input 
type="submit" name="submit_step" value="{$lang_submit}" title = 
"{$lang_submit}" />
+                                                       </xsl:when>
+                                               </xsl:choose>
                                                <input class="button" 
type="button" name="cancelButton" id ='cancelButton' value="{$lang_cancel}" 
title = "{$lang_cancel}" onClick="document.cancel_form.submit();"/>
                                        </div>
                        </dl>
                        </form>
                </div>
 
+               <xsl:variable name="cancel_params">
+                       <xsl:text>menuaction:property.uicondition_survey.view, 
id:</xsl:text>
+                               <xsl:value-of select="survey/id" />
+                       </xsl:variable>
                <xsl:variable name="cancel_url">
-                       <xsl:value-of select="php:function('get_phpgw_link', 
'/index.php', 'menuaction:property.uicondition_survey.index')" />
+                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $cancel_params )" />
                </xsl:variable>
 
                <form name="cancel_form" id="cancel_form" 
action="{$cancel_url}" method="post">
@@ -110,20 +117,7 @@
 
        </xsl:template>
 
-<xsl:template name="datasource-definition">
-       <script>
-       YAHOO.util.Event.onDOMReady(function(){
 
-               <xsl:for-each select="datatable_def">
-                       YAHOO.portico.inlineTableHelper("<xsl:value-of 
select="container"/>", <xsl:value-of select="requestUrl"/>, <xsl:value-of 
select="ColumnDefs"/>);
-               </xsl:for-each>
-
-       });
-  </script>
-
-</xsl:template>
-
-
 <xsl:template name="import_step_1" 
xmlns:formvalidator="http://www.w3.org/TR/html4/"; 
xmlns:php="http://php.net/xsl";>
        <dl class="proplist-col">
                <dt>




reply via email to

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