[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.uitts.php, 1.1.1.3
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.uitts.php, 1.1.1.3 |
Date: |
Fri, 21 May 2004 16:57:03 -0000 |
Update of /property
Modified Files:
Branch:
class.uitts.php
date: 2004/04/23 21:26:42; author: sigurdne; state: Exp; lines: +902 -902
Log Message:
no message
=====================================================================
Index: property/class.uitts.php
diff -u property/class.uitts.php:1.1.1.2 property/class.uitts.php:1.1.1.3
--- property/class.uitts.php:1.1.1.2 Fri Apr 23 20:27:12 2004
+++ property/class.uitts.php Fri Apr 23 21:26:42 2004
@@ -1,902 +1,902 @@
-<?php
-
/**************************************************************************\
- * phpGroupWare - property
*
- * http://www.phpgroupware.org
*
- *
*
- * Facilities Management
*
- * Written by Sigurd Nes [sigurdne at online.no]
*
- *
------------------------------------------------------------------------ *
- * Copyright 2000 - 2003 Free Software Foundation, Inc
*
- * This program is part of the GNU project, see http://www.gnu.org/
*
- *
------------------------------------------------------------------------ *
- * This program 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.
*
-
\**************************************************************************/
-
- class property_uitts
- {
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'add' => True,
- 'delete' => True,
- 'excel' => True
- );
-
- function property_uitts()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
-
- $this->bo =
CreateObject($this->currentapp.'_botts',True);
- $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
- $this->menu =
CreateObject($this->currentapp.'_menu');
- $this->fm_session =
CreateObject($this->currentapp.'_session');
-
- $this->acl2 =
$GLOBALS['phpgw']->acl;
- $this->acl2_location = '.ticket';
- $this->acl_read =
$this->acl2->check('.ticket',1);
- $this->acl_add =
$this->acl2->check('.ticket',2);
- $this->acl_edit =
$this->acl2->check('.ticket',4);
- $this->acl_delete =
$this->acl2->check('.ticket',8);
- $this->acl_manage =
$this->acl2->check('.ticket',16);
-
- $this->start =
$this->bo->start;
- $this->query =
$this->bo->query;
- $this->sort =
$this->bo->sort;
- $this->order =
$this->bo->order;
- $this->filter =
$this->bo->filter;
- $this->cat_id =
$this->bo->cat_id;
- $this->district_id =
$this->bo->district_id;
- $this->allrows =
$this->bo->allrows;
-
- $this->menu->sub ='ticket';
- }
-
- function save_sessiondata()
- {
- $data = array
- (
- 'start' => $this->start,
- 'query' => $this->query,
- 'sort' => $this->sort,
- 'order' => $this->order,
- 'filter' => $this->filter,
- 'cat_id' => $this->cat_id,
- 'district_id' => $this->district_id,
- 'allrows' => $this->allrows
- );
- $this->bo->save_sessiondata($data);
- }
-
-
- function excel()
- {
-
- $list = $this->bo->read();
-
- if (isset($list) AND is_array($list))
- {
- $i=0;
- foreach($list as $entry)
- {
- 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'])
- {
-
$list[$i]['date_' . $j]=$date['date_info'][0]['entry_date'];
-
$name_temp['date_' . $j]=True;
-
$descr_temp[$date['date_info'][0]['descr']]=True;
- }
- $j++;
- }
- }
- $i++;
- }
- }
-//html_print_r($descr_temp);
-
- $name = array('id',
- 'category',
- 'location_code',
- 'address',
- 'user',
- 'assignedto',
- 'timestampopened'
- );
-
- 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'));
-
-//html_print_r($descr);
-
-
-
- $this->bocommon->excel($list,$name,$descr);
- }
-
-
- function index()
- {
- if(!$this->acl_read)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $this->bocommon->xsl_add_file(array('tts',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
-
- $second_display =
get_var('second_display',array('POST','GET'));
-
- $default_category =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['default_district'];
-
- if ($default_category && !$second_display &&
!$this->district_id)
- {
- $this->bo->district_id = $default_category;
- $this->district_id =
$default_category;
- }
-
- $bgcolor['1'] = '#dadada';
- $bgcolor['2'] = '#dad0d0';
- $bgcolor['3'] = '#dacaca';
- $bgcolor['4'] = '#dac0c0';
- $bgcolor['5'] = '#dababa';
- $bgcolor['6'] = '#dab0b0';
- $bgcolor['7'] = '#daaaaa';
- $bgcolor['8'] = '#da9090';
- $bgcolor['9'] = '#da8a8a';
- $bgcolor['10'] = '#da7a7a';
-
-
- $links = $this->menu->links();
-
- $ticket_list = $this->bo->read();
-
- $uicols=$this->bo->uicols;
-
-//html_print_r($uicols);
-//html_print_r($ticket_list);
- while (is_array($ticket_list) && list(,$ticket) =
each($ticket_list))
- {
- $content[] = array
- (
- 'id'
=> $ticket['id'],
- 'bgcolor'
=> $bgcolor[$ticket['priority']],
- 'new_ticket'
=> $ticket['new_ticket'],
- 'priostr'
=> str_repeat("||", $ticket['priority']),
- 'first'
=> $ticket['category'],
- 'location_code'
=> $ticket['location_code'],
- 'address'
=> $ticket['address'],
- 'date'
=> $ticket['timestampopened'],
- 'finnish_date'
=> $ticket['finnish_date'],
- 'delay'
=> $ticket['delay'],
- 'user'
=> $ticket['user'],
- 'assignedto'
=> $ticket['assignedto'],
- 'child_date'
=> $ticket['child_date'],
- 'link_view'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitts.view&id='
. $ticket['id']),
- 'lang_view_statustext' =>
lang('view the ticket'),
- 'text_view'
=> lang('view'),
- );
- }
-
- $table_header[] = array
- (
- 'sort_priority' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'priority',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows)
-
)),
-
- 'lang_priority' => lang('Priority'),
- 'lang_priority_statustext' =>
lang('Sort the tickets by their priority'),
-
- 'sort_id' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'fm_tts_tickets.id',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows)
-
)),
-
- 'lang_id' => lang('ID'),
- 'lang_id_statustext' => lang('Sort
the tickets by their ID'),
-
- 'lang_subject' =>
lang('Category'),
- '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->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'assignedto',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows)
-
)),
- 'lang_assigned_to' =>
lang('Assigned to'),
- 'sort_opened_by' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'user',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows)
-
)),
- 'sort_date' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'fm_tts_tickets.entry_date',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows)
-
)),
- 'sort_finnish_date' =>
$this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'finnish_date',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
-
'cat_id'
=>$this->cat_id,
-
'filter'
=>$this->filter,
-
'district_id' =>
$this->district_id,
-
'query'
=>$this->query,
-
'second_display'
=> true,
-
'allrows'=>$this->allrows)
-
)),
- 'lang_finnish_date' =>
lang('finnish date'),
- 'lang_delay' =>
lang('delay'),
- 'lang_finnish_statustext'=> lang('presumed
finnish date'),
- 'lang_opened_by' => lang('Opened
by')
- );
-
- 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' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitts.add')
- );
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uitts.index',
- 'second_display' => true,
- 'sort' =>$this->sort,
- 'order' =>$this->order,
- 'cat_id' =>$this->cat_id,
- 'filter' =>$this->filter,
- 'query' =>$this->query,
- 'district_id' =>
$this->district_id,
- 'allrows' =>$this->allrows
- );
-
- $receipt =
$this->fm_session->appsession('receipt',$this->currentapp);
-
$this->fm_session->appsession('receipt',$this->currentapp,'');
-
- $GLOBALS['phpgw']->preferences->read_repository();
- if
($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'])
- {
- $autorefresh =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'].';
URL='.$this->bocommon->link('/index.php',$link_data);
- }
-
-
- if(!$this->allrows)
- {
- $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $record_limit = $this->bo->total_records;
- }
-
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $link_excel = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uitts.excel',
- 'second_display' => true,
- 'sort' =>$this->sort,
- 'order' =>$this->order,
- 'cat_id' =>$this->cat_id,
- 'filter' =>$this->filter,
- 'query' =>$this->query,
- 'district_id' =>
$this->district_id,
- 'allrows'
=>$this->allrows,
- 'start' =>$this->start
- );
-
- $data = array
- (
- 'lang_excel' =>
'excel',
- 'link_excel' =>
$this->bocommon->link('/index.php',$link_excel),
- 'lang_excel_help' =>
lang('Download table to MS Excel'),
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'autorefresh'
=> $autorefresh,
- 'links'
=> $links,
- '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'
=> $this->bocommon->link('/index.php',$link_data),
- 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the ticket belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
- 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'filter_name'
=> 'filter',
- 'filter_list'
=> $this->bo->filter(array('filter' => $this->filter,'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_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add,
-
- 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
- 'lang_no_district'
=> lang('no district'),
- 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
- 'select_district_name' =>
'district_id'
- );
-
- $appname
= lang('helpdesk');
- $function_msg =
lang('list ticket');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
- $return array('list' => $data);
- }
-
- function add()
- {
- if(!$this->acl_add)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
-
- $bolocation =
CreateObject($this->currentapp.'_bolocation');
-
- $values = get_var('values',array('POST'));
- $insert_record =
$this->fm_session->appsession('insert_record',$this->currentapp);
- $insert_record_entity =
$this->fm_session->appsession('insert_record_entity',$this->currentapp);
-
- for ($j=0;$j<count($insert_record_entity);$j++)
- {
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
- }
-
- $this->bocommon->xsl_add_file(array('tts'));
-
-//html_print_r($insert_record);
- if ($values['save'])
- {
- for ($i=0;
$i<count($insert_record['location']); $i++)
- {
-
if($_POST[$insert_record['location'][$i]])
- {
-
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
- }
- }
-
- while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
- {
- if($_POST[$key])
- {
- $values['extra'][$column]
= $_POST[$key];
- }
- }
-
- $values['street_name'] =
$_POST['street_name'];
- $values['street_number'] =
$_POST['street_number'];
- $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
-
-/* if(!$values['subject'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please type a subject for this ticket
!'));
- }
-
-*/ if(!$values['assignedto'] &&
!$values['group_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a person or a group to
handle the ticket !'));
- }
-
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- }
-
-/* if(!$values['details'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please give som details !'));
- }
-*/
- if(!$values['location']['loc1'] &&
!$values['extra']['p_num'])
- {
-
$receipt['error'][]=array('msg'=>lang('Pleace select a location - or an entity
!'));
- }
-
- if(!$receipt['error'])
- {
- $receipt = $this->bo->add($values);
-
$this->fm_session->appsession('receipt',$this->currentapp,$receipt);
- header('Location: '.
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitts.index'));
- }
- else
- {
- if($values['location'])
- {
- $location_code=implode("-",
$values['location']);
- $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
- }
- if($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']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
- }
- }
- }
-
- $location_data=$bolocation->initiate_ui_location(array(
- 'values' =>
$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' => $values['p']
- ));
-
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uitts.add'
- );
-
- if(!$values['assignedto'])
- {
- $values['assignedto']=
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['assigntodefault'];
- }
- if(!$values['group_id'])
- {
- $values['group_id']=
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['groupdefault'];
- }
-
- if(!$values['cat_id'])
- {
- $this->cat_id =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_category'];
- }
-
- $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);
-
- $data = array
- (
- 'lang_dateformat'
=> strtolower($dateformat),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- '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->acl2_location),
-
- 'lang_group'
=> lang('Group'),
- 'lang_no_group'
=> lang('No group'),
- 'group_list'
=> $this->bocommon->get_group_list('select',$values['group_id']),
- '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($values['priority']),
-
- 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.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_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'value_details'
=> $values['details'],
- 'value_subject'
=> $values['subject'],
-
- 'lang_finnish_date'
=> lang('finnish date'),
- 'value_finnish_date' =>
$values['finnish_date'],
-
- 'lang_done_statustext' =>
lang('Back to the ticket list'),
- 'lang_save_statustext' =>
lang('Save the ticket'),
- 'lang_no_cat'
=> lang('no category'),
- 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- '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_list'
=> $this->bo->select_category_list('select',$this->cat_id)
- );
-
-//html_print_r($data);
- $appname
= lang('helpdesk');
- $function_msg =
lang('add ticket');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('add' => $data);
- }
-
-
- function view()
- {
- if(!$this->acl_read)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
- }
-
- $bolocation =
CreateObject($this->currentapp.'_bolocation');
-
- $id = get_var('id',array('GET'));
- $values = get_var('values',array('POST','GET'));
-
- $this->bocommon->xsl_add_file(array('tts'));
-
- if($values['save'])
- {
- if(!$this->acl_edit)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=4&acl_location='
. $this->acl2_location);
- }
-
- $so2 =
CreateObject($this->currentapp.'_sotts2');
- $receipt = $so2->update_ticket($values,$id);
- }
-
- $ticket = $this->bo->read_single($id);
-
- $additional_notes =
$this->bo->read_additional_notes($id);
- $record_history = $this->bo->read_record_history($id);
-
- $request_link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.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'],
- 'ticket_id' => $id
- );
-
- $order_link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.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'],
- 'ticket_id' => $id
- );
-
- $form_link = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uitts.view',
- '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'),
- );
-
-//html_print_r($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' =>
$ticket['location_data']['tenant_id'],
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('ticket'),
- 'entity_data' => $ticket['p']
- ));
-
- if ($ticket['cat_id'])
- {
- $this->cat_id = $ticket['cat_id'];
- }
-
- if($ticket['request_id'])
- {
- $request_lookup_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uirequest.view'
- );
- }
- if($ticket['project_id'])
- {
- $project_lookup_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uiproject.view'
- );
- }
-
-
- $start_entity =
$this->bocommon->get_start_entity('ticket');
-//html_print_r($start_entity);
-
- if (isset($start_entity) AND is_array($start_entity))
- {
- $i=0;
- foreach($start_entity as $entry)
- {
- $link_entity[$i]['link'] =
$this->bocommon->link('/index.php',array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.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'],
- 'ticket_id'
=> $id
- ));
- $link_entity[$i]['name'] =
$entry['name'];
- $i++;
- }
- }
-
-//html_print_r($link_entity);
- $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);
-
- $data = array
- (
- 'lang_dateformat'
=> strtolower($dateformat),
- 'dateformat_validate' =>
$dateformat_validate,
- 'onKeyUp'
=> $onKeyUp,
- 'onBlur'
=> $onBlur,
- 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
- 'lang_finnish_date'
=> lang('finnish date'),
- 'value_finnish_date' =>
$ticket['finnish_date'],
-
- 'link_entity'
=> $link_entity,
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-
- 'entity_origin_list' =>
$ticket['entity'],
-
- 'lang_request'
=> lang('Request'),
- 'lang_request_statustext' =>
lang('Link to the request originatet from this ticket'),
- 'link_request'
=> $this->bocommon->link('/index.php',$request_lookup_data),
- 'value_request_id'
=> $ticket['request_id'],
-
- 'lang_project'
=> lang('Project'),
- 'lang_project_statustext' =>
lang('Link to the project originatet from this ticket'),
- 'link_project'
=> $this->bocommon->link('/index.php',$project_lookup_data),
- 'value_project_id'
=> $ticket['project_id'],
-
- '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'),
- 'select_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->acl2_location),
-
- 'lang_group'
=> lang('Group'),
- 'lang_no_group'
=> lang('No group'),
- 'group_list'
=> $this->bocommon->get_group_list('select',$ticket['group_id']),
- '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'),
- 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
- 'lang_category'
=> lang('category'),
- 'value_category_name' =>
$ticket['category_name'],
-
- 'form_action'
=> $this->bocommon->link('/index.php',$form_link),
- 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitts.index'),
- 'value_subject'
=> '[ #'. $id . ' ] - ' .$ticket['subject'],
-
- '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['timestampopened'],
-
- 'lang_assignedfrom'
=> lang('Assigned from'),
- 'value_assignedfrom' =>
$ticket['user_name'],
- 'lang_assignedto'
=> lang('Assigned to'),
- 'value_assignedto'
=> $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,
- 'request_link'
=> $this->bocommon->link('/index.php',$request_link_data),
- 'order_link'
=> $this->bocommon->link('/index.php',$order_link_data),
-
- 'lang_generate_request' =>
lang('Generate Request'),
- 'lang_generate_request_statustext'
=> lang('Klick this to generate a request with this information'),
- 'lang_generate_order' =>
lang('Generate order'),
- 'lang_generate_order_statustext'
=> lang('Klick this to generate an order with this information'),
-
- 'lang_save'
=> lang('save'),
- 'lang_name'
=> lang('name'),
- 'lang_done'
=> lang('done'),
- );
-
- $appname
= lang('helpdesk');
- $function_msg =
lang('view ticket detail');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('view' => $data);
- }
- }
-?>
+<?php
+
/**************************************************************************\
+ * phpGroupWare - property
*
+ * http://www.phpgroupware.org
*
+ *
*
+ * Facilities Management
*
+ * Written by Sigurd Nes [sigurdne at online.no]
*
+ *
------------------------------------------------------------------------ *
+ * Copyright 2000 - 2003 Free Software Foundation, Inc
*
+ * This program is part of the GNU project, see http://www.gnu.org/
*
+ *
------------------------------------------------------------------------ *
+ * This program 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.
*
+
\**************************************************************************/
+
+ class property_uitts
+ {
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'add' => True,
+ 'delete' => True,
+ 'excel' => True
+ );
+
+ function property_uitts()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+
+ $this->bo =
CreateObject($this->currentapp.'_botts',True);
+ $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
+ $this->menu =
CreateObject($this->currentapp.'_menu');
+ $this->fm_session =
CreateObject($this->currentapp.'_session');
+
+ $this->acl2 =
$GLOBALS['phpgw']->acl;
+ $this->acl2_location = '.ticket';
+ $this->acl_read =
$this->acl2->check('.ticket',1);
+ $this->acl_add =
$this->acl2->check('.ticket',2);
+ $this->acl_edit =
$this->acl2->check('.ticket',4);
+ $this->acl_delete =
$this->acl2->check('.ticket',8);
+ $this->acl_manage =
$this->acl2->check('.ticket',16);
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->district_id =
$this->bo->district_id;
+ $this->allrows =
$this->bo->allrows;
+
+ $this->menu->sub ='ticket';
+ }
+
+ function save_sessiondata()
+ {
+ $data = array
+ (
+ 'start' => $this->start,
+ 'query' => $this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'filter' => $this->filter,
+ 'cat_id' => $this->cat_id,
+ 'district_id' => $this->district_id,
+ 'allrows' => $this->allrows
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+
+ function excel()
+ {
+
+ $list = $this->bo->read();
+
+ if (isset($list) AND is_array($list))
+ {
+ $i=0;
+ foreach($list as $entry)
+ {
+ 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'])
+ {
+
$list[$i]['date_' . $j]=$date['date_info'][0]['entry_date'];
+
$name_temp['date_' . $j]=True;
+
$descr_temp[$date['date_info'][0]['descr']]=True;
+ }
+ $j++;
+ }
+ }
+ $i++;
+ }
+ }
+//html_print_r($descr_temp);
+
+ $name = array('id',
+ 'category',
+ 'location_code',
+ 'address',
+ 'user',
+ 'assignedto',
+ 'timestampopened'
+ );
+
+ 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'));
+
+//html_print_r($descr);
+
+
+
+ $this->bocommon->excel($list,$name,$descr);
+ }
+
+
+ function index()
+ {
+ if(!$this->acl_read)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $this->bocommon->xsl_add_file(array('tts',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+
+ $second_display =
get_var('second_display',array('POST','GET'));
+
+ $default_category =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['default_district'];
+
+ if ($default_category && !$second_display &&
!$this->district_id)
+ {
+ $this->bo->district_id = $default_category;
+ $this->district_id =
$default_category;
+ }
+
+ $bgcolor['1'] = '#dadada';
+ $bgcolor['2'] = '#dad0d0';
+ $bgcolor['3'] = '#dacaca';
+ $bgcolor['4'] = '#dac0c0';
+ $bgcolor['5'] = '#dababa';
+ $bgcolor['6'] = '#dab0b0';
+ $bgcolor['7'] = '#daaaaa';
+ $bgcolor['8'] = '#da9090';
+ $bgcolor['9'] = '#da8a8a';
+ $bgcolor['10'] = '#da7a7a';
+
+
+ $links = $this->menu->links();
+
+ $ticket_list = $this->bo->read();
+
+ $uicols=$this->bo->uicols;
+
+//html_print_r($uicols);
+//html_print_r($ticket_list);
+ while (is_array($ticket_list) && list(,$ticket) =
each($ticket_list))
+ {
+ $content[] = array
+ (
+ 'id'
=> $ticket['id'],
+ 'bgcolor'
=> $bgcolor[$ticket['priority']],
+ 'new_ticket'
=> $ticket['new_ticket'],
+ 'priostr'
=> str_repeat("||", $ticket['priority']),
+ 'first'
=> $ticket['category'],
+ 'location_code'
=> $ticket['location_code'],
+ 'address'
=> $ticket['address'],
+ 'date'
=> $ticket['timestampopened'],
+ 'finnish_date'
=> $ticket['finnish_date'],
+ 'delay'
=> $ticket['delay'],
+ 'user'
=> $ticket['user'],
+ 'assignedto'
=> $ticket['assignedto'],
+ 'child_date'
=> $ticket['child_date'],
+ 'link_view'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitts.view&id='
. $ticket['id']),
+ 'lang_view_statustext' =>
lang('view the ticket'),
+ 'text_view'
=> lang('view'),
+ );
+ }
+
+ $table_header[] = array
+ (
+ 'sort_priority' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'priority',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows)
+
)),
+
+ 'lang_priority' => lang('Priority'),
+ 'lang_priority_statustext' =>
lang('Sort the tickets by their priority'),
+
+ 'sort_id' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'fm_tts_tickets.id',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows)
+
)),
+
+ 'lang_id' => lang('ID'),
+ 'lang_id_statustext' => lang('Sort
the tickets by their ID'),
+
+ 'lang_subject' =>
lang('Category'),
+ '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->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'assignedto',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows)
+
)),
+ 'lang_assigned_to' =>
lang('Assigned to'),
+ 'sort_opened_by' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'user',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows)
+
)),
+ 'sort_date' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'fm_tts_tickets.entry_date',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows)
+
)),
+ 'sort_finnish_date' =>
$this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'finnish_date',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uitts.index',
+
'cat_id'
=>$this->cat_id,
+
'filter'
=>$this->filter,
+
'district_id' =>
$this->district_id,
+
'query'
=>$this->query,
+
'second_display'
=> true,
+
'allrows'=>$this->allrows)
+
)),
+ 'lang_finnish_date' =>
lang('finnish date'),
+ 'lang_delay' =>
lang('delay'),
+ 'lang_finnish_statustext'=> lang('presumed
finnish date'),
+ 'lang_opened_by' => lang('Opened
by')
+ );
+
+ 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' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitts.add')
+ );
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitts.index',
+ 'second_display' => true,
+ 'sort' =>$this->sort,
+ 'order' =>$this->order,
+ 'cat_id' =>$this->cat_id,
+ 'filter' =>$this->filter,
+ 'query' =>$this->query,
+ 'district_id' =>
$this->district_id,
+ 'allrows' =>$this->allrows
+ );
+
+ $receipt =
$this->fm_session->appsession('receipt',$this->currentapp);
+
$this->fm_session->appsession('receipt',$this->currentapp,'');
+
+ $GLOBALS['phpgw']->preferences->read_repository();
+ if
($GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'])
+ {
+ $autorefresh =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['refreshinterval'].';
URL='.$this->bocommon->link('/index.php',$link_data);
+ }
+
+
+ if(!$this->allrows)
+ {
+ $record_limit = 15;
//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $record_limit = $this->bo->total_records;
+ }
+
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $link_excel = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitts.excel',
+ 'second_display' => true,
+ 'sort' =>$this->sort,
+ 'order' =>$this->order,
+ 'cat_id' =>$this->cat_id,
+ 'filter' =>$this->filter,
+ 'query' =>$this->query,
+ 'district_id' =>
$this->district_id,
+ 'allrows'
=>$this->allrows,
+ 'start' =>$this->start
+ );
+
+ $data = array
+ (
+ 'lang_excel' =>
'excel',
+ 'link_excel' =>
$this->bocommon->link('/index.php',$link_excel),
+ 'lang_excel_help' =>
lang('Download table to MS Excel'),
+
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'autorefresh'
=> $autorefresh,
+ 'links'
=> $links,
+ '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'
=> $this->bocommon->link('/index.php',$link_data),
+ 'img_path'
=>
dirname($GLOBALS['HTTP_SERVER_VARS']['PHP_SELF']).'/api/skins/default/images',
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the ticket belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_list('filter',$this->cat_id),
+ 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'filter_name'
=> 'filter',
+ 'filter_list'
=> $this->bo->filter(array('filter' => $this->filter,'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_header'
=> $table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add,
+
+ 'district_list'
=> $this->bocommon->select_district_list('filter',$this->district_id),
+ 'lang_no_district'
=> lang('no district'),
+ 'lang_district_statustext' =>
lang('Select the district the selection belongs to. To do not use a district
select NO DISTRICT'),
+ 'select_district_name' =>
'district_id'
+ );
+
+ $appname
= lang('helpdesk');
+ $function_msg =
lang('list ticket');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ $return array('list' => $data);
+ }
+
+ function add()
+ {
+ if(!$this->acl_add)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+
+ $bolocation =
CreateObject($this->currentapp.'_bolocation');
+
+ $values = get_var('values',array('POST'));
+ $insert_record =
$this->fm_session->appsession('insert_record',$this->currentapp);
+ $insert_record_entity =
$this->fm_session->appsession('insert_record_entity',$this->currentapp);
+
+ for ($j=0;$j<count($insert_record_entity);$j++)
+ {
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ }
+
+ $this->bocommon->xsl_add_file(array('tts'));
+
+//html_print_r($insert_record);
+ if ($values['save'])
+ {
+ for ($i=0;
$i<count($insert_record['location']); $i++)
+ {
+
if($_POST[$insert_record['location'][$i]])
+ {
+
$values['location'][$insert_record['location'][$i]]=
$_POST[$insert_record['location'][$i]];
+ }
+ }
+
+ while (is_array($insert_record['extra']) &&
list($key,$column) = each($insert_record['extra']))
+ {
+ if($_POST[$key])
+ {
+ $values['extra'][$column]
= $_POST[$key];
+ }
+ }
+
+ $values['street_name'] =
$_POST['street_name'];
+ $values['street_number'] =
$_POST['street_number'];
+ $values['location_name'] = $_POST['loc'
. (count($values['location'])).'_name']; // if not address - get the parent
name as address
+
+/* if(!$values['subject'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please type a subject for this ticket
!'));
+ }
+
+*/ if(!$values['assignedto'] &&
!$values['group_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a person or a group to
handle the ticket !'));
+ }
+
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ }
+
+/* if(!$values['details'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please give som details !'));
+ }
+*/
+ if(!$values['location']['loc1'] &&
!$values['extra']['p_num'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Pleace select a location - or an entity
!'));
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt = $this->bo->add($values);
+
$this->fm_session->appsession('receipt',$this->currentapp,$receipt);
+ header('Location: '.
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitts.index'));
+ }
+ else
+ {
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
+ }
+ if($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']=$_POST['entity_cat_name_'.$values['extra']['p_entity_id']];
+ }
+ }
+ }
+
+ $location_data=$bolocation->initiate_ui_location(array(
+ 'values' =>
$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' => $values['p']
+ ));
+
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitts.add'
+ );
+
+ if(!$values['assignedto'])
+ {
+ $values['assignedto']=
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['assigntodefault'];
+ }
+ if(!$values['group_id'])
+ {
+ $values['group_id']=
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['groupdefault'];
+ }
+
+ if(!$values['cat_id'])
+ {
+ $this->cat_id =
$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['tts_category'];
+ }
+
+ $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);
+
+ $data = array
+ (
+ 'lang_dateformat'
=> strtolower($dateformat),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ '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->acl2_location),
+
+ 'lang_group'
=> lang('Group'),
+ 'lang_no_group'
=> lang('No group'),
+ 'group_list'
=> $this->bocommon->get_group_list('select',$values['group_id']),
+ '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($values['priority']),
+
+ 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.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_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'value_details'
=> $values['details'],
+ 'value_subject'
=> $values['subject'],
+
+ 'lang_finnish_date'
=> lang('finnish date'),
+ 'value_finnish_date' =>
$values['finnish_date'],
+
+ 'lang_done_statustext' =>
lang('Back to the ticket list'),
+ 'lang_save_statustext' =>
lang('Save the ticket'),
+ 'lang_no_cat'
=> lang('no category'),
+ 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ '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_list'
=> $this->bo->select_category_list('select',$this->cat_id)
+ );
+
+//html_print_r($data);
+ $appname
= lang('helpdesk');
+ $function_msg =
lang('add ticket');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('add' => $data);
+ }
+
+
+ function view()
+ {
+ if(!$this->acl_read)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=1&acl_location='
. $this->acl2_location);
+ }
+
+ $bolocation =
CreateObject($this->currentapp.'_bolocation');
+
+ $id = get_var('id',array('GET'));
+ $values = get_var('values',array('POST','GET'));
+
+ $this->bocommon->xsl_add_file(array('tts'));
+
+ if($values['save'])
+ {
+ if(!$this->acl_edit)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=4&acl_location='
. $this->acl2_location);
+ }
+
+ $so2 =
CreateObject($this->currentapp.'_sotts2');
+ $receipt = $so2->update_ticket($values,$id);
+ }
+
+ $ticket = $this->bo->read_single($id);
+
+ $additional_notes =
$this->bo->read_additional_notes($id);
+ $record_history = $this->bo->read_record_history($id);
+
+ $request_link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.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'],
+ 'ticket_id' => $id
+ );
+
+ $order_link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.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'],
+ 'ticket_id' => $id
+ );
+
+ $form_link = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitts.view',
+ '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'),
+ );
+
+//html_print_r($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' =>
$ticket['location_data']['tenant_id'],
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('ticket'),
+ 'entity_data' => $ticket['p']
+ ));
+
+ if ($ticket['cat_id'])
+ {
+ $this->cat_id = $ticket['cat_id'];
+ }
+
+ if($ticket['request_id'])
+ {
+ $request_lookup_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uirequest.view'
+ );
+ }
+ if($ticket['project_id'])
+ {
+ $project_lookup_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uiproject.view'
+ );
+ }
+
+
+ $start_entity =
$this->bocommon->get_start_entity('ticket');
+//html_print_r($start_entity);
+
+ if (isset($start_entity) AND is_array($start_entity))
+ {
+ $i=0;
+ foreach($start_entity as $entry)
+ {
+ $link_entity[$i]['link'] =
$this->bocommon->link('/index.php',array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.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'],
+ 'ticket_id'
=> $id
+ ));
+ $link_entity[$i]['name'] =
$entry['name'];
+ $i++;
+ }
+ }
+
+//html_print_r($link_entity);
+ $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);
+
+ $data = array
+ (
+ 'lang_dateformat'
=> strtolower($dateformat),
+ 'dateformat_validate' =>
$dateformat_validate,
+ 'onKeyUp'
=> $onKeyUp,
+ 'onBlur'
=> $onBlur,
+ 'dateformat_source'
=> './'.$this->currentapp.'/inc/dateformat.js',
+ 'lang_finnish_date'
=> lang('finnish date'),
+ 'value_finnish_date' =>
$ticket['finnish_date'],
+
+ 'link_entity'
=> $link_entity,
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+
+ 'entity_origin_list' =>
$ticket['entity'],
+
+ 'lang_request'
=> lang('Request'),
+ 'lang_request_statustext' =>
lang('Link to the request originatet from this ticket'),
+ 'link_request'
=> $this->bocommon->link('/index.php',$request_lookup_data),
+ 'value_request_id'
=> $ticket['request_id'],
+
+ 'lang_project'
=> lang('Project'),
+ 'lang_project_statustext' =>
lang('Link to the project originatet from this ticket'),
+ 'link_project'
=> $this->bocommon->link('/index.php',$project_lookup_data),
+ 'value_project_id'
=> $ticket['project_id'],
+
+ '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'),
+ 'select_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->acl2_location),
+
+ 'lang_group'
=> lang('Group'),
+ 'lang_no_group'
=> lang('No group'),
+ 'group_list'
=> $this->bocommon->get_group_list('select',$ticket['group_id']),
+ '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'),
+ 'lang_cat_statustext' =>
lang('Select the category the building belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'cat_list'
=> $this->bo->select_category_list('select',$this->cat_id),
+ 'lang_category'
=> lang('category'),
+ 'value_category_name' =>
$ticket['category_name'],
+
+ 'form_action'
=> $this->bocommon->link('/index.php',$form_link),
+ 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uitts.index'),
+ 'value_subject'
=> '[ #'. $id . ' ] - ' .$ticket['subject'],
+
+ '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['timestampopened'],
+
+ 'lang_assignedfrom'
=> lang('Assigned from'),
+ 'value_assignedfrom' =>
$ticket['user_name'],
+ 'lang_assignedto'
=> lang('Assigned to'),
+ 'value_assignedto'
=> $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,
+ 'request_link'
=> $this->bocommon->link('/index.php',$request_link_data),
+ 'order_link'
=> $this->bocommon->link('/index.php',$order_link_data),
+
+ 'lang_generate_request' =>
lang('Generate Request'),
+ 'lang_generate_request_statustext'
=> lang('Klick this to generate a request with this information'),
+ 'lang_generate_order' =>
lang('Generate order'),
+ 'lang_generate_order_statustext'
=> lang('Klick this to generate an order with this information'),
+
+ 'lang_save'
=> lang('save'),
+ 'lang_name'
=> lang('name'),
+ 'lang_done'
=> lang('done'),
+ );
+
+ $appname
= lang('helpdesk');
+ $function_msg =
lang('view ticket detail');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('view' => $data);
+ }
+ }
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.uitts.php, 1.1.1.3,
nomail <=