fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11482] property: add multiplier to condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [11482] property: add multiplier to condition survey
Date: Thu, 21 Nov 2013 20:18:36 +0000

Revision: 11482
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11482
Author:   sigurdne
Date:     2013-11-21 20:18:35 +0000 (Thu, 21 Nov 2013)
Log Message:
-----------
property: add multiplier to condition survey

Modified Paths:
--------------
    trunk/property/inc/class.bocondition_survey.inc.php
    trunk/property/inc/class.socondition_survey.inc.php
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/inc/class.uirequest.inc.php
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/request.xsl

Modified: trunk/property/inc/class.bocondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.bocondition_survey.inc.php 2013-11-21 14:26:59 UTC 
(rev 11481)
+++ trunk/property/inc/class.bocondition_survey.inc.php 2013-11-21 20:18:35 UTC 
(rev 11482)
@@ -311,6 +311,8 @@
 
                public function get_summation($id)
                {
+                       $survey = $this->so->read_single(array('id' => $id));
+
                        $data = $this->so->get_summation($id);
 //$total = 0;
 //_debug_array($data);
@@ -318,6 +320,7 @@
                        $i=0;
                        foreach ($data as $entry)
                        {
+                               $entry['amount'] = $entry['amount'] * 
$survey['multiplier'];
                                $i = $entry['building_part'] . '_' . 
$entry['category'];
                                
                                $values[$i]['building_part'] = 
$entry['building_part'];

Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2013-11-21 14:26:59 UTC 
(rev 11481)
+++ trunk/property/inc/class.socondition_survey.inc.php 2013-11-21 20:18:35 UTC 
(rev 11482)
@@ -89,8 +89,8 @@
                                $querymethod    = " {$where} {$table}.title 
{$this->_like} '%{$query}%'";
                        }
 
-                       $groupmethod = "GROUP BY 
$table.id,$table.title,$table.descr,$table.address,$table.entry_date,$table.user_id,
 org_name,multiplier";
-                       $sql = "SELECT DISTINCT 
$table.id,$table.title,$table.descr,$table.address,$table.entry_date,$table.user_id,multiplier,"
+                       $groupmethod = "GROUP BY $table.id, $table.title, 
$table.descr, $table.address, $table.entry_date, $table.user_id, org_name, 
$table.multiplier";
+                       $sql = "SELECT DISTINCT $table.id, $table.title, 
$table.descr, $table.address, $table.entry_date, $table.user_id, 
$table.multiplier,"
                        . " count(condition_survey_id) AS cnt, org_name as 
vendor FROM {$table} "
                        . " {$this->_join} fm_vendor ON {$table}.vendor_id = 
fm_vendor.id"
                        . " {$this->_left_join} fm_request ON {$table}.id 
=fm_request.condition_survey_id {$filtermethod} {$querymethod} {$groupmethod}";
@@ -259,6 +259,7 @@
                                }
 
                                $this->_edit($id, $value_set, 
'fm_condition_survey');
+                               $this->_db->query("UPDATE fm_request SET 
multiplier = '{$data['multiplier']}' WHERE condition_survey_id = 
{$id}",__LINE__,__FILE__);                            
                                $this->_db->Exception_On_Error = false;
                        }
 

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2013-11-21 14:26:59 UTC (rev 
11481)
+++ trunk/property/inc/class.sorequest.inc.php  2013-11-21 20:18:35 UTC (rev 
11482)
@@ -236,8 +236,10 @@
                        . " 
fm_request.start_date,fm_request.closed_date,fm_request.in_progress_date,fm_request.category
 as cat_id,"
                        . " fm_request.delivered_date,fm_request.title as 
title,max(fm_request_condition.degree) as condition_degree,"
        //              . " sum(fm_request_planning.amount) as planned_budget,"
-                       . " fm_request.amount_investment,"
-                       . " 
fm_request.amount_operation,fm_request.amount_potential_grants,fm_request.score,"
+                       . " (fm_request.amount_investment * 
fm_request.multiplier) as amount_investment,"
+                       . " (fm_request.amount_operation * 
fm_request.multiplier) as amount_operation,"
+                       . " (fm_request.amount_potential_grants * 
fm_request.multiplier) as amount_potential_grants,"
+                       . " fm_request.score,"
                        . " fm_request.recommended_year,"
                        . " fm_request.start_date"
                        . " FROM (( fm_request  LEFT JOIN fm_request_status ON 
fm_request.status = fm_request_status.id)"
@@ -441,7 +443,7 @@
                        $uicols['sortable'][]           = true;
 
 
-                       $cols.= ",$entity_table.amount_investment as 
amount_investment";
+                       $cols.= ",($entity_table.amount_investment * 
multiplier) as amount_investment";
                        $cols_return[]                          = 
'amount_investment';
                        $cols_group[]                           = 
'amount_investment';
                        $uicols['input_type'][]         = 'text';
@@ -455,7 +457,7 @@
                        $uicols['classname'][]          = 'rightClasss';
                        $uicols['sortable'][]           = true;
 
-                       $cols.= ",$entity_table.amount_operation as 
amount_operation";
+                       $cols.= ",($entity_table.amount_operation * multiplier) 
as amount_operation";
                        $cols_return[]                          = 
'amount_operation';
                        $cols_group[]                           = 
'amount_operation';
                        $uicols['input_type'][]         = 'text';
@@ -469,7 +471,7 @@
                        $uicols['classname'][]          = 'rightClasss';
                        $uicols['sortable'][]           = true;
 
-                       $cols.= ",$entity_table.amount_potential_grants as 
amount_potential_grants";
+                       $cols.= ",($entity_table.amount_potential_grants * 
multiplier) as amount_potential_grants";
                        $cols_return[]                          = 
'amount_potential_grants';
                        $cols_group[]                           = 
'amount_potential_grants';
                        $uicols['input_type'][]         = 'text';
@@ -784,7 +786,7 @@
                        $this->_db->fetchmode = 'ASSOC';
 
 //                     $sql2 = "SELECT count(*) as cnt, sum(amount_investment) 
as sum_investment, sum(amount_operation) as sum_operation, 
sum(amount_potential_grants) as sum_potential_grants FROM ({$sql}) as t";
-                       $sql2 = "SELECT count(*) as cnt, sum(amount_investment) 
as sum_investment, sum(amount_operation) as sum_operation, 
sum(amount_potential_grants) as sum_potential_grants FROM {$sql_arr[1]}";
+                       $sql2 = "SELECT count(*) as cnt, (sum(amount_investment 
* multiplier)) as sum_investment, (sum(amount_operation * multiplier)) as 
sum_operation, (sum(amount_potential_grants * multiplier)) as 
sum_potential_grants FROM {$sql_arr[1]}";
 
                        $this->_db->query($sql2,__LINE__,__FILE__);
                        $this->_db->next_record();
@@ -906,7 +908,8 @@
                                        'closed_date'                           
=> $this->_db->f('closed_date'),
                                        'in_progress_date'                      
=> $this->_db->f('in_progress_date'),
                                        'delivered_date'                        
=> $this->_db->f('delivered_date'),
-                                       'regulations'                           
=> explode(',', $this->_db->f('regulations'))
+                                       'regulations'                           
=> explode(',', $this->_db->f('regulations')),
+                                       'multiplier'                            
=> (float) $this->_db->f('multiplier'),
                                );
 
                                if ( isset($values['attributes']) && 
is_array($values['attributes']) )

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2013-11-21 14:26:59 UTC 
(rev 11481)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2013-11-21 20:18:35 UTC 
(rev 11482)
@@ -1384,6 +1384,12 @@
                                        'type'  => 'string',
                                        'required'      => false
                                ),
+                               array
+                               (
+                                       'name' => 'multiplier',
+                                       'type'  => 'float',
+                                       'required'      => false
+                               ),
                        );
 
 

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2013-11-21 14:26:59 UTC (rev 
11481)
+++ trunk/property/inc/class.uirequest.inc.php  2013-11-21 20:18:35 UTC (rev 
11482)
@@ -1774,7 +1774,9 @@
 
                                        'condition_list'                        
                => $this->bo->select_conditions($id),
                                        'building_part_list'                    
        => array('options' => 
$this->bocommon->select_category_list(array('type'=> 'building_part','selected' 
=>$values['building_part'], 'order' => 'id', 'id_in_name' => 'num', 'filter' => 
$_filter_buildingpart))),
-                                       'value_consume'                         
                => isset($receipt['error']) ? $values['consume_value'] : ''
+                                       'value_consume'                         
                => isset($receipt['error']) ? $values['consume_value'] : '',
+                                       'value_multiplier'                      
                => $values['multiplier'],
+                                       'value_total_cost_estimate'             
        => $values['multiplier'] ? number_format(($values['budget'] * 
$values['multiplier']) , 0, ',', ' ') : ''
                                );
 //_debug_array($data);die();
                        phpgwapi_yui::load_widget('dragdrop');

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2013-11-21 14:26:59 UTC (rev 11481)
+++ trunk/property/setup/setup.inc.php  2013-11-21 20:18:35 UTC (rev 11482)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.674';
+       $setup_info['property']['version']              = '0.9.17.675';
        $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 2013-11-21 14:26:59 UTC (rev 
11481)
+++ trunk/property/setup/tables_current.inc.php 2013-11-21 20:18:35 UTC (rev 
11482)
@@ -895,6 +895,7 @@
                                'in_progress_date' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'delivered_date' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'regulations' => array('type' => 
'varchar','precision' => 100,'nullable' => True),
+                               'multiplier' => array('type' => 
'decimal','precision' => '20','scale' => '2','default' => '1','nullable' => 
True),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2013-11-21 14:26:59 UTC (rev 
11481)
+++ trunk/property/setup/tables_update.inc.php  2013-11-21 20:18:35 UTC (rev 
11482)
@@ -7637,9 +7637,9 @@
                $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
 
                $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
-               
+
                $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM 
fm_entity_category");
-               
+
                $categories = array();
                while ($GLOBALS['phpgw_setup']->oProc->next_record())
                {
@@ -7655,7 +7655,7 @@
                }
 
                $tables = $GLOBALS['phpgw_setup']->oProc->m_odb->table_names();
-               
+
                foreach ($tables as $table)
                {
                        if(preg_match('/^fm_/', $table))
@@ -7676,7 +7676,7 @@
 
                                        foreach ($categories as $category)
                                        {
-                                       
+
                                                $cols = 
array_merge($primary_keys, array('p_num'));
                                                $records = array();
                                                $i = 0;
@@ -7690,7 +7690,7 @@
                                                        }
                                                        $i++;
                                                }
-                                               
+
                                                foreach ($records as $record)
                                                {
                                                        $p_num = (int) 
ltrim($record['p_num'], $category['prefix']);
@@ -7784,10 +7784,10 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
-       
+
        /**
        * Update property version from 0.9.17.673 to 0.9.17.674
-       * Add configurable prioriy keys for tickets
+       * Add multiplier to condition survey
        */
 
        $test[] = '0.9.17.673';
@@ -7811,3 +7811,33 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.674 to 0.9.17.675
+       * Add multiplier to condition survey
+       */
+
+       $test[] = '0.9.17.674';
+       function property_upgrade0_9_17_674()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn('fm_request', 
'multiplier', array
+                               (
+                                       'type'          => 'decimal',
+                                       'precision' => '20',
+                                       'scale'         => '2',
+                                       'default'       => '1.00',
+                                       'nullable'      => True
+                               )
+                       );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.675';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+

Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl   2013-11-21 14:26:59 UTC (rev 
11481)
+++ trunk/property/templates/base/request.xsl   2013-11-21 20:18:35 UTC (rev 
11482)
@@ -540,8 +540,24 @@
                                                                                
</input>
                                                                                
<xsl:text> </xsl:text>
                                                                        </div>
-                                                                       
<div><label class="requirement-action-label"><xsl:value-of 
select="php:function('lang', 'total cost estimate')"/></label><xsl:value-of 
select="value_budget"/><xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
+                                                                       <div>
+                                                                               
<label class="requirement-action-label">
+                                                                               
        <xsl:value-of select="php:function('lang', 'cost estimate')"/>
+                                                                               
</label>
+                                                                               
<xsl:value-of select="value_budget"/><xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
                                                                        </div>
+                                                                       <div>
+                                                                               
<label class="requirement-action-label">
+                                                                               
        <xsl:value-of select="php:function('lang', 'multiplier')"/>
+                                                                               
</label>
+                                                                               
<xsl:value-of select="value_multiplier"/>
+                                                                       </div>
+                                                                       <div>
+                                                                               
<label class="requirement-action-label">
+                                                                               
        <xsl:value-of select="php:function('lang', 'total cost estimate')"/>
+                                                                               
</label>
+                                                                               
<xsl:value-of select="value_total_cost_estimate"/><xsl:text> </xsl:text> [ 
<xsl:value-of select="currency"/> ]
+                                                                       </div>
                                                                </div>
                                                                <div 
class="requirement-action-sub-right">
                                                                        <div>




reply via email to

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