[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10958] property: condition survey
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10958] property: condition survey |
Date: |
Mon, 04 Mar 2013 14:52:30 +0000 |
Revision: 10958
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10958
Author: sigurdne
Date: 2013-03-04 14:52:29 +0000 (Mon, 04 Mar 2013)
Log Message:
-----------
property: condition survey
Modified Paths:
--------------
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/hook_config.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/request.xsl
Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2013-03-04 08:37:16 UTC
(rev 10957)
+++ trunk/property/inc/class.socondition_survey.inc.php 2013-03-04 14:52:29 UTC
(rev 10958)
@@ -305,13 +305,21 @@
$cats->supress_info = true;
$categories = $cats->return_sorted_array(0, false, '',
'', '', $globals = true, '', $use_acl = false);
+
/*
+ $import_types = array
+ (
+ 1 => 'Hidden',
+ 2 => 'Normal import',
+ 3 => 'Users/Customers responsibility',
+ );
+*/
+/*
$cats_candidates = array
(
1 => 'Investment',
2 => 'Operation',
3 => 'Combined::Investment/Operation',
- 4 => 'Special'
);
*/
@@ -324,28 +332,29 @@
}
+_debug_array($import_data);die();
foreach ($import_data as $entry)
{
- if( ctype_digit($entry['condition_degree']) &&
$entry['condition_degree'] > 0 && strlen($entry['building_part']) > 2)
+ if( ctype_digit($entry['condition_degree']) &&
$entry['condition_degree'] > 0 && $entry['building_part'] &&
(int)$entry['import_type'] > 0)
{
$request = array();
- if( $entry['percentage_investment'] ==
100)
+ if( $entry['amount_investment'] &&
!$entry['amount_operation'] )
{
if(isset($config->config_data['condition_survey_import_cat'][1]))
{
$request['cat_id'] =
(int)$config->config_data['condition_survey_import_cat'][1];
}
}
- else
if(!$entry['percentage_investment'])
+ if( !$entry['amount_investment'] &&
$entry['amount_operation'] )
{
if(isset($config->config_data['condition_survey_import_cat'][2]))
{
$request['cat_id'] =
(int)$config->config_data['condition_survey_import_cat'][2];
}
}
- else if($entry['percentage_investment']
&& $entry['percentage_investment'] < 100)
+ else
{
if(isset($config->config_data['condition_survey_import_cat'][3]))
{
@@ -361,19 +370,22 @@
$this->_check_building_part($entry['building_part'],$_update_buildingpart);
- $request['condition_survey_id'] =
$survey['id'];
- $request['street_name']
= $location_data['street_name'];
- $request['street_number']
= $location_data['street_number'];
- $request['location']
= $location;
- $request['location_code']
= $survey['location_code'];
- $request['origin_id']
= $GLOBALS['phpgw']->locations->get_id('property', '.project.condition_survey');
- $request['origin_item_id']
= (int)$survey['id'];
- $request['title']
= substr($entry['title'], 0, 255);
- $request['descr']
= $entry['descr'];
- $request['building_part']
= $entry['building_part'];
- $request['coordinator']
= $survey['coordinator_id'];
- $request['status']
= $config->config_data['condition_survey_initial_status'];
- $request['budget']
= $entry['amount'];
+ $request['condition_survey_id']
= $survey['id'];
+ $request['street_name']
= $location_data['street_name'];
+ $request['street_number']
= $location_data['street_number'];
+ $request['location']
= $location;
+ $request['location_code']
= $survey['location_code'];
+ $request['origin_id']
= $GLOBALS['phpgw']->locations->get_id('property',
'.project.condition_survey');
+ $request['origin_item_id']
= (int)$survey['id'];
+ $request['title']
= substr($entry['title'], 0, 255);
+ $request['descr']
= $entry['descr'];
+ $request['building_part']
= $entry['building_part'];
+ $request['coordinator']
= $survey['coordinator_id'];
+ $request['status']
= $config->config_data['condition_survey_initial_status'];
+ $request['amount_investment']
= $entry['amount_investment'];
+ $request['amount_operation']
= $entry['amount_operation'];
+ $request['amount_potential_grants']
= $entry['amount_potential_grants'];
+
$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
@@ -388,16 +400,6 @@
);
$sorequest->add($request,
$values_attribute = array());
- if($entry['amount_extra'] > 0)
- {
-
if(isset($config->config_data['condition_survey_import_cat'][4]))
- {
- $request['cat_id'] =
(int)$config->config_data['condition_survey_import_cat'][4];
- }
- $request['planning_value']
=$entry['amount_extra'];
- $request['budget']
=$entry['amount_extra'];
- $sorequest->add($request,
$values_attribute = array());
- }
}
}
Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php 2013-03-04 08:37:16 UTC (rev
10957)
+++ trunk/property/inc/class.sorequest.inc.php 2013-03-04 14:52:29 UTC (rev
10958)
@@ -789,36 +789,44 @@
$request = array();
if ($this->_db->next_record())
{
+ $amount_investment =
$this->_db->f('amount_investment');
+ $amount_operation =
$this->_db->f('amount_operation');
+ $amount_potential_grants =
$this->_db->f('amount_potential_grants');
+ $budget = $amount_investment +
$amount_operation;
+
$request = array
- (
- 'id'
=> $this->_db->f('id'),
- 'request_id'
=> $this->_db->f('id'), // FIXME
- 'title'
=> $this->_db->f('title', true),
- 'location_code'
=> $this->_db->f('location_code'),
- 'descr'
=> $this->_db->f('descr', true),
- 'status'
=> $this->_db->f('status'),
- 'budget'
=> (int)$this->_db->f('budget'),
- 'tenant_id'
=> $this->_db->f('tenant_id'),
- 'owner'
=> $this->_db->f('owner'),
- 'coordinator'
=> $this->_db->f('coordinator'),
- 'access'
=> $this->_db->f('access'),
- 'start_date'
=> $this->_db->f('start_date'),
- 'end_date'
=> $this->_db->f('end_date'),
- 'cat_id'
=> $this->_db->f('category'),
- 'branch_id'
=> $this->_db->f('branch_id'),
- 'authorities_demands' =>
$this->_db->f('authorities_demands'),
- 'score'
=> $this->_db->f('score'),
- 'p_num'
=> $this->_db->f('p_num'),
- 'p_entity_id'
=> $this->_db->f('p_entity_id'),
- 'p_cat_id'
=> $this->_db->f('p_cat_id'),
- 'contact_phone'
=> $this->_db->f('contact_phone', true),
- 'building_part'
=> $this->_db->f('building_part'),
- 'entry_date'
=> $this->_db->f('entry_date'),
- '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'))
- );
+ (
+ 'id'
=> $this->_db->f('id'),
+ 'request_id'
=> $this->_db->f('id'), // FIXME
+ 'title'
=> $this->_db->f('title', true),
+ 'location_code'
=> $this->_db->f('location_code'),
+ 'descr'
=> $this->_db->f('descr', true),
+ 'status'
=> $this->_db->f('status'),
+ 'amount_investment'
=> $amount_investment,
+ 'amount_operation'
=> $amount_operation,
+ 'amount_potential_grants' =>
$amount_potential_grants,
+ 'budget'
=> (int)$budget,
+ 'tenant_id'
=> $this->_db->f('tenant_id'),
+ 'owner'
=> $this->_db->f('owner'),
+ 'coordinator'
=> $this->_db->f('coordinator'),
+ 'access'
=> $this->_db->f('access'),
+ 'start_date'
=> $this->_db->f('start_date'),
+ 'end_date'
=> $this->_db->f('end_date'),
+ 'cat_id'
=> $this->_db->f('category'),
+ 'branch_id'
=> $this->_db->f('branch_id'),
+ 'authorities_demands' =>
$this->_db->f('authorities_demands'),
+ 'score'
=> $this->_db->f('score'),
+ 'p_num'
=> $this->_db->f('p_num'),
+ 'p_entity_id'
=> $this->_db->f('p_entity_id'),
+ 'p_cat_id'
=> $this->_db->f('p_cat_id'),
+ 'contact_phone'
=> $this->_db->f('contact_phone', true),
+ 'building_part'
=> $this->_db->f('building_part'),
+ 'entry_date'
=> $this->_db->f('entry_date'),
+ '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'))
+ );
if ( isset($values['attributes']) &&
is_array($values['attributes']) )
{
@@ -929,23 +937,25 @@
$id = $this->next_id();
- $value_set['id']
= $id;
- $value_set['title']
= $this->_db->db_addslashes($request['title']);
- $value_set['owner']
= $this->account;
- $value_set['category'] =
$request['cat_id'];
- $value_set['descr']
= $this->_db->db_addslashes($request['descr']);
-// $value_set['location_code'] =
$request['location_code'];
- $value_set['entry_date'] =
time();
- $value_set['budget'] =
(int)$request['budget'];
- $value_set['status'] =
$request['status'];
- $value_set['branch_id'] =
$request['branch_id'];
- $value_set['coordinator'] =
$request['coordinator'];
- $value_set['authorities_demands'] =
$request['authorities_demands'];
- $value_set['building_part'] =
$request['building_part'];
- $value_set['start_date'] =
$request['start_date'];
- $value_set['end_date'] =
$request['end_date'];
- $value_set['regulations'] =
$request['regulations'] ? ',' . implode(',',$request['regulations']) . ',' : '';
- $value_set['condition_survey_id'] =
$request['condition_survey_id'];
+ $value_set['id']
= $id;
+ $value_set['title']
= $this->_db->db_addslashes($request['title']);
+ $value_set['owner']
= $this->account;
+ $value_set['category']
= $request['cat_id'];
+ $value_set['descr']
= $this->_db->db_addslashes($request['descr']);
+// $value_set['location_code']
= $request['location_code'];
+ $value_set['entry_date']
= time();
+ $value_set['amount_investment'] = (int)
$request['amount_investment');
+ $value_set['amount_operation'] = (int)
$request['amount_operation');
+ $value_set['amount_potential_grants'] = (int)
$request['amount_potential_grants');
+ $value_set['status']
= $request['status'];
+ $value_set['branch_id']
= $request['branch_id'];
+ $value_set['coordinator']
= $request['coordinator'];
+ $value_set['authorities_demands'] =
$request['authorities_demands'];
+ $value_set['building_part']
= $request['building_part'];
+ $value_set['start_date']
= $request['start_date'];
+ $value_set['end_date']
= $request['end_date'];
+ $value_set['regulations']
= $request['regulations'] ? ',' . implode(',',$request['regulations']) . ',' :
'';
+ $value_set['condition_survey_id'] =
$request['condition_survey_id'];
$cols = implode(',', array_keys($value_set));
$values =
$this->_db->validate_insert(array_values($value_set));
@@ -1073,19 +1083,21 @@
$value_set = array
(
- 'title' =>
$this->_db->db_addslashes($request['title']),
- 'status' =>
$request['status'],
- 'category' =>
$request['cat_id'],
- 'start_date' =>
$request['start_date'],
- 'end_date' =>
$request['end_date'],
- 'coordinator' =>
$request['coordinator'],
- 'descr' =>
$this->_db->db_addslashes($request['descr']),
- 'budget' =>
(int)$request['budget'],
- 'location_code' =>
$request['location_code'],
- 'address' =>
$address,
- 'authorities_demands' =>
$request['authorities_demands'],
- 'building_part' =>
$request['building_part'],
- 'regulations' =>
$request['regulations'] ? ',' . implode(',',$request['regulations']) . ',' : ''
+ 'title'
=> $this->_db->db_addslashes($request['title']),
+ 'status'
=> $request['status'],
+ 'category'
=> $request['cat_id'],
+ 'start_date' =>
$request['start_date'],
+ 'end_date'
=> $request['end_date'],
+ 'coordinator' =>
$request['coordinator'],
+ 'descr'
=> $this->_db->db_addslashes($request['descr']),
+ 'amount_investment' =>
(int)$request['amount_investment');
+ 'amount_operation' =>
(int)$request['amount_operation');
+ 'amount_potential_grants'] => (int)
$request['amount_potential_grants');
+ 'location_code' =>
$request['location_code'],
+ 'address'
=> $address,
+ 'authorities_demands' =>
$request['authorities_demands'],
+ 'building_part' =>
$request['building_part'],
+ 'regulations' =>
$request['regulations'] ? ',' . implode(',',$request['regulations']) . ',' : ''
);
while (is_array($request['location']) &&
list($input_name,$value) = each($request['location']))
Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2013-03-04 08:37:16 UTC
(rev 10957)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2013-03-04 14:52:29 UTC
(rev 10958)
@@ -973,20 +973,20 @@
{
$_options = array
(
- '_skip_import_' =>
'Utelates fra import/implisitt',
- 'import_type' =>
'import type',
- 'building_part' =>
'bygningsdels kode',
- 'descr'
=> 'Tilstandbeskrivelse',
- 'title'
=> 'Tiltak',
- 'hjemmel'
=> 'Hjemmel/ krav',
- 'condition_degree' =>
'Tilstandsgrad',
- 'condition_type' =>
'Konsekvenstype',
- 'consequence' =>
'Konsekvensgrad',
- 'probability' =>
'Sannsynlighet',
- 'due_year'
=> 'År (innen)',
- 'percentage_investment' => 'Andel %
aktivering (U)',
- 'amount'
=> 'Kalkyle netto totalt (VU)',
- 'amount_extra' =>
'Merkostnad ENØK (U)',
+ '_skip_import_'
=> 'Utelates fra import/implisitt',
+ 'import_type'
=> 'import type',
+ 'building_part'
=> 'bygningsdels kode',
+ 'descr'
=> 'Tilstandbeskrivelse',
+ 'title'
=> 'Tiltak',
+ 'hjemmel'
=> 'Hjemmel/ krav',
+ 'condition_degree'
=> 'Tilstandsgrad',
+ 'condition_type'
=> 'Konsekvenstype',
+ 'consequence'
=> 'Konsekvensgrad',
+ 'probability'
=> 'Sannsynlighet',
+ 'due_year'
=> 'År (innen)',
+ 'amount_investment'
=> 'Beløp investering',
+ 'amount_operation'
=> 'Beløp drift',
+ 'amount_potential_grants' =>
'Potensial for offentlig støtte',
);
phpgw::import_class('phpgwapi.sbox');
Modified: trunk/property/inc/hook_config.inc.php
===================================================================
--- trunk/property/inc/hook_config.inc.php 2013-03-04 08:37:16 UTC (rev
10957)
+++ trunk/property/inc/hook_config.inc.php 2013-03-04 14:52:29 UTC (rev
10958)
@@ -350,7 +350,6 @@
1 => 'Investment',
2 => 'Operation',
3 => 'Combined::Investment/Operation',
- 4 => 'Special'
);
$cats = CreateObject('phpgwapi.categories', -1, 'property',
'.project');
Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang 2013-03-04 08:37:16 UTC (rev 10957)
+++ trunk/property/setup/phpgw_no.lang 2013-03-04 14:52:29 UTC (rev 10958)
@@ -1296,6 +1296,7 @@
popup calendar property no Kalender
post property no post
power meter property no Strømmåler
+potential grants property no Potensiell offentlig støtte
precision property no Presisjon
prefix property no prefiks
preview html property no Forhåndsvis som HTML
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2013-03-04 08:37:16 UTC (rev 10957)
+++ trunk/property/setup/setup.inc.php 2013-03-04 14:52:29 UTC (rev 10958)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.665';
+ $setup_info['property']['version'] = '0.9.17.666';
$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-03-04 08:37:16 UTC (rev
10957)
+++ trunk/property/setup/tables_current.inc.php 2013-03-04 14:52:29 UTC (rev
10958)
@@ -879,7 +879,9 @@
'tenant_id' => array('type' =>
'int','precision' => '4','nullable' => True),
'contact_phone' => array('type' =>
'varchar','precision' => '20','nullable' => True),
'entry_date' => array('type' =>
'int','precision' => '4','nullable' => True),
- 'budget' => array('type' => 'int','precision'
=> '4','nullable' => True),
+ 'amount_investment' => array('type' =>
'int','precision' => '4','default' => '0','nullable' => True),
+ 'amount_operation' => array('type' =>
'int','precision' => '4','default' => '0','nullable' => True),
+ 'amount_potential_grants' => array('type' =>
'int','precision' => '4','default' => '0','nullable' => True),
'status' => array('type' =>
'varchar','precision' => '10','nullable' => True),
'branch_id' => array('type' =>
'int','precision' => '4','nullable' => True),
'coordinator' => array('type' =>
'int','precision' => '4','nullable' => True),
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2013-03-04 08:37:16 UTC (rev
10957)
+++ trunk/property/setup/tables_update.inc.php 2013-03-04 14:52:29 UTC (rev
10958)
@@ -7383,3 +7383,44 @@
return $GLOBALS['setup_info']['property']['currentver'];
}
}
+
+
+ /**
+ * Update property version from 0.9.17.665 to 0.9.17.666
+ * Add bulk-flag to entities
+ */
+ $test[] = '0.9.17.665';
+ function property_upgrade0_9_17_665()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_request','budget','amount_investment');
+
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_request','amount_investment',array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'default' => '0',
+ 'nullable' => true
+ )
+ );
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_request','amount_operation',array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'default' => '0',
+ 'nullable' => true
+ )
+ );
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_request','amount_potential_grants',array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'default' => '0',
+ 'nullable' => true
+ )
+ );
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.666';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl 2013-03-04 08:37:16 UTC (rev
10957)
+++ trunk/property/templates/base/request.xsl 2013-03-04 14:52:29 UTC (rev
10958)
@@ -425,10 +425,38 @@
</xsl:choose>
<dt><label>
+
<xsl:value-of select="php:function('lang', 'investment')"/>
+ </label></dt>
+ <dd>
+ <input
type="text" name="values[amount_investment]" value="{value_amount_investment}">
+
<xsl:attribute name="title"><xsl:value-of
select="lang_budget_statustext"/></xsl:attribute>
+ </input>
+
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+ </dd>
+ <dt><label>
+
<xsl:value-of select="php:function('lang', 'operation')"/>
+ </label></dt>
+ <dd>
+ <input
type="text" name="values[amount_operation]" value="{value_amount_operation}">
+
<xsl:attribute name="title"><xsl:value-of
select="lang_budget_statustext"/></xsl:attribute>
+ </input>
+
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+ </dd>
+ <dt><label>
+
<xsl:value-of select="php:function('lang', 'potential grants')"/>
+ </label></dt>
+ <dd>
+ <input
type="text" name="values[amount_potential_grants]"
value="{value_amount_potential_grants}">
+
<xsl:attribute name="title"><xsl:value-of
select="lang_budget_statustext"/></xsl:attribute>
+ </input>
+
<xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+ </dd>
+
+ <dt><label>
<xsl:value-of select="php:function('lang', 'total cost estimate')"/>
</label></dt>
<dd>
- <input
type="text" name="values[budget]" value="{value_budget}"><xsl:attribute
name="title"><xsl:value-of
select="lang_budget_statustext"/></xsl:attribute></input><xsl:text> </xsl:text>
[ <xsl:value-of select="currency"/> ]
+
<xsl:value-of select="value_budget"/><xsl:text> </xsl:text> [ <xsl:value-of
select="currency"/> ]
</dd>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10958] property: condition survey,
Sigurd Nes <=