fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6874] property: configurable address data at entitie


From: Sigurd Nes
Subject: [Fmsystem-commits] [6874] property: configurable address data at entities and tickets
Date: Fri, 28 Jan 2011 16:00:55 +0000

Revision: 6874
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6874
Author:   sigurdne
Date:     2011-01-28 16:00:47 +0000 (Fri, 28 Jan 2011)
Log Message:
-----------
property: configurable address data at entities and tickets

Modified Paths:
--------------
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/class.boentity.inc.php
    trunk/property/inc/class.solocation.inc.php
    trunk/property/inc/class.uilookup.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/hook_config.inc.php
    trunk/property/templates/base/config.tpl

Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php   2011-01-28 09:16:43 UTC (rev 
6873)
+++ trunk/property/inc/class.bocommon.inc.php   2011-01-28 16:00:47 UTC (rev 
6874)
@@ -1259,29 +1259,35 @@
                                $cols_return[] = 'loc' . 
$location_types[$i]['id'];
                        }
 
-                       if($lookup)
+//                     if($lookup)
                        {
+                               $GLOBALS['phpgw']->config->read();
+                               $list_location_level = 
isset($GLOBALS['phpgw']->config->config_data['list_location_level'])     && 
$GLOBALS['phpgw']->config->config_data['list_location_level'] ? 
$GLOBALS['phpgw']->config->config_data['list_location_level'] : array();
+/*
                                $cols_return[]                          = 
'loc1_name';
                                $cols_extra[]                           = 
'loc1_name';
-                               $uicols['input_type'][]         = 'text';
+                               $cols_return_lookup[]           = 
"loc{$i}_name";
+                               $uicols['input_type'][]         = in_array(1, 
$list_location_level) ? 'text' : 'hidden';
                                $uicols['name'][]                       = 
'loc1_name';
-                               $uicols['descr'][]                      = 
lang('Property Name');
-                               $uicols['statustext'][]         = 
lang('Property Name');
-                               $uicols['exchange'][]           = true;
+                               $uicols['descr'][]                      = 
$location_types[0]['name'];
+                               $uicols['statustext'][]         = 
$location_types[0]['descr'];
+                               $uicols['exchange'][]           = $lookup;
                                $uicols['align'][]                      = '';
                                $uicols['datatype'][]           = '';
                                $uicols['formatter'][]          = '';
                                $uicols['classname'][]          = '';
                                $uicols['sortable'][]           = true;
-
-                               for ($i=2;$i<($type_id+1);$i++)
+*/
+                               for ($i=1;$i<($type_id+1);$i++)
                                {
-                                       $cols_return_lookup[]           = 'loc' 
. $i . '_name';
-                                       $uicols['input_type'][]         = 
'hidden';
-                                       $uicols['name'][]                       
= 'loc' . $i . '_name';
-                                       $uicols['descr'][]                      
= '';
-                                       $uicols['statustext'][]         = '';
-                                       $uicols['exchange'][]           = true;
+                                       $cols_return[]                          
= "loc{$i}_name";
+                                       $cols_extra[]                           
= "loc{$i}_name";
+                                       $cols_return_lookup[]           = 
"loc{$i}_name";
+                                       $uicols['input_type'][]         = 
in_array($i, $list_location_level) ? 'text' : 'hidden';
+                                       $uicols['name'][]                       
= "loc{$i}_name";
+                                       $uicols['descr'][]                      
= $location_types[($i-1)]['name'];
+                                       $uicols['statustext'][]         = 
$location_types[$i-1]['descr'];
+                                       $uicols['exchange'][]           = 
$lookup;
                                        $uicols['align'][]                      
= '';
                                        $uicols['datatype'][]           = '';
                                        $uicols['formatter'][]          = '';

Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php   2011-01-28 09:16:43 UTC (rev 
6873)
+++ trunk/property/inc/class.boentity.inc.php   2011-01-28 16:00:47 UTC (rev 
6874)
@@ -308,21 +308,21 @@
                        //_debug_array($cols_extra);
                        //_debug_array($cols_return_lookup);
 
-                       if(isset($data['lookup']) && $data['lookup'])
+//                     if(isset($data['lookup']) && $data['lookup'])
                        {
-                               for ($i=0;$i<count($entity);$i++)
+                               foreach ($entity as &$entry)
                                {
-                                       
$location_data=$this->solocation->read_single($entity[$i]['location_code']);
+                                       $location_data = 
$this->solocation->read_single($entry['location_code']);
                                        for ($j=0;$j<count($cols_extra);$j++)
                                        {
-                                               $entity[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
+                                               $entry[$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
                                        }
 
                                        if($cols_return_lookup)
                                        {
                                                for 
($k=0;$k<count($cols_return_lookup);$k++)
                                                {
-                                                       
$entity[$i][$cols_return_lookup[$k]] = $location_data[$cols_return_lookup[$k]];
+                                                       
$entry[$cols_return_lookup[$k]] = $location_data[$cols_return_lookup[$k]];
                                                }
                                        }
                                }

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2011-01-28 09:16:43 UTC (rev 
6873)
+++ trunk/property/inc/class.solocation.inc.php 2011-01-28 16:00:47 UTC (rev 
6874)
@@ -1141,7 +1141,7 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
-                       //echo $sql;
+//                     _debug_array($sql);
                        $cols_return    = $this->cols_return;
 
                        $this->db->next_record();

Modified: trunk/property/inc/class.uilookup.inc.php
===================================================================
--- trunk/property/inc/class.uilookup.inc.php   2011-01-28 09:16:43 UTC (rev 
6873)
+++ trunk/property/inc/class.uilookup.inc.php   2011-01-28 16:00:47 UTC (rev 
6874)
@@ -2011,12 +2011,12 @@
 
                        for ($i=0;$i<count($input_name);$i++)
                        {
-                               $function_exchange_values .= 
'opener.document.getElementsByName("'.$input_name[$i].'")[0].value = "";' 
."\r\n";
+                               $function_exchange_values .= 
"opener.document.getElementsByName('{$input_name[$i]}')[0].value = '';\r\n";
                        }
 
                        for ($i=0;$i<count($input_name);$i++)
                        {
-                               $function_exchange_values .= 
'opener.document.getElementsByName("'.$input_name[$i].'")[0].value = 
data.getData("'.$input_name[$i].'");' ."\r\n";
+                               $function_exchange_values .= 
"opener.document.getElementsByName('{$input_name[$i]}')[0].value = 
data.getData('{$input_name[$i]}');\r\n";
                        }
 
                        $function_exchange_values .= 'window.close()';
@@ -2069,11 +2069,11 @@
                                        {
                                                if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
                                                {
-                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                                       
$json_row[$column['name']] = "<a href='#' id='{$column['link']}' 
onclick='javascript:filter_data(this.id);'>{$column['value']}</a>";
                                                }
                                                else 
if(isset($column['format']) && $column['format']== "link")
                                                {
-                                                       
$json_row[$column['name']] = "<a href='".$column['link']."' target='_blank'>" 
.$column['value']."</a>";
+                                                       
$json_row[$column['name']] = "<a href='{$column['link']}' 
target='_blank'>{$column['value']}</a>";
                                                }
                                                else
                                                {

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2011-01-28 09:16:43 UTC (rev 
6873)
+++ trunk/property/inc/class.uitts.inc.php      2011-01-28 16:00:47 UTC (rev 
6874)
@@ -755,64 +755,104 @@
                        }
 
                        $ticket_list = array();
-                       //                      if(!$dry_run)
-                               {
-                                       $ticket_list = 
$this->bo->read($start_date, $end_date,'',$dry_run);
-                               }
 
+                       $ticket_list = $this->bo->read($start_date, 
$end_date,'',$dry_run);
+
                        $this->bo->get_origin_entity_type();
                        $uicols_related = $this->bo->uicols_related;
                        //_debug_array($uicols_related);
                        $uicols = array();
 
                        $uicols['name'][] = 'priority';
+                       $uicols['descr'][]      = lang('priority');
                        $uicols['name'][] = 'id';
+                       $uicols['descr'][]      = lang('id');
                        $uicols['name'][] = 'bgcolor';
+                       $uicols['descr'][]      = lang('bgcolor');
                        $uicols['name'][] = 'subject';
-                       $uicols['name'][] = 'loc1_name';
+                       $uicols['descr'][]      = lang('subject');
                        $uicols['name'][] = 'location_code';
+                       $uicols['descr'][]      = lang('location code');
+                       $location_types = 
execMethod('property.soadmin_location.select_location_type');
+                       $level_assigned = 
isset($this->bo->config->config_data['list_location_level']) && 
$this->bo->config->config_data['list_location_level'] ? 
$this->bo->config->config_data['list_location_level'] : array();
+
+                       foreach ( $location_types as $dummy => $level)
+                       {
+                               if ( in_array($level['id'], $level_assigned))
+                               {
+                                       $uicols['name'][] = 
"loc{$level['id']}_name";
+                                       $uicols['descr'][]      = 
$level['name'];
+                                       if($level['id'] > 1)
+                                       {
+                                               foreach ($ticket_list as & 
$ticket)
+                                               {
+                                                       $location_data = 
execMethod('property.solocation.read_single', $ticket['location_code']);
+                                                       
$ticket["loc{$level['id']}_name"] = $location_data["loc{$level['id']}_name"];
+                                               }
+                                       }
+                               }
+                       }
+
+//                     $uicols['name'][] = 'loc1_name';
+
                        $uicols['name'][] = 'address';
-                       //                      $uicols['name'][] = 'user';
+                       $uicols['descr'][]      = lang('address');
+//                     $uicols['name'][] = 'user';
+//                     $uicols['descr'][]      = lang('user');
                        $uicols['name'][] = 'assignedto';
+                       $uicols['descr'][]      = lang('assignedto');
                        $uicols['name'][] = 'entry_date';
+                       $uicols['descr'][]      = lang('entry date');
                        $uicols['name'][] = 'status';
+                       $uicols['descr'][]      = lang('status');
 
                        if( $this->acl->check('.ticket.order', PHPGW_ACL_READ, 
'property') )
                        {
                                $uicols['name'][] = 'order_id';
+                               $uicols['descr'][]      = lang('order id');
                                $uicols['name'][] = 'vendor';
+                               $uicols['descr'][]      = lang('vendor');
                        }
 
                        if( $this->acl->check('.ticket.order', PHPGW_ACL_ADD, 
'property') )
                        {
                                $uicols['name'][] = 'estimate';
+                               $uicols['descr'][]      = lang('estimate');
                                $uicols['name'][] = 'actual_cost';
+                               $uicols['descr'][]      = lang('actual cost');
                        }
 
                        foreach($uicols_related as $related)
                        {
                                $uicols['name'][] = $related;                   
+                               $uicols['descr'][]      = lang(str_replace('_', 
' ', $related));
                        }
 
                        if( $this->_show_finnish_date )
                        {
                                $uicols['name'][] = 'finnish_date';
+                               $uicols['descr'][]      = lang('finnish date');
                                $uicols['name'][] = 'delay';
+                               $uicols['descr'][]      = lang('delay');
                        }
 
                        $uicols['name'][] = 'child_date';
+                       $uicols['descr'][]      = lang('child date');
                        $uicols['name'][] = 'link_view';
+                       $uicols['descr'][]      = lang('link view');
                        $uicols['name'][] = 'lang_view_statustext';
+                       $uicols['descr'][]      = lang('lang view statustext');
                        $uicols['name'][] = 'text_view';
+                       $uicols['descr'][]      = lang('text view');
 
                        $custom_cols = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['ticket_columns'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['ticket_columns'] 
? $GLOBALS['phpgw_info']['user']['preferences']['property']['ticket_columns'] : 
array();
 
                        foreach ($custom_cols as $col)
                        {
-                               //                      $uicols['input_type'][] 
= 'text';
-                               $uicols['name'][]                       = $col;
-                               //                      $uicols['descr'][]      
        = lang(str_replace('_', ' ', $col));
-                               //                      $uicols['statustext'][] 
= $col;
+       //                      $uicols['input_type'][] = 'text';
+                               $uicols['name'][]               = $col;
+       //                      $uicols['descr'][]              = 
lang(str_replace('_', ' ', $col));
+       //                      $uicols['statustext'][] = $col;
                        }
 
 
@@ -1018,25 +1058,25 @@
                        unset($parameters);
                        for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               //              
if($uicols['input_type'][$i]!='hidden')
-                       {
-                               
$datatable['headers']['header'][$i]['formatter']                = 
!isset($uicols['formatter'][$i]) || $uicols['formatter'][$i]==''?  '""' : 
$uicols['formatter'][$i];
-                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
-                               $datatable['headers']['header'][$i]['text']     
                = lang(str_replace('_', ' ', $uicols['name'][$i]));
-                               $datatable['headers']['header'][$i]['visible']  
                = true;
-                               $datatable['headers']['header'][$i]['sortable'] 
                = false;
-                               if($uicols['name'][$i]=='priority' || 
$uicols['name'][$i]=='id' || $uicols['name'][$i]=='assignedto' || 
$uicols['name'][$i]=='finnish_date'|| $uicols['name'][$i]=='user'|| 
$uicols['name'][$i]=='entry_date' || $uicols['name'][$i]=='order_id')
+       //              if($uicols['input_type'][$i]!='hidden')
                                {
-                                       
$datatable['headers']['header'][$i]['sortable']         = true;
-                                       
$datatable['headers']['header'][$i]['sort_field']   = $uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
!isset($uicols['formatter'][$i]) || $uicols['formatter'][$i]==''?  '""' : 
$uicols['formatter'][$i];
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='priority' || 
$uicols['name'][$i]=='id' || $uicols['name'][$i]=='assignedto' || 
$uicols['name'][$i]=='finnish_date'|| $uicols['name'][$i]=='user'|| 
$uicols['name'][$i]=='entry_date' || $uicols['name'][$i]=='order_id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']   = $uicols['name'][$i];
+                                       }
+                                       if($uicols['name'][$i]=='text_view' || 
$uicols['name'][$i]=='bgcolor' || $uicols['name'][$i]=='child_date' || 
$uicols['name'][$i]== 'link_view' || 
$uicols['name'][$i]=='lang_view_statustext')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']          = false;
+                                               
$datatable['headers']['header'][$i]['format']           = 'hidden';
+                                       }
                                }
-                               if($uicols['name'][$i]=='text_view' || 
$uicols['name'][$i]=='bgcolor' || $uicols['name'][$i]=='child_date' || 
$uicols['name'][$i]== 'link_view' || 
$uicols['name'][$i]=='lang_view_statustext')
-                               {
-                                       
$datatable['headers']['header'][$i]['visible']          = false;
-                                       
$datatable['headers']['header'][$i]['format']           = 'hidden';
-                               }
                        }
-                       }
 
                        //path for property.js
                        $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";

Modified: trunk/property/inc/hook_config.inc.php
===================================================================
--- trunk/property/inc/hook_config.inc.php      2011-01-28 09:16:43 UTC (rev 
6873)
+++ trunk/property/inc/hook_config.inc.php      2011-01-28 16:00:47 UTC (rev 
6874)
@@ -171,3 +171,30 @@
                return $out;
        }
 
+
+       /**
+       * Get HTML checkbox with location levels that should be listed in lists
+       *
+       * @param $config
+       * @return string HTML checkboxes to be placed in a table
+       */
+       function list_location_level($config)
+       {
+               $location_types = 
execMethod('property.soadmin_location.select_location_type');
+
+               $level_assigned = isset($config['list_location_level']) ? 
$config['list_location_level'] : array();
+               $out = '';
+               foreach ( $location_types as $dummy => $level)
+               {
+                       $checked = '';
+                       if ( in_array($level['id'], $level_assigned))
+                       {
+                               $checked = ' checked';
+                       }
+
+                       $out .=  <<<HTML
+                       <tr><td><input type="checkbox" 
name="newsettings[list_location_level][]" value="{$level['id']}" 
{$checked}><label>{$level['name']}</label></td></tr>
+HTML;
+               }
+               return $out;
+       }

Modified: trunk/property/templates/base/config.tpl
===================================================================
--- trunk/property/templates/base/config.tpl    2011-01-28 09:16:43 UTC (rev 
6873)
+++ trunk/property/templates/base/config.tpl    2011-01-28 16:00:47 UTC (rev 
6874)
@@ -341,7 +341,6 @@
                                </table>
                        </td>
                </tr>
-
                <tr class="row_off">
                        <td>{lang_send_response_TTS}.</td>
                        <td>
@@ -446,6 +445,16 @@
                                </select>
                        </td>
                </tr>
+               <tr class="row_on">
+                       <td valign = 'top'>{lang_list_location_level}:</td>
+                       <td>
+                               <!--to be able to blank the setting - need an 
empty value-->
+                               <input type = 'hidden' 
name="newsettings[list_location_level][]" value="">
+                               <table>
+                                       {hook_list_location_level}
+                               </table>
+                       </td>
+               </tr>
                <!--
                groupnotification
                -->




reply via email to

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