[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.uirequest.php, 1.1.1.3
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.uirequest.php, 1.1.1.3 |
Date: |
Fri, 21 May 2004 19:08:40 -0000 |
Update of /property
Modified Files:
Branch:
class.uirequest.php
date: 2004/04/23 21:26:42; author: sigurdne; state: Exp; lines: +1102 -1102
Log Message:
no message
=====================================================================
Index: property/class.uirequest.php
diff -u property/class.uirequest.php:1.1.1.2
property/class.uirequest.php:1.1.1.3
--- property/class.uirequest.php:1.1.1.2 Fri Apr 23 20:26:53 2004
+++ property/class.uirequest.php Fri Apr 23 21:26:42 2004
@@ -1,1102 +1,1102 @@
-<?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_uirequest
- {
- var $grants;
- var $cat_id;
- var $start;
- var $query;
- var $sort;
- var $order;
- var $filter;
- var $part_of_town_id;
- var $sub;
- var $currentapp;
-
- var $public_functions = array
- (
- 'index' => True,
- 'view' => True,
- 'edit' => True,
- 'delete' => True,
- 'priority_key' => True
- );
-
- function property_uirequest()
- {
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
- $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->account =
$GLOBALS['phpgw_data']['user']['id'];
- $this->bo =
CreateObject($this->currentapp.'_borequest',True);
- $this->boproject =
CreateObject($this->currentapp.'_boproject');
- $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
- $this->menu =
CreateObject($this->currentapp.'_menu');
- $this->bolocation =
CreateObject($this->currentapp.'_bolocation');
- $this->config =
CreateObject('phpgwapi_config');
- $this->fm_session =
CreateObject($this->currentapp.'_session');
-
- $this->acl2 =
$GLOBALS['phpgw']->acl;
- $this->acl2_location = '.project';
- $this->acl_read =
$this->acl2->check('.project',1);
- $this->acl_add =
$this->acl2->check('.project',2);
- $this->acl_edit =
$this->acl2->check('.project',4);
- $this->acl_delete =
$this->acl2->check('.project',8);
- $this->acl_manage =
$this->acl2->check('.project',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->status_id =
$this->bo->status_id;
-
- $this->menu->sub ='project';
- }
-
- 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,
- 'status_id' => $this->status_id
- );
- $this->bo->save_sessiondata($data);
- }
-
- 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('request','table_header',
-
'menu',
-
'nextmatchs',
-
'search_field'));
-
- $project_id =
get_var('project_id',array('POST','GET')); // lookup for maintenance planning
-
- if($project_id)
- {
- $lookup = True;
- }
- $links = $this->menu->links('request');
-
- $request_list = $this->bo->read($project_id);
-
-//html_print_r($request_list);
-
- $uicols = $this->bo->uicols;
-//html_print_r($uicols);
-
- $j=0;
- while (is_array($request_list) && list(,$request_entry)
= each($request_list))
- {
- for ($k=0;$k<count($uicols['name']);$k++)
- {
- if($uicols['input_type'][$k]!='hidden')
- {
-
-
if($request_entry['query_location'][$uicols['name'][$k]])
- {
-
$content[$j]['row'][$k]['statustext'] = lang('search');
-
$content[$j]['row'][$k]['text'] =
$request_entry[$uicols['name'][$k]];
-
$content[$j]['row'][$k]['link'] =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.index&query='
. $request_entry['query_location'][$uicols['name'][$k]] . '&project_id=' .
$project_id);
- }
- else
- {
-
$content[$j]['row'][$k]['value'] =
$request_entry[$uicols['name'][$k]];
-
$content[$j]['row'][$k]['name'] = $uicols['name'][$k];
- }
-
- }
-
- }
-
- if(!$lookup)
- {
- if($this->acl_read)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('view the
request');
- $content[$j]['row'][$k]['text']
= lang('view');
- $content[$j]['row'][$k]['link']
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.view&id='
. $request_entry['request_id']);
- $k++;
- }
-
- if($this->acl_edit)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('edit the
request');
- $content[$j]['row'][$k]['text']
= lang('edit');
- $content[$j]['row'][$k]['link']
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.edit&id='
. $request_entry['request_id']);
- $k++;
- }
-
- if($this->acl_delete)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('delete the
request');
- $content[$j]['row'][$k]['text']
= lang('delete');
- $content[$j]['row'][$k]['link']
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.delete&id='
. $request_entry['request_id']);
- $k++;
- }
-
- }
- else
- {
- if($this->acl_read)
- {
-
$content[$j]['row'][$k]['statustext'] = lang('view the
request');
- $content[$j]['row'][$k]['text']
= lang('view');
-
$content[$j]['row'][$k]['target'] = '_blank';
- $content[$j]['row'][$k]['link']
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.view&id='
. $request_entry['request_id']);
-
$content[$j]['row'][$k]['request_id'] =
$request_entry['request_id'];
- $k++;
- }
-
- }
-
- $j++;
- }
-
- for ($i=0;$i<count($uicols['descr']);$i++)
- {
- if($uicols['input_type'][$i]!='hidden')
- {
- $table_header[$i]['header'] =
$uicols['descr'][$i];
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- if($uicols['name'][$i]=='loc1')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'location_code',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'project_id'
=>$project_id,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='request_id')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'request_id',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'project_id'
=>$project_id,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='score')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'score',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'project_id'
=>$project_id,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- if($uicols['name'][$i]=='address')
- {
- $table_header[$i]['sort_link']
=true;
- $table_header[$i]['sort']
= $this->bocommon->show_sort_order(array
-
(
-
'sort' => $this->sort,
-
'var' => 'address',
-
'order' => $this->order,
-
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
-
'type_id'
=>$type_id,
-
'query'
=>$this->query,
-
'project_id'
=>$project_id,
-
'district_id' =>
$this->district_id,
-
'cat_id'
=>$this->cat_id)
-
));
- }
- }
- }
-
- if($this->acl_read)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('view');
- $i++;
- }
-
- if(!$lookup)
- {
- if($this->acl_edit)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('edit');
- $i++;
- }
- if($this->acl_delete)
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header']
= lang('delete');
- $i++;
- }
- }
- else
- {
- $table_header[$i]['width']
= '5%';
- $table_header[$i]['align']
= 'center';
- $table_header[$i]['header'] =
lang('select');
- }
-
-//html_print_r($content);
- if($this->acl_add)
- {
- $table_add[] = array
- (
- 'lang_add'
=> lang('add'),
- 'lang_add_statustext' => lang('add a
request'),
- 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.edit')
- );
- }
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'district_id'
=>$this->district_id,
- 'filter'
=>$this->filter,
- 'status_id'
=>$this->status_id,
- 'project_id' =>$project_id,
- 'query'
=>$this->query
- );
-
-
- if($this->acl_manage)
- {
- $link_priority_key
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.priority_key');
- }
-
- $data = array
- (
- 'lang_priority_key'
=> lang('Priority key'),
- 'lang_priority_help'
=> lang('To alter the priority key'),
- 'link_priority_key'
=> $link_priority_key,
- 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
- 'lang_select'
=> lang('select'),
-
- 'lang_update_project'
=> lang('Update project'),
- 'lang_add_to_project_statustext' =>
lang('add selected request to project'),
- 'add_to_project_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiproject.edit&id='
. $project_id),
- 'project_id'
=> $project_id,
-
- 'lookup'
=> $lookup,
- 'links'
=> $links,
- 'allow_allrows'
=> false,
- 'start_record'
=> $this->start,
- 'record_limit'
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
- 'num_records'
=> count($request_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 request belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'cat_id',
- 'cat_list'
=> $this->bo->select_category_request_list('filter',$this->cat_id),
- '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',
- 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
-
- 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
- 'status_name'
=> 'status_id',
- 'lang_no_status'
=> lang('No status'),
- 'status_list'
=> $this->boproject->select_status_list('filter',$this->status_id),
-
- 'lang_user_statustext' =>
lang('Select the user the request belongs to. To do not use a category select
NO USER'),
- 'select_user_name'
=> 'filter',
- 'lang_no_user'
=> lang('No user'),
- 'user_list'
=> $this->bocommon->get_user_list('filter',$this->filter),
-
- '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
- );
-
- $appname
= lang('request');
- $function_msg =
lang('list request');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- //$this->save_sessiondata();
- return array('list' => $data);
- }
-
-
- function priority_key()
- {
- if(!$this->acl_manage)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
- }
- $this->bocommon->xsl_add_file(array('request'));
- $GLOBALS['phpgw_info']['flags']['headonly']=true;
- $values = get_var('values',array('POST','GET'));
-
- if($values['update'])
- {
- $receipt =
$this->bo->update_priority_key($values);
- }
-
- $function_msg = lang('Edit priority key');
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uirequest.priority_key');
-
- $priority_key = $this->bo->read_priority_key();
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'function_msg'
=> $function_msg,
- 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'lang_safety'
=> lang('safety'),
- 'lang_aesthetics'
=> lang('aesthetics'),
- 'lang_indoor_climate' =>
lang('indoor climate'),
- 'lang_consequential_damage' =>
lang('consequential damage'),
- 'lang_user_gratification' =>
lang('user gratification'),
- 'lang_residential_environment' =>
lang('residential environment'),
- 'lang_authorities_demands' =>
lang('authorities demands'),
- 'safety'
=> $priority_key['safety'],
- 'aesthetics'
=> $priority_key['aesthetics'],
- 'indoor_climate'
=> $priority_key['indoor_climate'],
- 'consequential_damage' =>
$priority_key['consequential_damage'],
- 'user_gratification' =>
$priority_key['user_gratification'],
- 'residential_environment' =>
$priority_key['residential_environment'],
- 'authorities_demands' =>
$priority_key['authorities_demands'],
- 'lang_save'
=> lang('save'),
- 'select_name'
=> 'period'
- );
-
- return array('priority_key' => $data);
- }
-
-
- function edit()
- {
- if(!$this->acl_add && !$this->acl_edit)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
- }
- $id =
get_var('id',array('POST','GET'));
- $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('request'));
-
- $bypass =
get_var('bypass',array('POST','GET'));
-
- if($_POST && !$bypass)
- {
- 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
- }
- else
- {
- $location_code =
get_var('location_code',array('POST','GET'));
- $tenant_id
= get_var('tenant_id',array('POST','GET'));
- $ticket_id
= get_var('ticket_id',array('POST','GET'));
-
- $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
- $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
- $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']
= get_var('p_num',array('POST','GET'));
-
- if($p_entity_id && $p_cat_id)
- {
- $boadmin_entity =
CreateObject($this->currentapp.'_boadmin_entity');
- $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($ticket_id)
- {
- $values['origin']= 'tts';
- $values['origin_id']= $ticket_id;
- }
-
- if($location_code)
- {
- $values['location_data'] =
$this->bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
- }
-
- }
-
- $values['start_date'] =
get_var('start_date',array('POST'));
- $values['end_date'] =
get_var('end_date',array('POST'));
-
-//html_print_r($values);
- $this->config->read_repository();
-
- if ($values['save'])
- {
- if(!$values['location'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
- $error_id=true;
- }
-
- if(!$values['title'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a request TITLE !'));
- $error_id=true;
- }
-
- if(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- $error_id=true;
- }
-
- if(!$values['status'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
- }
-
- if($id)
- {
- $values['request_id']=$id;
- $action='edit';
- }
-
- if(!$receipt['error'])
- {
- if(!$id)
- {
-
$values['request_id']=$this->bo->next_id();
- $id = $values['request_id'];
- }
-
- if($values['copy_request'])
- {
- $action='add';
- $values['request_id'] =
$this->bo->next_id();
- $id = $values['request_id'];
- }
- $receipt =
$this->bo->save($values,$action);
- $id = $values['request_id'];
- $function_msg = lang('Edit request');
-
- if ($values['notify'])
- {
-
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
-
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
- $headers = "Return-Path: <".
$coordinator_email .">\r\n";
- $headers .= "From: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
- $headers .= "Bcc: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
- $headers .= "Content-type:
text/plain; charset=iso-8859-1\r\n";
-
- $subject = lang(notify).": ".
$values['request_id'];
- $message = lang(request) . " "
. $values['request_id'] ." ". lang('is registered');
-
- $mail_method=
$this->config->config_data['fmwrkorder_mail'];
- if ($mail_method=='smtp'):
- {
- $bcc =
$coordinator_email;
- $send =
CreateObject('phpgwapi_send');
- $rcpt =
$send->msg('email', $values['mail_address'], $subject, stripslashes($message),
'', $cc, $bcc, $coordinator_email, $coordinator_name, 'plain');
- }
- elseif
($mail_method=='sendmail'):
- {
-
$rcpt=mail($values['mail_address'],$subject,$message, $headers);
- }
- else:
- {
-
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
- }
- endif;
- }
-
- if($rcpt)
- {
-
$receipt['message'][]=array('msg'=>lang('%1 is
notified',$values['mail_address']));
- }
- }
- else
- {
- if($values['location'])
- {
- $location_code=implode("-",
$values['location']);
- $values['location_data'] =
$this->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']];
- }
- }
- }
-
- if(!$receipt['error'] && !$bypass && $id)
- {
- $values = $this->bo->read_single($id);
- $record_history =
$this->bo->read_record_history($id);
- }
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- if ($id)
- {
- $function_msg = lang('Edit request');
- }
- else
- {
- $function_msg = lang('Add request');
- }
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
- $lookup_type='form';
-
-
$location_data=$this->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' => $lookup_type,
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('request'),
- 'entity_data' => $values['p']
- ));
-
-
- if($values['origin']== 'tts')
- {
- $origin_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uitts.view',
- 'id' =>
$values['origin_id']
- );
- }
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uirequest.edit',
- 'id' => $id
- );
-
- if(!$values['coordinator'])
- {
- $values['coordinator']=$this->account;
- }
-
-
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['approval_from'];
-
- $notify =
$this->config->config_data['workorder_approval'];
-
- if ($supervisor_id && ($notify=='yes'))
- {
- $prefs =
$this->bocommon->create_preferences($this->currentapp,$supervisor_id);
- $supervisor_email = $prefs['email'];
- }
-
-
-
- $table_header_importance[] = array
- (
- 'lang_subject' =>
lang('Subject'),
- 'lang_condition_degree' => lang('Condidtion
degree'),
- 'lang_prob_worsening' => lang('Probability'),
- 'lang_consequence' =>
lang('Consequence')
- );
-
- $importance_weight[] = array
- (
- 'lang_safety'
=> lang('Safety'),
- 'lang_aesthetics'
=> lang('Aesthetics'),
- 'lang_indoor_climate'
=> lang('Indoor climate'),
- 'lang_consequential_damage'
=> lang('Consequential damage'),
- 'lang_user_gratification'
=> lang('User gratification'),
- 'lang_residential_environment'
=> lang('Residential environment'),
-
- 'lang_degree_statustext'
=> lang('Select the appropriate condition degree'),
- 'lang_probability_statustext'
=> lang('Select the appropriate propability for worsening of the
condition'),
- 'lang_consequence_statustext'
=> lang('Select the appropriate consequence by breakdown of this
component for this theme'),
-
-
- 'degree_list_safety'
=>
$this->bo->select_degree_list($values['d_safety'],'default_safety'),
- 'degree_list_aesthetics'
=>
$this->bo->select_degree_list($values['d_aesthetics'],'default_aesthetics'),
- 'degree_list_indoor_climate'
=>
$this->bo->select_degree_list($values['d_indoor_climate'],'default_climate'),
- 'degree_list_consequential_damage'
=>
$this->bo->select_degree_list($values['d_consequential_damage'],'default_consequential_damage'),
- 'degree_list_user_gratification'
=>
$this->bo->select_degree_list($values['d_user_gratification'],'default_gratification'),
- 'degree_list_residential_environment'
=>
$this->bo->select_degree_list($values['d_residential_environment'],'default_environment'),
-
-
- 'probability_list_safety'
=> $this->bo->select_probability_list($values['p_safety']),
- 'probability_list_aesthetics'
=> $this->bo->select_probability_list($values['p_aesthetics']),
- 'probability_list_indoor_climate'
=> $this->bo->select_probability_list($values['p_indoor_climate']),
- 'probability_list_consequential_damage'
=> $this->bo->select_probability_list($values['p_consequential_damage']),
- 'probability_list_user_gratification'
=> $this->bo->select_probability_list($values['p_user_gratification']),
- 'probability_list_residential_environment'
=> $this->bo->select_probability_list($values['p_residential_environment']),
-
- 'consequence_list_safety'
=> $this->bo->select_consequence_list($values['c_safety']),
- 'consequence_list_aesthetics'
=> $this->bo->select_consequence_list($values['c_aesthetics']),
- 'consequence_list_indoor_climate'
=> $this->bo->select_consequence_list($values['c_indoor_climate']),
- 'consequence_list_consequential_damage'
=> $this->bo->select_consequence_list($values['c_consequential_damage']),
- 'consequence_list_user_gratification'
=> $this->bo->select_consequence_list($values['c_user_gratification']),
- 'consequence_list_residential_environment'
=> $this->bo->select_consequence_list($values['c_residential_environment']),
-
- 'lang_authorities_demands'
=> lang('Authorities Demands'),
- 'lang_authorities_demands_statustext'
=> lang('Is there a demand from the authorities to correct this
condition?'),
- 'authorities_demands'
=> $values['authorities_demands']
- );
-
- if($values['project_id'])
- {
- $project_lookup_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uiproject.view'
- );
- }
-
- $cal_info = $this->bocommon->jscalendar();
- $jsDateFormat=$cal_info['jsDateFormat'];
-
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $data = array
- (
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_origin'
=> lang('origin'),
- 'lang_origin_statustext' =>
lang('Link to the origin for this request'),
- 'link_origin'
=> $this->bocommon->link('/index.php',$origin_data),
- 'value_origin'
=> $values['origin'],
- 'value_origin_id'
=> $values['origin_id'],
-
- 'lang_project'
=> lang('Project'),
- 'lang_project_statustext' =>
lang('Link to the project originatet from this request'),
- 'link_project'
=> $this->bocommon->link('/index.php',$project_lookup_data),
- 'value_project_id'
=> $values['project_id'],
-
-
- 'generate_project_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiproject.edit'),
- 'lang_generate_project'
=> lang('Generate project'),
- 'lang_generate_project_statustext' =>
lang('Generate a project from this request'),
- 'location_code'
=> $values['location_code'],
- 'p_num'
=> $values['p_num'],
- 'p_entity_id'
=> $values['p_entity_id'],
- 'p_cat_id'
=> $values['p_cat_id'],
- 'tenant_id'
=> $values['tenant_id'],
-
- 'lang_importance'
=> lang('Importance'),
- 'table_header_importance' =>
$table_header_importance,
- 'importance_weight'
=> $importance_weight,
-
- 'lang_no_workorders' =>
lang('No workorder bugdet'),
- 'workorder_link'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiworkorder.edit'),
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
-
- 'jsDateFormat'
=> $jsDateFormat,
- 'date_img'
=> $cal_info['img'],
- 'lang_datetitle'
=> lang('Select date'),
- 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
- 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
-
- 'lang_start_date_statustext' => lang('Select
the estimated end date for the request'),
- 'lang_start_date'
=> lang('request start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date_statustext' =>
lang('Select the estimated end date for the request'),
- 'lang_end_date'
=> lang('request end date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'lang_copy_request'
=> lang('Copy request ?'),
- 'lang_copy_request_statustext' => lang('Choose
Copy request to copy this request to a new request'),
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'lang_power_meter_statustext' => lang('Enter
the power_meter'),
- 'value_power_meter'
=> $values['power_meter'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $values['budget'],
- 'lang_budget_statustext' =>
lang('Enter the budget'),
-
- 'location_data'
=> $location_data,
- 'location_type'
=> 'form',
- 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
- 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.index'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
-
- 'lang_request_id'
=> lang('request ID'),
- 'value_request_id'
=> $values['request_id'],
-
- 'lang_title'
=> lang('Title'),
- 'value_title'
=> $values['title'],
- 'lang_title_statustext' =>
lang('Enter request Title'),
-
- 'lang_descr_statustext' =>
lang('Enter a description of the request'),
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_score'
=> lang('Score'),
- 'value_score'
=> $values['score'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'lang_save_statustext' =>
lang('Save the request'),
- 'lang_no_cat'
=> lang('Select category'),
- 'lang_cat_statustext' =>
lang('Select the category the request belongs to. To do not use a category
select NO CATEGORY'),
- 'select_name'
=> 'values[cat_id]',
- 'value_cat_id'
=> $values['cat_id'],
- 'cat_list'
=> $this->bo->select_category_request_list('select',$values['cat_id']),
-
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_user_statustext' =>
lang('Select the coordinator the request belongs to. To do not use a category
select NO USER'),
- 'select_user_name'
=> 'values[coordinator]',
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl2_location),
-
- 'status_list'
=> $this->boproject->select_status_list('select',$values['status']),
- 'select_status_name' =>
'values[status]',
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
- 'lang_status_statustext' =>
lang('What is the current status of this request ?'),
-
- 'branch_list'
=> $this->boproject->select_branch_list($values['branch_id']),
- 'lang_branch'
=> lang('branch'),
- 'lang_no_branch'
=> lang('Select branch'),
- 'lang_branch_statustext' =>
lang('Select the branches for this request'),
-
- 'notify'
=> $notify,
- 'lang_notify'
=> lang('Notify'),
- 'lang_notify_statustext' =>
lang('Check this to notify your supervisor by email'),
- 'value_notify_mail_address' =>
$supervisor_email,
-
- 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
- );
-
- $appname
= lang('request');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('edit' => $data);
- }
-
- function delete()
- {
- if(!$this->acl_delete)
- {
-
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
- }
-
- $id = get_var('id',array('POST','GET'));
- $confirm = get_var('confirm',array('POST'));
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uirequest.index'
- );
-
- if (get_var('confirm',array('POST')))
- {
- $this->bo->delete($id);
- Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
- }
-
- $this->bocommon->xsl_add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$this->bocommon->link('/index.php',$link_data),
- 'delete_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.delete&id='
. $id),
- 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
- 'lang_yes' =>
lang('yes'),
- 'lang_yes_statustext' => lang('Delete the
entry'),
- 'lang_no_statustext' => lang('Back to the
list'),
- 'lang_no' =>
lang('no')
- );
-
- $appname
= lang('request');
- $function_msg =
lang('delete request');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
- return array('delete' => $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);
- }
-
- $id =
get_var('id',array('POST','GET'));
-
- $this->bocommon->xsl_add_file(array('request'));
-
- $values = $this->bo->read_single($id);
-
- $record_history = $this->bo->read_record_history($id);
-
- $table_header_history[] = array
- (
- 'lang_date' => lang('Date'),
- 'lang_user' => lang('User'),
- 'lang_action' => lang('Action'),
- 'lang_new_value' => lang('New value')
- );
-
- $function_msg = lang('View request');
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
-
$location_data=$this->bolocation->initiate_ui_location(array(
- 'values' =>
$values['location_data'],
- 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
- 'no_link' =>
False, // disable lookup links for location type less than type_id
- 'tenant' =>
$values['location_data']['tenant_id'],
- 'lookup_type' => 'view',
- 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
- 'entity_data' => $values['p']
- ));
-
-
-
- $link_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uirequest.edit',
- 'id' => $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));
-
-
- $table_header_importance[] = array
- (
- 'lang_subject' =>
lang('Subject'),
- 'lang_condition_degree' => lang('Condidtion
degree'),
- 'lang_prob_worsening' => lang('Probability'),
- 'lang_consequence' =>
lang('Consequence')
- );
-
- $importance_weight[] = array
- (
- 'lang_safety'
=> lang('Safety'),
- 'lang_aesthetics'
=> lang('Aesthetics'),
- 'lang_indoor_climate'
=> lang('Indoor climate'),
- 'lang_consequential_damage'
=> lang('Consequential damage'),
- 'lang_user_gratification'
=> lang('User gratification'),
- 'lang_residential_environment'
=> lang('Residential environment'),
-
- 'degree_safety'
=> $values['d_safety'],
- 'degree_aesthetics'
=> $values['d_aesthetics'],
- 'degree_indoor_climate'
=> $values['d_indoor_climate'],
- 'degree_consequential_damage'
=> $values['d_consequential_damage'],
- 'degree_user_gratification'
=> $values['d_user_gratification'],
- 'degree_residential_environment'
=> $values['d_residential_environment'],
-
- 'probability_safety'
=> $values['p_safety'],
- 'probability_aesthetics'
=> $values['p_aesthetics'],
- 'probability_indoor_climate'
=> $values['p_indoor_climate'],
- 'probability_consequential_damage'
=> $values['p_consequential_damage'],
- 'probability_user_gratification'
=> $values['p_user_gratification'],
- 'probability_residential_environment' =>
$values['p_residential_environment'],
-
- 'consequence_safety'
=> $values['c_safety'],
- 'consequence_aesthetics'
=> $values['c_aesthetics'],
- 'consequence_indoor_climate'
=> $values['c_indoor_climate'],
- 'consequence_consequential_damage'
=> $values['c_consequential_damage'],
- 'consequence_user_gratification'
=> $values['c_user_gratification'],
- 'consequence_residential_environment' =>
$values['c_residential_environment'],
-
- 'lang_authorities_demands'
=> lang('Authorities Demands'),
- 'authorities_demands'
=> $values['authorities_demands']
- );
-
-
- if($values['origin']== 'tts')
- {
- $origin_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uitts.view',
- 'id' =>
$values['origin_id']
- );
- }
-
- if($values['project_id'])
- {
- $project_lookup_data = array
- (
- 'sid=cookie&op' =>
$this->currentapp.'.uiproject.view'
- );
- }
-
- $data = array
- (
- 'lang_origin'
=> lang('origin'),
- 'lang_origin_statustext' =>
lang('Link to the origin for this request'),
- 'link_origin'
=> $this->bocommon->link('/index.php',$origin_data),
- 'value_origin_id'
=> $values['origin_id'],
-
- 'lang_project'
=> lang('Project'),
- 'lang_project_statustext' =>
lang('Link to the project originatet from this request'),
- 'link_project'
=> $this->bocommon->link('/index.php',$project_lookup_data),
- 'value_project_id'
=> $values['project_id'],
-
- 'lang_importance'
=> lang('Importance'),
- 'table_header_importance' =>
$table_header_importance,
- 'importance_weight_view' =>
$importance_weight,
-
- 'workorder_link'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiworkorder.edit'),
- 'record_history'
=> $record_history,
- 'table_header_history' =>
$table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
- 'lang_start_date'
=> lang('request start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date'
=> lang('request end date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'value_power_meter'
=> $values['power_meter'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $values['budget'],
-
- 'location_data'
=> $location_data,
- 'location_type'
=> 'view',
- 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.index'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
-
- 'lang_request_id'
=> lang('request ID'),
- 'value_request_id'
=> $values['request_id'],
-
- 'lang_title'
=> lang('Title'),
- 'value_title'
=> $values['title'],
-
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_score'
=> lang('Score'),
- 'value_score'
=> $values['score'],
- 'lang_done_statustext' =>
lang('Back to the list'),
- 'value_cat_id'
=> $values['cat_id'],
- 'cat_list'
=> $this->bo->select_category_request_list('select',$values['cat_id']),
-
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=> $this->bocommon->get_user_list('select',$values['coordinator']),
-
- 'status_list'
=> $this->boproject->select_status_list('select',$values['status']),
- 'lang_status'
=> lang('Status'),
-
- 'branch_list'
=> $this->boproject->select_branch_list($values['branch_id']),
- 'lang_branch'
=> lang('branch'),
-
- 'edit_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.edit&id='
. $id),
- 'lang_edit_statustext'
=> lang('Edit this entry request'),
- 'lang_edit'
=> lang('Edit'),
- 'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
- );
-
- $appname
= lang('request');
-
- $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_uirequest
+ {
+ var $grants;
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $part_of_town_id;
+ var $sub;
+ var $currentapp;
+
+ var $public_functions = array
+ (
+ 'index' => True,
+ 'view' => True,
+ 'edit' => True,
+ 'delete' => True,
+ 'priority_key' => True
+ );
+
+ function property_uirequest()
+ {
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
+ $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->account =
$GLOBALS['phpgw_data']['user']['id'];
+ $this->bo =
CreateObject($this->currentapp.'_borequest',True);
+ $this->boproject =
CreateObject($this->currentapp.'_boproject');
+ $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
+ $this->menu =
CreateObject($this->currentapp.'_menu');
+ $this->bolocation =
CreateObject($this->currentapp.'_bolocation');
+ $this->config =
CreateObject('phpgwapi_config');
+ $this->fm_session =
CreateObject($this->currentapp.'_session');
+
+ $this->acl2 =
$GLOBALS['phpgw']->acl;
+ $this->acl2_location = '.project';
+ $this->acl_read =
$this->acl2->check('.project',1);
+ $this->acl_add =
$this->acl2->check('.project',2);
+ $this->acl_edit =
$this->acl2->check('.project',4);
+ $this->acl_delete =
$this->acl2->check('.project',8);
+ $this->acl_manage =
$this->acl2->check('.project',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->status_id =
$this->bo->status_id;
+
+ $this->menu->sub ='project';
+ }
+
+ 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,
+ 'status_id' => $this->status_id
+ );
+ $this->bo->save_sessiondata($data);
+ }
+
+ 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('request','table_header',
+
'menu',
+
'nextmatchs',
+
'search_field'));
+
+ $project_id =
get_var('project_id',array('POST','GET')); // lookup for maintenance planning
+
+ if($project_id)
+ {
+ $lookup = True;
+ }
+ $links = $this->menu->links('request');
+
+ $request_list = $this->bo->read($project_id);
+
+//html_print_r($request_list);
+
+ $uicols = $this->bo->uicols;
+//html_print_r($uicols);
+
+ $j=0;
+ while (is_array($request_list) && list(,$request_entry)
= each($request_list))
+ {
+ for ($k=0;$k<count($uicols['name']);$k++)
+ {
+ if($uicols['input_type'][$k]!='hidden')
+ {
+
+
if($request_entry['query_location'][$uicols['name'][$k]])
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('search');
+
$content[$j]['row'][$k]['text'] =
$request_entry[$uicols['name'][$k]];
+
$content[$j]['row'][$k]['link'] =
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.index&query='
. $request_entry['query_location'][$uicols['name'][$k]] . '&project_id=' .
$project_id);
+ }
+ else
+ {
+
$content[$j]['row'][$k]['value'] =
$request_entry[$uicols['name'][$k]];
+
$content[$j]['row'][$k]['name'] = $uicols['name'][$k];
+ }
+
+ }
+
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('view the
request');
+ $content[$j]['row'][$k]['text']
= lang('view');
+ $content[$j]['row'][$k]['link']
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.view&id='
. $request_entry['request_id']);
+ $k++;
+ }
+
+ if($this->acl_edit)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('edit the
request');
+ $content[$j]['row'][$k]['text']
= lang('edit');
+ $content[$j]['row'][$k]['link']
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.edit&id='
. $request_entry['request_id']);
+ $k++;
+ }
+
+ if($this->acl_delete)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('delete the
request');
+ $content[$j]['row'][$k]['text']
= lang('delete');
+ $content[$j]['row'][$k]['link']
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.delete&id='
. $request_entry['request_id']);
+ $k++;
+ }
+
+ }
+ else
+ {
+ if($this->acl_read)
+ {
+
$content[$j]['row'][$k]['statustext'] = lang('view the
request');
+ $content[$j]['row'][$k]['text']
= lang('view');
+
$content[$j]['row'][$k]['target'] = '_blank';
+ $content[$j]['row'][$k]['link']
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.view&id='
. $request_entry['request_id']);
+
$content[$j]['row'][$k]['request_id'] =
$request_entry['request_id'];
+ $k++;
+ }
+
+ }
+
+ $j++;
+ }
+
+ for ($i=0;$i<count($uicols['descr']);$i++)
+ {
+ if($uicols['input_type'][$i]!='hidden')
+ {
+ $table_header[$i]['header'] =
$uicols['descr'][$i];
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ if($uicols['name'][$i]=='loc1')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'location_code',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'project_id'
=>$project_id,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='request_id')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'request_id',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'project_id'
=>$project_id,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='score')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'score',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'project_id'
=>$project_id,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ if($uicols['name'][$i]=='address')
+ {
+ $table_header[$i]['sort_link']
=true;
+ $table_header[$i]['sort']
= $this->bocommon->show_sort_order(array
+
(
+
'sort' => $this->sort,
+
'var' => 'address',
+
'order' => $this->order,
+
'extra' => array('sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
+
'type_id'
=>$type_id,
+
'query'
=>$this->query,
+
'project_id'
=>$project_id,
+
'district_id' =>
$this->district_id,
+
'cat_id'
=>$this->cat_id)
+
));
+ }
+ }
+ }
+
+ if($this->acl_read)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('view');
+ $i++;
+ }
+
+ if(!$lookup)
+ {
+ if($this->acl_edit)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('edit');
+ $i++;
+ }
+ if($this->acl_delete)
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header']
= lang('delete');
+ $i++;
+ }
+ }
+ else
+ {
+ $table_header[$i]['width']
= '5%';
+ $table_header[$i]['align']
= 'center';
+ $table_header[$i]['header'] =
lang('select');
+ }
+
+//html_print_r($content);
+ if($this->acl_add)
+ {
+ $table_add[] = array
+ (
+ 'lang_add'
=> lang('add'),
+ 'lang_add_statustext' => lang('add a
request'),
+ 'add_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.edit')
+ );
+ }
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uirequest.index',
+ 'sort'
=>$this->sort,
+ 'order'
=>$this->order,
+ 'cat_id'
=>$this->cat_id,
+ 'district_id'
=>$this->district_id,
+ 'filter'
=>$this->filter,
+ 'status_id'
=>$this->status_id,
+ 'project_id' =>$project_id,
+ 'query'
=>$this->query
+ );
+
+
+ if($this->acl_manage)
+ {
+ $link_priority_key
=
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.priority_key');
+ }
+
+ $data = array
+ (
+ 'lang_priority_key'
=> lang('Priority key'),
+ 'lang_priority_help'
=> lang('To alter the priority key'),
+ 'link_priority_key'
=> $link_priority_key,
+ 'overlib_source'
=> './'.$this->currentapp.'/inc/overlib.js',
+ 'lang_select'
=> lang('select'),
+
+ 'lang_update_project'
=> lang('Update project'),
+ 'lang_add_to_project_statustext' =>
lang('add selected request to project'),
+ 'add_to_project_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiproject.edit&id='
. $project_id),
+ 'project_id'
=> $project_id,
+
+ 'lookup'
=> $lookup,
+ 'links'
=> $links,
+ 'allow_allrows'
=> false,
+ 'start_record'
=> $this->start,
+ 'record_limit'
=> 15, //$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'num_records'
=> count($request_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 request belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'cat_id',
+ 'cat_list'
=> $this->bo->select_category_request_list('filter',$this->cat_id),
+ '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',
+ 'select_action'
=> $this->bocommon->link('/index.php',$link_data),
+
+ 'lang_status_statustext' =>
lang('Select the status the agreement belongs to. To do not use a category
select NO STATUS'),
+ 'status_name'
=> 'status_id',
+ 'lang_no_status'
=> lang('No status'),
+ 'status_list'
=> $this->boproject->select_status_list('filter',$this->status_id),
+
+ 'lang_user_statustext' =>
lang('Select the user the request belongs to. To do not use a category select
NO USER'),
+ 'select_user_name'
=> 'filter',
+ 'lang_no_user'
=> lang('No user'),
+ 'user_list'
=> $this->bocommon->get_user_list('filter',$this->filter),
+
+ '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
+ );
+
+ $appname
= lang('request');
+ $function_msg =
lang('list request');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ //$this->save_sessiondata();
+ return array('list' => $data);
+ }
+
+
+ function priority_key()
+ {
+ if(!$this->acl_manage)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=16&acl_location='
. $this->acl2_location);
+ }
+ $this->bocommon->xsl_add_file(array('request'));
+ $GLOBALS['phpgw_info']['flags']['headonly']=true;
+ $values = get_var('values',array('POST','GET'));
+
+ if($values['update'])
+ {
+ $receipt =
$this->bo->update_priority_key($values);
+ }
+
+ $function_msg = lang('Edit priority key');
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uirequest.priority_key');
+
+ $priority_key = $this->bo->read_priority_key();
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'function_msg'
=> $function_msg,
+ 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'lang_safety'
=> lang('safety'),
+ 'lang_aesthetics'
=> lang('aesthetics'),
+ 'lang_indoor_climate' =>
lang('indoor climate'),
+ 'lang_consequential_damage' =>
lang('consequential damage'),
+ 'lang_user_gratification' =>
lang('user gratification'),
+ 'lang_residential_environment' =>
lang('residential environment'),
+ 'lang_authorities_demands' =>
lang('authorities demands'),
+ 'safety'
=> $priority_key['safety'],
+ 'aesthetics'
=> $priority_key['aesthetics'],
+ 'indoor_climate'
=> $priority_key['indoor_climate'],
+ 'consequential_damage' =>
$priority_key['consequential_damage'],
+ 'user_gratification' =>
$priority_key['user_gratification'],
+ 'residential_environment' =>
$priority_key['residential_environment'],
+ 'authorities_demands' =>
$priority_key['authorities_demands'],
+ 'lang_save'
=> lang('save'),
+ 'select_name'
=> 'period'
+ );
+
+ return array('priority_key' => $data);
+ }
+
+
+ function edit()
+ {
+ if(!$this->acl_add && !$this->acl_edit)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=2&acl_location='
. $this->acl2_location);
+ }
+ $id =
get_var('id',array('POST','GET'));
+ $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('request'));
+
+ $bypass =
get_var('bypass',array('POST','GET'));
+
+ if($_POST && !$bypass)
+ {
+ 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
+ }
+ else
+ {
+ $location_code =
get_var('location_code',array('POST','GET'));
+ $tenant_id
= get_var('tenant_id',array('POST','GET'));
+ $ticket_id
= get_var('ticket_id',array('POST','GET'));
+
+ $p_entity_id =
get_var('p_entity_id',array('POST','GET'));
+ $p_cat_id =
get_var('p_cat_id',array('POST','GET'));
+ $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']
= get_var('p_num',array('POST','GET'));
+
+ if($p_entity_id && $p_cat_id)
+ {
+ $boadmin_entity =
CreateObject($this->currentapp.'_boadmin_entity');
+ $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($ticket_id)
+ {
+ $values['origin']= 'tts';
+ $values['origin_id']= $ticket_id;
+ }
+
+ if($location_code)
+ {
+ $values['location_data'] =
$this->bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num));
+ }
+
+ }
+
+ $values['start_date'] =
get_var('start_date',array('POST'));
+ $values['end_date'] =
get_var('end_date',array('POST'));
+
+//html_print_r($values);
+ $this->config->read_repository();
+
+ if ($values['save'])
+ {
+ if(!$values['location'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+ $error_id=true;
+ }
+
+ if(!$values['title'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a request TITLE !'));
+ $error_id=true;
+ }
+
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ $error_id=true;
+ }
+
+ if(!$values['status'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
+ }
+
+ if($id)
+ {
+ $values['request_id']=$id;
+ $action='edit';
+ }
+
+ if(!$receipt['error'])
+ {
+ if(!$id)
+ {
+
$values['request_id']=$this->bo->next_id();
+ $id = $values['request_id'];
+ }
+
+ if($values['copy_request'])
+ {
+ $action='add';
+ $values['request_id'] =
$this->bo->next_id();
+ $id = $values['request_id'];
+ }
+ $receipt =
$this->bo->save($values,$action);
+ $id = $values['request_id'];
+ $function_msg = lang('Edit request');
+
+ if ($values['notify'])
+ {
+
$coordinator_name=$GLOBALS['phpgw_info']['user']['fullname'];
+
$coordinator_email=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['email'];
+ $headers = "Return-Path: <".
$coordinator_email .">\r\n";
+ $headers .= "From: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
+ $headers .= "Bcc: " .
$coordinator_name . "<" . $coordinator_email .">\r\n";
+ $headers .= "Content-type:
text/plain; charset=iso-8859-1\r\n";
+
+ $subject = lang(notify).": ".
$values['request_id'];
+ $message = lang(request) . " "
. $values['request_id'] ." ". lang('is registered');
+
+ $mail_method=
$this->config->config_data['fmwrkorder_mail'];
+ if ($mail_method=='smtp'):
+ {
+ $bcc =
$coordinator_email;
+ $send =
CreateObject('phpgwapi_send');
+ $rcpt =
$send->msg('email', $values['mail_address'], $subject, stripslashes($message),
'', $cc, $bcc, $coordinator_email, $coordinator_name, 'plain');
+ }
+ elseif
($mail_method=='sendmail'):
+ {
+
$rcpt=mail($values['mail_address'],$subject,$message, $headers);
+ }
+ else:
+ {
+
$receipt['error'][]=array('msg'=>lang('Mailing method is not chosen! (admin
section)'));
+ }
+ endif;
+ }
+
+ if($rcpt)
+ {
+
$receipt['message'][]=array('msg'=>lang('%1 is
notified',$values['mail_address']));
+ }
+ }
+ else
+ {
+ if($values['location'])
+ {
+ $location_code=implode("-",
$values['location']);
+ $values['location_data'] =
$this->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']];
+ }
+ }
+ }
+
+ if(!$receipt['error'] && !$bypass && $id)
+ {
+ $values = $this->bo->read_single($id);
+ $record_history =
$this->bo->read_record_history($id);
+ }
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ if ($id)
+ {
+ $function_msg = lang('Edit request');
+ }
+ else
+ {
+ $function_msg = lang('Add request');
+ }
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+ $lookup_type='form';
+
+
$location_data=$this->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' => $lookup_type,
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('request'),
+ 'entity_data' => $values['p']
+ ));
+
+
+ if($values['origin']== 'tts')
+ {
+ $origin_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitts.view',
+ 'id' =>
$values['origin_id']
+ );
+ }
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uirequest.edit',
+ 'id' => $id
+ );
+
+ if(!$values['coordinator'])
+ {
+ $values['coordinator']=$this->account;
+ }
+
+
$supervisor_id=$GLOBALS['phpgw_info']['user']['preferences'][$this->currentapp]['approval_from'];
+
+ $notify =
$this->config->config_data['workorder_approval'];
+
+ if ($supervisor_id && ($notify=='yes'))
+ {
+ $prefs =
$this->bocommon->create_preferences($this->currentapp,$supervisor_id);
+ $supervisor_email = $prefs['email'];
+ }
+
+
+
+ $table_header_importance[] = array
+ (
+ 'lang_subject' =>
lang('Subject'),
+ 'lang_condition_degree' => lang('Condidtion
degree'),
+ 'lang_prob_worsening' => lang('Probability'),
+ 'lang_consequence' =>
lang('Consequence')
+ );
+
+ $importance_weight[] = array
+ (
+ 'lang_safety'
=> lang('Safety'),
+ 'lang_aesthetics'
=> lang('Aesthetics'),
+ 'lang_indoor_climate'
=> lang('Indoor climate'),
+ 'lang_consequential_damage'
=> lang('Consequential damage'),
+ 'lang_user_gratification'
=> lang('User gratification'),
+ 'lang_residential_environment'
=> lang('Residential environment'),
+
+ 'lang_degree_statustext'
=> lang('Select the appropriate condition degree'),
+ 'lang_probability_statustext'
=> lang('Select the appropriate propability for worsening of the
condition'),
+ 'lang_consequence_statustext'
=> lang('Select the appropriate consequence by breakdown of this
component for this theme'),
+
+
+ 'degree_list_safety'
=>
$this->bo->select_degree_list($values['d_safety'],'default_safety'),
+ 'degree_list_aesthetics'
=>
$this->bo->select_degree_list($values['d_aesthetics'],'default_aesthetics'),
+ 'degree_list_indoor_climate'
=>
$this->bo->select_degree_list($values['d_indoor_climate'],'default_climate'),
+ 'degree_list_consequential_damage'
=>
$this->bo->select_degree_list($values['d_consequential_damage'],'default_consequential_damage'),
+ 'degree_list_user_gratification'
=>
$this->bo->select_degree_list($values['d_user_gratification'],'default_gratification'),
+ 'degree_list_residential_environment'
=>
$this->bo->select_degree_list($values['d_residential_environment'],'default_environment'),
+
+
+ 'probability_list_safety'
=> $this->bo->select_probability_list($values['p_safety']),
+ 'probability_list_aesthetics'
=> $this->bo->select_probability_list($values['p_aesthetics']),
+ 'probability_list_indoor_climate'
=> $this->bo->select_probability_list($values['p_indoor_climate']),
+ 'probability_list_consequential_damage'
=> $this->bo->select_probability_list($values['p_consequential_damage']),
+ 'probability_list_user_gratification'
=> $this->bo->select_probability_list($values['p_user_gratification']),
+ 'probability_list_residential_environment'
=> $this->bo->select_probability_list($values['p_residential_environment']),
+
+ 'consequence_list_safety'
=> $this->bo->select_consequence_list($values['c_safety']),
+ 'consequence_list_aesthetics'
=> $this->bo->select_consequence_list($values['c_aesthetics']),
+ 'consequence_list_indoor_climate'
=> $this->bo->select_consequence_list($values['c_indoor_climate']),
+ 'consequence_list_consequential_damage'
=> $this->bo->select_consequence_list($values['c_consequential_damage']),
+ 'consequence_list_user_gratification'
=> $this->bo->select_consequence_list($values['c_user_gratification']),
+ 'consequence_list_residential_environment'
=> $this->bo->select_consequence_list($values['c_residential_environment']),
+
+ 'lang_authorities_demands'
=> lang('Authorities Demands'),
+ 'lang_authorities_demands_statustext'
=> lang('Is there a demand from the authorities to correct this
condition?'),
+ 'authorities_demands'
=> $values['authorities_demands']
+ );
+
+ if($values['project_id'])
+ {
+ $project_lookup_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uiproject.view'
+ );
+ }
+
+ $cal_info = $this->bocommon->jscalendar();
+ $jsDateFormat=$cal_info['jsDateFormat'];
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+ $data = array
+ (
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_origin'
=> lang('origin'),
+ 'lang_origin_statustext' =>
lang('Link to the origin for this request'),
+ 'link_origin'
=> $this->bocommon->link('/index.php',$origin_data),
+ 'value_origin'
=> $values['origin'],
+ 'value_origin_id'
=> $values['origin_id'],
+
+ 'lang_project'
=> lang('Project'),
+ 'lang_project_statustext' =>
lang('Link to the project originatet from this request'),
+ 'link_project'
=> $this->bocommon->link('/index.php',$project_lookup_data),
+ 'value_project_id'
=> $values['project_id'],
+
+
+ 'generate_project_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiproject.edit'),
+ 'lang_generate_project'
=> lang('Generate project'),
+ 'lang_generate_project_statustext' =>
lang('Generate a project from this request'),
+ 'location_code'
=> $values['location_code'],
+ 'p_num'
=> $values['p_num'],
+ 'p_entity_id'
=> $values['p_entity_id'],
+ 'p_cat_id'
=> $values['p_cat_id'],
+ 'tenant_id'
=> $values['tenant_id'],
+
+ 'lang_importance'
=> lang('Importance'),
+ 'table_header_importance' =>
$table_header_importance,
+ 'importance_weight'
=> $importance_weight,
+
+ 'lang_no_workorders' =>
lang('No workorder bugdet'),
+ 'workorder_link'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiworkorder.edit'),
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+
+ 'jsDateFormat'
=> $jsDateFormat,
+ 'date_img'
=> $cal_info['img'],
+ 'lang_datetitle'
=> lang('Select date'),
+ 'calendar_setup_start' =>
"Calendar.setup({inputField : 'start_date',ifFormat : '" . $jsDateFormat .
"',button : 'start_date-trigger'});",
+ 'calendar_setup_end' =>
"Calendar.setup({inputField : 'end_date',ifFormat : '" . $jsDateFormat .
"',button : 'end_date-trigger'});",
+
+ 'lang_start_date_statustext' => lang('Select
the estimated end date for the request'),
+ 'lang_start_date'
=> lang('request start date'),
+ 'value_start_date'
=> $values['start_date'],
+
+ 'lang_end_date_statustext' =>
lang('Select the estimated end date for the request'),
+ 'lang_end_date'
=> lang('request end date'),
+ 'value_end_date'
=> $values['end_date'],
+
+ 'lang_copy_request'
=> lang('Copy request ?'),
+ 'lang_copy_request_statustext' => lang('Choose
Copy request to copy this request to a new request'),
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'lang_power_meter_statustext' => lang('Enter
the power_meter'),
+ 'value_power_meter'
=> $values['power_meter'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $values['budget'],
+ 'lang_budget_statustext' =>
lang('Enter the budget'),
+
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'form',
+ 'form_action'
=> $this->bocommon->link('/index.php',$link_data),
+ 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.index'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+
+ 'lang_request_id'
=> lang('request ID'),
+ 'value_request_id'
=> $values['request_id'],
+
+ 'lang_title'
=> lang('Title'),
+ 'value_title'
=> $values['title'],
+ 'lang_title_statustext' =>
lang('Enter request Title'),
+
+ 'lang_descr_statustext' =>
lang('Enter a description of the request'),
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_score'
=> lang('Score'),
+ 'value_score'
=> $values['score'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'lang_save_statustext' =>
lang('Save the request'),
+ 'lang_no_cat'
=> lang('Select category'),
+ 'lang_cat_statustext' =>
lang('Select the category the request belongs to. To do not use a category
select NO CATEGORY'),
+ 'select_name'
=> 'values[cat_id]',
+ 'value_cat_id'
=> $values['cat_id'],
+ 'cat_list'
=> $this->bo->select_category_request_list('select',$values['cat_id']),
+
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_user_statustext' =>
lang('Select the coordinator the request belongs to. To do not use a category
select NO USER'),
+ 'select_user_name'
=> 'values[coordinator]',
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=>
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl2_location),
+
+ 'status_list'
=> $this->boproject->select_status_list('select',$values['status']),
+ 'select_status_name' =>
'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+ 'lang_status_statustext' =>
lang('What is the current status of this request ?'),
+
+ 'branch_list'
=> $this->boproject->select_branch_list($values['branch_id']),
+ 'lang_branch'
=> lang('branch'),
+ 'lang_no_branch'
=> lang('Select branch'),
+ 'lang_branch_statustext' =>
lang('Select the branches for this request'),
+
+ 'notify'
=> $notify,
+ 'lang_notify'
=> lang('Notify'),
+ 'lang_notify_statustext' =>
lang('Check this to notify your supervisor by email'),
+ 'value_notify_mail_address' =>
$supervisor_email,
+
+ 'currency'
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
+ );
+
+ $appname
= lang('request');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('edit' => $data);
+ }
+
+ function delete()
+ {
+ if(!$this->acl_delete)
+ {
+
$this->bocommon->redirect_link('/index.php','sid=cookie&op='.$this->currentapp.'.uilocation.stop&perm=8&acl_location='
. $this->acl2_location);
+ }
+
+ $id = get_var('id',array('POST','GET'));
+ $confirm = get_var('confirm',array('POST'));
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uirequest.index'
+ );
+
+ if (get_var('confirm',array('POST')))
+ {
+ $this->bo->delete($id);
+ Header('Location: ' .
$this->bocommon->link('/index.php',$link_data));
+ }
+
+ $this->bocommon->xsl_add_file(array('app_delete'));
+
+ $data = array
+ (
+ 'done_action' =>
$this->bocommon->link('/index.php',$link_data),
+ 'delete_action' =>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.delete&id='
. $id),
+ 'lang_confirm_msg' => lang('do you
really want to delete this entry'),
+ 'lang_yes' =>
lang('yes'),
+ 'lang_yes_statustext' => lang('Delete the
entry'),
+ 'lang_no_statustext' => lang('Back to the
list'),
+ 'lang_no' =>
lang('no')
+ );
+
+ $appname
= lang('request');
+ $function_msg =
lang('delete request');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+ return array('delete' => $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);
+ }
+
+ $id =
get_var('id',array('POST','GET'));
+
+ $this->bocommon->xsl_add_file(array('request'));
+
+ $values = $this->bo->read_single($id);
+
+ $record_history = $this->bo->read_record_history($id);
+
+ $table_header_history[] = array
+ (
+ 'lang_date' => lang('Date'),
+ 'lang_user' => lang('User'),
+ 'lang_action' => lang('Action'),
+ 'lang_new_value' => lang('New value')
+ );
+
+ $function_msg = lang('View request');
+
+ if ($values['cat_id'])
+ {
+ $this->cat_id = $values['cat_id'];
+ }
+
+
$location_data=$this->bolocation->initiate_ui_location(array(
+ 'values' =>
$values['location_data'],
+ 'type_id' =>
count(explode('-',$values['location_data']['location_code'])),
+ 'no_link' =>
False, // disable lookup links for location type less than type_id
+ 'tenant' =>
$values['location_data']['tenant_id'],
+ 'lookup_type' => 'view',
+ 'lookup_entity' =>
$this->bocommon->get_lookup_entity('project'),
+ 'entity_data' => $values['p']
+ ));
+
+
+
+ $link_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uirequest.edit',
+ 'id' => $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));
+
+
+ $table_header_importance[] = array
+ (
+ 'lang_subject' =>
lang('Subject'),
+ 'lang_condition_degree' => lang('Condidtion
degree'),
+ 'lang_prob_worsening' => lang('Probability'),
+ 'lang_consequence' =>
lang('Consequence')
+ );
+
+ $importance_weight[] = array
+ (
+ 'lang_safety'
=> lang('Safety'),
+ 'lang_aesthetics'
=> lang('Aesthetics'),
+ 'lang_indoor_climate'
=> lang('Indoor climate'),
+ 'lang_consequential_damage'
=> lang('Consequential damage'),
+ 'lang_user_gratification'
=> lang('User gratification'),
+ 'lang_residential_environment'
=> lang('Residential environment'),
+
+ 'degree_safety'
=> $values['d_safety'],
+ 'degree_aesthetics'
=> $values['d_aesthetics'],
+ 'degree_indoor_climate'
=> $values['d_indoor_climate'],
+ 'degree_consequential_damage'
=> $values['d_consequential_damage'],
+ 'degree_user_gratification'
=> $values['d_user_gratification'],
+ 'degree_residential_environment'
=> $values['d_residential_environment'],
+
+ 'probability_safety'
=> $values['p_safety'],
+ 'probability_aesthetics'
=> $values['p_aesthetics'],
+ 'probability_indoor_climate'
=> $values['p_indoor_climate'],
+ 'probability_consequential_damage'
=> $values['p_consequential_damage'],
+ 'probability_user_gratification'
=> $values['p_user_gratification'],
+ 'probability_residential_environment' =>
$values['p_residential_environment'],
+
+ 'consequence_safety'
=> $values['c_safety'],
+ 'consequence_aesthetics'
=> $values['c_aesthetics'],
+ 'consequence_indoor_climate'
=> $values['c_indoor_climate'],
+ 'consequence_consequential_damage'
=> $values['c_consequential_damage'],
+ 'consequence_user_gratification'
=> $values['c_user_gratification'],
+ 'consequence_residential_environment' =>
$values['c_residential_environment'],
+
+ 'lang_authorities_demands'
=> lang('Authorities Demands'),
+ 'authorities_demands'
=> $values['authorities_demands']
+ );
+
+
+ if($values['origin']== 'tts')
+ {
+ $origin_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uitts.view',
+ 'id' =>
$values['origin_id']
+ );
+ }
+
+ if($values['project_id'])
+ {
+ $project_lookup_data = array
+ (
+ 'sid=cookie&op' =>
$this->currentapp.'.uiproject.view'
+ );
+ }
+
+ $data = array
+ (
+ 'lang_origin'
=> lang('origin'),
+ 'lang_origin_statustext' =>
lang('Link to the origin for this request'),
+ 'link_origin'
=> $this->bocommon->link('/index.php',$origin_data),
+ 'value_origin_id'
=> $values['origin_id'],
+
+ 'lang_project'
=> lang('Project'),
+ 'lang_project_statustext' =>
lang('Link to the project originatet from this request'),
+ 'link_project'
=> $this->bocommon->link('/index.php',$project_lookup_data),
+ 'value_project_id'
=> $values['project_id'],
+
+ 'lang_importance'
=> lang('Importance'),
+ 'table_header_importance' =>
$table_header_importance,
+ 'importance_weight_view' =>
$importance_weight,
+
+ 'workorder_link'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uiworkorder.edit'),
+ 'record_history'
=> $record_history,
+ 'table_header_history' =>
$table_header_history,
+ 'lang_history'
=> lang('History'),
+ 'lang_no_history'
=> lang('No history'),
+
+ 'lang_start_date'
=> lang('request start date'),
+ 'value_start_date'
=> $values['start_date'],
+
+ 'lang_end_date'
=> lang('request end date'),
+ 'value_end_date'
=> $values['end_date'],
+
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'value_power_meter'
=> $values['power_meter'],
+
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> $values['budget'],
+
+ 'location_data'
=> $location_data,
+ 'location_type'
=> 'view',
+ 'done_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.index'),
+ 'lang_category'
=> lang('category'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+
+ 'lang_request_id'
=> lang('request ID'),
+ 'value_request_id'
=> $values['request_id'],
+
+ 'lang_title'
=> lang('Title'),
+ 'value_title'
=> $values['title'],
+
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
+ 'lang_score'
=> lang('Score'),
+ 'value_score'
=> $values['score'],
+ 'lang_done_statustext' =>
lang('Back to the list'),
+ 'value_cat_id'
=> $values['cat_id'],
+ 'cat_list'
=> $this->bo->select_category_request_list('select',$values['cat_id']),
+
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_no_user'
=> lang('Select coordinator'),
+ 'user_list'
=> $this->bocommon->get_user_list('select',$values['coordinator']),
+
+ 'status_list'
=> $this->boproject->select_status_list('select',$values['status']),
+ 'lang_status'
=> lang('Status'),
+
+ 'branch_list'
=> $this->boproject->select_branch_list($values['branch_id']),
+ 'lang_branch'
=> lang('branch'),
+
+ 'edit_action'
=>
$this->bocommon->link('/index.php','sid=cookie&op='.$this->currentapp.'.uirequest.edit&id='
. $id),
+ 'lang_edit_statustext'
=> lang('Edit this entry request'),
+ 'lang_edit'
=> lang('Edit'),
+ 'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency']
+ );
+
+ $appname
= lang('request');
+
+ $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.uirequest.php, 1.1.1.3,
nomail <=