[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8436] property: cleanup
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8436] property: cleanup |
Date: |
Sun, 25 Dec 2011 20:48:29 +0000 |
Revision: 8436
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8436
Author: sigurdne
Date: 2011-12-25 20:48:28 +0000 (Sun, 25 Dec 2011)
Log Message:
-----------
property: cleanup
Modified Paths:
--------------
trunk/property/inc/class.uiproject.inc.php
trunk/property/inc/class.uiworkorder.inc.php
trunk/property/templates/base/project.xsl
Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php 2011-12-24 23:40:48 UTC (rev
8435)
+++ trunk/property/inc/class.uiproject.inc.php 2011-12-25 20:48:28 UTC (rev
8436)
@@ -926,275 +926,295 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('date_search' => $data));
}
- function edit()
+ function edit($mode = 'edit')
{
$id = (int)phpgw::get_var('id', 'int');
- if(!$this->acl_add && !$this->acl_edit)
+
+ if($mode == 'edit' && (!$this->acl_add &&
!$this->acl_edit))
{
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiproject.view', 'id'=> $id));
}
- $values =
phpgw::get_var('values');
- $values_attribute =
phpgw::get_var('values_attribute');
- $add_request =
phpgw::get_var('add_request');
- $values['project_group'] =
phpgw::get_var('project_group');
- $values['ecodimb'] =
phpgw::get_var('ecodimb');
- $values['b_account_id'] =
phpgw::get_var('b_account_id', 'int', 'POST');
- $values['b_account_name'] =
phpgw::get_var('b_account_name', 'string', 'POST');
- $values['contact_id'] =
phpgw::get_var('contact', 'int', 'POST');
- $auto_create = false;
+ if($mode == 'view')
+ {
+ if( !$this->acl_read)
+ {
+ $this->bocommon->no_access();
+ return;
+ }
- $location_id =
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
-
- $datatable = array();
-
- /*$datatable['config']['base_java_url'] =
"menuaction:'property.uiproject.edit',"
- ."id:'{$id}'";*/
-
- $config =
CreateObject('phpgwapi.config','property');
- $bolocation =
CreateObject('property.bolocation');
-
- $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record','property');
-
- $insert_record_entity =
$GLOBALS['phpgw']->session->appsession("insert_record_values{$this->acl_location}",'property');
-
- if(isset($insert_record_entity) &&
is_array($insert_record_entity))
+ if(!$id)
+ {
+ phpgwapi_cache::message_set('ID is
required for the function uiproject::view()', 'error');
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiproject.index'));
+ }
+ }
+ else
{
- for ($j=0;$j<count($insert_record_entity);$j++)
+ if(!$this->acl_add && !$this->acl_edit)
{
-
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
+ $this->bocommon->no_access();
+ return;
}
}
-
$GLOBALS['phpgw']->xslttpl->add_file(array('project','attributes_form'));
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
+ $config =
CreateObject('phpgwapi.config','property');
+ $config->read();
+ $bolocation =
CreateObject('property.bolocation');
- $bypass = phpgw::get_var('bypass', 'bool');
-
- if($add_request)
+ if($mode == 'edit')
{
- $receipt =
$this->bo->add_request($add_request,$id);
- }
- if($_POST && !$bypass && isset($insert_record) &&
is_array($insert_record))
- {
- $values =
$this->bocommon->collect_locationdata($values,$insert_record);
- }
- else
- {
- $location_code =
phpgw::get_var('location_code');
- $tenant_id =
phpgw::get_var('tenant_id', 'int');
- $values['descr'] =
phpgw::get_var('descr');
- $p_entity_id =
phpgw::get_var('p_entity_id', 'int');
- $p_cat_id =
phpgw::get_var('p_cat_id', 'int');
- $values['p'][$p_entity_id]['p_entity_id']
= $p_entity_id;
- $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
- $values['p'][$p_entity_id]['p_num']
= phpgw::get_var('p_num');
+ $values
= phpgw::get_var('values');
+ $values_attribute =
phpgw::get_var('values_attribute');
+ $add_request =
phpgw::get_var('add_request');
+ $values['project_group'] =
phpgw::get_var('project_group');
+ $values['ecodimb'] =
phpgw::get_var('ecodimb');
+ $values['b_account_id'] =
phpgw::get_var('b_account_id', 'int', 'POST');
+ $values['b_account_name'] =
phpgw::get_var('b_account_name', 'string', 'POST');
+ $values['contact_id'] =
phpgw::get_var('contact', 'int', 'POST');
+ $auto_create = false;
- $origin =
phpgw::get_var('origin');
- $origin_id =
phpgw::get_var('origin_id', 'int');
+ $datatable = array();
- //23.jun 08: This will be handled by the
interlink code - just doing a quick hack for now...
- if($origin == '.ticket' && $origin_id &&
!$values['descr'])
- {
- $boticket=
CreateObject('property.botts');
- $ticket =
$boticket->read_single($origin_id);
- $values['descr'] = $ticket['details'];
- $values['name'] = $ticket['subject'] ?
$ticket['subject'] : $ticket['category_name'];
- $ticket_notes =
$boticket->read_additional_notes($origin_id);
- $i = count($ticket_notes)-1;
-
if(isset($ticket_notes[$i]['value_note']) && $ticket_notes[$i]['value_note'])
- {
- $values['descr'] .= ": " .
$ticket_notes[$i]['value_note'];
- }
- $values['contact_id'] =
$ticket['contact_id'];
- $tts_status_create_project =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_create_project'])
?
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_create_project']
: '';
- if($tts_status_create_project)
- {
-
$boticket->update_status(array('status' => $tts_status_create_project),
$origin_id);
- }
+ $insert_record =
$GLOBALS['phpgw']->session->appsession('insert_record','property');
- if (
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['auto_create_project_from_ticket'])
- &&
$GLOBALS['phpgw_info']['user']['preferences']['property']['auto_create_project_from_ticket']
== 'yes')
- {
- $auto_create = true;
- }
- }
+ $insert_record_entity =
$GLOBALS['phpgw']->session->appsession("insert_record_values{$this->acl_location}",'property');
- if($p_entity_id && $p_cat_id)
+ if(isset($insert_record_entity) &&
is_array($insert_record_entity))
{
-
- if(!is_object($boadmin_entity))
+ for
($j=0;$j<count($insert_record_entity);$j++)
{
- $boadmin_entity =
CreateObject('property.boadmin_entity');
+
$insert_record['extra'][$insert_record_entity[$j]] =
$insert_record_entity[$j];
}
-
- $entity_category =
$boadmin_entity->read_single_category($p_entity_id,$p_cat_id);
-
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
}
- if($location_code)
- {
- $values['location_data'] =
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num,
'view' => true));
- }
- }
- if(isset($values['origin']) && $values['origin'])
- {
- $origin = $values['origin'];
- $origin_id = $values['origin_id'];
- }
+ $bypass = phpgw::get_var('bypass', 'bool');
- $interlink = CreateObject('property.interlink');
-
- if(isset($origin) && $origin)
- {
- unset($values['origin']);
- unset($values['origin_id']);
- $values['origin'][0]['location']= $origin;
- $values['origin'][0]['descr']=
$interlink->get_location_name($origin);
- $values['origin'][0]['data'][]= array(
- 'id' => $origin_id,
- 'link' =>
$interlink->get_relation_link(array('location' => $origin), $origin_id),
- );
- }
-
- $config->read();
-
- $save='';
- if (isset($values['save']))
- {
- if($GLOBALS['phpgw']->session->is_repost())
+ if($add_request)
{
-
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
+ $receipt =
$this->bo->add_request($add_request,$id);
}
- $save=true;
-
- if(!isset($values['location']))
+ if($_POST && !$bypass && isset($insert_record)
&& is_array($insert_record))
{
-
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
- $error_id=true;
+ $values =
$this->bocommon->collect_locationdata($values,$insert_record);
}
-
- if(!isset($values['b_account_id']) ||
!$values['b_account_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select an account group!'));
- $error_id=true;
- }
else
{
- $sogeneric =
CreateObject('property.sogeneric');
-
$sogeneric->get_location_info('b_account_category',false);
- $status_data =
$sogeneric->read_single(array('id' => (int)$values['b_account_id']),array());
+ $location_code =
phpgw::get_var('location_code');
+ $tenant_id =
phpgw::get_var('tenant_id', 'int');
+ $values['descr'] =
phpgw::get_var('descr');
+ $p_entity_id =
phpgw::get_var('p_entity_id', 'int');
+ $p_cat_id =
phpgw::get_var('p_cat_id', 'int');
+
$values['p'][$p_entity_id]['p_entity_id'] = $p_entity_id;
+ $values['p'][$p_entity_id]['p_cat_id']
= $p_cat_id;
+ $values['p'][$p_entity_id]['p_num']
= phpgw::get_var('p_num');
- if(isset($status_data['project_group'])
&& $status_data['project_group'])//mandatory for this account group
+ $origin =
phpgw::get_var('origin');
+ $origin_id =
phpgw::get_var('origin_id', 'int');
+
+ //23.jun 08: This will be handled by
the interlink code - just doing a quick hack for now...
+ if($origin == '.ticket' && $origin_id
&& !$values['descr'])
{
-
if(!isset($values['project_group']) || !$values['project_group'])
+ $boticket=
CreateObject('property.botts');
+ $ticket =
$boticket->read_single($origin_id);
+ $values['descr'] =
$ticket['details'];
+ $values['name'] =
$ticket['subject'] ? $ticket['subject'] : $ticket['category_name'];
+ $ticket_notes =
$boticket->read_additional_notes($origin_id);
+ $i = count($ticket_notes)-1;
+
if(isset($ticket_notes[$i]['value_note']) && $ticket_notes[$i]['value_note'])
{
-
$receipt['error'][]=array('msg'=>lang('Please select a project group!'));
- $error_id=true;
+ $values['descr'] .= ":
" . $ticket_notes[$i]['value_note'];
}
+ $values['contact_id'] =
$ticket['contact_id'];
+ $tts_status_create_project
=
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_create_project'])
?
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_status_create_project']
: '';
+ if($tts_status_create_project)
+ {
+
$boticket->update_status(array('status' => $tts_status_create_project),
$origin_id);
+ }
+
+ if (
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['auto_create_project_from_ticket'])
+ &&
$GLOBALS['phpgw_info']['user']['preferences']['property']['auto_create_project_from_ticket']
== 'yes')
+ {
+ $auto_create = true;
+ }
}
- }
- if(!isset($values['end_date']) ||
!$values['end_date'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select an end date!'));
- $error_id=true;
- }
+ if($p_entity_id && $p_cat_id)
+ {
+ if(!is_object($boadmin_entity))
+ {
+ $boadmin_entity =
CreateObject('property.boadmin_entity');
+ }
- if(!$values['name'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please enter a project NAME !'));
- $error_id=true;
- }
+ $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(!$values['cat_id'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
- $error_id=true;
- }
+ if($location_code)
+ {
+ $values['location_data'] =
$bolocation->read_single($location_code,array('tenant_id'=>$tenant_id,'p_num'=>$p_num,
'view' => true));
+ }
- if(!$values['coordinator'])
- {
-
$receipt['error'][]=array('msg'=>lang('Please select a coordinator !'));
- $error_id=true;
}
- if(!$values['status'])
+ if(isset($values['origin']) &&
$values['origin'])
{
-
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
- $error_id=true;
+ $origin = $values['origin'];
+ $origin_id = $values['origin_id'];
}
- if(isset($values['budget']) &&
$values['budget'] && !ctype_digit(ltrim($values['budget'],'-')))
- {
-
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an
integer !'));
- $error_id=true;
- }
+ $interlink =
CreateObject('property.interlink');
- if(isset($values['reserve']) &&
$values['reserve'] && !ctype_digit(ltrim($values['reserve'],'-')))
+ if(isset($origin) && $origin)
{
-
$receipt['error'][]=array('msg'=>lang('reserve') . ': ' . lang('Please enter an
integer !'));
- $error_id=true;
+ unset($values['origin']);
+ unset($values['origin_id']);
+ $values['origin'][0]['location']=
$origin;
+ $values['origin'][0]['descr']=
$interlink->get_location_name($origin);
+ $values['origin'][0]['data'][]= array(
+ 'id' => $origin_id,
+ 'link' =>
$interlink->get_relation_link(array('location' => $origin), $origin_id),
+ );
}
- if(isset($values_attribute) &&
is_array($values_attribute))
+
+ $save='';
+ if (isset($values['save']))
{
- foreach ($values_attribute as
$attribute )
+
if($GLOBALS['phpgw']->session->is_repost())
{
- if($attribute['nullable'] != 1
&& (!$attribute['value'] && !$values['extra'][$attribute['name']]))
+
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
+ }
+
+ $save=true;
+
+ if(!isset($values['location']))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
+ $error_id=true;
+ }
+
+ if(!isset($values['b_account_id']) ||
!$values['b_account_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select an account group!'));
+ $error_id=true;
+ }
+ else
+ {
+ $sogeneric =
CreateObject('property.sogeneric');
+
$sogeneric->get_location_info('b_account_category',false);
+ $status_data =
$sogeneric->read_single(array('id' => (int)$values['b_account_id']),array());
+
+
if(isset($status_data['project_group']) &&
$status_data['project_group'])//mandatory for this account group
{
-
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1',
$attribute['input_text']));
+
if(!isset($values['project_group']) || !$values['project_group'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a project group!'));
+ $error_id=true;
+ }
}
}
- }
+ if(!isset($values['end_date']) ||
!$values['end_date'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select an end date!'));
+ $error_id=true;
+ }
- if($id)
- {
- $values['id'] = $id;
- $action='edit';
- }
+ if(!$values['name'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a project NAME !'));
+ $error_id=true;
+ }
- if(!$receipt['error'])
- {
+ if(!$values['cat_id'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a category !'));
+ $error_id=true;
+ }
- if($values['copy_project'])
+ if(!$values['coordinator'])
{
- $action='add';
+
$receipt['error'][]=array('msg'=>lang('Please select a coordinator !'));
+ $error_id=true;
}
- $receipt =
$this->bo->save($values,$action,$values_attribute);
+ if(!$values['status'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please select a status !'));
+ $error_id=true;
+ }
- if (! $receipt['error'])
+ if(isset($values['budget']) &&
$values['budget'] && !ctype_digit(ltrim($values['budget'],'-')))
{
- $id = $receipt['id'];
+
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an
integer !'));
+ $error_id=true;
}
- if (
isset($GLOBALS['phpgw_info']['server']['smtp_server'])
- &&
$GLOBALS['phpgw_info']['server']['smtp_server'] )
- //
&& $config->config_data['project_approval'] )
+ if(isset($values['reserve']) &&
$values['reserve'] && !ctype_digit(ltrim($values['reserve'],'-')))
{
- $historylog =
CreateObject('property.historylog','project');
- if
(!is_object($GLOBALS['phpgw']->send))
+
$receipt['error'][]=array('msg'=>lang('reserve') . ': ' . lang('Please enter an
integer !'));
+ $error_id=true;
+ }
+
+ if(isset($values_attribute) &&
is_array($values_attribute))
+ {
+ foreach ($values_attribute as
$attribute )
{
- $GLOBALS['phpgw']->send
= CreateObject('phpgwapi.send');
+
if($attribute['nullable'] != 1 && (!$attribute['value'] &&
!$values['extra'][$attribute['name']]))
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1',
$attribute['input_text']));
+ }
}
+ }
- $action_params['responsible'] =
$_account_id;
-
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
-
$from_email=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+ if($id)
+ {
+ $values['id'] = $id;
+ $action='edit';
+ }
- $subject = lang(Approval).": ".
$id;
- $message = '<a href ="' .
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.edit','id'=> $id),false,true).'">' . lang('project %1 needs
approval',$id) .'</a>';
+ if(!$receipt['error'])
+ {
+ if($values['copy_project'])
+ {
+ $action='add';
+ }
- $bcc = '';//$from_email;
+ $receipt =
$this->bo->save($values,$action,$values_attribute);
- $action_params = array
+ if (! $receipt['error'])
+ {
+ $id = $receipt['id'];
+ }
+
+ if (
isset($GLOBALS['phpgw_info']['server']['smtp_server'])
+ &&
$GLOBALS['phpgw_info']['server']['smtp_server'] )
+ // &&
$config->config_data['project_approval'] )
+ {
+ $historylog =
CreateObject('property.historylog','project');
+ if
(!is_object($GLOBALS['phpgw']->send))
+ {
+
$GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
+ }
+
+
$action_params['responsible'] = $_account_id;
+
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
+
$from_email=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+
+ $subject =
lang(Approval).": ". $id;
+ $message = '<a href ="'
. $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.edit','id'=> $id),false,true).'">' . lang('project %1 needs
approval',$id) .'</a>';
+
+ $bcc = '';//$from_email;
+
+ $action_params = array
(
'appname'
=> 'property',
'location'
=> '.project',
@@ -1202,130 +1222,130 @@
'responsible'
=> '',
'responsible_type' => 'user',
'action'
=> 'approval',
-
'remark'
=> '',
'deadline'
=> ''
);
- if
(isset($values['mail_address']) && is_array($values['mail_address']))
- {
- foreach
($values['mail_address'] as $_account_id => $_address)
+ if
(isset($values['mail_address']) && is_array($values['mail_address']))
{
-
if(isset($values['approval'][$_account_id]) &&
$values['approval'][$_account_id])
+ foreach
($values['mail_address'] as $_account_id => $_address)
{
- $rcpt =
$GLOBALS['phpgw']->send->msg('email',$_address, $subject,
stripslashes($message), '', $cc, $bcc, $from_email, $from_name, 'html');
-
$action_params['responsible'] = $_account_id;
-
execMethod('property.sopending_action.set_pending_action', $action_params);
-
if(!$rcpt)
+
if(isset($values['approval'][$_account_id]) &&
$values['approval'][$_account_id])
{
-
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '" .
$_address . "', subject='$subject' failed !!!");
-
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
-
$bypass_error=true;
+
$rcpt = $GLOBALS['phpgw']->send->msg('email',$_address, $subject,
stripslashes($message), '', $cc, $bcc, $from_email, $from_name, 'html');
+
$action_params['responsible'] = $_account_id;
+
execMethod('property.sopending_action.set_pending_action', $action_params);
+
if(!$rcpt)
+
{
+
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to
'" . $_address . "', subject='$subject' failed !!!");
+
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
+
$bypass_error=true;
+
}
+
else
+
{
+
$historylog->add('AP', $id, lang('%1 is notified',$_address));
+
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
+
}
}
- else
- {
-
$historylog->add('AP', $id, lang('%1 is notified',$_address));
-
$receipt['message'][]=array('msg'=>lang('%1 is notified',$_address));
- }
}
}
- }
- $toarray = array();
- $toarray_sms = array();
- if
(isset($receipt['notice_owner']) && is_array($receipt['notice_owner']) )
- {
-
if($this->account!=$values['coordinator']
- &&
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['notify_project_owner'])
&&
$GLOBALS['phpgw_info']['user']['preferences']['property']['notify_project_owner']
- //
&&
$config->config_data['mailnotification']
- )
+ $toarray = array();
+ $toarray_sms = array();
+ if
(isset($receipt['notice_owner']) && is_array($receipt['notice_owner']) )
{
-
$prefs_coordinator =
$this->bocommon->create_preferences('property',$values['coordinator']);
- $toarray[] =
$prefs_coordinator['email'];
+
if($this->account!=$values['coordinator']
+ &&
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['notify_project_owner'])
&&
$GLOBALS['phpgw_info']['user']['preferences']['property']['notify_project_owner']
+ // &&
$config->config_data['mailnotification']
+ )
+ {
+
$prefs_coordinator =
$this->bocommon->create_preferences('property',$values['coordinator']);
+
$toarray[] = $prefs_coordinator['email'];
+ }
}
- }
- $notify_list =
execMethod('property.notify.read', array
+ $notify_list =
execMethod('property.notify.read', array
(
'location_id' => $location_id,
'location_item_id' => $id
)
);
- $subject=lang('project %1 has
been edited',$id);
- $sms_text = "{$subject}.
\r\n{$GLOBALS['phpgw_info']['user']['fullname']}
\r\n{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}";
- $sms =
CreateObject('sms.sms');
+ $subject=lang('project
%1 has been edited',$id);
+ $sms_text =
"{$subject}. \r\n{$GLOBALS['phpgw_info']['user']['fullname']}
\r\n{$GLOBALS['phpgw_info']['user']['preferences']['property']['email']}";
+ $sms =
CreateObject('sms.sms');
- foreach($notify_list as $entry)
- {
- if($entry['is_active']
&& $entry['notification_method'] == 'email' && $entry['email'])
+ foreach($notify_list as
$entry)
{
- $toarray[] =
"{$entry['first_name']} {$entry['last_name']}<{$entry['email']}>";
+
if($entry['is_active'] && $entry['notification_method'] == 'email' &&
$entry['email'])
+ {
+
$toarray[] = "{$entry['first_name']} {$entry['last_name']}<{$entry['email']}>";
+ }
+ else
if($entry['is_active'] && $entry['notification_method'] == 'sms' &&
$entry['sms'])
+ {
+
$sms->websend2pv($this->account,$entry['sms'],$sms_text);
+
$toarray_sms[] = "{$entry['first_name']}
{$entry['last_name']}({$entry['sms']})";
+
$receipt['message'][]=array('msg'=>lang('%1 is
notified',"{$entry['first_name']} {$entry['last_name']}"));
+ }
}
- else
if($entry['is_active'] && $entry['notification_method'] == 'sms' &&
$entry['sms'])
+ unset($entry);
+
+ if($toarray_sms)
{
-
$sms->websend2pv($this->account,$entry['sms'],$sms_text);
- $toarray_sms[]
= "{$entry['first_name']} {$entry['last_name']}({$entry['sms']})";
-
$receipt['message'][]=array('msg'=>lang('%1 is
notified',"{$entry['first_name']} {$entry['last_name']}"));
+
$historylog->add('MS',$id,implode(',',$toarray_sms));
}
- }
- unset($entry);
-
- if($toarray_sms)
- {
-
$historylog->add('MS',$id,implode(',',$toarray_sms));
- }
- if ($toarray)
- {
- $to =
implode(';',$toarray);
-
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
-
$from_email=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+ if ($toarray)
+ {
+ $to =
implode(';',$toarray);
+
$from_name=$GLOBALS['phpgw_info']['user']['fullname'];
+
$from_email=$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
- $body = '<a href ="' .
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.edit', 'id'=> $id),false, true).'">' . lang('project %1 has
been edited',$id) .'</a>' . "\n";
+ $body = '<a
href ="' . $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.edit', 'id'=> $id),false, true).'">' . lang('project %1 has
been edited',$id) .'</a>' . "\n";
-
foreach($receipt['notice_owner'] as $notice)
- {
- $body .=
$notice . "\n";
- }
+
foreach($receipt['notice_owner'] as $notice)
+ {
+ $body
.= $notice . "\n";
+ }
- $body .= lang('Altered
by') . ': ' . $from_name . "\n";
- $body .= lang('remark')
. ': ' . $values['remark'] . "\n";
+ $body .=
lang('Altered by') . ': ' . $from_name . "\n";
+ $body .=
lang('remark') . ': ' . $values['remark'] . "\n";
- $body = nl2br($body);
+ $body =
nl2br($body);
- $returncode =
$GLOBALS['phpgw']->send->msg('email',$to,$subject,$body, false,false,false,
$from_email, $from_name, 'html');
+ $returncode =
$GLOBALS['phpgw']->send->msg('email',$to,$subject,$body, false,false,false,
$from_email, $from_name, 'html');
- if (!$returncode)
// not nice, but better than failing silently
- {
-
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '$to'
subject='$subject' failed !!!");
-
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
-
$bypass_error=true;
+ if
(!$returncode) // not nice, but better than failing silently
+ {
+
$receipt['error'][]=array('msg'=>"uiproject::edit: sending message to '$to'
subject='$subject' failed !!!");
+
$receipt['error'][]=array('msg'=> $GLOBALS['phpgw']->send->err['desc']);
+
$bypass_error=true;
+ }
+ else
+ {
+
$historylog->add('ON', $id, lang('%1 is notified',$to));
+
$receipt['message'][]=array('msg'=>lang('%1 is notified',$to));
+ }
}
- else
- {
-
$historylog->add('ON', $id, lang('%1 is notified',$to));
-
$receipt['message'][]=array('msg'=>lang('%1 is notified',$to));
- }
}
}
- }
- if($receipt['error'] && !isset($bypass_error))
- {
- if(isset($values['location']) &&
is_array($values['location']))
+ if($receipt['error'] &&
!isset($bypass_error))
{
- $location_code=implode("-",
$values['location']);
- $values['extra']['view'] = true;
- $values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
- }
+ if(isset($values['location'])
&& is_array($values['location']))
+ {
+
$location_code=implode("-", $values['location']);
+
$values['extra']['view'] = true;
+
$values['location_data'] =
$bolocation->read_single($location_code,$values['extra']);
+ }
- if(isset($values['extra']['p_num']))
- {
-
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
-
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
-
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=phpgw::get_var('entity_cat_name_'.$values['extra']['p_entity_id'],
'string', 'POST');
+
if(isset($values['extra']['p_num']))
+ {
+
$values['p'][$values['extra']['p_entity_id']]['p_num']=$values['extra']['p_num'];
+
$values['p'][$values['extra']['p_entity_id']]['p_entity_id']=$values['extra']['p_entity_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_id']=$values['extra']['p_cat_id'];
+
$values['p'][$values['extra']['p_entity_id']]['p_cat_name']=phpgw::get_var('entity_cat_name_'.$values['extra']['p_entity_id'],
'string', 'POST');
+ }
}
}
}
@@ -1364,6 +1384,7 @@
$values =
$this->bocommon->preserve_attribute_values($values,$values_attribute);
}
+/*
$table_header_history[] = array
(
'lang_date' => lang('Date'),
@@ -1382,9 +1403,10 @@
'lang_status' =>
lang('status')
);
+*/
if ($id)
{
- $function_msg = lang('Edit Project');
+ $function_msg = lang("{$mode} project");
}
else
{
@@ -1418,7 +1440,7 @@
$this->cat_id = $values['cat_id'];
}
- $lookup_type='form';
+ $lookup_type = $mode == 'edit' ? 'form' : 'view';
//_debug_array($values);
$location_data=$bolocation->initiate_ui_location(array
@@ -1443,15 +1465,16 @@
'b_account_id' =>
$values['b_account_id'],
'b_account_name' =>
$values['b_account_name'],
'role'
=> 'group',
- // 'disabled'
=> isset($values['workorder_budget'][0]['b_account_id']) &&
$values['workorder_budget'][0]['b_account_id'] ? true : false
+ 'type'
=> $lookup_type
)
);
$ecodimb_data=$this->bocommon->initiate_ecodimb_lookup(array
(
'ecodimb'
=> $values['ecodimb'],
- 'ecodimb_descr' =>
$values['ecodimb_descr'])
- );
+ 'ecodimb_descr' =>
$values['ecodimb_descr'],
+ 'disabled'
=> $mode == 'view'
+ ));
}
$contact_data=$this->bocommon->initiate_ui_contact_lookup(array
@@ -1459,7 +1482,8 @@
'contact_id' =>
$values['contact_id'],
'contact_name' =>
$values['contact_name'],
'field' =>
'contact',
- 'type' =>
'form')
+ 'type' =>
$lookup_type
+ )
);
@@ -1475,10 +1499,10 @@
}
$link_data = array
- (
- 'menuaction' =>
'property.uiproject.edit',
- 'id' => $id
- );
+ (
+ 'menuaction' => 'property.uiproject.edit',
+ 'id' => $id
+ );
$link_request_data = array
(
@@ -1706,8 +1730,11 @@
$myColumnDefs[] = $notify_info['column_defs'];
- $myButtons = array();
- $myButtons[] = $notify_info['buttons'];
+ $myButtons = array();
+ if($mode == 'edit')
+ {
+ $myButtons[] = $notify_info['buttons'];
+ }
// _debug_array($myButtons);die();
//----------------------------------------------datatable settings--------
@@ -1718,6 +1745,7 @@
$data = array
(
+ 'mode'
=> $mode,
'suppressmeter'
=> isset($config->config_data['project_suppressmeter']) &&
$config->config_data['project_suppressmeter'] ? 1 : '',
'suppresscoordination'
=> $suppresscoordination,
'custom_attributes'
=> array('attributes' => $values['attributes']),
@@ -1850,7 +1878,11 @@
'value_approval_mail_address'
=> $supervisor_email,
'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
- 'base_java_url'
=>
"{menuaction:'property.notify.update_data',location_id:{$location_id},location_item_id:{$id}}",
+ 'base_java_url'
=>
"{menuaction:'property.notify.update_data',location_id:{$location_id},location_item_id:{$id}}",
+ 'edit_action'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'property.uiproject.edit', 'id' => $id)),
+ 'lang_edit_statustext'
=> lang('Edit this entry '),
+ 'lang_edit'
=> lang('Edit'),
+
);
//_debug_array($data);die;
@@ -1924,32 +1956,6 @@
$this->bo->delete($project_id);
return "project_id ".$project_id." ".lang("has
been deleted");
}
-
- $confirm = phpgw::get_var('confirm', 'bool',
'POST');
- $link_data = array
- (
- 'menuaction' =>
'property.uiproject.index',
- 'project_id' => $project_id
- );
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
-
- $data = array
- (
- 'done_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
- 'delete_action' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.delete', 'project_id'=> $project_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('project');
- $function_msg = lang('delete
project');
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
}
@@ -2126,201 +2132,14 @@
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('bulk_update_status' =>
$data));
}
-
function view()
{
if(!$this->acl_read)
{
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+ $this->bocommon->no_access();
+ return;
}
-
- $receipt =
$GLOBALS['phpgw']->session->appsession('receipt','property');
-
$GLOBALS['phpgw']->session->appsession('receipt','property','');
- $bolocation =
CreateObject('property.bolocation');
-
- $id = phpgw::get_var('id', 'int');
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('project','attributes_form'));
-
- $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')
- );
-
- $table_header_workorder_budget[] = array
- (
- 'lang_workorder_id' =>
lang('Workorder'),
- 'lang_budget' =>
lang('Budget'),
- 'lang_calculation' =>
lang('Calculation'),
- 'lang_vendor' =>
lang('Vendor')
- );
-
- $function_msg = lang('View Project');
-
- if ($values['cat_id'])
- {
- $this->cat_id = $values['cat_id'];
- }
-
- $location_data=$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' =>
isset($values['p'])?$values['p']:''
- ));
-
- if($values['contact_phone'])
- {
- for
($i=0;$i<count($location_data['location']);$i++)
- {
-
if($location_data['location'][$i]['input_name'] == 'contact_phone')
- {
-
unset($location_data['location'][$i]['value']);
- }
- }
- }
-
- $values['sum'] =
isset($values['budget'])?$values['budget']:0;
-
- if(isset($values['reserve']) && $values['reserve']!=0)
- {
-
$reserve_remainder=$values['reserve']-$values['deviation'];
- $remainder_percent=
number_format(($reserve_remainder/$values['reserve'])*100, 2, ',', '');
- $values['sum'] = $values['sum'] +
$values['reserve'];
- }
-
- //_debug_array($values);
- $msgbox_data = $this->bocommon->msgbox_data($receipt);
-
- $categories =
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id));
-
- $project_group_data =
$this->bocommon->initiate_project_group_lookup(array(
- 'project_group' =>
$values['project_group'],
- 'project_group_descr' =>
$values['project_group_descr'],
- 'type' =>
'view'));
-
- $config =
CreateObject('phpgwapi.config','property');
- $config->read();
-
- $suppresscoordination =
isset($config->config_data['project_suppresscoordination']) &&
$config->config_data['project_suppresscoordination'] ? 1 : '';
- $data = array
- (
- 'suppressmeter'
=> isset($config->config_data['project_suppressmeter']) &&
$config->config_data['project_suppressmeter'] ? 1 : '',
- 'suppresscoordination'
=> $suppresscoordination,
- 'tabs'
=> self::_generate_tabs(array(),array('coordination' =>
$suppresscoordination)),
-
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
-
- 'project_group_data'
=> $project_group_data,
- 'value_origin'
=> $values['origin'],
- 'custom_attributes'
=> array('attributes' => $values['attributes']),
-
- 'table_header_workorder_budget'
=> $table_header_workorder_budget,
- 'lang_no_workorders'
=> lang('No workorder budget'),
- 'workorder_link'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiworkorder.view')),
- 'record_history'
=> $record_history,
- 'table_header_history'
=> $table_header_history,
- 'lang_history'
=> lang('History'),
- 'lang_no_history'
=> lang('No history'),
-
- 'lang_start_date'
=> lang('Project start date'),
- 'value_start_date'
=> $values['start_date'],
-
- 'lang_end_date'
=> lang('Project end date'),
- 'value_end_date'
=> $values['end_date'],
-
- 'lang_charge_tenant'
=> lang('Charge tenant'),
- 'charge_tenant'
=> isset($values['charge_tenant'])?$values['charge_tenant']:'',
-
- 'lang_power_meter'
=> lang('Power meter'),
- 'value_power_meter'
=> $values['power_meter'],
-
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> $values['budget'],
-
- 'lang_reserve'
=> lang('reserve'),
- 'value_reserve'
=> $values['reserve'],
-
- 'value_sum'
=> (isset($values['sum'])?$values['sum']:''),
-
- 'lang_reserve_remainder'
=> lang('reserve remainder'),
- 'value_reserve_remainder'
=> isset($reserve_remainder)?$reserve_remainder:'',
- 'value_reserve_remainder_percent'
=> isset($remainder_percent)?$remainder_percent:'',
-
- 'vendor_data'
=> isset($vendor_data)?$vendor_data:'',
- 'location_data'
=> $location_data,
- 'location_type'
=> 'view',
- 'done_action'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.index')),
- 'lang_year'
=> lang('Year'),
- 'lang_category'
=> lang('category'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_name'
=> lang('Name'),
-
- 'lang_project_id'
=> lang('Project ID'),
- 'value_project_id'
=> $values['project_id'],
- 'value_name'
=> $values['name'],
-
- 'lang_other_branch'
=> lang('Other branch'),
- 'value_other_branch'
=> $values['other_branch'],
-
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
- 'lang_done_statustext'
=> lang('Back to the list'),
- 'select_name'
=> 'values[cat_id]',
-
- 'cat_list'
=> $categories['cat_list'],
- 'lang_workorder_id'
=> lang('Workorder ID'),
- 'sum_workorder_budget'
=> $values['sum_workorder_budget'],
- 'sum_workorder_calculation'
=> $values['sum_workorder_calculation'],
- 'workorder_budget'
=> $values['workorder_budget'],
- 'sum_workorder_actual_cost'
=> $values['sum_workorder_actual_cost'],
- 'lang_actual_cost'
=> lang('Actual cost'),
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_sum'
=> lang('Sum'),
- 'select_user_name'
=> 'values[coordinator]',
- 'lang_no_user'
=> lang('Select coordinator'),
- 'user_list'
=>
$this->bocommon->get_user_list('select',$values['coordinator'],$extra=false,$default=false,$start=-1,$sort='ASC',$order='account_lastname',$query='',$offset=-1),
-
- 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
-
- 'branch_list'
=> $this->bo->select_branch_p_list($values['project_id']),
- 'lang_branch'
=> lang('branch'),
-
- 'key_responsible_list'
=> $this->bo->select_branch_list($values['key_responsible']),
- 'lang_key_responsible'
=> lang('key responsible'),
-
- 'key_fetch_list'
=> $this->bo->select_key_location_list($values['key_fetch']),
- 'lang_key_fetch'
=> lang('key fetch location'),
-
- 'key_deliver_list'
=> $this->bo->select_key_location_list($values['key_deliver']),
- 'lang_key_deliver'
=> lang('key deliver location'),
-
- 'edit_action'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.edit', 'id'=> $id)),
- 'lang_edit_statustext'
=> lang('Edit this entry project'),
- 'lang_edit'
=> lang('Edit'),
- 'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
-
- 'lang_contact_phone'
=> lang('Contact phone'),
- 'contact_phone'
=> $values['contact_phone'],
- );
-
- $appname = lang('project');
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('view' => $data));
-
+ $this->edit('view');
}
protected function _generate_tabs($tabs_ = array(), $suppress =
array())
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2011-12-24 23:40:48 UTC
(rev 8435)
+++ trunk/property/inc/class.uiworkorder.inc.php 2011-12-25 20:48:28 UTC
(rev 8436)
@@ -1777,7 +1777,7 @@
'value_billable_hours'
=> $values['billable_hours'],
'base_java_url'
=>
"{menuaction:'property.notify.update_data',location_id:{$location_id},location_item_id:'{$id}'}",
'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'property.uiworkorder.edit', 'id' => $id)),
- 'lang_edit_statustext'
=> lang('Edit this entry workorder'),
+ 'lang_edit_statustext'
=> lang('Edit this entry '),
'lang_edit'
=> lang('Edit'),
);
Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl 2011-12-24 23:40:48 UTC (rev
8435)
+++ trunk/property/templates/base/project.xsl 2011-12-25 20:48:28 UTC (rev
8436)
@@ -29,80 +29,10 @@
<xsl:when test="edit">
<xsl:apply-templates select="edit"/>
</xsl:when>
- <xsl:when test="view">
- <xsl:apply-templates select="view"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="list_project"/>
- </xsl:otherwise>
</xsl:choose>
</xsl:template>
-<xsl:template match="list_project">
- <xsl:apply-templates select="menu"/>
- <table width="100%" cellpadding="2" cellspacing="2" align="center">
- <tr>
- <td>
- <xsl:call-template name="categories"/>
- </td>
- <td align="left">
- <xsl:call-template name="status_filter"/>
- </td>
- <td align="left">
- <xsl:call-template name="wo_hour_cat_filter"/>
- </td>
- <td align="center">
- <xsl:call-template name="user_id_filter"/>
- </td>
- <td align="right">
- <xsl:call-template name="search_field"/>
- </td>
- <td class="small_text" valign="top" align="left">
- <xsl:variable
name="link_download"><xsl:value-of select="link_download"/></xsl:variable>
- <xsl:variable
name="lang_download_help"><xsl:value-of
select="lang_download_help"/></xsl:variable>
- <xsl:variable
name="lang_download"><xsl:value-of select="lang_download"/></xsl:variable>
- <a href="javascript:var
w=window.open('{$link_download}','','left=50,top=100')"
onMouseOver="overlib('{$lang_download_help}', CAPTION, '{$lang_download}')"
onMouseOut="nd()">
- <xsl:value-of
select="lang_download"/></a>
- </td>
- </tr>
- <tr>
- <td colspan="6" width="100%">
- <xsl:call-template name="nextmatchs"/>
- </td>
- </tr>
- </table>
- <table width="100%" cellpadding="2" cellspacing="2" align="center">
- <xsl:call-template name="table_header"/>
- <xsl:choose>
- <xsl:when test="values">
- <xsl:call-template name="values"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="table_add !=''">
- <xsl:apply-templates select="table_add"/>
- </xsl:when>
- </xsl:choose>
- </table>
-</xsl:template>
-
-<xsl:template match="table_add">
- <tr>
- <td height="50">
- <xsl:variable name="add_action"><xsl:value-of
select="add_action"/></xsl:variable>
- <xsl:variable name="lang_add"><xsl:value-of
select="lang_add"/></xsl:variable>
- <form method="post" action="{$add_action}">
- <input type="submit" name="add"
value="{$lang_add}">
- <xsl:attribute name="title">
- <xsl:value-of
select="lang_add_statustext"/>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
-</xsl:template>
-
<!-- add / edit -->
<xsl:template xmlns:php="http://php.net/xsl" match="edit">
@@ -126,7 +56,7 @@
</xsl:when>
</xsl:choose>
<xsl:choose>
- <xsl:when test="value_project_id > 0">
+ <xsl:when test="value_project_id > 0 and
mode='edit'">
<td valign="top">
<xsl:variable
name="lang_add_workorder"><xsl:value-of
select="lang_add_workorder"/></xsl:variable>
<input type="button"
name="add_workorder" value="{$lang_add_workorder}" onClick="add_workorder()">
@@ -283,17 +213,15 @@
</td>
</tr>
<xsl:choose>
- <xsl:when
test="value_project_id > 0">
+ <xsl:when
test="value_project_id > 0 and mode='edit'">
<tr>
<td>
<xsl:value-of select="lang_confirm_status"/>
</td>
<td>
-
<input type="checkbox" name="values[confirm_status]" value="True"
onMouseout="window.status='';return true;">
-
<xsl:attribute name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
+
<input type="checkbox" name="values[confirm_status]" value="True">
+
<xsl:attribute name="title">
<xsl:value-of select="lang_confirm_statustext"/>
-
<xsl:text>'; return true;</xsl:text>
</xsl:attribute>
</input>
</td>
@@ -301,7 +229,7 @@
</xsl:when>
</xsl:choose>
<xsl:choose>
- <xsl:when test="need_approval='1'">
+ <xsl:when test="need_approval='1' and mode='edit'">
<tr>
<td valign="top">
<xsl:value-of
select="lang_ask_approval"/>
@@ -354,7 +282,7 @@
<table cellpadding="2" cellspacing="2" width="80%" align="center">
<xsl:choose>
- <xsl:when test="location_type='form'">
+ <xsl:when test="mode='edit'">">
<xsl:call-template name="location_form"/>
</xsl:when>
<xsl:otherwise>
@@ -420,7 +348,14 @@
<xsl:choose>
<xsl:when test="b_account_data!=''">
- <xsl:call-template name="b_account_form"/>
+ <xsl:choose>
+ <xsl:when test="mode='edit'">
+ <xsl:call-template
name="b_account_form"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template
name="b_account_view"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
</xsl:choose>
@@ -677,21 +612,24 @@
<xsl:call-template name="attributes_values"/>
</div>
</div>
-<table>
- <tr height="50">
- <td>
- <xsl:variable name="lang_save"><xsl:value-of
select="lang_save"/></xsl:variable>
- <input type="submit" name="values[save]"
value="{$lang_save}" onMouseout="window.status='';return true;">
- <xsl:attribute name="onMouseover">
- <xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_save_statustext"/>
- <xsl:text>'; return true;</xsl:text>
- </xsl:attribute>
- </input>
- </td>
- </tr>
-</table>
+ <xsl:choose>
+ <xsl:when test="mode='edit'">
+ <table>
+ <tr height="50">
+ <td>
+ <xsl:variable
name="lang_save"><xsl:value-of select="lang_save"/></xsl:variable>
+ <input type="submit"
name="values[save]" value="{$lang_save}" onMouseout="window.status='';return
true;">
+ <xsl:attribute
name="title">
+
<xsl:value-of select="lang_save_statustext"/>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </table>
+ </xsl:when>
+ </xsl:choose>
</form>
+
<table>
<tr>
<td>
@@ -699,25 +637,37 @@
<xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
<form method="post"
action="{$done_action}">
<input type="submit"
name="done" value="{$lang_done}" onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
+ <xsl:attribute
name="title">
<xsl:value-of
select="lang_done_statustext"/>
- <xsl:text>';
return true;</xsl:text>
</xsl:attribute>
</input>
</form>
</td>
+ <xsl:choose>
+ <xsl:when test="mode='view'">
+ <td>
+ <xsl:variable
name="edit_action"><xsl:value-of select="edit_action"/></xsl:variable>
+ <xsl:variable
name="lang_edit"><xsl:value-of select="lang_edit"/></xsl:variable>
+ <form method="post"
action="{$edit_action}">
+ <input
type="submit" class="forms" name="edit" value="{$lang_edit}"
onMouseout="window.status='';return true;">
+
<xsl:attribute name="title">
+
<xsl:value-of select="lang_edit_statustext"/>
+
</xsl:attribute>
+ </input>
+ </form>
+ </td>
+ </xsl:when>
+ </xsl:choose>
</tr>
</table>
-
<!-- AQUI VA EL SCRIPT -->
-
- <xsl:variable name="add_workorder_action"><xsl:value-of
select="add_workorder_action"/>&project_id=<xsl:value-of
select="value_project_id"/></xsl:variable>
- <form method="post" name="add_workorder_form"
action="{$add_workorder_action}">
- </form>
-
-
-
+ <xsl:choose>
+ <xsl:when test="mode='edit'">
+ <xsl:variable
name="add_workorder_action"><xsl:value-of
select="add_workorder_action"/>&project_id=<xsl:value-of
select="value_project_id"/></xsl:variable>
+ <form method="post" name="add_workorder_form"
action="{$add_workorder_action}">
+ </form>
+ </xsl:when>
+ </xsl:choose>
</xsl:template>
<xsl:template match="workorder_budget">
@@ -804,444 +754,6 @@
</xsl:choose>
</xsl:template>
-
- <xsl:template match="table_header_history">
- <tr class="th">
- <td class="th_text" width="20%" align="left">
- <xsl:value-of select="lang_date"/>
- </td>
- <td class="th_text" width="10%" align="left">
- <xsl:value-of select="lang_user"/>
- </td>
- <td class="th_text" width="30%" align="left">
- <xsl:value-of select="lang_action"/>
- </td>
- <td class="th_text" width="10%" align="left">
- <xsl:value-of select="lang_new_value"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="record_history">
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@class">
- <xsl:value-of select="@class"/>
- </xsl:when>
- <xsl:when test="position() mod 2 = 0">
- <xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td align="left">
- <xsl:value-of select="value_date"/>
- </td>
- <td align="left">
- <xsl:value-of select="value_user"/>
- </td>
- <td align="left">
- <xsl:value-of select="value_action"/>
- </td>
- <td align="left">
- <xsl:value-of select="value_new_value"/>
- </td>
- </tr>
- </xsl:template>
-
- <xsl:template match="table_header_workorder_budget">
- <tr class="th">
- <td class="th_text" width="4%" align="right">
- <xsl:value-of select="lang_workorder_id"/>
- </td>
- <td class="th_text" width="10%" align="right">
- <xsl:value-of select="lang_budget"/>
- </td>
- <td class="th_text" width="10%" align="right">
- <xsl:value-of select="lang_calculation"/>
- </td>
- <td class="th_text" width="10%" align="right">
- <xsl:value-of select="lang_vendor"/>
- </td>
- <td class="th_text" width="10%" align="right">
- <xsl:value-of select="lang_status"/>
- </td>
- </tr>
- </xsl:template>
-
-
-<!-- view -->
-
- <xsl:template match="view">
- <div class="yui-navset" id="project_tabview">
- <xsl:value-of disable-output-escaping="yes"
select="tabs"/>
- <div class="yui-content">
- <div id="general">
- <table cellpadding="2" cellspacing="2"
width="80%" align="center">
- <tr>
- <td>
- <xsl:value-of
select="lang_project_id"/>
- </td>
- <td>
- <xsl:value-of
select="value_project_id"/>
- </td>
- </tr>
-
- <xsl:for-each
select="value_origin">
- <tr>
- <td
valign="top">
-
<xsl:value-of select="descr"/>
- </td>
- <td
class="th_text" align="left">
-
<xsl:for-each select="data">
-
<a href="{link}" title="{statustext}"><xsl:value-of select="id"/></a>
-
<xsl:text> </xsl:text>
-
</xsl:for-each>
- </td>
- </tr>
- </xsl:for-each>
-
- <xsl:choose>
- <xsl:when
test="project_group_data!=''">
-
<xsl:call-template name="project_group_view"/>
- </xsl:when>
- </xsl:choose>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_name"/>
- </td>
- <td>
- <xsl:value-of
select="value_name"/>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_descr"/>
- </td>
- <td>
- <xsl:value-of
select="value_descr"/>
- </td>
- </tr>
- <tr>
- <td>
- <xsl:value-of
select="lang_coordinator"/>
- </td>
- <xsl:for-each
select="user_list">
- <xsl:choose>
-
<xsl:when test="selected">
-
<td>
-
<xsl:value-of select="name"/>
-
</td>
-
</xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </tr>
-
- <tr>
- <td>
- <xsl:value-of
select="lang_category"/>
- </td>
- <xsl:for-each
select="cat_list">
- <xsl:choose>
-
<xsl:when test="selected='selected'">
-
<td>
-
<xsl:value-of select="name"/>
-
</td>
-
</xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </tr>
- <xsl:apply-templates
select="custom_attributes/attributes"/>
- </table>
- </div>
-
- <div id="location">
- <table cellpadding="2" cellspacing="2"
width="80%" align="center">
- <xsl:call-template
name="location_view"/>
-
- <xsl:choose>
- <xsl:when
test="contact_phone !=''">
- <tr>
- <td
class="th_text" align="left">
-
<xsl:value-of select="lang_contact_phone"/>
- </td>
- <td
align="left">
-
<xsl:value-of select="contact_phone"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
-
- <xsl:choose>
- <xsl:when
test="suppressmeter =''">
- <tr>
- <td
valign="top">
-
<xsl:value-of select="lang_power_meter"/>
- </td>
- <td>
-
<xsl:value-of select="value_power_meter"/>
- </td>
- </tr>
- </xsl:when>
- </xsl:choose>
- </table>
- </div>
-
- <div id="budget">
- <table cellpadding="2" cellspacing="2"
width="80%" align="center">
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_budget"/>
- </td>
- <td>
- <xsl:value-of
select="value_budget"/>
- <xsl:text>
</xsl:text> [ <xsl:value-of select="currency"/> ]
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_reserve"/>
- </td>
- <td>
- <xsl:value-of
select="value_reserve"/>
- <xsl:text>
</xsl:text> [ <xsl:value-of select="currency"/> ]
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_sum"/>
- </td>
- <td>
- <xsl:value-of
select="value_sum"/>
- <xsl:text>
</xsl:text> [ <xsl:value-of select="currency"/> ]
- </td>
- </tr>
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_reserve_remainder"/>
- </td>
- <td>
- <xsl:value-of
select="value_reserve_remainder"/>
- <xsl:text>
</xsl:text> [ <xsl:value-of select="currency"/> ]
- <xsl:text>
</xsl:text> ( <xsl:value-of select="value_reserve_remainder_percent"/>
- <xsl:text> %
)</xsl:text>
- </td>
- </tr>
-
- <tr>
- <td class="th_text"
valign="top">
- <xsl:value-of
select="lang_workorder_id"/>
- </td>
- <xsl:choose>
- <xsl:when
test="sum_workorder_budget=''">
- <td
class="th_text">
-
<xsl:value-of select="lang_no_workorders"/>
- </td>
- </xsl:when>
- <xsl:otherwise>
- <td>
-
<table width="100%" cellpadding="2" cellspacing="2" align="center">
-
<xsl:apply-templates select="table_header_workorder_budget"/>
-
<xsl:apply-templates select="workorder_budget"/>
-
<tr class="th">
-
<td class="th_text" width="5%" align="right">
-
<xsl:value-of select="lang_sum"/>
-
</td>
-
<td class="th_text" width="5%" align="right">
-
<xsl:value-of select="sum_workorder_budget"/>
-
</td>
-
<td class="th_text" width="5%" align="right">
-
<xsl:value-of select="sum_workorder_calculation"/>
-
</td>
-
<td>
-
</td>
-
<td>
-
</td>
-
</tr>
-
</table>
- </td>
- </xsl:otherwise>
- </xsl:choose>
- </tr>
-
- <tr>
- <td valign="top">
- <xsl:value-of
select="lang_actual_cost"/>
- </td>
- <td>
- <xsl:value-of
select="sum_workorder_actual_cost"/>
- <xsl:text>
</xsl:text> [ <xsl:value-of select="currency"/> ]
- </td>
- </tr>
- </table>
- </div>
-
- <xsl:choose>
- <xsl:when test="suppresscoordination
=''">
-
- <div id="coordination">
- <table cellpadding="2"
cellspacing="2" width="80%" align="center">
- <tr>
- <td>
-
<xsl:value-of select="lang_status"/>
- </td>
-
<xsl:for-each select="status_list">
-
<xsl:choose>
-
<xsl:when test="selected">
-
<td>
-
<xsl:value-of select="name"/>
-
</td>
-
</xsl:when>
-
</xsl:choose>
-
</xsl:for-each>
- </tr>
- <tr>
- <td
valign="top">
-
<xsl:value-of select="lang_start_date"/>
- </td>
- <td>
-
<xsl:value-of select="value_start_date"/>
- </td>
- </tr>
- <tr>
- <td
valign="top">
-
<xsl:value-of select="lang_end_date"/>
- </td>
- <td>
-
<xsl:value-of select="value_end_date"/>
- </td>
- </tr>
- <tr>
- <td
valign="top">
-
<xsl:value-of select="lang_branch"/>
- </td>
- <td>
-
<xsl:for-each select="branch_list[selected='selected']">
-
<xsl:value-of select="name"/>
-
<xsl:if test="position() != last()">, </xsl:if>
-
</xsl:for-each>
- </td>
- </tr>
- <tr>
- <td
valign="top">
-
<xsl:value-of select="lang_other_branch"/>
- </td>
- <td>
-
<xsl:value-of select="value_other_branch"/>
- </td>
- </tr>
- <tr>
- <td>
-
<xsl:value-of select="lang_key_fetch"/>
- </td>
- <td>
-
<xsl:for-each select="key_fetch_list">
-
<xsl:choose>
-
<xsl:when test="selected">
-
<xsl:value-of select="name"/>
-
</xsl:when>
-
</xsl:choose>
-
</xsl:for-each>
- </td>
- </tr>
- <tr>
- <td>
-
<xsl:value-of select="lang_key_deliver"/>
- </td>
- <td>
-
<xsl:for-each select="key_deliver_list">
-
<xsl:choose>
-
<xsl:when test="selected">
-
<xsl:value-of select="name"/>
-
</xsl:when>
-
</xsl:choose>
-
</xsl:for-each>
- </td>
- </tr>
- <tr>
- <td>
-
<xsl:value-of select="lang_key_responsible"/>
- </td>
-
- <td>
-
<xsl:for-each select="key_responsible_list">
-
<xsl:choose>
-
<xsl:when test="selected">
-
<xsl:value-of select="name"/>
-
</xsl:when>
-
</xsl:choose>
-
</xsl:for-each>
- </td>
- </tr>
- </table>
- </div>
- </xsl:when>
- </xsl:choose>
-
-
- <div id="history">
- <hr noshade="noshade" width="100%"
align="center" size="1"/>
- <table cellpadding="2" cellspacing="2"
width="80%" align="center">
- <xsl:choose>
- <xsl:when
test="record_history=''">
- <tr>
- <td
class="th_text" align="left">
-
<xsl:value-of select="lang_no_history"/>
- </td>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <tr>
- <td
class="th_text" align="left">
-
<xsl:value-of select="lang_history"/>
- </td>
- </tr>
-
<xsl:apply-templates select="table_header_history"/>
-
<xsl:apply-templates select="record_history"/>
- </xsl:otherwise>
- </xsl:choose>
- </table>
- <hr noshade="noshade" width="100%"
align="center" size="1"/>
- </div>
- </div>
- </div>
- <table>
- <tr height="50">
- <td>
- <xsl:variable
name="done_action"><xsl:value-of select="done_action"/></xsl:variable>
- <xsl:variable
name="lang_done"><xsl:value-of select="lang_done"/></xsl:variable>
- <form method="post"
action="{$done_action}">
- <input type="submit"
class="forms" name="done" value="{$lang_done}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_done_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- <td>
- </td>
- <xsl:variable
name="edit_action"><xsl:value-of select="edit_action"/></xsl:variable>
- <xsl:variable
name="lang_edit"><xsl:value-of select="lang_edit"/></xsl:variable>
- <form method="post"
action="{$edit_action}">
- <input type="submit"
class="forms" name="edit" value="{$lang_edit}"
onMouseout="window.status='';return true;">
- <xsl:attribute
name="onMouseover">
-
<xsl:text>window.status='</xsl:text>
- <xsl:value-of
select="lang_edit_statustext"/>
- <xsl:text>';
return true;</xsl:text>
- </xsl:attribute>
- </input>
- </form>
- </td>
- </tr>
- </table>
- </xsl:template>
-
-
<xsl:template xmlns:php="http://php.net/xsl" match="bulk_update_status">
<div align="left">
<table cellpadding="2" cellspacing="2" width="80%"
align="center">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8436] property: cleanup,
Sigurd Nes <=