fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7520] property: more on import


From: Sigurd Nes
Subject: [Fmsystem-commits] [7520] property: more on import
Date: Mon, 22 Aug 2011 13:07:23 +0000

Revision: 7520
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7520
Author:   sigurdne
Date:     2011-08-22 13:07:23 +0000 (Mon, 22 Aug 2011)
Log Message:
-----------
property: more on import

Modified Paths:
--------------
    trunk/property/inc/class.sorequest.inc.php
    trunk/property/inc/class.uirequest.inc.php
    trunk/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
    trunk/property/templates/base/request.xsl

Modified: trunk/property/inc/class.sorequest.inc.php
===================================================================
--- trunk/property/inc/class.sorequest.inc.php  2011-08-21 16:24:30 UTC (rev 
7519)
+++ trunk/property/inc/class.sorequest.inc.php  2011-08-22 13:07:23 UTC (rev 
7520)
@@ -50,13 +50,16 @@
 
                function read_priority_key()
                {
-                       $this->db->query("SELECT * FROM 
fm_request_condition_type",__LINE__,__FILE__);
+                       $this->db->query("SELECT * FROM 
fm_request_condition_type ORDER BY priority_key DESC, id 
ASC",__LINE__,__FILE__);
 
+                       $priority_key = array();
                        while ($this->db->next_record())
                        {
-                               $priority_key[] = array(
-                                       'id'            => $this->db->f('id'),
-                                       'descr'         => 
$this->db->f('descr'),
+                               $priority_key[] = array
+                               (
+                                       'id'                    => 
$this->db->f('id'),
+                                       'name'                  => 
$this->db->f('name',true),
+                                       'descr'                 => 
$this->db->f('descr',true),
                                        'priority_key'  => 
$this->db->f('priority_key')
                                );
                        }
@@ -120,9 +123,8 @@
                                        $score = $this->db->f('score');
                                        $this->db->query("UPDATE fm_request SET 
score = $score WHERE id = $id",__LINE__,__FILE__);
                                }
-
-                               $this->db->query("UPDATE fm_request SET score = 
score + {$authorities_demands} WHERE id = $id AND authorities_demands = 
1",__LINE__,__FILE__);
                        }
+                       $this->db->query("UPDATE fm_request SET score = score + 
{$authorities_demands} WHERE authorities_demands = 1",__LINE__,__FILE__);
                }
 
                function select_status_list()
@@ -202,6 +204,9 @@
                        $dry_run                = isset($data['dry_run']) ? 
$data['dry_run'] : '';
                        $p_num                  = isset($data['p_num']) ? 
$data['p_num'] : '';
 
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request');
+                       $attribute_table = 'phpgw_cust_attribute';
+                       $attribute_filter = " location_id = {$location_id}";
 
                        $entity_table = 'fm_request';
 
@@ -325,6 +330,25 @@
                        $uicols['sortable'][]           = true;
 
 
+                       $this->db->query("SELECT * FROM $attribute_table WHERE 
list=1 AND $attribute_filter");
+                       while ($this->db->next_record())
+                       {
+                               $cols .= ",{$entity_table}." . 
$this->db->f('column_name');
+
+                               $cols_return[]                          =  
$this->db->f('column_name');
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       =  
$this->db->f('column_name');
+                               $uicols['descr'][]                      =  
$this->db->f('input_text',true);
+                               $uicols['statustext'][]         =  
$this->db->f('statustext',true);
+                               $uicols['exchange'][]           = '';
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = 
$this->db->f('datatype');
+                               $uicols['formatter'][]          = '';
+                               $uicols['classname'][]          = '';
+                               $uicols['sortable'][]           = false;
+
+                       }
+
                        $paranthesis = '(';
                        $joinmethod = "{$this->left_join} fm_request_status ON 
{$entity_table}.status = fm_request_status.id)";
 
@@ -678,7 +702,7 @@
                                        (
                                                'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$request['origin'][0]['location']),
                                                'location1_item_id' => 
$request['origin'][0]['data'][0]['id'],
-                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request'),           
             
+                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request'),
                                                'location2_item_id' => $id,
                                                'account_id'            => 
$this->account
                                        );

Modified: trunk/property/inc/class.uirequest.inc.php
===================================================================
--- trunk/property/inc/class.uirequest.inc.php  2011-08-21 16:24:30 UTC (rev 
7519)
+++ trunk/property/inc/class.uirequest.inc.php  2011-08-22 13:07:23 UTC (rev 
7520)
@@ -344,8 +344,7 @@
                                                                ( // TEXT IMPUT
                                                                        'name'  
   => 'query',
                                                                        'id'    
 => 'txt_query',
-                                                                       
//'value'    => '',//$query,
-                                                                       'value' 
   => phpgw::get_var('query'),
+                                                                       'value' 
   => $this->query,
                                                                        'type' 
=> 'text',
                                                                        'size'  
  => 28,
                                                                        
'onkeypress' => 'return pulsar(event)',
@@ -419,7 +418,7 @@
                        }
 
                        $request_list = array();
-                       $request_list = $this->bo->read(array('project_id' => 
1,'allrows'=>$this->allrows, 'dry_run' => $dry_run));
+                       $request_list = $this->bo->read(array('project_id' => 
$project_id,'allrows'=>$this->allrows, 'dry_run' => $dry_run));
                        $uicols = $this->bo->uicols;
 
                        $j=0;
@@ -801,9 +800,7 @@
                        }
 
                        $function_msg   = lang('Edit priority key');
-                       $link_data = array
-                               (
-                                       'menuaction' => 
'property.uirequest.priority_key');
+                       $link_data = array('menuaction' => 
'property.uirequest.priority_key');
 
                        $priority_key = $this->bo->read_priority_key();
 

Modified: trunk/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb
===================================================================
--- trunk/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb   
2011-08-21 16:24:30 UTC (rev 7519)
+++ trunk/property/inc/import/default/cvs_import_vedlikeholdsplan_bkb   
2011-08-22 13:07:23 UTC (rev 7520)
@@ -65,11 +65,11 @@
 
                        if($data[7])
                        {
-                               $entry_date_info = explode('/',$data[4]);
+                               $entry_date_info = explode('/',$data[7]);
                        }
                        else if($data[8])
                        {
-                               $entry_date_info = explode('/',$data[5]);
+                               $entry_date_info = explode('/',$data[8]);
                        }
                        //YYYY/MM/DD
                        
@@ -83,12 +83,10 @@
                                $entry_date = time();
                        }
 
-//$authorities_demands
-//$building_part
-//$coordinator
-_debug_array($entry_date_info);
-_debug_array($entry_date);
 
+//_debug_array($entry_date_info);
+//_debug_array($entry_date);
+
                        $status = 'registrert';
                        
                        if($data[3])//historikk
@@ -140,10 +138,10 @@
                        }
                        
                        $value_set['id']                                        
= $id;
-                       $value_set['title']                                     
= $this->db->db_addslashes("{$data[0]}::{$data[6]}::{$data[20]}");
+                       $value_set['title']                                     
= substr($this->db->db_addslashes("{$data[0]}::{$data[6]}::{$data[20]}"), 0 , 
100);
                        $value_set['owner']                                     
= $this->account;
                        $value_set['category']                          = 
$category;
-                       $value_set['descr']                                     
= $this->db->db_addslashes("{$data[0]}\n{$data[6]}\n{$data[20]}");
+                       $value_set['descr']                                     
= $this->db->db_addslashes("{$data[6]}\n{$data[20]}");
                        $value_set['location_code']                     = 
$location_code;
                        $value_set['address']                           = 
$address;
                        $value_set['entry_date']                        = 
$entry_date;
@@ -161,7 +159,7 @@
                                {
                                        foreach($attrib['choice'] as $choice)
                                        {
-                                               
if(preg_match("/{$choice['value']}/i", $data[11]))
+                                               if(strpos($choice['value'], 
$data[11]) !== false)
                                                {
                                                        
$value_set['lovhjemmel']        = $choice['id'];
                                                        break 2;
@@ -177,7 +175,7 @@
                                {
                                        foreach($attrib['choice'] as $choice)
                                        {
-                                               
if(preg_match("/{$choice['value']}/i", $data[12]))
+                                               if(strpos($choice['value'], 
$data[12]) !== false)
                                                {
                                                        
$value_set['forskriftshjemmel'] = $choice['id'];
                                                        break 2;
@@ -208,18 +206,15 @@
 
                        $condition = array();
                        $condition_type = (int) substr($data[14], 0, 1);
+//_debug_array($data);                 
+                       $condition[$condition_type] = array
+                       (
+                               'degree'                => $data[13] ? 
(int)$data[13] : 1,
+                               'probability'   =>      $data[16] ? 
(int)$data[16] : 1,
+                               'consequence'   =>      $data[15] ? 
(int)$data[15] : 1,
+                       );
                        
-                       if($data[13] || $data[15])
-                       {
-                               $condition[$condition_type] = array
-                               (
-                                       'degree'                => 
(int)$data[13],
-                                       'probability'   =>      $data[16] ? 
(int)$data[16] : 1,
-                                       'consequence'   =>      (int)$data[15]
-                               );
-                       }
-                       
-                       
+//_debug_array($condition);                    
                        foreach ($condition as $condition_type => $value_type)
                        {
                                $sql = "INSERT INTO fm_request_condition 
(request_id,condition_type,degree,probability,consequence,user_id,entry_date) "

Modified: trunk/property/templates/base/request.xsl
===================================================================
--- trunk/property/templates/base/request.xsl   2011-08-21 16:24:30 UTC (rev 
7519)
+++ trunk/property/templates/base/request.xsl   2011-08-22 13:07:23 UTC (rev 
7520)
@@ -77,6 +77,8 @@
                                </xsl:choose>
                        </xsl:attribute>
                        <td class="small_text" align="left">
+                               <xsl:value-of select="name"/>
+                               <xsl:text>::</xsl:text>
                                <xsl:value-of select="descr"/>
                        </td>
                        <td class="small_text" align="left">




reply via email to

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