phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [20982] property only: various improvements and featu


From: Sigurd Nes
Subject: [Phpgroupware-cvs] [20982] property only: various improvements and features - 4512:4565
Date: Fri, 22 Jan 2010 09:56:10 +0000

Revision: 20982
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=20982
Author:   sigurdne
Date:     2010-01-22 09:56:10 +0000 (Fri, 22 Jan 2010)
Log Message:
-----------
property only: various improvements and features  - 4512:4565

Modified Paths:
--------------
    people/sigurdne/modules/property/trunk/inc/class.boadmin_entity.inc.php
    people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php
    people/sigurdne/modules/property/trunk/inc/class.botts.inc.php
    people/sigurdne/modules/property/trunk/inc/class.menu.inc.php
    people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php
    people/sigurdne/modules/property/trunk/inc/class.socustom.inc.php
    people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uicategory.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uicustom.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uiinvoice.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uilocation.inc.php
    people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php
    people/sigurdne/modules/property/trunk/inc/hook_home.inc.php
    people/sigurdne/modules/property/trunk/inc/hook_settings.inc.php
    people/sigurdne/modules/property/trunk/js/yahoo/location.index.js
    people/sigurdne/modules/property/trunk/js/yahoo/property.js
    people/sigurdne/modules/property/trunk/setup/phpgw_no.lang
    people/sigurdne/modules/property/trunk/setup/setup.inc.php
    people/sigurdne/modules/property/trunk/setup/tables_current.inc.php
    people/sigurdne/modules/property/trunk/setup/tables_update.inc.php
    people/sigurdne/modules/property/trunk/templates/base/category.xsl
    people/sigurdne/modules/property/trunk/templates/base/config.tpl
    people/sigurdne/modules/property/trunk/templates/base/tts.xsl

Modified: 
people/sigurdne/modules/property/trunk/inc/class.boadmin_entity.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.boadmin_entity.inc.php     
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.boadmin_entity.inc.php     
2010-01-22 09:56:10 UTC (rev 20982)
@@ -118,7 +118,7 @@
                        $this->query                    = isset($query) ? 
$query : $this->query;
                        $this->sort                             = isset($sort) 
&& $sort ? $sort : '';
                        $this->order                    = isset($order) && 
$order ? $order : '';
-                       $this->type                             = isset($type)  
&& $type && $this->type_app[$type] ? $type : 'entity';
+                       $this->type                             = isset($type)  
&& $type && isset($this->type_app[$type]) ? $type : 'entity';
                        $this->cat_id                   = isset($cat_id) && 
$cat_id ? $cat_id : '';
                        $this->entity_id                = isset($entity_id) && 
$entity_id ? $entity_id : '';
                        $this->allrows                  = isset($allrows) && 
$allrows ? $allrows : '';

Modified: people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php   
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.bocommon.inc.php   
2010-01-22 09:56:10 UTC (rev 20982)
@@ -1614,7 +1614,7 @@
                * @param array $descr array containing Names for the heading of 
the output for the coresponding keys in $list
                * @param array $input_type array containing information whether 
fields are to be suppressed from the output
                */
-               function download($list,$name,$descr,$input_type='')
+               function download($list,$name,$descr,$input_type=array())
                {
                        $GLOBALS['phpgw_info']['flags']['noheader'] = true;
                        $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
@@ -1644,7 +1644,7 @@
                * @param array $descr array containing Names for the heading of 
the output for the coresponding keys in $list
                * @param array $input_type array containing information whether 
fields are to be suppressed from the output
                */
-               function excel_out($list,$name,$descr,$input_type='')
+               function excel_out($list,$name,$descr,$input_type=array())
                {
                        $filename= str_replace(' 
','_',$GLOBALS['phpgw_info']['user']['account_lid']).'.xls';
 
@@ -1659,7 +1659,7 @@
                        $m=0;
                        for ($k=0;$k<$count_uicols_name;$k++)
                        {
-                               if($input_type[$k]!='hidden')
+                               if(!isset($input_type[$k]) || 
$input_type[$k]!='hidden')
                                {
                                        $worksheet1->write_string(0, $m, 
$this->utf2ascii($descr[$k]));
                                        $m++;
@@ -1674,7 +1674,7 @@
                                        $m=0;
                                        for ($k=0;$k<$count_uicols_name;$k++)
                                        {
-                                               if($input_type[$k]!='hidden')
+                                               if(!isset($input_type[$k]) || 
$input_type[$k]!='hidden')
                                                {
                                                        $content[$j][$m]        
= str_replace("\r\n"," ",$entry[$name[$k]]);
                                                        $m++;
@@ -1722,11 +1722,10 @@
                        $header = array();
                        for ( $i = 0; $i < $count_uicols_name; ++$i )
                        {
-                               if ( $input_type[$i] == 'hidden' )
+                               if ( !isset($input_type[$i]) || $input_type[$i] 
!= 'hidden' )
                                {
-                                       continue;
+                                       $header[] = 
$this->utf2ascii($descr[$i]);
                                }
-                               $header[] = $this->utf2ascii($descr[$i]);
                        }
                        fputcsv($fp, $header);
                        unset($header);
@@ -1738,11 +1737,10 @@
                                        $row = array();
                                        for ( $i = 0; $i < $count_uicols_name; 
++$i )
                                        {
-                                               if ( $input_type[$i] == 
'hidden' )
+                                               if ( !isset($input_type[$i]) || 
$input_type[$i] != 'hidden' )
                                                {
-                                                       continue;
+                                                       $row[] = 
preg_replace("/\r\n/", ' ', $entry[$name[$i]]);
                                                }
-                                               $row[] = preg_replace("/\r\n/", 
' ', $entry[$name[$i]]);
                                        }
                                        fputcsv($fp, $row);
                                }
@@ -1771,7 +1769,7 @@
                        $m=0;
                        for ($k=0;$k<$count_uicols_name;$k++)
                        {
-                               if($input_type[$k]!='hidden')
+                               if(!isset($input_type[$k]) || 
$input_type[$k]!='hidden')
                                {
                                        $object->addCell(1, 0, $m, $descr[$k], 
'string');
                                        $m++;
@@ -1786,7 +1784,7 @@
                                        $m=0;
                                        for ($k=0;$k<$count_uicols_name;$k++)
                                        {
-                                               if($input_type[$k]!='hidden')
+                                               if(!isset($input_type[$k]) || 
$input_type[$k]!='hidden')
                                                {
                                                        $content[$j][$m]        
= str_replace(array('&'), array('og'), 
$entry[$name[$k]]);//str_replace("\r\n"," ",$entry[$name[$k]]);
                                                        $m++;

Modified: people/sigurdne/modules/property/trunk/inc/class.botts.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.botts.inc.php      
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.botts.inc.php      
2010-01-22 09:56:10 UTC (rev 20982)
@@ -45,14 +45,17 @@
                var $start_date;
                var $end_date;
                var $fields_updated = false;
+               var $status_id;
+               var $user_id;
+               var $part_of_town_id;
+               var $district_id;
+               var $total_records;
 
                var $public_functions = array
                (
                        'read'                  => true,
                        'read_single'           => true,
                        'save'                  => true,
-                       'delete'                => true,
-                       'check_perms'           => true
                );
 
                var $soap_functions = array(
@@ -191,7 +194,7 @@
                        if(!$leave_out_open)
                        {
                                $status[$i]['id']='O';
-                               $status[$i]['name']=lang('Open');
+                               $status[$i]['name']= 
isset($this->config->config_data['tts_lang_open']) && 
$this->config->config_data['tts_lang_open'] ? 
$this->config->config_data['tts_lang_open'] : lang('Open');
                                $i++;
                        }
 
@@ -224,7 +227,8 @@
                                'H' => lang('Billing hours'),
                                'F' => lang('finnish date'),
                                'SC' => lang('Status changed'),
-                               'M' => lang('Sendt by email to')
+                               'M' => lang('Sendt by email to'),
+                               'AC'=> lang('actual cost changed'),
                        );
 
                        $custom_status  = $this->so->get_custom_status();
@@ -537,6 +541,7 @@
                                                case 'F': $type = lang('finnish 
date changed'); break;
                                                case 'IF': $type = 
lang('Initial finnish date'); break;
                                                case 'L': $type = 
lang('Location changed'); break;
+                                               case 'AC': $type = lang('actual 
cost changed'); break;
                                                case 'M':
                                                        $type = lang('Sendt by 
email to');
                                                        
$this->order_sent_adress = $value['new_value']; // in case we want to resend 
the order as an reminder
@@ -916,7 +921,7 @@
 
                function delete($id)
                {
-                       $this->so->delete($id);
+                       return $this->so->delete($id);
                }
 
                /**

Modified: people/sigurdne/modules/property/trunk/inc/class.menu.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.menu.inc.php       
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.menu.inc.php       
2010-01-22 09:56:10 UTC (rev 20982)
@@ -72,7 +72,9 @@
                        $soadmin_location       = 
CreateObject('property.soadmin_location');
                        $locations      = 
$soadmin_location->select_location_type();
 
-                       if ( 
isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
+//                     if ( 
isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
+                       if ( $GLOBALS['phpgw']->acl->check('run', 
phpgwapi_acl::READ, 'admin')
+                       || $GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'property'))
                        {
                                if ( is_array($entity_list) && 
count($entity_list) )
                                {

Modified: people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php 
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.socategory.inc.php 
2010-01-22 09:56:10 UTC (rev 20982)
@@ -67,6 +67,7 @@
                        $uicols['name'][]                       = 
$this->location_info['id']['name'];
                        $uicols['descr'][]                      = lang('id');
                        $uicols['datatype'][]           = 
$this->location_info['id']['type'] == 'varchar' ? 'V' : 'I';
+                       $uicols['sortable'][]           = true;
 
                        foreach($this->location_info['fields'] as $field)
                        {
@@ -74,6 +75,7 @@
                                $uicols['name'][]                       = 
$field['name'];
                                $uicols['descr'][]                      = 
$field['descr'];
                                $uicols['datatype'][]           = 'V';
+                               $uicols['sortable'][]           = 
isset($field['sortable']) && $field['sortable'] ? true : false;
                        }
 
                        
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->location_info['acl_location']))
@@ -932,6 +934,13 @@
                                                        ),
                                                        array
                                                        (
+                                                               'name' => 
'sorting',
+                                                               'descr' => 
lang('sorting'),
+                                                               'type' => 
'integer',
+                                                               'sortable'=> 
true
+                                                       ),
+                                                       array
+                                                       (
                                                                'name' => 
'color',
                                                                'descr' => 
lang('color'),
                                                                'type' => 
'varchar'

Modified: people/sigurdne/modules/property/trunk/inc/class.socustom.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.socustom.inc.php   
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.socustom.inc.php   
2010-01-22 09:56:10 UTC (rev 20982)
@@ -182,7 +182,7 @@
                        $custom['name'] = 
$this->db->db_addslashes($custom['name']);
                        $custom['sql_text'] = 
$this->db->db_addslashes(htmlspecialchars_decode($custom['sql_text']));
 
-                       $this->db->query("UPDATE fm_custom set sql_text='" . 
$custom['sql_text'] . "', entry_date='" . time() . "', name='" . 
$custom['name'] . "' WHERE id=" . (int) $custom['custom_id'],__LINE__,__FILE__);
+                       $this->db->query("UPDATE fm_custom set 
sql_text='{$custom['sql_text']}', entry_date='" . time() . "', 
name='{$custom['name']}' WHERE id=" . (int) 
$custom['custom_id'],__LINE__,__FILE__);
 
                        if($custom['new_name'])
                        {

Modified: people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php      
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.sotts.inc.php      
2010-01-22 09:56:10 UTC (rev 20982)
@@ -234,7 +234,7 @@
                                }
                                else
                                {
-                                       $querymethod = " $where (subject 
$this->like '%$query%' or address $this->like '%$query%' or 
fm_tts_tickets.location_code $this->like '%$query%')";
+                                       $querymethod = " $where (subject 
$this->like '%$query%' OR address $this->like '%$query%' OR 
fm_tts_tickets.location_code $this->like '%$query%' OR fm_tts_tickets.order_id 
= '$query')";
                                }
                        }
 
@@ -281,6 +281,7 @@
                                        'entry_date'            => 
$this->db->f('entry_date'),
                                        'finnish_date'          => 
$this->db->f('finnish_date'),
                                        'finnish_date2'         => 
$this->db->f('finnish_date2'),
+                                       'order_id'                      => 
$this->db->f('order_id'),
                                        'new_ticket'            => ''
                                );
                        }
@@ -359,6 +360,7 @@
                                $ticket['ecodimb']                      = 
$this->db->f('ecodimb');
                                $ticket['budget']                       = 
$this->db->f('budget');
                                $ticket['actual_cost']          = 
$this->db->f('actual_cost');
+                               $ticket['order_cat_id']         = 
$this->db->f('order_cat_id');
 
                                $user_id=(int)$this->db->f('user_id');
                                $this->db->query("SELECT 
account_firstname,account_lastname FROM phpgw_accounts WHERE 
account_id='$user_id' ");
@@ -508,7 +510,7 @@
 
                public function get_custom_status()
                {
-                       $sql = "SELECT * FROM fm_tts_status";
+                       $sql = "SELECT * FROM fm_tts_status ORDER BY sorting 
ASC";
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        $status= array();
@@ -608,7 +610,11 @@
                //      $old_billable_rate      = $this->db->f('billable_rate');
                        $old_subject            = $this->db->f('subject');
                        $old_contact_id         = $this->db->f('contact_id');
+                       $old_actual_cost        = $this->db->f('actual_cost');
+                       $old_order_cat_id       = $this->db->f('order_cat_id');
+
                        if($oldcat_id ==0){$oldcat_id ='';}
+                       if($old_order_cat_id ==0){$old_order_cat_id ='';}
                        if($oldassigned ==0){$oldassigned ='';}
                        if($oldgroup_id ==0){$oldgroup_id ='';}
 
@@ -755,12 +761,29 @@
        */
                        if ($old_subject != $ticket['subject'])
                        {
-                               $this->db->query("update fm_tts_tickets set 
subject='" . $ticket['subject']
+                               $this->db->query("UPDATE fm_tts_tickets SET 
subject='" . $ticket['subject']
                                        . "' where id='$id'",__LINE__,__FILE__);
                                
$this->historylog->add('S',$id,$ticket['subject'],$old_subject);
                                $receipt['message'][]= array('msg' => 
lang('Subject has been updated'));
                        }
 
+                       if ((int)$old_actual_cost != 
(int)$ticket['actual_cost'])
+                       {
+                               $this->db->query("UPDATE fm_tts_tickets SET 
actual_cost='" . (float)$ticket['actual_cost']
+                                       . "' WHERE id='$id'",__LINE__,__FILE__);
+                               
$this->historylog->add('AC',$id,(float)$ticket['actual_cost'] , 
$old_actual_cost);
+                               $receipt['message'][]= array('msg' => 
lang('actual_cost has been updated'));
+                       }
+
+                       if ((int)$old_order_cat_id != 
(int)$ticket['order_cat_id'])
+                       {
+                               $this->db->query("UPDATE fm_tts_tickets SET 
order_cat_id='" . (int)$ticket['order_cat_id']
+                                       . "' WHERE id='$id'",__LINE__,__FILE__);
+                               $receipt['message'][]= array('msg' => 
lang('order category has been updated'));
+                               $this->fields_updated = true;
+                       }
+
+
                        if (($old_note != $ticket['note']) && $ticket['note'])
                        {
                                $this->fields_updated = true;
@@ -942,4 +965,34 @@
                                //close
                        }
                }
+
+               function delete($id)
+               {
+                       $id = (int)$id;
+
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket');
+
+                       if ( !$location_id )
+                       {
+                               throw new Exception("phpgwapi_locations::get_id 
('property', '.ticket') returned 0");
+                       }
+
+                       $this->db->transaction_begin(); 
+
+                       $this->db->query("DELETE FROM fm_action_pending WHERE 
location_id = {$location_id} AND item_id = {$id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM phpgw_interlink WHERE 
location1_id = {$location_id} AND location1_item_id = {$id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM phpgw_interlink WHERE 
location2_id = {$location_id} AND location2_item_id = {$id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_tts_history WHERE 
history_record_id = {$id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_tts_views WHERE id = 
{$id}",__LINE__,__FILE__);
+                       $this->db->query("DELETE FROM fm_tts_tickets WHERE id = 
{$id}",__LINE__,__FILE__);
+
+                       if($this->db->transaction_commit())
+                       {
+                               return true;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
        }

Modified: people/sigurdne/modules/property/trunk/inc/class.uicategory.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uicategory.inc.php 
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.uicategory.inc.php 
2010-01-22 09:56:10 UTC (rev 20982)
@@ -186,11 +186,6 @@
                        $values = $this->bo->read();
                        $uicols = $this->bo->uicols;
 
-/*                     $uicols['name'][0]      = 'id';
-                       $uicols['descr'][0]     = lang('category ID');
-                       $uicols['name'][1]      = 'descr';
-                       $uicols['descr'][1]     = lang('Descr');
-*/
                        $j = 0;
                        $count_uicols_name = count($uicols['name']);
 
@@ -297,12 +292,8 @@
                                        
$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]=='id')
-                                       {
-                                               
$datatable['headers']['header'][$i]['sortable']                 = true;
-                                               
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
-                                       }
+                                       
$datatable['headers']['header'][$i]['sortable']                 = 
$uicols['sortable'][$i];
+                                       
$datatable['headers']['header'][$i]['sort_field']       = $uicols['name'][$i];
                                }
                        }
 

Modified: people/sigurdne/modules/property/trunk/inc/class.uicustom.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uicustom.inc.php   
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.uicustom.inc.php   
2010-01-22 09:56:10 UTC (rev 20982)
@@ -415,7 +415,7 @@
                        $cols_id        = phpgw::get_var('cols_id', 'int');
                        $resort         = phpgw::get_var('resort');
                        $values         = phpgw::get_var('values');
-
+                       $values['sql_text'] = $_POST['values']['sql_text'];
                        if($cols_id)
                        {
                                
$this->bo->resort(array('custom_id'=>$custom_id,'id'=>$cols_id,'resort'=>$resort));

Modified: people/sigurdne/modules/property/trunk/inc/class.uiinvoice.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uiinvoice.inc.php  
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.uiinvoice.inc.php  
2010-01-22 09:56:10 UTC (rev 20982)
@@ -316,7 +316,7 @@
                                        array( //boton  OWNER
                                            'id' => 'btn_user_lid',
                                            'name' => 'user_lid',
-                                           'value'     => user_lid,
+                                           'value'     => 'user_lid',
                                            'type' => 'button',
                                            'tab_index' => 2,
                                            'style' => 'filter'
@@ -2603,8 +2603,8 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $GLOBALS['phpgw_info']['flags'][noheader] = true;
-                       $GLOBALS['phpgw_info']['flags'][nofooter] = true;
+                       $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
 
                        $voucher_id = phpgw::get_var('voucher_id', 'int');

Modified: people/sigurdne/modules/property/trunk/inc/class.uilocation.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uilocation.inc.php 
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.uilocation.inc.php 
2010-01-22 09:56:10 UTC (rev 20982)
@@ -218,6 +218,15 @@
                                return;
                        }
 
+                       $second_display = phpgw::get_var('second_display', 
'bool');
+                       $default_district       = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
+
+                       if ($default_district && !$second_display && 
!$this->district_id)
+                       {
+                               $this->bo->district_id  = $default_district;
+                               $this->district_id              = 
$default_district;
+                       }
+
                        $datatable = array();
                        $values_combo_box = array();
 
@@ -250,6 +259,7 @@
                                                                                
."district_id: '{$this->district_id}',"
                                                                                
."part_of_town_id:'{$this->part_of_town_id}',"
                                                                                
."lookup:'{$lookup}',"
+                                                                               
."second_display:1,"
                                                                                
."lookup_tenant:'{$lookup_tenant}',"
                                                                                
."lookup_name:'{$lookup_name}',"
                                                                                
."cat_id:'{$this->cat_id}',"

Modified: people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php      
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/class.uitts.inc.php      
2010-01-22 09:56:10 UTC (rev 20982)
@@ -1,98 +1,100 @@
-<?php
-       /**
-       * phpGroupWare - property: a Facilities Management System.
-       *
-       * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
-       * This file is part of phpGroupWare.
-       *
-       * phpGroupWare is free software; you can redistribute it and/or modify
-       * it under the terms of the GNU General Public License as published by
-       * the Free Software Foundation; either version 2 of the License, or
-       * (at your option) any later version.
-       *
-       * phpGroupWare is distributed in the hope that it will be useful,
-       * but WITHOUT ANY WARRANTY; without even the implied warranty of
-       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       * GNU General Public License for more details.
-       *
-       * You should have received a copy of the GNU General Public License
-       * along with phpGroupWare; if not, write to the Free Software
-       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
-       *
-       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
-       * @package property
-       * @subpackage helpdesk
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage helpdesk
        * @version $Id$
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
        phpgw::import_class('phpgwapi.yui');
 
-       class property_uitts
-       {
-               var $public_functions = array
-               (
-                       'index'         => true,
-                       'index2'        => true,
-                       'view'          => true,
-                       'view2'         => true,
-                       'add'           => true,
-                       'add2'          => true,
-                       'delete'        => true,
-                       'download'              => true,
-                       'download2'     => true,
+       class property_uitts
+       {
+               var $public_functions = array
+               (
+                       'index'         => true,
+                       'index2'        => true,
+                       'view'          => true,
+                       'view2'         => true,
+                       'add'           => true,
+                       'add2'          => true,
+                       'delete'        => true,
+                       'download'      => true,
+                       'download2'     => true,
                        'view_file'     => true,
                        'edit_status'=> true
-               );
-
+               );
+
                /**
                 * @var boolean $_simple use simplified interface
                 */
                protected $_simple = false;
                protected $_show_finnish_date = false;
+               var $part_of_town_id;
+               var $status;
 
-               public function __construct()
-               {
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::helpdesk';
-                       if($this->tenant_id     = 
$GLOBALS['phpgw']->session->appsession('tenant_id','property'))
-                       {
+               public function __construct()
+               {
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::helpdesk';
+                       if($this->tenant_id     = 
$GLOBALS['phpgw']->session->appsession('tenant_id','property'))
+                       {
        //                      $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
-                               $GLOBALS['phpgw_info']['flags']['noheader'] = 
true;
-                               $GLOBALS['phpgw_info']['flags']['nofooter'] = 
true;
-                       }
-
-                       $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
-                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
-                       $this->bo                                       = 
CreateObject('property.botts',true);
-                       $this->bocommon                         = & 
$this->bo->bocommon;
-                       $this->cats                                     = & 
$this->bo->cats;
-                       $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
+                               $GLOBALS['phpgw_info']['flags']['noheader'] = 
true;
+                               $GLOBALS['phpgw_info']['flags']['nofooter'] = 
true;
+                       }
+
+                       $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
+                       $this->bo                                       = 
CreateObject('property.botts',true);
+                       $this->bocommon                         = & 
$this->bo->bocommon;
+                       $this->cats                                     = & 
$this->bo->cats;
+                       $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
                        $this->acl_location                     = 
$this->bo->acl_location;
                        $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
                        $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
                        $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
                        $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
                        $this->acl_manage                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_PRIVATE, 'property'); // manage
-                       $this->bo->acl_location         = $this->acl_location;
-
-                       $this->start                            = 
$this->bo->start;
-                       $this->query                            = 
$this->bo->query;
-                       $this->sort                                     = 
$this->bo->sort;
-                       $this->order                            = 
$this->bo->order;
+                       $this->bo->acl_location         = $this->acl_location;
+
+                       $this->start                            = 
$this->bo->start;
+                       $this->query                            = 
$this->bo->query;
+                       $this->sort                                     = 
$this->bo->sort;
+                       $this->order                            = 
$this->bo->order;
                        $this->status_id                        = 
$this->bo->status_id;
                        $this->user_id                          = 
$this->bo->user_id;
-                       $this->cat_id                           = 
$this->bo->cat_id;
-                       $this->district_id                      = 
$this->bo->district_id;
-                       $this->allrows                          = 
$this->bo->allrows;
-                       $this->start_date                       = 
$this->bo->start_date;
-                       $this->end_date                         = 
$this->bo->end_date;
+                       $this->cat_id                           = 
$this->bo->cat_id;
+                       $this->district_id                      = 
$this->bo->district_id;
+                       $this->allrows                          = 
$this->bo->allrows;
+                       $this->start_date                       = 
$this->bo->start_date;
+                       $this->end_date                         = 
$this->bo->end_date;
 
                        $user_groups =  
$GLOBALS['phpgw']->accounts->membership($this->account);
                        $simple_group = 
isset($this->bo->config->config_data['fmttssimple_group']) ? 
$this->bo->config->config_data['fmttssimple_group'] : array();
@@ -116,120 +118,117 @@
                                        break;
                                }
                        }
-
-
-
-               }
-
-               function save_sessiondata()
-               {
-                       $data = array
-                       (
-                               'start'         => $this->start,
-                               'query'         => $this->query,
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
+               }
+
+               function save_sessiondata()
+               {
+                       $data = array
+                       (
+                               'start'                 => $this->start,
+                               'query'                 => $this->query,
+                               'sort'                  => $this->sort,
+                               'order'                 => $this->order,
                                'status_id'             => $this->status_id,
                                'user_id'               => $this->user_id,
-                               'cat_id'        => $this->cat_id,
-                               'district_id'   => $this->district_id,
-                               'allrows'       => $this->allrows,
-                               'start_date'    => $this->start_date,
-                               'end_date'      => $this->end_date
-                       );
-                       $this->bo->save_sessiondata($data);
-               }
-
-               function download2()
-               {
-                       if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_READ, 'property'))
-                       {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> '.ticket.external'));
-                       }
-
-                       $this->download($external = true);
-               }
-
-               function download($external='')
-               {
-                       $start_date     = urldecode($this->start_date);
-                       $end_date       = urldecode($this->end_date);
-
-                       $this->bo->allrows = true;
+                               'cat_id'                => $this->cat_id,
+                               'district_id'   => $this->district_id,
+                               'allrows'               => $this->allrows,
+                               'start_date'    => $this->start_date,
+                               'end_date'              => $this->end_date
+                       );
+                       $this->bo->save_sessiondata($data);
+               }
+
+               function download2()
+               {
+                       if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_READ, 'property'))
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> '.ticket.external'));
+                       }
+
+                       $this->download($external = true);
+               }
+
+               function download($external='')
+               {
+                       $start_date     = urldecode($this->start_date);
+                       $end_date       = urldecode($this->end_date);
+
+                       $this->bo->allrows = true;
                        $list = 
$this->bo->read($start_date,$end_date,$external, '', $download = true);
-
-                       if (isset($list) AND is_array($list))
-                       {
-                               $i=0;
-                               foreach($list as &$entry)
-                               {
-                                       if($entry['subject'])
-                                       {
-                                               $entry['category'] = 
$entry['subject'];
-                                       }
-
-                                       if (isset($entry['child_date']) AND 
is_array($entry['child_date']))
-                                       {
-                                               $j=0;
-                                               foreach($entry['child_date'] as 
$date)
-                                               {
-                                                       
if($date['date_info'][0]['descr'])
-                                                       {
-                                                               $entry['date_' 
. $j]=$date['date_info'][0]['entry_date'];
-                                                               
$name_temp['date_' . $j]=true;
-                                                               
$descr_temp[$date['date_info'][0]['descr']]=true;
-                                                        }
-                                                        $j++;
-                                               }
-                                               unset($entry['child_date']);
-                                       }
-                                       $i++;
-                               }
-                       }
-//_debug_array($descr_temp);
-
-                       $name   = array('id',
-                                               'category',
-                                               'location_code',
-                                               'address',
-                                               'user',
-                                               'assignedto',
+
+                       if (isset($list) AND is_array($list))
+                       {
+                               $i=0;
+                               foreach($list as &$entry)
+                               {
+                                       if($entry['subject'])
+                                       {
+                                               $entry['category'] = 
$entry['subject'];
+                                       }
+
+                                       if (isset($entry['child_date']) AND 
is_array($entry['child_date']))
+                                       {
+                                               $j=0;
+                                               foreach($entry['child_date'] as 
$date)
+                                               {
+                                                       
if($date['date_info'][0]['descr'])
+                                                       {
+                                                               $entry['date_' 
. $j]=$date['date_info'][0]['entry_date'];
+                                                               
$name_temp['date_' . $j]=true;
+                                                               
$descr_temp[$date['date_info'][0]['descr']]=true;
+                                                        }
+                                                        $j++;
+                                               }
+                                               unset($entry['child_date']);
+                                       }
+                                       $i++;
+                               }
+                       }
+//_debug_array($descr_temp);
+
+                       $name   = array('id',
+                                               'category',
+                                               'location_code',
+                                               'address',
+                                               'user',
+                                               'assignedto',
                                                'entry_date'
-                                               );
-
-                       while (is_array($name_temp) && list($name_entry,) = 
each($name_temp))
-                       {
-                               array_push($name,$name_entry);
-                       }
-
-                       array_push($name,'finnish_date','delay');
-
-                       $descr  = array(lang('ID'),
-                                       lang('category'),
-                                       lang('location'),
-                                       lang('address'),
-                                       lang('user'),
-                                       lang('Assigned to'),
-                                       lang('Started')
-                                       );
-
-                       while (is_array($descr_temp) && list($descr_entry,) = 
each($descr_temp))
-                       {
-                               array_push($descr,$descr_entry);
-                       }
-
-                       array_push($descr,lang('finnish date'),lang('delay'));
-
-                       $this->bocommon->download($list,$name,$descr);
-               }
-
+                                               );
+
+                       while (is_array($name_temp) && list($name_entry,) = 
each($name_temp))
+                       {
+                               array_push($name,$name_entry);
+                       }
+
+                       array_push($name,'finnish_date','delay');
+
+                       $descr  = array(lang('ID'),
+                                       lang('category'),
+                                       lang('location'),
+                                       lang('address'),
+                                       lang('user'),
+                                       lang('Assigned to'),
+                                       lang('Started')
+                                       );
+
+                       while (is_array($descr_temp) && list($descr_entry,) = 
each($descr_temp))
+                       {
+                               array_push($descr,$descr_entry);
+                       }
+
+                       array_push($descr,lang('finnish date'),lang('delay'));
+
+                       $this->bocommon->download($list,$name,$descr);
+               }
+
                function edit_status()
                {
                        if(!$this->acl_edit)
-                       {
+                       {
                                return lang('sorry - insufficient rights');
-                       }
-
+                       }
+
                        $new_status = phpgw::get_var('new_status', 'string', 
'GET');
                        $id             = phpgw::get_var('id', 'int');
                        $receipt        = 
$this->bo->update_status(array('status'=>$new_status),$id);
@@ -239,55 +238,73 @@
                        }
                //      
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
                        return "id ".$id." ".lang('Status has been changed');
+               }
+
+               function delete()
+               {
+                       if(!$this->acl_delete)
+                       {
+                               return lang('sorry - insufficient rights');
+                       }
+
+                       $id = phpgw::get_var('id', 'int');
+                       if( $this->bo->delete($id) )
+                       {
+                               return lang('ticket %1 has been deleted', $id);
                        }
+                       else
+                       {
+                               return lang('delete failed');                   
+                       }
+               }
 
                function index()
-                       {
+               {
                        if($this->tenant_id)
-                               {
+                       {
 //                             
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index2'));
-                               }
-
+                       }
+
                        if(!$this->acl_read)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> $this->acl_location));
-                       }
+                       }
 
                        $this->save_sessiondata();
 
                        $dry_run=false;
-
-                       $second_display = phpgw::get_var('second_display', 
'bool');
-
-                       $default_category = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
+
+                       $second_display = phpgw::get_var('second_display', 
'bool');
+
+                       $default_category       = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
                        //FIXME: differentiate mainsreen and helpdesk if this 
should be used.
                        $default_status         = 
'';//isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status']:'';
-                       $start_date     = urldecode($this->start_date);
-                       $end_date       = urldecode($this->end_date);
-
-                       if ($default_category && !$second_display && 
!$this->district_id)
-                       {
-                               $this->bo->district_id  = $default_category;
-                               $this->district_id              = 
$default_category;
-                       }
-
-                       if ($default_status && !$second_display)
-                       {
+                       $start_date             = urldecode($this->start_date);
+                       $end_date                       = 
urldecode($this->end_date);
+
+                       if ($default_category && !$second_display && 
!$this->district_id)
+                       {
+                               $this->bo->district_id  = $default_category;
+                               $this->district_id              = 
$default_category;
+                       }
+
+                       if ($default_status && !$second_display)
+                       {
                                $this->bo->status_id    = $default_status;
                                $this->status_id                = 
$default_status;
-                       }
-
+                       }
+
 /*
-                       $bgcolor_array[1]       = '#dadada';
-                       $bgcolor_array[2]       = '#dad0d0';
-                       $bgcolor_array[3]       = '#dacaca';
-                       $bgcolor_array[4]       = '#dac0c0';
-                       $bgcolor_array[5]       = '#dababa';
-                       $bgcolor_array[6]       = '#dab0b0';
-                       $bgcolor_array[7]       = '#daaaaa';
-                       $bgcolor_array[8]       = '#da9090';
-                       $bgcolor_array[9]       = '#da8a8a';
-                       $bgcolor_array[10]      = '#da7a7a';
+                       $bgcolor_array[1]       = '#dadada';
+                       $bgcolor_array[2]       = '#dad0d0';
+                       $bgcolor_array[3]       = '#dacaca';
+                       $bgcolor_array[4]       = '#dac0c0';
+                       $bgcolor_array[5]       = '#dababa';
+                       $bgcolor_array[6]       = '#dab0b0';
+                       $bgcolor_array[7]       = '#daaaaa';
+                       $bgcolor_array[8]       = '#da9090';
+                       $bgcolor_array[9]       = '#da8a8a';
+                       $bgcolor_array[10]      = '#da7a7a';
 */
                        $bgcolor_array[1]       = '#da7a7a';
                        $bgcolor_array[2]       = '#dababa';
@@ -351,7 +368,7 @@
                                $values_combo_box = array();
 
                                $values_combo_box[2]  = 
$this->bo->filter(array('format' => $group_filters, 'filter'=> 
$this->status_id,'default' => 'O'));
-                               $default_value = array 
('id'=>'','name'=>lang('Open'));
+                               $default_value = array 
('id'=>'','name'=>isset($this->bo->config->config_data['tts_lang_open']) && 
$this->bo->config->config_data['tts_lang_open'] ? 
$this->bo->config->config_data['tts_lang_open'] : lang('Open'));
                                array_unshift 
($values_combo_box[2],$default_value);
 
                                if(!$this->_simple)
@@ -359,11 +376,11 @@
                                        $values_combo_box[0] = 
$this->cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->cat_id,'globals' => True));
                                        $default_value = array 
('cat_id'=>'','name'=> lang('no category'));
                                        array_unshift 
($values_combo_box[0]['cat_list'],$default_value);
-
+
                                        $values_combo_box[1]  = 
$this->bocommon->select_district_list('filter',$this->district_id);
                                        $default_value = array 
('id'=>'','name'=>lang('no district'));
                                        array_unshift 
($values_combo_box[1],$default_value);
-
+
                                        $values_combo_box[3]  = 
$this->bocommon->get_user_list_right2('filter',2,$this->user_id,$this->acl_location);
                                        $default_value = array 
('id'=>'','name'=>lang('no user'));
                                        array_unshift 
($values_combo_box[3],$default_value);
@@ -585,7 +602,7 @@
                        }
                        else
                        {
-                       $ticket_list = $this->bo->read($start_date,$end_date);
+                               $ticket_list = 
$this->bo->read($start_date,$end_date);
                        }
                        $this->bo->get_origin_entity_type();
                        $uicols_related = $this->bo->uicols_related;
@@ -604,6 +621,12 @@
                        $uicols['name'][$i++] = 'assignedto';
                        $uicols['name'][$i++] = 'entry_date';
                        $uicols['name'][$i++] = 'status';
+                       
+                       if( $this->acl->check('.ticket.order', PHPGW_ACL_READ, 
'property') )
+                       {
+                               $uicols['name'][$i++] = 'order_id';
+                       }
+
                        foreach($uicols_related as $related)
                        {
                                $uicols['name'][$i++] = $related;               
        
@@ -616,53 +639,53 @@
                        $uicols['name'][$i++] = 'link_view';
                        $uicols['name'][$i++] = 'lang_view_statustext';
                        $uicols['name'][$i++] = 'text_view';
-
+
                        $count_uicols_name = count($uicols['name']);
-
+
                        $j = 0;
                        $k = 0;
-                       if(is_array($ticket_list))
-                       {
-                               $status['X'] = array
-                               (
-                                       'bgcolor'                       => 
'#5EFB6E',
-                                       'status'                        => 
lang('closed'),
-                                       'text_edit_status'      => lang('Open'),
+                       if(is_array($ticket_list))
+                       {
+                               $status['X'] = array
+                               (
+                                       'bgcolor'                       => 
'#5EFB6E',
+                                       'status'                        => 
lang('closed'),
+                                       'text_edit_status'      => lang('Open'),
                                        'new_status'            => 'O'
-                               );
-
-                               $custom_status  = 
$this->bo->get_custom_status();
-
-                               foreach($custom_status as $custom)
-                               {
-                                       $status["C{$custom['id']}"] = array
-                                       (
-                                               'bgcolor'                       
=> $custom['color'] ? $custom['color'] : '',
-                                               'status'                        
=> $custom['name'],
-                                               'text_edit_status'      => 
lang('close'),
-                                               'new_status'            => 'X'
-                                       );
-                               }
-
-                               foreach($ticket_list as $ticket)
-                               {
+                               );
+
+                               $custom_status  = 
$this->bo->get_custom_status();
+
+                               foreach($custom_status as $custom)
+                               {
+                                       $status["C{$custom['id']}"] = array
+                                       (
+                                               'bgcolor'                       
=> $custom['color'] ? $custom['color'] : '',
+                                               'status'                        
=> $custom['name'],
+                                               'text_edit_status'      => 
lang('close'),
+                                               'new_status'            => 'X'
+                                       );
+                               }
+
+                               foreach($ticket_list as $ticket)
+                               {
                                        for ($k=0;$k<$count_uicols_name;$k++)
-                                       {
+                                       {
                                                if($uicols['name'][$k] == 
'status' && $ticket[$uicols['name'][$k]]=='O')
                                                {
                                                        
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k];
                                                        
$datatable['rows']['row'][$j]['column'][$k]['value']    = lang('Open');
-                                       }
+                                               }
                                                else if($uicols['name'][$k] == 
'status' && $ticket[$uicols['name'][$k]]=='C')
                                                {
                                                        
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k];
                                                        
$datatable['rows']['row'][$j]['column'][$k]['value']    = lang('Closed');
-                               }
+                                               }
                                                else if($uicols['name'][$k] == 
'status' && array_key_exists($ticket[$uicols['name'][$k]],$status))
                                                {
                                                        
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k];
                                                        
$datatable['rows']['row'][$j]['column'][$k]['value']    = 
$status[$ticket[$uicols['name'][$k]]]['status'];
-                       }
+                                               }
                                                else
                                                {
                                                        
$datatable['rows']['row'][$j]['column'][$k]['name']             = 
$uicols['name'][$k];
@@ -672,7 +695,7 @@
                                                {
                                                        
$datatable['rows']['row'][$j]['column'][$k]['format']   = 'link';
                                                        
$datatable['rows']['row'][$j]['column'][$k]['link']             =       
$GLOBALS['phpgw']->link('/index.php',array
-                                                                               
(
+                                                               (
                                                                        
'menuaction'    => 'property.uitts.view',
                                                                        'id'    
                => $ticket['id']
                                                                ));
@@ -690,7 +713,7 @@
                                                                
$datatable['rows']['row'][$j]['column'][$k]['value']    = 
$ticket['child_date'][$n]['date_info'][0]['entry_date'];
                                                                
$datatable['rows']['row'][$j]['column'][$k]['statustext']       = 
$ticket['child_date'][$n]['statustext'];
                                                                
$datatable['rows']['row'][$j]['column'][$k]['target']   = '_blank';
-
+                                                               
                                                        }
                                                        $n++;
                                                }
@@ -699,33 +722,48 @@
                                        $j++;
                                }
                        }
-
+
                        $parameters = array
-                                                                               
(
+                       (
                                'parameter' => array
-                                                                               
(
+                               (
                                        array
-                                                                               
(
+                                       (
                                                'name'          => 'id',
                                                'source'        => 'id'
                                        ),
-                                                                               
                                                        )
-                       );
-
+                               )
+                       );
+
                        if($this->acl_read)
-                       {
+                       {
                                $datatable['rowactions']['action'][] = array(
                                        'my_name'                       => 
'view',
-                                       'statustext'    => lang('view the 
project'),
+                                       'statustext'    => lang('view the 
ticket'),
                                        'text'                  => lang('view'),
                                        'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                       (
+                                                       (
                                                                'menuaction'    
=> 'property.uitts.view'
                                                        )),
                                'parameters'    => $parameters
-                       );
+                               );
                        }
 
+                       if($this->acl_delete)
+                       {
+                               $datatable['rowactions']['action'][] = array(
+                                       'my_name'                       => 
'delete',
+                                       'statustext'    => lang('delete the 
ticket'),
+                                       'text'                  => 
lang('delete'),
+                                       'confirm_msg'   => lang('do you really 
want to delete this ticket'),
+                                       'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                                       (
+                                                               'menuaction'    
=> 'property.uitts.delete'
+                                                       )),
+                               'parameters'    => $parameters
+                               );
+                       }
+
                        
if(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_link'])
                                && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_link'] == 
'yes'
                                && $this->acl_edit)
@@ -739,23 +777,23 @@
                                                'text'                  => 
lang('change to') . ':  ' .$status_info['status'],
                                                'confirm_msg'   => lang('do you 
really want to change the status to %1',$status_info['status']),
                                                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                       (
+                                                               (
                                                                        
'menuaction'            => 'property.uitts.edit_status',
                                                                        
'edit_status'           => true,
                                                                        
'new_status'            => $status_code,
                                                                        
'second_display'        => true,
-                               'sort'          => $this->sort,
-                               'order'         => $this->order,
-                               'cat_id'        => $this->cat_id,
-                               'filter'        => $this->filter,
-                               'user_filter'   => $this->user_filter,
-                               'query'         => $this->query,
-                               'district_id'   => $this->district_id,
+                                                                       'sort'  
                        => $this->sort,
+                                                                       'order' 
                        => $this->order,
+                                                                       
'cat_id'                        => $this->cat_id,
+                                                                       
'filter'                        => $this->filter,
+                                                                       
'user_filter'           => $this->user_filter,
+                                                                       'query' 
                        => $this->query,
+                                                                       
'district_id'           => $this->district_id,
                                                                        
'allrows'                       => $this->allrows,
                                                                        
'delete'                        => 'dummy'// FIXME to trigger the json in 
property.js.
                                                                        )),
                                                'parameters'    => $parameters
-                       );
+                                       );
                                }
                        }
 
@@ -771,33 +809,33 @@
                                                                                
))
                                );
                        }
-
+
                        unset($parameters);
                        for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               if($uicols['input_type'][$i]!='hidden')
+               //              if($uicols['input_type'][$i]!='hidden')
                                {
-                                       
$datatable['headers']['header'][$i]['formatter']                = 
($uicols['formatter'][$i]==''?  '""' : $uicols['formatter'][$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']                     = 
lang($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')
+                                       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';
                                        }
                                }
-                       }
-
+                       }
+
                        //path for property.js
                        $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";
-
+
                        // Pagination and sort values
                        $datatable['pagination']['records_start']       = 
(int)$this->bo->start;
                        $datatable['pagination']['records_limit']       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
@@ -810,40 +848,40 @@
                        $function_msg                                   = 
lang('list ticket');
 
                        if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
-                       {
+                       {
                                $datatable['sorting']['order']                  
= 'entry_date'; // name key Column in myColumnDef
                                $datatable['sorting']['sort']                   
= 'desc'; // ASC / DESC
-                       }
-                       else
-                       {
+                       }
+                       else
+                       {
                                $datatable['sorting']['order']                  
= phpgw::get_var('order', 'string'); // name of column of Database
                                $datatable['sorting']['sort']                   
= phpgw::get_var('sort', 'string'); // ASC / DESC
-                       }
-
+                       }
+
                        phpgwapi_yui::load_widget('dragdrop');
                        phpgwapi_yui::load_widget('datatable');
                        phpgwapi_yui::load_widget('menu');
                        phpgwapi_yui::load_widget('connection');
                        phpgwapi_yui::load_widget('loader');
                        phpgwapi_yui::load_widget('paginator');
-
+
 //-- BEGIN----------------------------- JSON CODE 
------------------------------
                        if( phpgw::get_var('phpgw_return_as') == 'json' )
                        {
                //values for Pagination
                        $json = array
-                       (
+                       (
                                'recordsReturned'       => 
$datatable['pagination']['records_returned'],
                                'totalRecords'          => 
(int)$datatable['pagination']['records_total'],
                                'startIndex'            => 
$datatable['pagination']['records_start'],
                                        'sort'                          => 
$datatable['sorting']['order'],
                                'dir'                           => 
$datatable['sorting']['sort'],
                                        'records'                       => 
array()
-                       );
-
+                       );
+
                                // values for datatable
                        if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
-                       {
+                       {
                                foreach( $datatable['rows']['row'] as $row )
                                {
                                        $json_row = array();
@@ -856,12 +894,12 @@
                                                else 
if(isset($column['format']) && $column['format']== "link")
                                                {
                                                  $json_row[$column['name']] = 
"<a href='".$column['link']."' title = '{$column['statustext']}'>" 
.$column['value']."</a>";
-                       }
-                       else
-                       {
+                                               }
+                                               else
+                                               {
                                                  $json_row[$column['name']] = 
$column['value'];
-                       }
-
+                                               }
+
                                                if($column['name'] == 
'priority')
                                                {
                                                        $_value = 
$column['value'];//str_repeat("||", abs(6 - 2*$column['value'])) . 
$column['value'];
@@ -879,13 +917,13 @@
                                                                                
break;
                                                                }
                                                                unset($_value);
-
+
                                                }
                                        }
                                        $json['records'][] = $json_row;
                                }
                        }
-
+
                                // values for control select
                                $opt_cb_depend =  
$this->bocommon->select_part_of_town('filter',$this->part_of_town_id,$this->district_id);
                                $default_value = array ('id'=>'','name'=>'!no 
part of town');
@@ -901,7 +939,7 @@
                                return $json;
                        }
 //-------------------- JSON CODE ----------------------
-
+
 // Prepare template variables and process XSLT
                        $template_vars = array();
                        $template_vars['datatable'] = $datatable;
@@ -912,7 +950,7 @@
                {
                        $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
                }
-
+
                        // Prepare CSS Style
                        $GLOBALS['phpgw']->css->validate_file('datatable');
                        $GLOBALS['phpgw']->css->validate_file('property');
@@ -920,440 +958,440 @@
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
        
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+       
                        $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
$this->_simple ? 'tts.index.simple' : 'tts.index' , 'property' );
-               }
-
-               function index2()
-               {
-                       if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_READ, 'property'))
-                       {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> '.ticket.external'));
-                       }
-
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('tts',
-                                                                               
'nextmatchs'));
-
-
-                       $second_display = phpgw::get_var('second_display', 
'bool');
-
-                       $default_category = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
-                       $default_status = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status']:'');
-                       $start_date     = urldecode($this->start_date);
-                       $end_date       = urldecode($this->end_date);
-
-                       if ($default_category && !$second_display && 
!$this->district_id)
-                       {
-                               $this->bo->district_id  = $default_category;
-                               $this->district_id              = 
$default_category;
-                       }
-
-                       if ($default_status && !$second_display)
-                       {
+               }
+
+               function index2()
+               {
+                       if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_READ, 'property'))
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> '.ticket.external'));
+                       }
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('tts',
+                                                                               
'nextmatchs'));
+
+
+                       $second_display = phpgw::get_var('second_display', 
'bool');
+
+                       $default_category = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']:'');
+                       $default_status = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status']:'');
+                       $start_date     = urldecode($this->start_date);
+                       $end_date       = urldecode($this->end_date);
+
+                       if ($default_category && !$second_display && 
!$this->district_id)
+                       {
+                               $this->bo->district_id  = $default_category;
+                               $this->district_id              = 
$default_category;
+                       }
+
+                       if ($default_status && !$second_display)
+                       {
                                $this->bo->status_id    = $default_status;
                                $this->status_id        = $default_status;
-                       }
-
+                       }
+
                        $bgcolor_array[1]       = '#da7a7a';
                        $bgcolor_array[2]       = '#dababa';
                        $bgcolor_array[3]       = '#dadada';
-
-
+
+
                        $ticket_list = $this->bo->read($start_date,$end_date);
                        $uicols = $this->bo->uicols;
-
-//_debug_array($uicols);
-//_debug_array($ticket_list);
-                       while (is_array($ticket_list) && list(,$ticket) = 
each($ticket_list))
-                       {
-                               if ($ticket['status']=='O')
-                               {
-                                       $status = lang('Open');
-                               }
-                               else
-                               {
-                                       $status = lang('Closed');
-                               }
-
-                               $content[] = array
-                               (
-                                       'id'                                    
=> $ticket['id'],
-                                       'bgcolor'                               
=> $bgcolor[$ticket['priority']],
+
+//_debug_array($uicols);
+//_debug_array($ticket_list);
+                       while (is_array($ticket_list) && list(,$ticket) = 
each($ticket_list))
+                       {
+                               if ($ticket['status']=='O')
+                               {
+                                       $status = lang('Open');
+                               }
+                               else
+                               {
+                                       $status = lang('Closed');
+                               }
+
+                               $content[] = array
+                               (
+                                       'id'                                    
=> $ticket['id'],
+                                       'bgcolor'                               
=> $bgcolor[$ticket['priority']],
                                        'new_ticket'                    => 
$ticket['new_ticket']?$ticket['new_ticket']:'',
-                                       'priostr'                               
=> str_repeat("||", $ticket['priority']),
-                                       'subject'                               
=> $ticket['subject'],
-                                       'location_code'                 => 
$ticket['location_code'],
-                                       'address'                               
=> $ticket['address'],
+                                       'priostr'                               
=> str_repeat("||", $ticket['priority']),
+                                       'subject'                               
=> $ticket['subject'],
+                                       'location_code'                 => 
$ticket['location_code'],
+                                       'address'                               
=> $ticket['address'],
                                        'date'                                  
=> $ticket['entry_date'],
-                                       'finnish_date'                  => 
$ticket['finnish_date'],
-                                       'delay'                                 
=> (isset($ticket['delay'])?$ticket['delay']:''),
-                                       'user'                                  
=> $ticket['user'],
-                                       'assignedto'                    => 
$ticket['assignedto'],
-                                       'child_date'                    => 
$ticket['child_date'],
-                                       'link_view'                             
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.view2', 'id'=> $ticket['id'])),
-                                       'lang_view_statustext'  => lang('view 
the ticket'),
-                                       'text_view'                             
=> lang('view'),
-                                       'status'                                
=> $status,
-                               );
-                       }
-
-                       $table_header[] = array
-                       (
-                               'sort_priority' => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'priority',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
+                                       'finnish_date'                  => 
$ticket['finnish_date'],
+                                       'delay'                                 
=> (isset($ticket['delay'])?$ticket['delay']:''),
+                                       'user'                                  
=> $ticket['user'],
+                                       'assignedto'                    => 
$ticket['assignedto'],
+                                       'child_date'                    => 
$ticket['child_date'],
+                                       'link_view'                             
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.view2', 'id'=> $ticket['id'])),
+                                       'lang_view_statustext'  => lang('view 
the ticket'),
+                                       'text_view'                             
=> lang('view'),
+                                       'status'                                
=> $status,
+                               );
+                       }
+
+                       $table_header[] = array
+                       (
+                               'sort_priority' => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'priority',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra' => array('menuaction' => 'property.uitts.index',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'filter'        
=>$this->status_id,
                                                                                
                                                        'user_id'       
=>$this->user_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
-                                                                               
                                                        )
-                                                                               
)),
-
-                               'lang_priority'         => lang('Priority'),
-                               'lang_priority_statustext'              => 
lang('Sort the tickets by their priority'),
-
-                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'fm_tts_tickets.id',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'second_display'        
=> true,
+                                                                               
                                                        
'allrows'=>$this->allrows,
+                                                                               
                                                        'start_date'    
=>$start_date,
+                                                                               
                                                        'end_date'      
=>$end_date
+                                                                               
                                                        )
+                                                                               
)),
+
+                               'lang_priority'         => lang('Priority'),
+                               'lang_priority_statustext'              => 
lang('Sort the tickets by their priority'),
+
+                               'sort_id'       => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'fm_tts_tickets.id',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra' => array('menuaction' => 'property.uitts.index',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'filter'        
=>$this->status_id,
                                                                                
                                                        'user_id'       
=>$this->user_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
-                                                                               
                                                        )
-                                                                               
)),
-
-                               'lang_id'               => lang('ID'),
-                               'lang_id_statustext'    => lang('Sort the 
tickets by their ID'),
-
-                               'lang_subject'          => lang('Subject'),
-                               'lang_time_created'     => lang('Started'),
-                               'lang_view'             => lang('view'),
-                               'lang_location_code'    => lang('Location'),
-                               'lang_address'          => lang('Address'),
-                               'lang_user'             => lang('user'),
-                               'sort_assigned_to'      => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'assignedto',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction' => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'second_display'        
=> true,
+                                                                               
                                                        
'allrows'=>$this->allrows,
+                                                                               
                                                        'start_date'    
=>$start_date,
+                                                                               
                                                        'end_date'      
=>$end_date
+                                                                               
                                                        )
+                                                                               
)),
+
+                               'lang_id'               => lang('ID'),
+                               'lang_id_statustext'    => lang('Sort the 
tickets by their ID'),
+
+                               'lang_subject'          => lang('Subject'),
+                               'lang_time_created'     => lang('Started'),
+                               'lang_view'             => lang('view'),
+                               'lang_location_code'    => lang('Location'),
+                               'lang_address'          => lang('Address'),
+                               'lang_user'             => lang('user'),
+                               'sort_assigned_to'      => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'assignedto',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra' => array('menuaction' => 'property.uitts.index',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'filter'        
=>$this->status_id,
                                                                                
                                                        'user_id'       
=>$this->user_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
-                                                                               
                                                        )
-                                                                               
)),
-                               'lang_assigned_to'      => lang('Assigned to'),
-                               'sort_opened_by'        => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'user_lid',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'second_display'        
=> true,
+                                                                               
                                                        
'allrows'=>$this->allrows,
+                                                                               
                                                        'start_date'    
=>$start_date,
+                                                                               
                                                        'end_date'      
=>$end_date
+                                                                               
                                                        )
+                                                                               
)),
+                               'lang_assigned_to'      => lang('Assigned to'),
+                               'sort_opened_by'        => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'user_lid',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra' => array('menuaction'   => 'property.uitts.index',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'filter'        
=>$this->status_id,
                                                                                
                                                        'user_id'       
=>$this->user_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
-                                                                               
                                                        )
-                                                                               
)),
-                               'sort_date'     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'fm_tts_tickets.entry_date',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        
=>$this->cat_id,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'second_display'        
=> true,
+                                                                               
                                                        
'allrows'=>$this->allrows,
+                                                                               
                                                        'start_date'    
=>$start_date,
+                                                                               
                                                        'end_date'      
=>$end_date
+                                                                               
                                                        )
+                                                                               
)),
+                               'sort_date'     => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'fm_tts_tickets.entry_date',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra' => array('menuaction'   => 'property.uitts.index',
+                                                                               
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'filter'        
=>$this->status_id,
                                                                                
                                                        'user_id'       
=>$this->user_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         
=>$this->query,
-                                                                               
                                                        'second_display'        
=> true,
-                                                                               
                                                        
'allrows'=>$this->allrows,
-                                                                               
                                                        'start_date'    
=>$start_date,
-                                                                               
                                                        'end_date'      
=>$end_date
-                                                                               
                                                        )
-                                                                               
)),
-                               'sort_finnish_date'     => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   => 'finnish_date',
-                                                                               
        'order' => $this->order,
-                                                                               
        'extra' => array('menuaction'   => 'property.uitts.index',
-                                                                               
                                                        'cat_id'        => 
$this->cat_id,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'second_display'        
=> true,
+                                                                               
                                                        
'allrows'=>$this->allrows,
+                                                                               
                                                        'start_date'    
=>$start_date,
+                                                                               
                                                        'end_date'      
=>$end_date
+                                                                               
                                                        )
+                                                                               
)),
+                               'sort_finnish_date'     => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'finnish_date',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra' => array('menuaction'   => 'property.uitts.index',
+                                                                               
                                                        'cat_id'        => 
$this->cat_id,
                                                                                
                                                        'filter'        => 
$this->status_id,
                                                                                
                                                        'user_id'       => 
$this->user_id,
-                                                                               
                                                        'district_id'   => 
$this->district_id,
-                                                                               
                                                        'query'         => 
$this->query,
-                                                                               
                                                        'second_display'=> true,
-                                                                               
                                                        'allrows'       => 
$this->allrows,
-                                                                               
                                                        'start_date'    => 
$start_date,
-                                                                               
                                                        'end_date'      => 
$end_date
-                                                                               
                                                        )
-                                                                               
)),
-                               'lang_finnish_date'     => lang('finnish date'),
-                               'lang_delay'            => lang('delay'),
-                               'lang_finnish_statustext'=> lang('presumed 
finnish date'),
-                               'lang_opened_by'        => lang('Opened by'),
-                               'lang_status'           => lang('Status')
-                       );
-
-                       for ($i=0;$i<count($uicols);$i++)
-                       {
-                               $table_header[0]['extra'][$i]['header'] = 
$uicols[$i];
-                       }
-
-                       $table_add[] = array
-                       (
-                               'lang_add'                              => 
lang('add'),
-                               'lang_add_statustext'   => lang('add a ticket'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.add2'))
-                       );
-
-                       $link_data = array
-                       (
-                               'menuaction'            => 
'property.uitts.index2',
-                               'second_display'        => true,
-                               'sort'                          => $this->sort,
-                               'order'                         => $this->order,
-                               'cat_id'                        => 
$this->cat_id,
+                                                                               
                                                        'district_id'   => 
$this->district_id,
+                                                                               
                                                        'query'         => 
$this->query,
+                                                                               
                                                        'second_display'=> true,
+                                                                               
                                                        'allrows'       => 
$this->allrows,
+                                                                               
                                                        'start_date'    => 
$start_date,
+                                                                               
                                                        'end_date'      => 
$end_date
+                                                                               
                                                        )
+                                                                               
)),
+                               'lang_finnish_date'     => lang('finnish date'),
+                               'lang_delay'            => lang('delay'),
+                               'lang_finnish_statustext'=> lang('presumed 
finnish date'),
+                               'lang_opened_by'        => lang('Opened by'),
+                               'lang_status'           => lang('Status')
+                       );
+
+                       for ($i=0;$i<count($uicols);$i++)
+                       {
+                               $table_header[0]['extra'][$i]['header'] = 
$uicols[$i];
+                       }
+
+                       $table_add[] = array
+                       (
+                               'lang_add'                              => 
lang('add'),
+                               'lang_add_statustext'   => lang('add a ticket'),
+                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.add2'))
+                       );
+
+                       $link_data = array
+                       (
+                               'menuaction'            => 
'property.uitts.index2',
+                               'second_display'        => true,
+                               'sort'                          => $this->sort,
+                               'order'                         => $this->order,
+                               'cat_id'                        => 
$this->cat_id,
                                'filter'                        => 
$this->status_id,
                                'user_id'               => $this->user_id,
-                               'query'                         => $this->query,
-                               'district_id'           => $this->district_id,
-                               'start_date'            => $start_date,
-                               'end_date'                      => $end_date,
-                               'allrows'                       => 
$this->allrows
-                       );
-
-                       $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
-                       
$GLOBALS['phpgw']->session->appsession('receipt','property','');
-
+                               'query'                         => $this->query,
+                               'district_id'           => $this->district_id,
+                               'start_date'            => $start_date,
+                               'end_date'                      => $end_date,
+                               'allrows'                       => 
$this->allrows
+                       );
+
+                       $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
+                       
$GLOBALS['phpgw']->session->appsession('receipt','property','');
+
                        $GLOBALS['phpgw']->preferences->read();
-                       $autorefresh ='';
-                       if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['refreshinterval']))
-                       {
-                               $autorefresh = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['refreshinterval'].'; 
URL='.$GLOBALS['phpgw']->link('/index.php',$link_data);
-                       }
-
-                       if(!$this->allrows)
-                       {
-                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-                       }
-                       else
-                       {
-                               $record_limit   = $this->bo->total_records;
-                       }
-
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-                       $link_date_search       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.date_search'));
-
-                       $link_download = array
-                       (
-                               'menuaction'            => 
'property.uitts.download2',
-                               'second_display'        => true,
-                               'sort'                          => $this->sort,
-                               'order'                         => $this->order,
-                               'cat_id'                        => 
$this->cat_id,
+                       $autorefresh ='';
+                       if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['refreshinterval']))
+                       {
+                               $autorefresh = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['refreshinterval'].'; 
URL='.$GLOBALS['phpgw']->link('/index.php',$link_data);
+                       }
+
+                       if(!$this->allrows)
+                       {
+                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       }
+                       else
+                       {
+                               $record_limit   = $this->bo->total_records;
+                       }
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $link_date_search       = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiproject.date_search'));
+
+                       $link_download = array
+                       (
+                               'menuaction'            => 
'property.uitts.download2',
+                               'second_display'        => true,
+                               'sort'                          => $this->sort,
+                               'order'                         => $this->order,
+                               'cat_id'                        => 
$this->cat_id,
                                'filter'                        => 
$this->status_id,
                                'user_id'               => $this->user_id,
-                               'query'                         => $this->query,
-                               'district_id'           => $this->district_id,
-                               'allrows'                       => 
$this->allrows,
-                               'start_date'            => $start_date,
-                               'end_date'                      => $end_date,
-                               'start'                         => $this->start
-                       );
-
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
-
-                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
-
-                       $data = array
-                       (
-                               'lang_download'                                 
=> 'download',
-                               'link_download'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_download),
-                               'lang_download_help'                            
=> lang('Download table to your browser'),
-
-                               'start_date'                                    
=> $start_date,
-                               'end_date'                                      
        => $end_date,
-                               'lang_none'                                     
        => lang('None'),
-                               'lang_date_search'                              
=> lang('Date search'),
-                               'lang_date_search_help'                 => 
lang('Narrow the search by dates'),
-                               'link_date_search'                              
=> $link_date_search,
-
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'autorefresh'                                   
=> $autorefresh,
-                               'allow_allrows'                                 
=> true,
-                               'allrows'                                       
        => $this->allrows,
-                               'start_record'                                  
=> $this->start,
-                               'record_limit'                                  
=> $record_limit,
-                               'num_records'                                   
=> count($ticket_list),
-                               'all_records'                                   
=> $this->bo->total_records,
-                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
-
-                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'filter_name'                                   
=> 'filter',
+                               'query'                         => $this->query,
+                               'district_id'           => $this->district_id,
+                               'allrows'                       => 
$this->allrows,
+                               'start_date'            => $start_date,
+                               'end_date'                      => $end_date,
+                               'start'                         => $this->start
+                       );
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('search_field'));
+
+                       
$GLOBALS['phpgw']->js->validate_file('overlib','overlib','property');
+
+                       $data = array
+                       (
+                               'lang_download'                                 
=> 'download',
+                               'link_download'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_download),
+                               'lang_download_help'                            
=> lang('Download table to your browser'),
+
+                               'start_date'                                    
=> $start_date,
+                               'end_date'                                      
        => $end_date,
+                               'lang_none'                                     
        => lang('None'),
+                               'lang_date_search'                              
=> lang('Date search'),
+                               'lang_date_search_help'                 => 
lang('Narrow the search by dates'),
+                               'link_date_search'                              
=> $link_date_search,
+
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'autorefresh'                                   
=> $autorefresh,
+                               'allow_allrows'                                 
=> true,
+                               'allrows'                                       
        => $this->allrows,
+                               'start_record'                                  
=> $this->start,
+                               'record_limit'                                  
=> $record_limit,
+                               'num_records'                                   
=> count($ticket_list),
+                               'all_records'                                   
=> $this->bo->total_records,
+                               'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+
+                               'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'filter_name'                                   
=> 'filter',
                                'filter_list'                                   
=> $this->bo->filter(array('format' => 'filter', 'filter'=> 
$this->status_id,'default' => 'open')),
-                               'lang_show_all'                                 
=> lang('Open'),
-                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
-                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
-                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
-                               'query'                                         
        => $this->query,
-                               'lang_search'                                   
=> lang('search'),
-                               'table_header2'                                 
=> $table_header,
-                               'values2'                                       
        => (isset($content)?$content:''),
-                               'table_add'                                     
        => $table_add,
-                       );
-
-                       $appname                                        = 
lang('helpdesk');
-                       $function_msg                                   = 
lang('list ticket');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list2' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-                       $this->save_sessiondata();
-               }
-
-               function add()
-               {
-                       if(!$this->acl_add)
-                       {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 2, 'acl_location'=> $this->acl_location));
-                       }
+                               'lang_show_all'                                 
=> lang('Open'),
+                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
+                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
+                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
+                               'query'                                         
        => $this->query,
+                               'lang_search'                                   
=> lang('search'),
+                               'table_header2'                                 
=> $table_header,
+                               'values2'                                       
        => (isset($content)?$content:''),
+                               'table_add'                                     
        => $table_add,
+                       );
+
+                       $appname                                        = 
lang('helpdesk');
+                       $function_msg                                   = 
lang('list ticket');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list2' => $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+                       $this->save_sessiondata();
+               }
+
+               function add()
+               {
+                       if(!$this->acl_add)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 2, 'acl_location'=> $this->acl_location));
+                       }
                        if($this->tenant_id)
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.add2'));
                        }
-
-                       $bolocation             = 
CreateObject('property.bolocation');
-
-                       $values         = phpgw::get_var('values');
+
+                       $bolocation             = 
CreateObject('property.bolocation');
+
+                       $values         = phpgw::get_var('values');
                        $values['contact_id']           = 
phpgw::get_var('contact', 'int', 'POST');
                        if ((isset($values['cancel']) && $values['cancel']))
                        {
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index'));
                        }
 
-//------------------- start ticket from other location
-                       $bypass                 = phpgw::get_var('bypass', 
'bool');
-                       if(isset($_POST) && $_POST && isset($bypass) && $bypass)
-                       {
-                               $boadmin_entity         = 
CreateObject('property.boadmin_entity');
-                               $location_code          = 
phpgw::get_var('location_code');
-                               $values['descr']        = 
phpgw::get_var('descr');
-                               $p_entity_id            = 
phpgw::get_var('p_entity_id', 'int');
-                               $p_cat_id               = 
phpgw::get_var('p_cat_id', 'int');
-                               $values['p'][$p_entity_id]['p_entity_id']       
= $p_entity_id;
-                               $values['p'][$p_entity_id]['p_cat_id']          
= $p_cat_id;
-                               $values['p'][$p_entity_id]['p_num']             
= phpgw::get_var('p_num');
-
-                               $origin         = phpgw::get_var('origin');
-                               $origin_id      = phpgw::get_var('origin_id', 
'int');
-
-                               if($p_entity_id && $p_cat_id)
-                               {
-                                       $entity_category = 
$boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
-                                       
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
-                               }
-
-                               if($location_code)
-                               {
+//------------------- start ticket from other location
+                       $bypass                 = phpgw::get_var('bypass', 
'bool');
+                       if(isset($_POST) && $_POST && isset($bypass) && $bypass)
+                       {
+                               $boadmin_entity         = 
CreateObject('property.boadmin_entity');
+                               $location_code          = 
phpgw::get_var('location_code');
+                               $values['descr']        = 
phpgw::get_var('descr');
+                               $p_entity_id            = 
phpgw::get_var('p_entity_id', 'int');
+                               $p_cat_id               = 
phpgw::get_var('p_cat_id', 'int');
+                               $values['p'][$p_entity_id]['p_entity_id']       
= $p_entity_id;
+                               $values['p'][$p_entity_id]['p_cat_id']          
= $p_cat_id;
+                               $values['p'][$p_entity_id]['p_num']             
= phpgw::get_var('p_num');
+
+                               $origin         = phpgw::get_var('origin');
+                               $origin_id      = phpgw::get_var('origin_id', 
'int');
+
+                               if($p_entity_id && $p_cat_id)
+                               {
+                                       $entity_category = 
$boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
+                                       
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
+                               }
+
+                               if($location_code)
+                               {
                                        $values['location_data'] = 
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num,
 'view' => true));
-                               }
-                       }
-
-                       if(isset($values['origin']) && $values['origin'])
-                       {
-                               $origin         = $values['origin'];
-                               $origin_id      = $values['origin_id'];
-                       }
-
-                       $interlink      = CreateObject('property.interlink');
-
-                       if(isset($origin) && $origin)
-                       {
-                               unset($values['origin']);
-                               unset($values['origin_id']);
-                               $values['origin'][0]['location']= $origin;
-                               $values['origin'][0]['descr']= 
$interlink->get_location_name($origin);
-                               $values['origin'][0]['data'][]= array(
-                                       'id'    => $origin_id,
-                                       'link'  => 
$interlink->get_relation_link(array('location' => $origin), $origin_id),
-                                       );
-                       }
-//_debug_array($insert_record);
+                               }
+                       }
+
+                       if(isset($values['origin']) && $values['origin'])
+                       {
+                               $origin         = $values['origin'];
+                               $origin_id      = $values['origin_id'];
+                       }
+
+                       $interlink      = CreateObject('property.interlink');
+
+                       if(isset($origin) && $origin)
+                       {
+                               unset($values['origin']);
+                               unset($values['origin_id']);
+                               $values['origin'][0]['location']= $origin;
+                               $values['origin'][0]['descr']= 
$interlink->get_location_name($origin);
+                               $values['origin'][0]['data'][]= array(
+                                       'id'    => $origin_id,
+                                       'link'  => 
$interlink->get_relation_link(array('location' => $origin), $origin_id),
+                                       );
+                       }
+//_debug_array($insert_record);
                        if ((isset($values['save']) && $values['save']) || 
(isset($values['apply']) && $values['apply']))
-                       {
-                               $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
-                               $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession('insert_record_entity','property');
+                       {
+                               $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
+                               $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession('insert_record_entity','property');
+
+                               if(isset($insert_record_entity) && 
is_array($insert_record_entity))
+                               {
+                                       for 
($j=0;$j<count($insert_record_entity);$j++)
+                                       {
+                                               
$insert_record['extra'][$insert_record_entity[$j]]      = 
$insert_record_entity[$j];
+                                       }
+                               }
+
+                               $values = 
$this->bocommon->collect_locationdata($values,$insert_record);
+
 
-                               if(isset($insert_record_entity) && 
is_array($insert_record_entity))
-                               {
-                                       for 
($j=0;$j<count($insert_record_entity);$j++)
-                                       {
-                                               
$insert_record['extra'][$insert_record_entity[$j]]      = 
$insert_record_entity[$j];
-                                       }
-                               }
-
-                               $values = 
$this->bocommon->collect_locationdata($values,$insert_record);
-
-
                                if(!$values['subject'] && 
isset($this->bo->config->config_data['tts_mandatory_title']) && 
$this->bo->config->config_data['tts_mandatory_title'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please enter a title !'));
                                }
 
-                               if(!$values['cat_id'])
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
-                               }
-
-                               if(!isset($values['details']) || 
!$values['details'])
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please give som details !'));
-                               }
-
-                               if((!isset($values['location']['loc1']) || 
!$values['location']['loc1']) && (!isset($values['extra']['p_num']) || 
!$values['extra']['p_num']))
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please select a location - or an 
entity!'));
-                               }
-
-                               if(!$values['assignedto'] && 
!$values['group_id'])
-                               {
+                               if(!$values['cat_id'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+                               }
+
+                               if(!isset($values['details']) || 
!$values['details'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please give som details !'));
+                               }
+
+                               if((!isset($values['location']['loc1']) || 
!$values['location']['loc1']) && (!isset($values['extra']['p_num']) || 
!$values['extra']['p_num']))
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a location - or an 
entity!'));
+                               }
+
+                               if(!$values['assignedto'] && 
!$values['group_id'])
+                               {
                                        $_responsible = 
execMethod('property.boresponsible.get_responsible', $values);
                                        if(!$_responsible)
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('Please select a person or a group to 
handle the ticket !'));
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('Please select a person or a group to 
handle the ticket !'));
                                        }
                                        else
                                        {
@@ -1376,350 +1414,350 @@
                                        unset($_priority);
                                }
 
-                               if(!isset($receipt['error']))
-                               {
-                                       $receipt = $this->bo->add($values);
-
-//------------ files
-                                       $values['file_name'] = @str_replace(' 
','_',$_FILES['file']['name']);
-
+                               if(!isset($receipt['error']))
+                               {
+                                       $receipt = $this->bo->add($values);
+
+//------------ files
+                                       $values['file_name'] = @str_replace(' 
','_',$_FILES['file']['name']);
+
                                        if($values['file_name'] && 
$receipt['id'])
-                                       {
-                                               $bofiles        = 
CreateObject('property.bofiles');
-                                               $to_file = $bofiles->fakebase . 
'/fmticket/' . $receipt['id'] . '/' . $values['file_name'];
+                                       {
+                                               $bofiles        = 
CreateObject('property.bofiles');
+                                               $to_file = $bofiles->fakebase . 
'/fmticket/' . $receipt['id'] . '/' . $values['file_name'];
+
+                                               
if($bofiles->vfs->file_exists(array(
+                                                               'string' => 
$to_file,
+                                                               'relatives' => 
Array(RELATIVE_NONE)
+                                                       )))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+                                               }
+                                               else
+                                               {
+                                                       
$bofiles->create_document_dir("fmticket/{$receipt['id']}");
+                                                       
$bofiles->vfs->override_acl = 1;
+
+                                                       
if(!$bofiles->vfs->cp(array (
+                                                               'from'  => 
$_FILES['file']['tmp_name'],
+                                                               'to'    => 
$to_file,
+                                                               'relatives'     
=> array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+                                                       {
+                                                               
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
+                                                       }
+                                                       
$bofiles->vfs->override_acl = 0;
+                                               }
+                                       }
+//--------------end files
+                                       
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
+                                       
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts','');
 
-                                               
if($bofiles->vfs->file_exists(array(
-                                                               'string' => 
$to_file,
-                                                               'relatives' => 
Array(RELATIVE_NONE)
-                                                       )))
-                                               {
-                                                       
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
-                                               }
-                                               else
-                                               {
-                                                       
$bofiles->create_document_dir("fmticket/{$receipt['id']}");
-                                                       
$bofiles->vfs->override_acl = 1;
-
-                                                       
if(!$bofiles->vfs->cp(array (
-                                                               'from'  => 
$_FILES['file']['tmp_name'],
-                                                               'to'    => 
$to_file,
-                                                               'relatives'     
=> array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
-                                                       {
-                                                               
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
-                                                       }
-                                                       
$bofiles->vfs->override_acl = 0;
-                                               }
-                                       }
-//--------------end files
-                                       
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
-                                       
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts','');
-
                                        if ((isset($values['save']) && 
$values['save']))
                                        {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index'));
-                               }
-                               else
-                               {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index'));
+                                       }
+                                       else
+                                       {
                                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.view', 'id' => $receipt['id'], 'tab' =>'general'));             
                     
                                        }
                                }
                                else
                                {
-                                       if(isset($values['location']) && 
$values['location'])
-                                       {
-                                               $location_code=implode("-", 
$values['location']);
-                                               $values['extra']['view'] = true;
-                                               $values['location_data'] = 
$bolocation->read_single($location_code, $values['extra']);
-                                       }
-                                       if(isset($values['extra']['p_num']) && 
$values['extra']['p_num'])
-                                       {
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=phpgw::get_var('entity_cat_name_'.$values['extra']['p_entity_id'],
 'string', 'POST');
-                                       }
-                               }
+                                       if(isset($values['location']) && 
$values['location'])
+                                       {
+                                               $location_code=implode("-", 
$values['location']);
+                                               $values['extra']['view'] = true;
+                                               $values['location_data'] = 
$bolocation->read_single($location_code, $values['extra']);
+                                       }
+                                       if(isset($values['extra']['p_num']) && 
$values['extra']['p_num'])
+                                       {
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=phpgw::get_var('entity_cat_name_'.$values['extra']['p_entity_id'],
 'string', 'POST');
+                                       }
+                               }
                        }
 
-                       $location_data=$bolocation->initiate_ui_location(array(
-                                               'values'        => 
(isset($values['location_data'])?$values['location_data']:''),
-                                               'type_id'       => -1, // 
calculated from location_types
-                                               'no_link'       => false, // 
disable lookup links for location type less than type_id
-                                               'tenant'        => true,
-                                               'lookup_type'   => 'form',
-                                               'lookup_entity' => 
$this->bocommon->get_lookup_entity('ticket'),
-                                               'entity_data'   => 
(isset($values['p'])?$values['p']:'')
-                                               ));
-
-
+                       $location_data=$bolocation->initiate_ui_location(array(
+                                               'values'        => 
(isset($values['location_data'])?$values['location_data']:''),
+                                               'type_id'       => -1, // 
calculated from location_types
+                                               'no_link'       => false, // 
disable lookup links for location type less than type_id
+                                               'tenant'        => true,
+                                               'lookup_type'   => 'form',
+                                               'lookup_entity' => 
$this->bocommon->get_lookup_entity('ticket'),
+                                               'entity_data'   => 
(isset($values['p'])?$values['p']:'')
+                                               ));
+
+
                        
$contact_data=$this->bocommon->initiate_ui_contact_lookup(array(
                                                'contact_id'            => 
$ticket['contact_id'],
                                                'field'                         
=> 'contact',
                                                'type'                          
=> 'form'));
 
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uitts.add'
-                       );
+                       $link_data = array
+                       (
+                               'menuaction'    => 'property.uitts.add'
+                       );
+
+                       if(!isset($values['assignedto']))
+                       {
+                               $values['assignedto']= 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault']:'');
+                       }
+                       if(!isset($values['group_id']))
+                       {
+                               $values['group_id']= 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault']:'');
+                       }
+
+                       if(!isset($values['cat_id']))
+                       {
+                               $this->cat_id = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category']:'');
+                       }
+                       else
+                       {
+                               $this->cat_id = $values['cat_id'];
+                       }
+
+                       $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
+
 
-                       if(!isset($values['assignedto']))
-                       {
-                               $values['assignedto']= 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault']:'');
-                       }
-                       if(!isset($values['group_id']))
-                       {
-                               $values['group_id']= 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault']:'');
-                       }
-
-                       if(!isset($values['cat_id']))
-                       {
-                               $this->cat_id = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category']:'');
-                       }
-                       else
-                       {
-                               $this->cat_id = $values['cat_id'];
-                       }
-
-                       $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
-
-
                        if(!$this->_simple && $this->_show_finnish_date)
                        {
-                       $jscal = CreateObject('phpgwapi.jscalendar');
-                       $jscal->add_listener('values_finnish_date');
+                               $jscal = CreateObject('phpgwapi.jscalendar');
+                               $jscal->add_listener('values_finnish_date');
                        }
-
-                       $data = array
-                       (
+
+                       $data = array
+                       (
                                'contact_data'                                  
=> $contact_data,
                                'simple'                                        
        => $this->_simple,
                                'show_finnish_date'                             
=> $this->_show_finnish_date,
-                               'value_origin'                                  
=> isset($values['origin']) ? $values['origin'] : '',
-                               'value_origin_type'                             
=> (isset($origin)?$origin:''),
-                               'value_origin_id'                               
=> (isset($origin_id)?$origin_id:''),
-
-                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'location_data'                         => 
$location_data,
-                               'lang_assign_to'                        => 
lang('Assign to'),
-                               'lang_no_user'                          => 
lang('Select user'),
-                               'lang_user_statustext'                  => 
lang('Select the user the selection belongs to. To do not use a user select NO 
USER'),
-                               'select_user_name'                      => 
'values[assignedto]',
-                               'user_list'                             => 
$this->bocommon->get_user_list_right2('select',4,$values['assignedto'],$this->acl_location),
-
-                               'lang_group'                            => 
lang('Group'),
-                               'lang_no_group'                         => 
lang('No group'),
-                               'group_list'                            => 
$this->bocommon->get_group_list('select',$values['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
-                               'select_group_name'                     => 
'values[group_id]',
-
-                               'lang_priority'                         => 
lang('Priority'),
-                               'lang_priority_statustext'              => 
lang('Select the priority the selection belongs to.'),
-                               'select_priority_name'                  => 
'values[priority]',
-                               'priority_list'                         => 
$this->bo->get_priority_list((isset($values['priority'])?$values['priority']:'')),
-
-                               'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
-                               'lang_subject'                          => 
lang('Subject'),
-                               'lang_subject_statustext'               => 
lang('Enter the subject of this ticket'),
-
-                               'lang_details'                          => 
lang('Details'),
-                               'lang_details_statustext'               => 
lang('Enter the details of this ticket'),
-                               'lang_category'                         => 
lang('category'),
-                               'lang_save'                             => 
lang('save'),
+                               'value_origin'                                  
=> isset($values['origin']) ? $values['origin'] : '',
+                               'value_origin_type'                             
=> (isset($origin)?$origin:''),
+                               'value_origin_id'                               
=> (isset($origin_id)?$origin_id:''),
+
+                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'location_data'                         => 
$location_data,
+                               'lang_assign_to'                        => 
lang('Assign to'),
+                               'lang_no_user'                          => 
lang('Select user'),
+                               'lang_user_statustext'                  => 
lang('Select the user the selection belongs to. To do not use a user select NO 
USER'),
+                               'select_user_name'                      => 
'values[assignedto]',
+                               'user_list'                             => 
$this->bocommon->get_user_list_right2('select',4,$values['assignedto'],$this->acl_location),
+
+                               'lang_group'                            => 
lang('Group'),
+                               'lang_no_group'                         => 
lang('No group'),
+                               'group_list'                            => 
$this->bocommon->get_group_list('select',$values['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
+                               'select_group_name'                     => 
'values[group_id]',
+
+                               'lang_priority'                         => 
lang('Priority'),
+                               'lang_priority_statustext'              => 
lang('Select the priority the selection belongs to.'),
+                               'select_priority_name'                  => 
'values[priority]',
+                               'priority_list'                         => 
$this->bo->get_priority_list((isset($values['priority'])?$values['priority']:'')),
+
+                               'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'lang_subject'                          => 
lang('Subject'),
+                               'lang_subject_statustext'               => 
lang('Enter the subject of this ticket'),
+
+                               'lang_details'                          => 
lang('Details'),
+                               'lang_details_statustext'               => 
lang('Enter the details of this ticket'),
+                               'lang_category'                         => 
lang('category'),
+                               'lang_save'                                     
=> lang('save'),
                                'lang_cancel'                           => 
lang('cancel'),
                                'lang_send'                                     
=> lang('send'),
-                               'value_details'                         => 
(isset($values['details'])?$values['details']:''),
-                               'value_subject'                         => 
(isset($values['subject'])?$values['subject']:''),
-
-                               'lang_finnish_date'                     => 
lang('finnish date'),
-                               'value_finnish_date'                    => 
(isset($values['finnish_date'])?$values['finnish_date']:''),
-                               'img_cal'                                       
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
-                               'lang_datetitle'                        => 
lang('Select date'),
-                               'lang_finnish_date_statustext'          => 
lang('Select the estimated date for closing the task'),
-
+                               'value_details'                         => 
(isset($values['details'])?$values['details']:''),
+                               'value_subject'                         => 
(isset($values['subject'])?$values['subject']:''),
+
+                               'lang_finnish_date'                     => 
lang('finnish date'),
+                               'value_finnish_date'                    => 
(isset($values['finnish_date'])?$values['finnish_date']:''),
+                               'img_cal'                                       
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                               'lang_datetitle'                        => 
lang('Select date'),
+                               'lang_finnish_date_statustext'          => 
lang('Select the estimated date for closing the task'),
+
                                'lang_cancel_statustext'                        
=> lang('Back to the ticket list'),
                                'lang_send_statustext'                  => 
lang('Save the entry and return to list'),
                                'lang_save_statustext'                  => 
lang('Save the ticket'),
-                               'lang_no_cat'                           => 
lang('no category'),
-                               'lang_town_statustext'                  => 
lang('Select the part of town the building belongs to. To do not use a part of 
town -  select NO PART OF TOWN'),
-                               'lang_part_of_town'                     => 
lang('Part of town'),
-                               'lang_no_part_of_town'                  => 
lang('No part of town'),
-                               'cat_select'                            => 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id)),
-
-                               'mailnotification'                      => 
(isset($this->bo->config->config_data['mailnotification'])?$this->bo->config->config_data['mailnotification']:''),
-                               'lang_mailnotification'                 => 
lang('Send e-mail'),
-                               'lang_mailnotification_statustext'      => 
lang('Choose to send mailnotification'),
-                               'pref_send_mail'                        => 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification']:''),
-                               'fileupload'                            => 
(isset($this->bo->config->config_data['fmttsfileupload'])?$this->bo->config->config_data['fmttsfileupload']:''),
-                       );
-
-//_debug_array($data);
-                       $appname                                        = 
lang('helpdesk');
-                       $function_msg                                   = 
lang('add ticket');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('tts','files'));
-                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add' 
=> $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-               }
-
-               function add2()
-               {
-                       if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_ADD, 'property'))
-                       {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> '.ticket.external'));
-                       }
-
-                       $bolocation             = 
CreateObject('property.bolocation');
-
-                       $values         = phpgw::get_var('values');
-
-                       
$GLOBALS['phpgw']->xslttpl->add_file(array('tts','files'));
-
-
-                       if(!$this->tenant_id)
-                       {
-                               $receipt['error'][]=array('msg'=>lang('No 
Tenant selected !'));
-                       }
-                       else
-                       {
-                               $values['extra']['tenant_id'] = 
$this->tenant_id;
-                               $values['location_code'] = 
$bolocation->get_tenant_location($this->tenant_id);
-
-
-                               if(!$values['location_code'])
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('No location for this tenant!'));
-                               }
-                               else
-                               {
-                                       $location = 
explode('-',$values['location_code']);
-                                       $i = 1;
-                                       foreach ($location as $entry)
-                                       {
-                                               
$values['location']["loc{$i}"]=$entry;
-                                               $i++;
-                                       }
-                               }
-                               if(is_array($values['location_code']))
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Several locations for this tenant!'));
-                               }
-                       }
-
+                               'lang_no_cat'                                   
=> lang('no category'),
+                               'lang_town_statustext'                  => 
lang('Select the part of town the building belongs to. To do not use a part of 
town -  select NO PART OF TOWN'),
+                               'lang_part_of_town'                             
=> lang('Part of town'),
+                               'lang_no_part_of_town'                  => 
lang('No part of town'),
+                               'cat_select'                            => 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id)),
+
+                               'mailnotification'                      => 
(isset($this->bo->config->config_data['mailnotification'])?$this->bo->config->config_data['mailnotification']:''),
+                               'lang_mailnotification'                 => 
lang('Send e-mail'),
+                               'lang_mailnotification_statustext'      => 
lang('Choose to send mailnotification'),
+                               'pref_send_mail'                        => 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification']:''),
+                               'fileupload'                            => 
(isset($this->bo->config->config_data['fmttsfileupload'])?$this->bo->config->config_data['fmttsfileupload']:''),
+                       );
+
+//_debug_array($data);
+                       $appname                                        = 
lang('helpdesk');
+                       $function_msg                                   = 
lang('add ticket');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('tts','files'));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add' 
=> $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function add2()
+               {
+                       if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_ADD, 'property'))
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> '.ticket.external'));
+                       }
+
+                       $bolocation             = 
CreateObject('property.bolocation');
+
+                       $values         = phpgw::get_var('values');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('tts','files'));
+
+
+                       if(!$this->tenant_id)
+                       {
+                               $receipt['error'][]=array('msg'=>lang('No 
Tenant selected !'));
+                       }
+                       else
+                       {
+                               $values['extra']['tenant_id'] = 
$this->tenant_id;
+                               $values['location_code'] = 
$bolocation->get_tenant_location($this->tenant_id);
+
+
+                               if(!$values['location_code'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('No location for this tenant!'));
+                               }
+                               else
+                               {
+                                       $location = 
explode('-',$values['location_code']);
+                                       $i = 1;
+                                       foreach ($location as $entry)
+                                       {
+                                               
$values['location']["loc{$i}"]=$entry;
+                                               $i++;
+                                       }
+                               }
+                               if(is_array($values['location_code']))
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Several locations for this tenant!'));
+                               }
+                       }
+
                        $values['location_data'] = 
$bolocation->read_single($values['location_code'],array('tenant_id'=>$this->tenant_id,
 'view' => true));
-
-                       $values['street_name'] = 
$values['location_data']['street_name'];
-                       $values['street_number'] = 
$values['location_data']['street_number'];
-
-
-                       $values['assignedto']= 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault']:'');
-                       if(!$values['assignedto'])
-                       {
-                               $receipt['error'][]=array('msg'=>lang('Please 
set default assign to in preferences for user %1!', 
$GLOBALS['phpgw']->accounts->id2name($this->account)));
-                       }
-
-                       $values['group_id']= 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault']:'');
-
-                       $values['cat_id'] = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category']:'');
-
-                       if(!$values['cat_id'])
-                       {
-                               $receipt['error'][]=array('msg'=>lang('Please 
set default category in preferences for user %1!', 
$GLOBALS['phpgw']->accounts->id2name($this->account)));
-                       }
-
-                       if (isset($values['save']))
-                       {
-                               if(!$values['subject'])
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please type a subject for this ticket 
!'));
-                               }
-
-                               if(!isset($values['details']) || 
!$values['details'])
-                               {
-                                       
$receipt['error'][]=array('msg'=>lang('Please give som details !'));
-                               }
-
-                               if(!isset($receipt['error']))
-                               {
-                                       $receipt = $this->bo->add($values);
-                                       
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
-                                       
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts','');
+
+                       $values['street_name'] = 
$values['location_data']['street_name'];
+                       $values['street_number'] = 
$values['location_data']['street_number'];
+
+
+                       $values['assignedto']= 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault']:'');
+                       if(!$values['assignedto'])
+                       {
+                               $receipt['error'][]=array('msg'=>lang('Please 
set default assign to in preferences for user %1!', 
$GLOBALS['phpgw']->accounts->id2name($this->account)));
+                       }
+
+                       $values['group_id']= 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['groupdefault']:'');
+
+                       $values['cat_id'] = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_category']:'');
+
+                       if(!$values['cat_id'])
+                       {
+                               $receipt['error'][]=array('msg'=>lang('Please 
set default category in preferences for user %1!', 
$GLOBALS['phpgw']->accounts->id2name($this->account)));
+                       }
+
+                       if (isset($values['save']))
+                       {
+                               if(!$values['subject'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please type a subject for this ticket 
!'));
+                               }
+
+                               if(!isset($values['details']) || 
!$values['details'])
+                               {
+                                       
$receipt['error'][]=array('msg'=>lang('Please give som details !'));
+                               }
+
+                               if(!isset($receipt['error']))
+                               {
+                                       $receipt = $this->bo->add($values);
+                                       
$GLOBALS['phpgw']->session->appsession('receipt','property',$receipt);
+                                       
$GLOBALS['phpgw']->session->appsession('session_data','fm_tts','');
                                        
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index'));
-                               }
-                               else
-                               {
-                                       if(isset($values['extra']['p_num']) && 
$values['extra']['p_num'])
-                                       {
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=phpgw::get_var('entity_cat_name_'.$values['extra']['p_entity_id'],
 'string', 'POST');
-                                       }
-                               }
-                       }
+                               }
+                               else
+                               {
+                                       if(isset($values['extra']['p_num']) && 
$values['extra']['p_num'])
+                                       {
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+                                               
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=phpgw::get_var('entity_cat_name_'.$values['extra']['p_entity_id'],
 'string', 'POST');
+                                       }
+                               }
+                       }
+
+                       $location_data=$bolocation->initiate_ui_location(array(
+                                               'values'        => 
(isset($values['location_data'])?$values['location_data']:''),
+                                               'type_id'       => -1, // 
calculated from location_types
+                                               'no_link'       => false, // 
disable lookup links for location type less than type_id
+                                               'tenant'        => true,
+                                               'lookup_type'   => 'view',
+                                               'lookup_entity' => false,
+                                               'entity_data'   => false
+                                               ));
+
+                       $link_data = array
+                       (
+                               'menuaction'    => 'property.uitts.add2'
+                       );
 
-                       $location_data=$bolocation->initiate_ui_location(array(
-                                               'values'        => 
(isset($values['location_data'])?$values['location_data']:''),
-                                               'type_id'       => -1, // 
calculated from location_types
-                                               'no_link'       => false, // 
disable lookup links for location type less than type_id
-                                               'tenant'        => true,
-                                               'lookup_type'   => 'view',
-                                               'lookup_entity' => false,
-                                               'entity_data'   => false
-                                               ));
-
-                       $link_data = array
-                       (
-                               'menuaction'    => 'property.uitts.add2'
-                       );
-
-                       $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
-
-                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
-
-                       $data = array
-                       (
-                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-                               'location_data'                                 
        => $location_data,
-
-                               'form_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
+                       $msgbox_data = 
(isset($receipt)?$this->bocommon->msgbox_data($receipt):'');
+
+                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
+
+                       $data = array
+                       (
+                               'msgbox_data'                                   
        => $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'location_data'                                 
        => $location_data,
+
+                               'form_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'done_action'                                   
        => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitts.index')),
-                               'lang_subject'                                  
        => lang('Subject'),
-                               'lang_subject_statustext'                       
=> lang('Enter the subject of this ticket'),
-
-                               'lang_details'                                  
        => lang('Details'),
-                               'lang_details_statustext'                       
=> lang('Enter the details of this ticket'),
+                               'lang_subject'                                  
        => lang('Subject'),
+                               'lang_subject_statustext'                       
=> lang('Enter the subject of this ticket'),
 
-                               'lang_save'                                     
                => lang('save'),
-                               'lang_done'                                     
                => lang('done'),
-                               'value_details'                                 
        => (isset($values['details'])?$values['details']:''),
-                               'value_subject'                                 
        => (isset($values['subject'])?$values['subject']:''),
-
-                               'lang_done_statustext'                          
=> lang('Back to the ticket list'),
-                               'lang_save_statustext'                          
=> lang('Save the ticket'),
-                               'lang_contact_phone'                            
=> lang('contact phone'),
-                               'lang_contact_phone_statustext'         => 
lang('contact phone'),
+                               'lang_details'                                  
        => lang('Details'),
+                               'lang_details_statustext'                       
=> lang('Enter the details of this ticket'),
+
+                               'lang_save'                                     
                => lang('save'),
+                               'lang_done'                                     
                => lang('done'),
+                               'value_details'                                 
        => (isset($values['details'])?$values['details']:''),
+                               'value_subject'                                 
        => (isset($values['subject'])?$values['subject']:''),
+
+                               'lang_done_statustext'                          
=> lang('Back to the ticket list'),
+                               'lang_save_statustext'                          
=> lang('Save the ticket'),
+                               'lang_contact_phone'                            
=> lang('contact phone'),
+                               'lang_contact_phone_statustext'         => 
lang('contact phone'),
                                'value_contact_phone'                           
=> isset($values['contact_phone'])?$values['contact_phone']:'',
-
-                               'lang_contact_email'                            
=> lang('contact email'),
-                               'lang_contact_email_statustext'         => 
lang('contact email'),
+
+                               'lang_contact_email'                            
=> lang('contact email'),
+                               'lang_contact_email_statustext'         => 
lang('contact email'),
                                'value_contact_email'                           
=> isset($values['contact_email'])?$values['contact_email']:'',
-                       );
-
-                       $appname                                        = 
lang('helpdesk');
-                       $function_msg                                   = 
lang('add ticket');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add2' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-               }
-
-               function view()
-               {
-                       if(!$this->acl_read)
-                       {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
-                       }
-
+                       );
+
+                       $appname                                        = 
lang('helpdesk');
+                       $function_msg                           = lang('add 
ticket');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add2' => $data));
+               //      $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+               function view()
+               {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
                        $id = phpgw::get_var('id', 'int', 'GET');
 
                        if($this->tenant_id)
@@ -1727,8 +1765,8 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.view2', 'id' => $id ));
                        }
 
-                       $bolocation     = CreateObject('property.bolocation');
-
+                       $bolocation     = CreateObject('property.bolocation');
+
                        $values = phpgw::get_var('values');
                        $values['contact_id']           = 
phpgw::get_var('contact', 'int', 'POST');
                        $values['ecodimb']                      = 
phpgw::get_var('ecodimb');
@@ -1739,16 +1777,16 @@
 
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('receipt','property');
                        
$GLOBALS['phpgw']->session->appsession('receipt','property','');
-
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('tts', 
'files'));
-
-                       if(isset($values['save']))
-                       {
-                               if(!$this->acl_edit)
-                               {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>4, 'acl_location'=> $this->acl_location));
-                               }
-
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('tts', 
'files'));
+
+                       if(isset($values['save']))
+                       {
+                               if(!$this->acl_edit)
+                               {
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>4, 'acl_location'=> $this->acl_location));
+                               }
+
                                $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
                                $insert_record_entity = 
$GLOBALS['phpgw']->session->appsession('insert_record_entity','property');
 
@@ -1778,83 +1816,83 @@
                                {
                                        $receipt = $this->bo->mail_ticket($id, 
$this->bo->fields_updated, $receipt);
                                }
-
-//--------- files
-                               $bofiles        = 
CreateObject('property.bofiles');
-                               if(isset($values['file_action']) && 
is_array($values['file_action']))
-                               {
-                                       
$bofiles->delete_file("/fmticket/{$id}/", $values);
-                               }
-
-                               $values['file_name']=str_replace(' 
','_',$_FILES['file']['name']);
-
-                               if($values['file_name'])
-                               {
-                                       $to_file = $bofiles->fakebase . 
'/fmticket/' . $id . '/' . $values['file_name'];
-
-                                       if($bofiles->vfs->file_exists(array(
-                                                       'string' => $to_file,
-                                                       'relatives' => 
Array(RELATIVE_NONE)
-                                               )))
-                                       {
-                                               
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
-                                       }
-                                       else
-                                       {
-                                               
$bofiles->create_document_dir("fmticket/{$id}");
-                                               $bofiles->vfs->override_acl = 1;
-
-                                               if(!$bofiles->vfs->cp (array (
-                                                       'from'  => 
$_FILES['file']['tmp_name'],
-                                                       'to'    => $to_file,
-                                                       'relatives'     => 
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
-                                               {
-                                                       
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
-                                               }
-                                               $bofiles->vfs->override_acl = 0;
-                                       }
-                               }
+
+//--------- files
+                               $bofiles        = 
CreateObject('property.bofiles');
+                               if(isset($values['file_action']) && 
is_array($values['file_action']))
+                               {
+                                       
$bofiles->delete_file("/fmticket/{$id}/", $values);
+                               }
+
+                               $values['file_name']=str_replace(' 
','_',$_FILES['file']['name']);
+
+                               if($values['file_name'])
+                               {
+                                       $to_file = $bofiles->fakebase . 
'/fmticket/' . $id . '/' . $values['file_name'];
+
+                                       if($bofiles->vfs->file_exists(array(
+                                                       'string' => $to_file,
+                                                       'relatives' => 
Array(RELATIVE_NONE)
+                                               )))
+                                       {
+                                               
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+                                       }
+                                       else
+                                       {
+                                               
$bofiles->create_document_dir("fmticket/{$id}");
+                                               $bofiles->vfs->override_acl = 1;
+
+                                               if(!$bofiles->vfs->cp (array (
+                                                       'from'  => 
$_FILES['file']['tmp_name'],
+                                                       'to'    => $to_file,
+                                                       'relatives'     => 
array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
+                                               }
+                                               $bofiles->vfs->override_acl = 0;
+                                       }
+                               }
        //                      
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uitts.index'));
-                       }
-//---------end files
-                       $ticket = $this->bo->read_single($id);
-
+                       }
+//---------end files
+                       $ticket = $this->bo->read_single($id);
+
                        $order_link                             = '';
                        $add_to_project_link    = '';
                        $request_link                   ='';
 
                        if($GLOBALS['phpgw']->acl->check('.project.request', 
PHPGW_ACL_ADD, 'property'))
                        {
-                       $request_link_data = array
-                       (
-                               'menuaction'            => 
'property.uirequest.edit',
-                               'bypass'                => true,
-                               'location_code'         => 
$ticket['location_code'],
-                               'p_num'                 => $ticket['p_num'],
-                               'p_entity_id'           => 
$ticket['p_entity_id'],
-                               'p_cat_id'              => $ticket['p_cat_id'],
-                               'tenant_id'             => $ticket['tenant_id'],
-                               'origin'                => '.ticket',
-                               'origin_id'             => $id
-                       );
+                               $request_link_data = array
+                               (
+                                       'menuaction'            => 
'property.uirequest.edit',
+                                       'bypass'                        => true,
+                                       'location_code'         => 
$ticket['location_code'],
+                                       'p_num'                         => 
$ticket['p_num'],
+                                       'p_entity_id'           => 
$ticket['p_entity_id'],
+                                       'p_cat_id'                      => 
$ticket['p_cat_id'],
+                                       'tenant_id'                     => 
$ticket['tenant_id'],
+                                       'origin'                        => 
'.ticket',
+                                       'origin_id'                     => $id
+                               );
 
                                $request_link                   = 
$GLOBALS['phpgw']->link('/index.php',$request_link_data);
                        }
-
+
                        if($GLOBALS['phpgw']->acl->check('.project', 
PHPGW_ACL_ADD, 'property'))
                        {
-                       $order_link_data = array
-                       (
-                               'menuaction'            => 
'property.uiproject.edit',
-                               'bypass'                => true,
-                               'location_code'         => 
$ticket['location_code'],
-                               'p_num'                 => $ticket['p_num'],
-                               'p_entity_id'           => 
$ticket['p_entity_id'],
-                               'p_cat_id'              => $ticket['p_cat_id'],
-                               'tenant_id'             => $ticket['tenant_id'],
-                               'origin'                => '.ticket',
-                               'origin_id'             => $id
-                       );
+                               $order_link_data = array
+                               (
+                                       'menuaction'            => 
'property.uiproject.edit',
+                                       'bypass'                        => true,
+                                       'location_code'         => 
$ticket['location_code'],
+                                       'p_num'                         => 
$ticket['p_num'],
+                                       'p_entity_id'           => 
$ticket['p_entity_id'],
+                                       'p_cat_id'                      => 
$ticket['p_cat_id'],
+                                       'tenant_id'                     => 
$ticket['tenant_id'],
+                                       'origin'                        => 
'.ticket',
+                                       'origin_id'                     => $id
+                               );
 
                                $add_to_project_link_data = array
                                (
@@ -1875,13 +1913,13 @@
 
                        }
 
-                       $form_link = array
-                       (
-                               'menuaction'    => 'property.uitts.view',
-                               'id'            => $id
-                       );
-
-
+                       $form_link = array
+                       (
+                               'menuaction'    => 'property.uitts.view',
+                               'id'            => $id
+                       );
+
+
                        if($ticket['origin'] || $ticket['target'])
                        {
                                $lookup_type    = 'view';
@@ -1893,14 +1931,14 @@
                                $type_id                = -1;
                        }
 
-                       $location_data=$bolocation->initiate_ui_location(array(
-                                               'values'        => 
$ticket['location_data'],
+                       $location_data=$bolocation->initiate_ui_location(array(
+                                               'values'        => 
$ticket['location_data'],
                                                'type_id'       => $type_id,
-                                               'no_link'       => false, // 
disable lookup links for location type less than type_id
-                                               'tenant'        => 
(isset($ticket['location_data']['tenant_id'])?$ticket['location_data']['tenant_id']:''),
+                                               'no_link'       => false, // 
disable lookup links for location type less than type_id
+                                               'tenant'        => 
(isset($ticket['location_data']['tenant_id'])?$ticket['location_data']['tenant_id']:''),
                                                'lookup_type'   => $lookup_type,
-                                               'lookup_entity' => 
$this->bocommon->get_lookup_entity('ticket'),
-                                               'entity_data'   => 
(isset($ticket['p'])?$ticket['p']:'')
+                                               'lookup_entity' => 
$this->bocommon->get_lookup_entity('ticket'),
+                                               'entity_data'   => 
(isset($ticket['p'])?$ticket['p']:'')
                                                ));
                        unset($type_id);
 
@@ -1909,66 +1947,66 @@
                                                'field'                         
=> 'contact',
                                                'type'                          
=> 'form'));
 
-
-                       if($ticket['contact_phone'])
-                       {
-                               for 
($i=0;$i<count($location_data['location']);$i++)
-                               {
-                                       
if($location_data['location'][$i]['input_name'] == 'contact_phone')
-                                       {
-                                               
unset($location_data['location'][$i]['value']);
-                                       }
-                               }
-                       }
-
-                       if ($ticket['cat_id'])
-                       {
-                               $this->cat_id = $ticket['cat_id'];
-                       }
-
-                       $start_entity   = 
$this->bocommon->get_start_entity('ticket');
-
+
+                       if($ticket['contact_phone'])
+                       {
+                               for 
($i=0;$i<count($location_data['location']);$i++)
+                               {
+                                       
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+                                       {
+                                               
unset($location_data['location'][$i]['value']);
+                                       }
+                               }
+                       }
+
+                       if ($ticket['cat_id'])
+                       {
+                               $this->cat_id = $ticket['cat_id'];
+                       }
+
+                       $start_entity   = 
$this->bocommon->get_start_entity('ticket');
+
                        $link_entity = array();
-                       if (isset($start_entity) AND is_array($start_entity))
-                       {
-                               $i=0;
-                               foreach($start_entity as $entry)
+                       if (isset($start_entity) AND is_array($start_entity))
+                       {
+                               $i=0;
+                               foreach($start_entity as $entry)
                                {
                                        
if($GLOBALS['phpgw']->acl->check(".entity.{$entry['id']}", PHPGW_ACL_ADD, 
'property'))
                                        {
-                                       $link_entity[$i]['link'] = 
$GLOBALS['phpgw']->link('/index.php',array
-                                       (
-                                               'menuaction'            => 
'property.uientity.edit',
-                                               'bypass'                => true,
-                                               'location_code'         => 
$ticket['location_code'],
-                                               'entity_id'             => 
$entry['id'],
-                                               'p_num'                 => 
$ticket['p_num'],
-                                               'p_entity_id'           => 
$ticket['p_entity_id'],
-                                               'p_cat_id'              => 
$ticket['p_cat_id'],
-                                               'tenant_id'             => 
$ticket['tenant_id'],
-                                               'origin'                => 
'.ticket',
-                                               'origin_id'             => $id
-                                       ));
-                                       $link_entity[$i]['name']        = 
$entry['name'];
-                               $i++;
-                               }
-                       }
+                                               $link_entity[$i]['link'] = 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'            
=> 'property.uientity.edit',
+                                                       'bypass'                
=> true,
+                                                       'location_code'         
=> $ticket['location_code'],
+                                                       'entity_id'             
=> $entry['id'],
+                                                       'p_num'                 
=> $ticket['p_num'],
+                                                       'p_entity_id'           
=> $ticket['p_entity_id'],
+                                                       'p_cat_id'              
=> $ticket['p_cat_id'],
+                                                       'tenant_id'             
=> $ticket['tenant_id'],
+                                                       'origin'                
=> '.ticket',
+                                                       'origin_id'             
=> $id
+                                               ));
+                                               $link_entity[$i]['name']        
= $entry['name'];
+                                               $i++;
+                                       }
+                               }
                        }
-
-//_debug_array($link_entity);
-
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-                       $link_file_data = array
-                       (
-                               'menuaction'    => 'property.uitts.view_file',
-                               'id'            => $id
-                       );
-
+
+//_debug_array($link_entity);
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $link_file_data = array
+                       (
+                               'menuaction'    => 'property.uitts.view_file',
+                               'id'            => $id
+                       );
+
                        if(!$this->_simple && $this->_show_finnish_date)
                        {
-                       $jscal = CreateObject('phpgwapi.jscalendar');
-                       $jscal->add_listener('values_finnish_date');
+                               $jscal = CreateObject('phpgwapi.jscalendar');
+                               $jscal->add_listener('values_finnish_date');
                        }
 
                        // -------- start order section
@@ -2355,8 +2393,11 @@
                        
                        
//----------------------------------------------datatable settings--------      
                
 
-                       $data = array
-                       (
+                       $cat_select     = 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id));
+                       $this->cats->app_name           = 'property.project';
+                       $order_catetory = 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $ticket['order_cat_id']));
+                       $data = array
+                       (
                                'access_order'                                  
=> $access_order,
                                'currency'                                      
        => $GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
                                'value_order_id'                                
=> $ticket['order_id'],
@@ -2379,80 +2420,81 @@
                                'datatable'                                     
        => $datavalues,
                                'myColumnDefs'                                  
=> $myColumnDefs,
                        
-                               'value_origin'                          => 
$ticket['origin'],
-                               'value_target'                          => 
$ticket['target'],
-                               'value_finnish_date'            => 
$ticket['finnish_date'],
-                               'img_cal'                                       
=> $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
-                               'lang_datetitle'                        => 
lang('Select date'),
-
-                               'link_entity'                           => 
$link_entity,
-                               'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
-
-                               'location_data'                         => 
$location_data,
-
-                               'status_name'                           => 
'values[status]',
+                               'value_origin'                                  
=> $ticket['origin'],
+                               'value_target'                                  
=> $ticket['target'],
+                               'value_finnish_date'                    => 
$ticket['finnish_date'],
+                               'img_cal'                                       
        => $GLOBALS['phpgw']->common->image('phpgwapi','cal'),
+                               'lang_datetitle'                                
=> lang('Select date'),
+
+                               'link_entity'                                   
=> $link_entity,
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+
+                               'location_data'                                 
=> $location_data,
+
+                               'status_name'                                   
=> 'values[status]',
                                'value_status'                                  
=> $ticket['status'],
-                               'status_list'                           => 
$this->bo->get_status_list($ticket['status']),
-
-                               'lang_no_user'                          => 
lang('Select user'),
-                               'lang_user_statustext'                  => 
lang('Select the user the selection belongs to. To do not use a user select NO 
USER'),
-                               'select_user_name'                      => 
'values[assignedto]',
+                               'status_list'                                   
=> $this->bo->get_status_list($ticket['status']),
+
+                               'lang_no_user'                                  
=> lang('Select user'),
+                               'lang_user_statustext'                  => 
lang('Select the user the selection belongs to. To do not use a user select NO 
USER'),
+                               'select_user_name'                              
=> 'values[assignedto]',
                                'value_assignedto_id'                   => 
$ticket['assignedto'],
-                               'user_list'                                     
=> 
$this->bocommon->get_user_list_right2('select',4,$ticket['assignedto'],$this->acl_location),
-
-                               'lang_no_group'                         => 
lang('No group'),
-                               'group_list'                            => 
$this->bocommon->get_group_list('select',$ticket['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
-                               'select_group_name'                     => 
'values[group_id]',
+                               'user_list'                                     
        => 
$this->bocommon->get_user_list_right2('select',4,$ticket['assignedto'],$this->acl_location),
+
+                               'lang_no_group'                                 
=> lang('No group'),
+                               'group_list'                                    
=> 
$this->bocommon->get_group_list('select',$ticket['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
+                               'select_group_name'                             
=> 'values[group_id]',
                                'value_group_id'                                
=> $ticket['group_id'],
 
                                'lang_takeover'                                 
=> (isset($values['assignedto']) && $values['assignedto'] != $this->account)  
|| (!isset($values['assignedto']) || !$values['assignedto']) ? lang('take 
over') : '',
-
-                               'value_priority'                        => 
$ticket['priority'],
-                               'lang_priority_statustext'              => 
lang('Select the priority the selection belongs to.'),
-                               'select_priority_name'                  => 
'values[priority]',
-                               'priority_list'                         => 
$this->bo->get_priority_list($ticket['priority']),
-
-                               'lang_no_cat'                           => 
lang('no category'),
+
+                               'value_priority'                                
=> $ticket['priority'],
+                               'lang_priority_statustext'              => 
lang('Select the priority the selection belongs to.'),
+                               'select_priority_name'                  => 
'values[priority]',
+                               'priority_list'                                 
=> $this->bo->get_priority_list($ticket['priority']),
+
+                               'lang_no_cat'                                   
=> lang('no category'),
                                'value_cat_id'                                  
=> $this->cat_id,
-                               'cat_select'                            => 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id)),
-                               'value_category_name'                   => 
$ticket['category_name'],
-
-                               'form_action'                           => 
$GLOBALS['phpgw']->link('/index.php',$form_link),
-                               'done_action'                           => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uitts.index')),
-                               'value_subject'                         => 
$ticket['subject'],
+                               'cat_select'                                    
=> $cat_select,
+                               'value_category_name'                   => 
$ticket['category_name'],
 
-                               'value_id'                              => '[ 
#'. $id . ' ] - ',
-
-                               'value_details'                         => 
$ticket['details'],
-
+                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$form_link),
+                               'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uitts.index')),
+                               'value_subject'                                 
=> $ticket['subject'],
+
+                               'value_id'                                      
        => '[ #'. $id . ' ] - ',
+
+                               'value_details'                                 
=> $ticket['details'],
+
                                'value_opendate'                                
=> $ticket['entry_date'],
-                               'value_assignedfrom'                    => 
$ticket['user_name'],
+                               'value_assignedfrom'                    => 
$ticket['user_name'],
                                'value_assignedto_name'                 => 
isset($ticket['assignedto_name'])?$ticket['assignedto_name']:'',
-
-                               'additional_notes'                      => 
$additional_notes,
-                               'record_history'                        => 
$record_history,
+
+                               'additional_notes'                              
=> $additional_notes,
+                               'record_history'                                
=> $record_history,
                                'request_link'                                  
=> $request_link,
                                'order_link'                                    
=> $order_link,
                                'add_to_project_link'                   => 
$add_to_project_link,
 
-                               'lang_name'                             => 
lang('name'),
-                               'contact_phone'                         => 
$ticket['contact_phone'],
+                               'lang_name'                                     
        => lang('name'),
+                               'contact_phone'                                 
=> $ticket['contact_phone'],
                                'mailnotification'                              
=> isset($this->bo->config->config_data['mailnotification'])?true:'',
                                'pref_send_mail'                                
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification'])?$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification']:'',
                                'fileupload'                                    
=> 
isset($this->bo->config->config_data['fmttsfileupload'])?$this->bo->config->config_data['fmttsfileupload']:'',
-                               'link_view_file'                                
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+                               'link_view_file'                                
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
                                'link_to_files'                                 
=> 
isset($this->bo->config->config_data['files_url'])?$this->bo->config->config_data['files_url']:'',
-                               'files'                                         
        => isset($ticket['files'])?$ticket['files']:'',
-                               'lang_files'                                    
=> lang('files'),
-                               'lang_filename'                                 
=> lang('Filename'),
-                               'lang_file_action'                              
=> lang('Delete file'),
-                               'lang_view_file_statustext'             => 
lang('click to view file'),
-                               'lang_file_action_statustext'   => lang('Check 
to delete file'),
-                               'lang_upload_file'                              
=> lang('Upload file'),
-                               'lang_file_statustext'                  => 
lang('Select file to upload'),
+                               'files'                                         
        => isset($ticket['files'])?$ticket['files']:'',
+                               'lang_files'                                    
=> lang('files'),
+                               'lang_filename'                                 
=> lang('Filename'),
+                               'lang_file_action'                              
=> lang('Delete file'),
+                               'lang_view_file_statustext'             => 
lang('click to view file'),
+                               'lang_file_action_statustext'   => lang('Check 
to delete file'),
+                               'lang_upload_file'                              
=> lang('Upload file'),
+                               'lang_file_statustext'                  => 
lang('Select file to upload'),
                                'textareacols'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 60,
-                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6
-                       );
+                               'textarearows'                                  
=> 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
+                               'order_cat_list'                                
=> $order_catetory
+                       );
 
                        //---datatable settings--------------------
                        phpgwapi_yui::load_widget('dragdrop');
@@ -2473,41 +2515,40 @@
                        $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'tts.view', 'property' );
                        //-----------------------datatable settings---
                        
+//_debug_array($data);die();
                        
-                       
-                       $appname                                        = 
lang('helpdesk');
-                       $function_msg                                   = 
lang('view ticket detail');
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
-               //      $GLOBALS['phpgw']->xslttpl->pp();
-               }
-
-               function view2()
-               {
-                       if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_READ, 'property'))
-                       {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> '.ticket.external'));
-                       }
-
-                       $bolocation     = CreateObject('property.bolocation');
-
-                       $id = phpgw::get_var('id', 'int', 'GET');
-                       $values = phpgw::get_var('values');
-                       $receipt = '';
-
-                       $GLOBALS['phpgw']->xslttpl->add_file(array('tts'));
-
-                       if(isset($values['save']))
-                       {
-                               if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_ADD, 'property'))
-                               {
-                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>4, 'acl_location'=> '.ticket.external'));
-                               }
-
-                               $values['assignedto'] = 'ignore';
-                               $values['group_id'] = 'ignore';
-                               $values['cat_id'] = 'ignore';
-
+                       $appname                = lang('helpdesk');
+                       $function_msg   = lang('view ticket detail');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
+               }
+
+               function view2()
+               {
+                       if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_READ, 'property'))
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 1, 'acl_location'=> '.ticket.external'));
+                       }
+
+                       $bolocation     = CreateObject('property.bolocation');
+
+                       $id = phpgw::get_var('id', 'int', 'GET');
+                       $values = phpgw::get_var('values');
+                       $receipt = '';
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('tts'));
+
+                       if(isset($values['save']))
+                       {
+                               if(!$this->acl->check('.ticket.external', 
PHPGW_ACL_ADD, 'property'))
+                               {
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>4, 'acl_location'=> '.ticket.external'));
+                               }
+
+                               $values['assignedto'] = 'ignore';
+                               $values['group_id'] = 'ignore';
+                               $values['cat_id'] = 'ignore';
+
                                $so     = CreateObject('property.sotts');
                                $so->acl_location       = '.ticket.external';
                                $receipt = $so->update_ticket($values,$id);
@@ -2515,219 +2556,219 @@
                                {
                                        $receipt = $this->bo->mail_ticket($id, 
$so->fields_updated, $receipt);
                                }
-                       }
-
-                       $ticket = $this->bo->read_single($id);
-
-                       $additional_notes = 
$this->bo->read_additional_notes($id);
-                       $record_history = $this->bo->read_record_history($id);
-
-                       $form_link = array
-                       (
-                               'menuaction'    => 'property.uitts.view2',
-                               'id'            => $id
-                       );
-
-                       $table_header_history[] = array
-                       (
-                               'lang_date'             => lang('Date'),
-                               'lang_user'             => lang('User'),
-                               'lang_action'           => lang('Action'),
-                               'lang_new_value'        => lang('New value')
-                       );
-
-                       $table_header_additional_notes[] = array
-                       (
-                               'lang_count'            => '#',
-                               'lang_date'             => lang('Date'),
-                               'lang_user'             => lang('User'),
-                               'lang_note'             => lang('Note'),
-                       );
-
-//_debug_array($ticket['location_data']);
-
-                       $location_data=$bolocation->initiate_ui_location(array(
-                                               'values'        => 
$ticket['location_data'],
-                                               'type_id'       => 
count(explode('-',$ticket['location_data']['location_code'])),
-                                               'no_link'       => false, // 
disable lookup links for location type less than type_id
-                                               'tenant'        => 
(isset($ticket['location_data']['tenant_id'])?$ticket['location_data']['tenant_id']:''),
-                                               'lookup_type'   => 'view',
-                                               'lookup_entity' => 
$this->bocommon->get_lookup_entity('ticket'),
-                                               'entity_data'   => 
(isset($ticket['p'])?$ticket['p']:'')
-                                               ));
-
-
-                       if($ticket['contact_phone'])
-                       {
-                               for 
($i=0;$i<count($location_data['location']);$i++)
-                               {
-                                       
if($location_data['location'][$i]['input_name'] == 'contact_phone')
-                                       {
-                                               
unset($location_data['location'][$i]['value']);
-                                       }
-                               }
-                       }
-
-                       if ($ticket['cat_id'])
-                       {
-                               $this->cat_id = $ticket['cat_id'];
-                       }
-
-
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $sep = '/';
-                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
-                       $dlarr[strpos($dateformat,'m')] = 'MM';
-                       $dlarr[strpos($dateformat,'d')] = 'DD';
-                       ksort($dlarr);
-
-                       $dateformat= (implode($sep,$dlarr));
-
-                       switch(substr($dateformat,0,1))
-                       {
-                               case 'M':
-                                       $dateformat_validate= 
"javascript:vDateType='1'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
-                                       break;
-                               case 'y':
-                                       
$dateformat_validate="javascript:vDateType='2'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
-                                       break;
-                               case 'D':
-                                       
$dateformat_validate="javascript:vDateType='3'";
-                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
-                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
-                                       break;
-                       }
-
-                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
-                       if (isset($ticket['origin']) AND 
is_array($ticket['origin']))
-                       {
-                               for ($i=0;$i<count($ticket['origin']);$i++)
-                               {
-                                       
$ticket['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$ticket['origin'][$i]['link']);
-
-                                       
if(substr($ticket['origin'][$i]['type'],0,6)=='entity')
-                                       {
-                                               $type           = 
explode("_",$ticket['origin'][$i]['type']);
-                                               $entity_id      = $type[1];
-                                               $cat_id         = $type[2];
-
-                                               if(!is_object($boadmin_entity))
-                                               {
-                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
-                                               }
-                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
-                                               $ticket['origin'][$i]['descr'] 
= $entity_category['name'];
-                                       }
-                                       else
-                                       {
-                                               $ticket['origin'][$i]['descr']= 
lang($ticket['origin'][$i]['type']);
-                                       }
-                               }
-                       }
-
-                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
-
-                       $data = array
-                       (
-                               'value_origin'                                  
=> (isset($ticket['origin'])?$ticket['origin']:''),
-                               'lang_dateformat'                               
=> strtolower($dateformat),
-                               'dateformat_validate'                   => 
$dateformat_validate,
-                               'onKeyUp'                                       
        => $onKeyUp,
-                               'onBlur'                                        
        => $onBlur,
-                               'lang_finnish_date'                             
=> lang('finnish date'),
-                               'value_finnish_date'                    => 
$ticket['finnish_date'],
-
-                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-
-                               'location_data'                                 
=> $location_data,
-                               'lang_location_code'                    => 
lang('Location Code'),
-
-                               'lang_ticket'                                   
=> lang('Ticket'),
-                               'table_header_additional_notes' => 
$table_header_additional_notes,
-                               'table_header_history'                  => 
$table_header_history,
-                               'lang_status'                                   
=> lang('Status'),
-                               'status_name'                                   
=> 'values[status]',
-                               'status_list'                                   
=> $this->bo->get_status_list($ticket['status']),
-                               'lang_status_statustext'                => 
lang('Set the status of the ticket'),
-
-                               'lang_no_user'                                  
=> lang('Select user'),
-                               'lang_user_statustext'                  => 
lang('Select the user the selection belongs to. To do not use a user select NO 
USER'),
-                               'select_user_name'                              
=> 'values[assignedto]',
-                               'user_list'                                     
        => 
$this->bocommon->get_user_list_right2('select',4,$ticket['assignedto'],$this->acl_location),
-
-                               'lang_group'                                    
=> lang('Group'),
-                               'lang_no_group'                                 
=> lang('No group'),
-                               'group_list'                                    
=> 
$this->bocommon->get_group_list('select',$ticket['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
-                               'select_group_name'                             
=> 'values[group_id]',
-
-                               'lang_priority'                                 
=> lang('Priority'),
-                               'value_priority'                                
=> $ticket['priority'],
-                               'lang_priority_statustext'              => 
lang('Select the priority the selection belongs to.'),
-                               'select_priority_name'                  => 
'values[priority]',
-                               'priority_list'                                 
=> $this->bo->get_priority_list($ticket['priority']),
-
-                               'lang_no_cat'                                   
=> lang('no category'),
-                               'cat_select'                            => 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id)),
-                               'lang_category'                                 
=> lang('category'),
-                               'value_category_name'                   => 
$ticket['category_name'],
-
-                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$form_link),
+                       }
+
+                       $ticket = $this->bo->read_single($id);
+
+                       $additional_notes = 
$this->bo->read_additional_notes($id);
+                       $record_history = $this->bo->read_record_history($id);
+
+                       $form_link = array
+                       (
+                               'menuaction'    => 'property.uitts.view2',
+                               'id'            => $id
+                       );
+
+                       $table_header_history[] = array
+                       (
+                               'lang_date'             => lang('Date'),
+                               'lang_user'             => lang('User'),
+                               'lang_action'           => lang('Action'),
+                               'lang_new_value'        => lang('New value')
+                       );
+
+                       $table_header_additional_notes[] = array
+                       (
+                               'lang_count'            => '#',
+                               'lang_date'             => lang('Date'),
+                               'lang_user'             => lang('User'),
+                               'lang_note'             => lang('Note'),
+                       );
+
+//_debug_array($ticket['location_data']);
+
+                       $location_data=$bolocation->initiate_ui_location(array(
+                                               'values'        => 
$ticket['location_data'],
+                                               'type_id'       => 
count(explode('-',$ticket['location_data']['location_code'])),
+                                               'no_link'       => false, // 
disable lookup links for location type less than type_id
+                                               'tenant'        => 
(isset($ticket['location_data']['tenant_id'])?$ticket['location_data']['tenant_id']:''),
+                                               'lookup_type'   => 'view',
+                                               'lookup_entity' => 
$this->bocommon->get_lookup_entity('ticket'),
+                                               'entity_data'   => 
(isset($ticket['p'])?$ticket['p']:'')
+                                               ));
+
+
+                       if($ticket['contact_phone'])
+                       {
+                               for 
($i=0;$i<count($location_data['location']);$i++)
+                               {
+                                       
if($location_data['location'][$i]['input_name'] == 'contact_phone')
+                                       {
+                                               
unset($location_data['location'][$i]['value']);
+                                       }
+                               }
+                       }
+
+                       if ($ticket['cat_id'])
+                       {
+                               $this->cat_id = $ticket['cat_id'];
+                       }
+
+
+                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                       $sep = '/';
+                       $dlarr[strpos($dateformat,'y')] = 'yyyy';
+                       $dlarr[strpos($dateformat,'m')] = 'MM';
+                       $dlarr[strpos($dateformat,'d')] = 'DD';
+                       ksort($dlarr);
+
+                       $dateformat= (implode($sep,$dlarr));
+
+                       switch(substr($dateformat,0,1))
+                       {
+                               case 'M':
+                                       $dateformat_validate= 
"javascript:vDateType='1'";
+                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'1')";
+                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'1')";
+                                       break;
+                               case 'y':
+                                       
$dateformat_validate="javascript:vDateType='2'";
+                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'2')";
+                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'2')";
+                                       break;
+                               case 'D':
+                                       
$dateformat_validate="javascript:vDateType='3'";
+                                       $onKeyUp        = 
"DateFormat(this,this.value,event,false,'3')";
+                                       $onBlur         = 
"DateFormat(this,this.value,event,true,'3')";
+                                       break;
+                       }
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       if (isset($ticket['origin']) AND 
is_array($ticket['origin']))
+                       {
+                               for ($i=0;$i<count($ticket['origin']);$i++)
+                               {
+                                       
$ticket['origin'][$i]['link']=$GLOBALS['phpgw']->link('/index.php',$ticket['origin'][$i]['link']);
+
+                                       
if(substr($ticket['origin'][$i]['type'],0,6)=='entity')
+                                       {
+                                               $type           = 
explode("_",$ticket['origin'][$i]['type']);
+                                               $entity_id      = $type[1];
+                                               $cat_id         = $type[2];
+
+                                               if(!is_object($boadmin_entity))
+                                               {
+                                                       $boadmin_entity = 
CreateObject('property.boadmin_entity');
+                                               }
+                                               $entity_category = 
$boadmin_entity->read_single_category($entity_id,$cat_id);
+                                               $ticket['origin'][$i]['descr'] 
= $entity_category['name'];
+                                       }
+                                       else
+                                       {
+                                               $ticket['origin'][$i]['descr']= 
lang($ticket['origin'][$i]['type']);
+                                       }
+                               }
+                       }
+
+                       
$GLOBALS['phpgw']->js->validate_file('dateformat','dateformat','property');
+
+                       $data = array
+                       (
+                               'value_origin'                                  
=> (isset($ticket['origin'])?$ticket['origin']:''),
+                               'lang_dateformat'                               
=> strtolower($dateformat),
+                               'dateformat_validate'                   => 
$dateformat_validate,
+                               'onKeyUp'                                       
        => $onKeyUp,
+                               'onBlur'                                        
        => $onBlur,
+                               'lang_finnish_date'                             
=> lang('finnish date'),
+                               'value_finnish_date'                    => 
$ticket['finnish_date'],
+
+                               'msgbox_data'                                   
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+
+                               'location_data'                                 
=> $location_data,
+                               'lang_location_code'                    => 
lang('Location Code'),
+
+                               'lang_ticket'                                   
=> lang('Ticket'),
+                               'table_header_additional_notes' => 
$table_header_additional_notes,
+                               'table_header_history'                  => 
$table_header_history,
+                               'lang_status'                                   
=> lang('Status'),
+                               'status_name'                                   
=> 'values[status]',
+                               'status_list'                                   
=> $this->bo->get_status_list($ticket['status']),
+                               'lang_status_statustext'                => 
lang('Set the status of the ticket'),
+
+                               'lang_no_user'                                  
=> lang('Select user'),
+                               'lang_user_statustext'                  => 
lang('Select the user the selection belongs to. To do not use a user select NO 
USER'),
+                               'select_user_name'                              
=> 'values[assignedto]',
+                               'user_list'                                     
        => 
$this->bocommon->get_user_list_right2('select',4,$ticket['assignedto'],$this->acl_location),
+
+                               'lang_group'                                    
=> lang('Group'),
+                               'lang_no_group'                                 
=> lang('No group'),
+                               'group_list'                                    
=> 
$this->bocommon->get_group_list('select',$ticket['group_id'],$start=-1,$sort='ASC',$order='account_firstname',$query='',$offset=-1),
+                               'select_group_name'                             
=> 'values[group_id]',
+
+                               'lang_priority'                                 
=> lang('Priority'),
+                               'value_priority'                                
=> $ticket['priority'],
+                               'lang_priority_statustext'              => 
lang('Select the priority the selection belongs to.'),
+                               'select_priority_name'                  => 
'values[priority]',
+                               'priority_list'                                 
=> $this->bo->get_priority_list($ticket['priority']),
+
+                               'lang_no_cat'                                   
=> lang('no category'),
+                               'cat_select'                            => 
$this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id)),
+                               'lang_category'                                 
=> lang('category'),
+                               'value_category_name'                   => 
$ticket['category_name'],
+
+                               'form_action'                                   
=> $GLOBALS['phpgw']->link('/index.php',$form_link),
                                'done_action'                                   
=> 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uitts.index')),
-                               'value_subject'                                 
=> $ticket['subject'],
-                               'lang_subject_statustext'               => 
lang('update subject'),
-                               'value_id'                                      
        => '[ #'. $id . ' ] - ',
-
-                               'lang_details'                                  
=> lang('Details'),
-                               'value_details'                                 
=> $ticket['details'],
-                               'lang_details_statustext'               => 
lang('Add new comments'),
-
-                               'lang_additional_notes'                 => 
lang('Additional notes'),
-
-                               'lang_new_note'                                 
=> lang('New Note'),
-                               'lang_opendate'                                 
=> lang('Open Date'),
+                               'value_subject'                                 
=> $ticket['subject'],
+                               'lang_subject_statustext'               => 
lang('update subject'),
+                               'value_id'                                      
        => '[ #'. $id . ' ] - ',
+
+                               'lang_details'                                  
=> lang('Details'),
+                               'value_details'                                 
=> $ticket['details'],
+                               'lang_details_statustext'               => 
lang('Add new comments'),
+
+                               'lang_additional_notes'                 => 
lang('Additional notes'),
+
+                               'lang_new_note'                                 
=> lang('New Note'),
+                               'lang_opendate'                                 
=> lang('Open Date'),
                                'value_opendate'                                
=> $ticket['entry_date'],
-
-                               'lang_assignedfrom'                             
=> lang('Assigned from'),
-                               'value_assignedfrom'                    => 
$ticket['user_name'],
-                               'lang_assignedto'                               
=> lang('Assigned to'),
+
+                               'lang_assignedfrom'                             
=> lang('Assigned from'),
+                               'value_assignedfrom'                    => 
$ticket['user_name'],
+                               'lang_assignedto'                               
=> lang('Assigned to'),
                                'value_assignedto_name'                         
=> (isset($ticket['assignedto_name'])?$ticket['assignedto_name']:''),
+
+                               'lang_no_additional_notes'              => 
lang('No additional notes'),
+                               'lang_history'                                  
=> lang('History'),
+                               'lang_no_history'                               
=> lang('No history for this record'),
+                               'additional_notes'                              
=> $additional_notes,
+                               'record_history'                                
=> $record_history,
+
+                               'lang_save'                                     
        => lang('save'),
+                               'lang_name'                                     
        => lang('name'),
+                               'lang_done'                                     
        => lang('done'),
+                               'lang_contact_phone'                    => 
lang('Contact phone'),
+                               'contact_phone'                                 
=> $ticket['contact_phone'],
+                       );
+//_debug_array($data);
+                       $appname                = lang('helpdesk');
+                       $function_msg   = lang('view ticket detail');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view2' => $data));
+               }
+
+               function view_file()
+               {
+                       if(!$this->acl_read)
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $bofiles        = CreateObject('property.bofiles');
+                       $bofiles->view_file('fmticket');
+               }
 
-                               'lang_no_additional_notes'              => 
lang('No additional notes'),
-                               'lang_history'                                  
=> lang('History'),
-                               'lang_no_history'                               
=> lang('No history for this record'),
-                               'additional_notes'                              
=> $additional_notes,
-                               'record_history'                                
=> $record_history,
-
-                               'lang_save'                                     
        => lang('save'),
-                               'lang_name'                                     
        => lang('name'),
-                               'lang_done'                                     
        => lang('done'),
-                               'lang_contact_phone'                    => 
lang('Contact phone'),
-                               'contact_phone'                                 
=> $ticket['contact_phone'],
-                       );
-//_debug_array($data);
-                       $appname                = lang('helpdesk');
-                       $function_msg   = lang('view ticket detail');
-
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view2' => $data));
-               }
-
-               function view_file()
-               {
-                       if(!$this->acl_read)
-                       {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
-                       }
-
-                       $bofiles        = CreateObject('property.bofiles');
-                       $bofiles->view_file('fmticket');
-               }
-
                protected function _generate_tabs($history='')
                {
                        if(!$tab = phpgw::get_var('tab'))
@@ -2748,6 +2789,6 @@
                        phpgwapi_yui::tabview_setup('ticket_tabview');
 
                        return  phpgwapi_yui::tabview_generate($tabs, $tab);
-       }
+               }
 
        }

Modified: people/sigurdne/modules/property/trunk/inc/hook_home.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/hook_home.inc.php        
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/hook_home.inc.php        
2010-01-22 09:56:10 UTC (rev 20982)
@@ -277,14 +277,13 @@
                unset($default_status);
        }
 
-       // ticket initiated by user
        if ( isset($prefs['property']['mainscreen_show_new_updated_tts_4'])
                && $prefs['property']['mainscreen_show_new_updated_tts_4'] == 
'yes')
        {
 
                $default_status         = 
isset($prefs['property']['tts_status_4']) ? $prefs['property']['tts_status_4'] 
: '';
                $tts = CreateObject('property.sotts');
-               $tickets = $tts->read(array('owner_id' => $accound_id, 
'status_id' => $default_status));
+               $tickets = $tts->read(array('user_id' => $accound_id, 
'status_id' => $default_status));
                $total_records = $tts->total_records;
 
                $portalbox = CreateObject('phpgwapi.listbox', array

Modified: people/sigurdne/modules/property/trunk/inc/hook_settings.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/inc/hook_settings.inc.php    
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/inc/hook_settings.inc.php    
2010-01-22 09:56:10 UTC (rev 20982)
@@ -75,15 +75,15 @@
        create_select_box('Default ticket 
status','tts_status',$_status_tts,'The default status when entering the 
helpdesk and mainscreen');
        create_input_box('Custom title on main screen 
tickets','mainscreen_tts_title');
 
-       create_select_box('show new/updated tickets on main screen 
2','mainscreen_show_new_updated_tts_2',$yes_and_no,'Link to tickets you are 
assigned to');
+       create_select_box('show updated tickets on main screen 
2','mainscreen_show_new_updated_tts_2',$yes_and_no,'Link to tickets you are 
assigned to');
        create_select_box('Default ticket status 
2','tts_status_2',$_status_tts,'The default status when entering the helpdesk 
and mainscreen');
        create_input_box('Custom title on main screen 
tickets','mainscreen_tts_title_2');
 
-       create_select_box('show new/updated tickets on main screen 
3','mainscreen_show_new_updated_tts_3',$yes_and_no,'Link to tickets you are 
assigned to');
+       create_select_box('show updated tickets on main screen 
3','mainscreen_show_new_updated_tts_3',$yes_and_no,'Link to tickets you are 
assigned to');
        create_select_box('Default ticket status 
3','tts_status_3',$_status_tts,'The default status when entering the helpdesk 
and mainscreen');
        create_input_box('Custom title on main screen 
tickets','mainscreen_tts_title_3');
 
-       create_select_box('show tickets on main screen initiated by 
user','mainscreen_show_new_updated_tts_4',$yes_and_no,'Link to tickets you have 
started');
+       create_select_box('show updated tickets on main screen 
4','mainscreen_show_new_updated_tts_4',$yes_and_no,'Link to tickets you are 
assigned to');
        create_select_box('Default ticket status 
4','tts_status_4',$_status_tts,'The default status when entering the helpdesk 
and mainscreen');
        create_input_box('Custom title on main screen 
tickets','mainscreen_tts_title_4');
 
@@ -133,20 +133,24 @@
        create_select_box('Default assign to 
TTS','assigntodefault',$_accounts,'The default user to assign a ticket in 
Helpdesk-submodule');
 
        // Choose the correct priority to display
-       $priority_comment[1]  = ' - ' . lang('Lowest');
-       $priority_comment[5]  = ' - ' . lang('Medium');
-       $priority_comment[10] = ' - ' . lang('Highest');
-       for ($i=1; $i<=10; $i++)
+       $config = CreateObject('phpgwapi.config','property');
+       $config->read();
+       $priority = array();
+       $prioritylevels = isset($config->config_data['prioritylevels']) && 
$config->config_data['prioritylevels'] ? $config->config_data['prioritylevels'] 
: 3;
+       $priority_comment[1]  = ' - ' . lang('Highest');
+       $priority_comment[$prioritylevels] = ' - ' . lang('Lowest');
+       for ($i=1; $i<=$prioritylevels; $i++)
        {
-               $priority[$i] = $i . $priority_comment[$i];
+               $priority[$i] = $i . isset($priority_comment[$i]) ? 
$priority_comment[$i] : '';
        }
 
 
+       $degree = array();
        // Choose the correct degree to display
-               $degree_comment[0]=' - '.lang('None');
-               $degree_comment[1]=' - '.lang('Minor');
-               $degree_comment[2]=' - '.lang('Medium');
-               $degree_comment[3]=' - '.lang('Serious');
+       $degree_comment[0]=' - '.lang('None');
+       $degree_comment[1]=' - '.lang('Minor');
+       $degree_comment[2]=' - '.lang('Medium');
+       $degree_comment[3]=' - '.lang('Serious');
        for ($i=0; $i<=3; $i++)
        {
                $degree[$i] = $i . $degree_comment[$i];
@@ -234,7 +238,7 @@
 
        create_select_box('Workorder Approval 
From','approval_from',$_accounts,'If you need approval from your supervisor for 
projects/workorders');
 
-       if(!$email_org)
+//     if(!$email_org)
        {
                create_input_box('Your Email','email','Insert your email 
address');
        }

Modified: people/sigurdne/modules/property/trunk/js/yahoo/location.index.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/location.index.js   
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/js/yahoo/location.index.js   
2010-01-22 09:56:10 UTC (rev 20982)
@@ -40,6 +40,19 @@
        {
            if(flag_particular_setting=='init')
            {
+                       //category
+                       index = 
locate_in_array_options(0,"value",path_values.cat_id);
+                       if(index)
+                       {
+                               oMenuButton_0.set("label", ("<em>" + 
array_options[0][index][1] + "</em>"));
+                       }
+                       //district
+                       index = 
locate_in_array_options(1,"value",path_values.district_id);
+                       if(index)
+                       {
+                               oMenuButton_1.set("label", ("<em>" + 
array_options[1][index][1] + "</em>"));
+                       }
+
                        YAHOO.util.Dom.get(textImput[0].id).focus();
 //                     oMenuButton_0.focus();
            }

Modified: people/sigurdne/modules/property/trunk/js/yahoo/property.js
===================================================================
--- people/sigurdne/modules/property/trunk/js/yahoo/property.js 2010-01-22 
09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/js/yahoo/property.js 2010-01-22 
09:56:10 UTC (rev 20982)
@@ -9,7 +9,7 @@
        var showTimer,hideTimer;
        var tt = new YAHOO.widget.Tooltip("myTooltip");
        var lightbox;
-       var maxRowsPerPage = 1000;
+       var maxRowsPerPage = 10000;
        var myLoading;
        var message_delete = "";
 

Modified: people/sigurdne/modules/property/trunk/setup/phpgw_no.lang
===================================================================
--- people/sigurdne/modules/property/trunk/setup/phpgw_no.lang  2010-01-22 
09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/setup/phpgw_no.lang  2010-01-22 
09:56:10 UTC (rev 20982)
@@ -26,6 +26,7 @@
 activity num   property        no      Aktivitet num
 actor  property        no      Aktør
 actual cost    property        no      Faktisk kostnad
+actual cost changed    property        no      Faktisk kostnad er endret
 actual cost - paid so far      property        no      Faktisk betalt - pr dd
 add a apartment        property        no      Legg til leilighet
 add a attrib   property        no      Legg til en attibutt
@@ -401,6 +402,7 @@
 delete entity type     property        no      Slett entitet-type
 delete entrance        property        no      slett inngang
 delete equipment       property        no      slett utstyr
+delete failed  property        no      Sletting feilet
 delete file    property        no      Slett fil
 delete investment history element      property        no      slett historie 
post for investering
 delete last entry      property        no      slett siste post
@@ -636,6 +638,7 @@
 enter a statustext for the inputfield in forms property        no      Angi en 
statustekst for inputfeltet
 enter a value for the labour cost      property        no      angi arbeids 
kostnader
 enter a value for the material cost    property        no      angi 
materialkostnader
+Enter actual cost      property        no      Angi faktisk kostnad
 enter building id      property        no      angi bygnings ID
 enter document name    property        no      angi dokument ID
 enter document title   property        no      angi dokument tittel
@@ -845,6 +848,7 @@
 is there a demand from the authorities to correct this condition?      
property        no      Finnes det offentlige pålegg fo å rette opp tilstanden?
 items  property        no      Detaljer
 janitor        property        no      Oppsynsmann
+jasper reports property        no      JasperReports
 key deliver location   property        no      Sted for å levere nøkkel
 key fetch location     property        no      Sted for å hente nøkkel
 key location   property        no      Nøkkel lokalisert
@@ -1056,6 +1060,7 @@
 open view in new window        property        no      Åpne visning i nytt 
vindu
 order  property        no      bestill
 order id       property        no      OrdreNr
+order_id       property        no      OrdreNr
 order # that initiated the invoice     property        no      Order nr som 
referanse for fakturaen
 order text     property        no      Bestillingstekst
 other branch   property        no      Andre fag
@@ -1597,6 +1602,7 @@
 this vendor is already registered for this activity    property        no      
Denne leverandøren er allerede registert for denne aktiviteten
 ticket property        no      melding
 .ticket        property        no      Melding
+ticket %1 has been deleted     property        no      Melding %1 er slettet
 ticket categories      property        no      Meldinger kategorier
 ticket has been saved  property        no      Melding er lagret
 ticket has been updated        property        no      melding er oppdatert

Modified: people/sigurdne/modules/property/trunk/setup/setup.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/setup.inc.php  2010-01-22 
09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/setup/setup.inc.php  2010-01-22 
09:56:10 UTC (rev 20982)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']         = 'property';
-       $setup_info['property']['version']              = '0.9.17.576';
+       $setup_info['property']['version']              = '0.9.17.578';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']       = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: people/sigurdne/modules/property/trunk/setup/tables_current.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/tables_current.inc.php 
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/setup/tables_current.inc.php 
2010-01-22 09:56:10 UTC (rev 20982)
@@ -831,6 +831,7 @@
                                'approved' => array('type' => 'int','precision' 
=> '2','nullable' => True),
                                'in_progress' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'delivered' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'sorting' => array('type' => 'int','precision' 
=> '4','nullable' => True)
                        ),
                        'pk' => array('id'),
                        'ix' => array(),
@@ -873,7 +874,8 @@
                                'b_account_id' => array('type' => 
'varchar','precision' => '20','nullable' => True),
                                'ecodimb' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
                                'budget' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'actual_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00')
+                               'actual_cost' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'order_cat_id' => array('type' => 
'int','precision' => '4','nullable' => True)
                        ),
                        'pk' => array('id'),
                        'ix' => array(),

Modified: people/sigurdne/modules/property/trunk/setup/tables_update.inc.php
===================================================================
--- people/sigurdne/modules/property/trunk/setup/tables_update.inc.php  
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/setup/tables_update.inc.php  
2010-01-22 09:56:10 UTC (rev 20982)
@@ -3856,7 +3856,7 @@
 
        /**
        * Update property version from 0.9.17.575 to 0.9.17.576
-       * Add variants of closed and approved-status for tickets
+       * Add contact_email to tickets
        * 
        */
 
@@ -3874,3 +3874,45 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.576 to 0.9.17.577
+       * Add sorting to ticket status
+       * 
+       */
+
+       $test[] = '0.9.17.576';
+       function property_upgrade0_9_17_576()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_status','sorting',array('type'
 => 'int','precision' => 4,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.577';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+
+       /**
+       * Update property version from 0.9.17.576 to 0.9.17.577
+       * Add order categories to ticket ad hoc orders
+       * 
+       */
+
+       $test[] = '0.9.17.577';
+       function property_upgrade0_9_17_577()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_tts_tickets','order_cat_id',array('type'
 => 'int','precision' => 4,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.578';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+

Modified: people/sigurdne/modules/property/trunk/templates/base/category.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/category.xsl  
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/templates/base/category.xsl  
2010-01-22 09:56:10 UTC (rev 20982)
@@ -81,7 +81,7 @@
                                                                <xsl:value-of 
select="value"/>          
                                                        </textarea>
                                                </xsl:when>
-                                               <xsl:when test="type='varchar'">
+                                               <xsl:when test="type='varchar' 
or type='integer'">
                                                        <input type="text" 
name="values[{name}]" value="{value}" onMouseout="window.status='';return 
true;">
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="descr"/>

Modified: people/sigurdne/modules/property/trunk/templates/base/config.tpl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/config.tpl    
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/templates/base/config.tpl    
2010-01-22 09:56:10 UTC (rev 20982)
@@ -111,6 +111,11 @@
     <td colspan="2">&nbsp;<b>{lang_TTS}::{lang_settings}</b></td>
    </tr>
    <tr class="row_on">
+    <td>{lang_Open_translates_to}: <br>
+       {lang_default}: {lang_Open}</td>
+    <td><input name="newsettings[tts_lang_open]" 
value="{value_tts_lang_open}"></td>
+   </tr>
+   <tr class="row_on">
     <td valign = 'top'>{lang_TTS_simplified_group}:</td>
     <td>
        <!--to be able to blank the setting - need an empty value-->

Modified: people/sigurdne/modules/property/trunk/templates/base/tts.xsl
===================================================================
--- people/sigurdne/modules/property/trunk/templates/base/tts.xsl       
2010-01-22 09:52:44 UTC (rev 20981)
+++ people/sigurdne/modules/property/trunk/templates/base/tts.xsl       
2010-01-22 09:56:10 UTC (rev 20982)
@@ -1097,6 +1097,20 @@
                                                <xsl:call-template 
name="vendor_form"/>
                                                <xsl:call-template 
name="ecodimb_form"/>
                                                <xsl:call-template 
name="b_account_form"/>
+                                               <tr>
+                                                       <td>
+                                                               <xsl:value-of 
select="php:function('lang', 'order category')" />
+                                                       </td>
+                                                       <td>
+                                                               <xsl:variable 
name="lang_cat_statustext"><xsl:value-of select="php:function('lang', 'select 
order category')" /></xsl:variable>
+                                                                       <select 
name="values[order_cat_id]"  title="{$lang_cat_statustext}">
+                                                                               
<option value="0">
+                                                                               
        <xsl:value-of select="php:function('lang', 'select order category')" />
+                                                                               
</option>
+                                                                               
        <xsl:apply-templates select="order_cat_list/cat_list"/>
+                                                                       
</select>
+                                                       </td>
+                                               </tr>
 
                                                <tr>
                                                        <td valign="top">
@@ -1116,7 +1130,12 @@
                                                    <xsl:value-of 
select="php:function('lang', 'actual cost')" />
                                                        </td>
                                                        <td>
-                                                               <xsl:value-of 
select="value_actual_cost"/>
+                                                               <input 
type="text" name="values[actual_cost]" value="{value_actual_cost}">
+                                                                       
<xsl:attribute name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'Enter actual cost')" />
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                       <!--<xsl:value-of 
select="value_actual_cost"/> -->
                                                                <xsl:text> 
</xsl:text> [ <xsl:value-of select="currency"/> ]
                                                        </td>
                                                </tr>
@@ -1744,4 +1763,3 @@
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
-





reply via email to

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