fmsystem-commits
[Top][All Lists]
Advanced

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

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


From: Sigurd Nes
Subject: [Fmsystem-commits] [10654] property: condition survey
Date: Wed, 09 Jan 2013 12:09:32 +0000

Revision: 10654
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10654
Author:   sigurdne
Date:     2013-01-09 12:09:30 +0000 (Wed, 09 Jan 2013)
Log Message:
-----------
property: condition survey

Modified Paths:
--------------
    trunk/property/inc/class.bocondition_survey.inc.php
    trunk/property/inc/class.borequest.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/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-01-08 14:56:32 UTC 
(rev 10653)
+++ trunk/property/inc/class.bocondition_survey.inc.php 2013-01-09 12:09:30 UTC 
(rev 10654)
@@ -307,12 +307,13 @@
                public function get_summation($id)
                {
                        $data = $this->so->get_summation($id);
-
+//$total = 0;
+//_debug_array($data);
                        $values =array();
                        $i=0;
                        foreach ($data as $entry)
                        {
-                               $i = $entry['building_part'];
+                               $i = $entry['building_part'] . '_' . 
$entry['cat_id'];
                                
                                $values[$i]['building_part'] = 
$entry['building_part'];
                                $values[$i]['category'] = 
$this->get_category_name($entry['cat_id']);
@@ -330,21 +331,26 @@
        
                                for ($j = 1; $j < 7 ; $j++ )
                                {
+                                       $values[$i]["period_{$j}"] += 0;
+                                       $values[$i]['sum'] += 0;
                                        if($j == $period)
                                        {
                                                $values[$i]["period_{$j}"] += 
$entry['amount'];
                                                $values[$i]['sum'] += 
$entry['amount'];
                                        }
-                                       else
-                                       {
-                                               $values[$i]["period_{$j}"] += 
0;                                        
-                                       }
                                }
+                       }
+                       unset($entry);
 
-                               $i++;
+                       $ret    =array();
+                       foreach ($values as $entry)
+                       {
+                               $ret[] = $entry;
                        }
-//_debug_array($values);
-                       return $values;
+
+//_debug_array($total);
+//_debug_array($ret);
+                       return $ret;
                }
 
                function get_category_name($cat_id)

Modified: trunk/property/inc/class.borequest.inc.php
===================================================================
--- trunk/property/inc/class.borequest.inc.php  2013-01-08 14:56:32 UTC (rev 
10653)
+++ trunk/property/inc/class.borequest.inc.php  2013-01-09 12:09:30 UTC (rev 
10654)
@@ -415,7 +415,32 @@
 
                public function read_survey_data($data)
                {
+
+                       $interlink      = CreateObject('property.interlink');
+
+
                        $values = $this->so->read_survey_data($data);
+
+                       foreach($values as &$entry)
+                       {
+                               $target = $interlink->get_relation('property', 
$this->acl_location, $entry['id'], 'target');
+                               $related = array();
+                               if($target)
+                               {
+                                       foreach($target as $_target_section)
+                                       {
+                                               foreach 
($_target_section['data'] as $_target_entry)
+                                               {
+                                                       $related[] = "<a 
href=\"{$_target_entry['link']}\" 
title=\"{$_target_entry['title']}\">{$_target_section['descr']}::{$_target_entry['id']}::{$_target_entry['statustext']}</a>";
+                                               }
+                                       }
+                                       $entry['related'] = implode(' 
/</br>',$related);
+                               }
+
+                               $category                       = 
$this->cats->return_single($entry['cat_id']);
+                               $entry['category']      = $category[0]['name'];
+                       }
+
                        $this->total_records    = $this->so->total_records;
                        return $values;
                }

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2013-01-08 14:56:32 UTC (rev 
10653)
+++ trunk/property/inc/class.sorequest.inc.php  2013-01-09 12:09:30 UTC (rev 
10654)
@@ -229,7 +229,7 @@
                        }
 
                        $sql = "SELECT DISTINCT fm_request.id as 
request_id,fm_request_status.descr as status,fm_request.building_part,"
-                       . " 
fm_request.start_date,fm_request.closed_date,fm_request.in_progress_date,"
+                       . " 
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.budget,fm_request.score,min(fm_request_planning.date) as 
planned_year"
                        . " FROM (((( fm_request  LEFT JOIN fm_request_status 
ON fm_request.status = fm_request_status.id)"
@@ -280,6 +280,7 @@
                                        'planned_budget'        => 
$this->_db->f('planned_budget'),
                                        'score'                         => 
$this->_db->f('score'),
                                        'planned_year'          => 
$this->_db->f('planned_year') ? date('Y', $this->_db->f('planned_year')) : '',
+                                       'cat_id'                        => 
$this->_db->f('cat_id'),
                                );
                        }
                        return $values;
@@ -935,7 +936,7 @@
                        $value_set['descr']                                     
= $this->_db->db_addslashes($request['descr']);
 //                     $value_set['location_code']                     = 
$request['location_code'];
                        $value_set['entry_date']                        = 
time();
-                       $value_set['budget']                            = 
$request['budget'];
+                       $value_set['budget']                            = 
(int)$request['budget'];
                        $value_set['status']                            = 
$request['status'];
                        $value_set['branch_id']                         = 
$request['branch_id'];
                        $value_set['coordinator']                       = 
$request['coordinator'];

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2013-01-08 14:56:32 UTC 
(rev 10653)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2013-01-09 12:09:30 UTC 
(rev 10654)
@@ -390,15 +390,18 @@
 
                        $related_def = array
                        (
-                               array('key' => 
'url','label'=>lang('id'),'sortable'=>false,'resizeable'=>true),
-                               array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'url','label'=>lang('id'),'sortable'=>true,'resizeable'=>true),
+                               array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true,'width' => 
'100'),//width not working...
                                array('key' => 
'status','label'=>lang('status'),'sortable'=>true,'resizeable'=>true),
+                               array('key' => 
'category','label'=>lang('category'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'condition_degree','label'=>lang('condition 
degree'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'score','label'=>lang('score'),'sortable'=>true,'resizeable'=>true),
                                array('key' => 
'budget','label'=>lang('budget'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
 //                             array('key' => 
'planned_budget','label'=>lang('planned 
budget'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
                                array('key' => 
'planned_year','label'=>lang('year'),'sortable'=>true,'resizeable'=>true),
+                               array('key' => 
'related','label'=>lang('related'),'sortable'=>false,'resizeable'=>true),
                        );
 
-
                        $datatable_def[] = array
                        (
                                'container'             => 
'datatable-container_1',
@@ -625,6 +628,9 @@
                        $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;
                        $start = phpgw::get_var('startIndex', 'int', 'REQUEST', 
0);
 
+                       $allrows = true;
+                       $num_rows = $total_records;
+
                        if($allrows)
                        {
                                $out = $values;

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2013-01-08 14:56:32 UTC (rev 
10653)
+++ trunk/property/inc/class.uirequest.inc.php  2013-01-09 12:09:30 UTC (rev 
10654)
@@ -1579,9 +1579,23 @@
                        }
 
 
+                       $ticket_link_data = array
+                       (
+                               'menuaction'            => 'property.uitts.add',
+                               'bypass'                        => true,
+                               'location_code'         => 
$values['location_code'],
+                       //      'p_num'                         => 0,
+                       //      'p_entity_id'           => 0,
+                       ///     'p_cat_id'                      => 0,
+                               'origin'                        => 
$this->acl_location,
+                               'origin_id'                     => $id
+                       );
+
+
                        $data = array
                                (
                                        'mode'                                  
                        => $mode,
+                                       'ticket_link'                           
                => $GLOBALS['phpgw']->link('/index.php',$ticket_link_data),
                                        'value_authorities_demands'             
=> isset($this->config->config_data['authorities_demands']) &&  
$this->config->config_data['authorities_demands'] ? 
$this->config->config_data['authorities_demands'] : 0,
                                        'suppressmeter'                         
                => isset($this->config->config_data['project_suppressmeter']) 
&& $this->config->config_data['project_suppressmeter'] ? 1 : '',
                                        'show_dates'                            
                => $show_dates,

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2013-01-08 14:56:32 UTC (rev 
10653)
+++ trunk/property/setup/tables_update.inc.php  2013-01-09 12:09:30 UTC (rev 
10654)
@@ -7188,6 +7188,7 @@
 
 
                $GLOBALS['phpgw_setup']->oProc->query('UPDATE fm_project_budget 
SET active = 1',__LINE__,__FILE__);
+               $GLOBALS['phpgw_setup']->oProc->query('UPDATE fm_request set 
budget = 0 WHERE budget IS NULL',__LINE__,__FILE__);
 
                $GLOBALS['phpgw_setup']->oProc->CreateTable(
                        'fm_workorder_budget',  array(

Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl   2013-01-08 14:56:32 UTC (rev 
10653)
+++ trunk/property/templates/base/request.xsl   2013-01-09 12:09:30 UTC (rev 
10654)
@@ -136,6 +136,17 @@
                                                                        </input>
                                                                </form>
                                                        </td>
+                                                       <td>
+                                                               <form 
method="post" action="{ticket_link}">
+                                                                       
<xsl:variable name="lang_start_ticket">
+                                                                               
<xsl:value-of select="php:function('lang', 'start ticket')"/>
+                                                                       
</xsl:variable>
+                                                                       <input 
type="hidden" name="values[subject]" value="{value_title}"/>
+                                                                       <input 
type="hidden" name="values[details]" value="{value_descr}"/>
+                                                                       <input 
type="submit" name="start_ticket" value="{$lang_start_ticket}">
+                                                                       </input>
+                                                               </form>
+                                                       </td>
                                                </tr>
                                        </xsl:when>
                                </xsl:choose>




reply via email to

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