[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8781] property: custom redirect based on configurabl
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8781] property: custom redirect based on configurable change of status |
Date: |
Fri, 03 Feb 2012 10:19:44 +0000 |
Revision: 8781
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8781
Author: sigurdne
Date: 2012-02-03 10:19:43 +0000 (Fri, 03 Feb 2012)
Log Message:
-----------
property: custom redirect based on configurable change of status
Modified Paths:
--------------
trunk/property/inc/class.sotts.inc.php
Added Paths:
-----------
trunk/property/inc/custom/default/ticket_redirect_based_on_status.php
Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php 2012-02-03 10:19:24 UTC (rev
8780)
+++ trunk/property/inc/class.sotts.inc.php 2012-02-03 10:19:43 UTC (rev
8781)
@@ -896,24 +896,25 @@
$this->db->query("select * from fm_tts_tickets where
id='$id'",__LINE__,__FILE__);
$this->db->next_record();
- $location_code = $this->db->f('location_code');
- $oldlocation_code = $this->db->f('location_code');
- $oldfinnish_date = $this->db->f('finnish_date');
- $oldfinnish_date2 = $this->db->f('finnish_date2');
- $oldassigned = $this->db->f('assignedto');
- $oldgroup_id = $this->db->f('group_id');
- $oldpriority = $this->db->f('priority');
- $oldcat_id =
$this->db->f('cat_id');
- $old_status = $this->db->f('status');
- $old_budget = $this->db->f('budget');
- $old_billable_hours =
$this->db->f('billable_hours');
- // $old_billable_rate =
$this->db->f('billable_rate');
- $old_subject = $this->db->f('subject');
- $old_contact_id = $this->db->f('contact_id');
- $old_actual_cost = $this->db->f('actual_cost');
- $old_order_cat_id = $this->db->f('order_cat_id');
- $old_building_part =
$this->db->f('building_part',true);
- $old_order_dim1 =
(int)$this->db->f('order_dim1');
+ $location_code =
$this->db->f('location_code');
+ $oldlocation_code =
$this->db->f('location_code');
+ $oldfinnish_date =
$this->db->f('finnish_date');
+ $oldfinnish_date2 =
$this->db->f('finnish_date2');
+ $oldassigned =
$this->db->f('assignedto');
+ $oldgroup_id =
$this->db->f('group_id');
+ $oldpriority =
$this->db->f('priority');
+ $oldcat_id =
$this->db->f('cat_id');
+ $old_status =
$this->db->f('status');
+ $ticket['old_status'] = $old_status; // used for
custom functions
+ $old_budget =
$this->db->f('budget');
+ $old_billable_hours =
$this->db->f('billable_hours');
+ // $old_billable_rate = $this->db->f('billable_rate');
+ $old_subject =
$this->db->f('subject');
+ $old_contact_id =
$this->db->f('contact_id');
+ $old_actual_cost =
$this->db->f('actual_cost');
+ $old_order_cat_id =
$this->db->f('order_cat_id');
+ $old_building_part =
$this->db->f('building_part',true);
+ $old_order_dim1 =
(int)$this->db->f('order_dim1');
if($oldcat_id ==0){$oldcat_id ='';}
@@ -1281,6 +1282,7 @@
{
$receipt['message'][]= array('msg' =>
lang('Ticket has been updated'));
+/*
$criteria = array
(
'appname' => 'property',
@@ -1304,6 +1306,7 @@
require_once $file;
}
}
+*/
}
return $receipt;
}
Added: trunk/property/inc/custom/default/ticket_redirect_based_on_status.php
===================================================================
--- trunk/property/inc/custom/default/ticket_redirect_based_on_status.php
(rev 0)
+++ trunk/property/inc/custom/default/ticket_redirect_based_on_status.php
2012-02-03 10:19:43 UTC (rev 8781)
@@ -0,0 +1,89 @@
+<?php
+
+ /*
+ * This class will enable status conditional redirect on tickets.
+ * A config section will be defined where conditions on status and
target can be configured.
+ */
+ $ticket_redirect = new ticket_redirect_based_on_status();
+ $ticket_redirect->check_status($data);
+
+ class ticket_redirect_based_on_status extends property_botts
+ {
+ protected $db;
+ protected $config = array();
+ protected $status_text = array();
+ protected $custom_config;
+
+ function __construct()
+ {
+ parent::__construct();
+ $this->db = & $GLOBALS['phpgw']->db;
+ $custom_config =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property',
'.ticket'));
+ $this->config = $custom_config->config_data;
+ $this->status_text = parent::get_status_text();
+ if($this->acl_location != '.ticket')
+ {
+ throw new Exception("'catch_ticket_export' is
intended for location = '.ticket'");
+ }
+
+ if(!isset($this->config['ticket_redirect']) ||
!$this->config['ticket_redirect'])
+ {
+ $this->custom_config = $custom_config;
+ $this->initiate_config();
+ }
+ }
+
+ protected function initiate_config()
+ {
+ $receipt_section =
$this->custom_config->add_section(array
+ (
+ 'name' => 'ticket_redirect',
+ 'descr' => 'ticket redirect based on
status'
+ )
+ );
+ $receipt = $this->custom_config->add_attrib(array
+ (
+ 'section_id' =>
$receipt_section['section_id'],
+ 'input_type' => 'text',
+ 'name' => 'status',
+ 'descr' =>
'commaseparated list of status that initiate redirect'
+ )
+ );
+ $receipt = $this->custom_config->add_attrib(array
+ (
+ 'section_id' =>
$receipt_section['section_id'],
+ 'input_type' => 'text',
+ 'name' => 'target',
+ 'descr' =>
'commaseparated list of target of redirect'
+ )
+ );
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'admin.uiconfig2.list_attrib', 'section_id' =>
$receipt_section['section_id'] , 'location_id' =>
$GLOBALS['phpgw']->locations->get_id('property', '.ticket')) );
+ }
+
+ function check_status($data)
+ {
+ $status_arr = explode(',',
$this->config['ticket_redirect']['status']);
+ $target_arr = explode(',',
$this->config['ticket_redirect']['target']);
+
+ foreach($status_arr as $key => $status_redirect)
+ {
+ if($data['status'] != $data['old_status'] &&
trim($data['status'],'C') == $status_redirect && isset($target_arr[$key]) &&
$target_arr[$key])
+ {
+ $link_data = array
+ (
+ 'menuaction' =>
$target_arr[$key],
+ 'bypass'
=> true,
+ 'location_code' =>
$data['location_code'],
+ 'p_num'
=> $data['p_num'],
+ 'p_entity_id' =>
$data['p_entity_id'],
+ 'p_cat_id'
=> $data['p_cat_id'],
+ 'tenant_id'
=> $data['tenant_id'],
+ 'origin'
=> '.ticket',
+ 'origin_id'
=> $data['id']
+ );
+
+
$GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
+ }
+ }
+ }
+ }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8781] property: custom redirect based on configurable change of status,
Sigurd Nes <=