fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7146] property: start ticket from entity-list, add


From: Sigurd Nes
Subject: [Fmsystem-commits] [7146] property: start ticket from entity-list, add order to excisting project from entity
Date: Mon, 28 Mar 2011 14:26:40 +0000

Revision: 7146
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7146
Author:   sigurdne
Date:     2011-03-28 14:26:38 +0000 (Mon, 28 Mar 2011)
Log Message:
-----------
property: start ticket from entity-list, add order to excisting project from 
entity

Modified Paths:
--------------
    trunk/property/inc/class.boentity.inc.php
    trunk/property/inc/class.uientity.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/templates/base/entity.xsl

Modified: trunk/property/inc/class.boentity.inc.php
===================================================================
--- trunk/property/inc/class.boentity.inc.php   2011-03-28 12:40:11 UTC (rev 
7145)
+++ trunk/property/inc/class.boentity.inc.php   2011-03-28 14:26:38 UTC (rev 
7146)
@@ -61,24 +61,33 @@
                var $type_app = array();
                var $type;
 
-               function property_boentity($session=false)
+               function property_boentity($session=false, $type = '', 
$entity_id = 0, $cat_id = 0)
                {
                        $this->solocation                               = 
CreateObject('property.solocation');
                        $this->bocommon                                 = 
CreateObject('property.bocommon');
 
+                       if(!$type)
+                       {
+                               $type                                           
= phpgw::get_var('type');
+                       }
+                       if(!$entity_id)
+                       {
+                               $entity_id                                      
= phpgw::get_var('entity_id', 'int');
+                       }
+                       if(!$cat_id)
+                       {
+                               $cat_id                                         
= phpgw::get_var('cat_id', 'int');
+                       }
                        $start                                                  
= phpgw::get_var('start', 'int', 'REQUEST', 0);
                        $query                                                  
= phpgw::get_var('query');
                        $sort                                                   
= phpgw::get_var('sort');
                        $order                                                  
= phpgw::get_var('order');
                        $filter                                                 
= phpgw::get_var('filter', 'int');
-                       $cat_id                                                 
= phpgw::get_var('cat_id', 'int');
                        $district_id                                    = 
phpgw::get_var('district_id', 'int');
-                       $entity_id                                              
= phpgw::get_var('entity_id', 'int');
                        $status                                                 
= phpgw::get_var('status');
                        $start_date                                             
= phpgw::get_var('start_date');
                        $end_date                                               
= phpgw::get_var('end_date');
                        $allrows                                                
= phpgw::get_var('allrows', 'bool');
-                       $type                                                   
= phpgw::get_var('type');
                        $criteria_id                                    = 
phpgw::get_var('criteria_id');
 
                        $this->criteria_id                              = 
isset($criteria_id) && $criteria_id ? $criteria_id : '';
@@ -96,8 +105,8 @@
                        $this->soadmin_entity->type_app = $this->type_app;
                        $this->so->type                                 = 
$this->type;
 
+                       $this->category_dir = 
"{$this->type}_{$entity_id}_{$cat_id}";
 
-                       $this->category_dir = 
"{$this->type}_{$entity_id}_{$cat_id}";
                        if ($session)
                        {
                                $this->read_sessiondata();
@@ -129,7 +138,7 @@
                        {
                                $this->order = $order;
                        }
-                       if(isset($_POST['cat_id']) || isset($_GET['cat_id']))
+                       if($cat_id || isset($_POST['cat_id']) || 
isset($_GET['cat_id']))
                        {
                                $this->cat_id = $cat_id;
                        }
@@ -340,7 +349,7 @@
                        }
                        $values = $this->custom->prepare($values, 
$this->type_app[$this->type],".{$this->type}.{$data['entity_id']}.{$data['cat_id']}",
 $data['view']);
 
-                       //              $soadmin_entity = 
CreateObject('property.soadmin_entity');
+       //              $soadmin_entity = 
CreateObject('property.soadmin_entity');
 
                        if($values['location_code'])
                        {

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2011-03-28 12:40:11 UTC (rev 
7145)
+++ trunk/property/inc/class.uientity.inc.php   2011-03-28 14:26:38 UTC (rev 
7146)
@@ -763,6 +763,28 @@
                                        )
                                );
 
+                       $parameters2 = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'location_code',
+                                                       'source'        => 
'location_code'
+                                               ),
+                                               array
+                                               (
+                                                       'name'          => 
'origin_id',
+                                                       'source'        => 'id'
+                                               ),
+                                               array
+                                               (
+                                                       'name'          => 
'p_num',
+                                                       'source'        => 'id'
+                                               ),
+                                       )
+                               );
+
                        if($this->acl_read)
                        {
                                $datatable['rowactions']['action'][] = array
@@ -823,6 +845,28 @@
                                                'parameters'                    
=> $parameters
                                        );
                        }
+
+                       if(     $category['start_ticket'])
+                       {
+                               $datatable['rowactions']['action'][] = array
+                                       (
+                                               'my_name'               => 
'edit',
+                                               'text'                  => 
lang('start ticket'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'property.uitts.add',
+                                                       'p_entity_id'   => 
$this->entity_id,
+                                                       'p_cat_id'              
=> $this->cat_id,
+                                                       'type'                  
=> $this->type,
+                                                       'target'                
=> '_blank',
+                                                       'bypass'                
=> true,
+                                                       'origin'                
=> ".{$this->type}.{$this->entity_id}.{$this->cat_id}",
+
+                                               )),
+                                               'parameters'                    
=> $parameters2
+                                       );
+                       }
+
                        $jasper = execMethod('property.sojasper.read', 
array('location_id' => 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
$this->acl_location)));
 
                        foreach ($jasper as $report)
@@ -1476,6 +1520,20 @@
                                        'origin_id'                     => $id
                                );
 
+                       $add_to_project_link_data = array
+                       (
+                                       'menuaction'            => 
'property.uiproject.index',
+                                       'from'                          => 
'workorder',
+                                       'lookup'                        => true,
+                                       'query'                         => 
isset($values['location_data']['loc1']) ? $values['location_data']['loc1'] : '',
+                       //              'p_num'                         => $id,
+                       //              'p_entity_id'           => 
$this->entity_id,
+                       //              'p_cat_id'                      => 
$this->cat_id,
+                                       'tenant_id'                     => 
$values['tenant_id'],
+                                       'origin'                        => 
".{$this->type}.{$this->entity_id}.{$this->cat_id}",
+                                       'origin_id'                     => $id
+                       );
+
                        $ticket_link_data = array
                                (
                                        'menuaction'            => 
'property.uitts.add',
@@ -1846,6 +1904,7 @@
                                        'start_project'                         
        => $category['start_project'],
                                        'lang_start_project'                    
=> lang('start project'),
                                        'project_link'                          
        => $GLOBALS['phpgw']->link('/index.php',$project_link_data),
+                                       'add_to_project_link'                   
=> $GLOBALS['phpgw']->link('/index.php',$add_to_project_link_data),
                                        'start_ticket'                          
        => $category['start_ticket'],
                                        'lang_start_ticket'                     
        => lang('start ticket'),
                                        'ticket_link'                           
        => $GLOBALS['phpgw']->link('/index.php',$ticket_link_data),

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2011-03-28 12:40:11 UTC (rev 
7145)
+++ trunk/property/inc/class.uitts.inc.php      2011-03-28 14:26:38 UTC (rev 
7146)
@@ -1681,7 +1681,8 @@
 
                        //------------------- start ticket from other location
                        $bypass                 = phpgw::get_var('bypass', 
'bool');
-                       if(isset($_POST) && $_POST && isset($bypass) && $bypass)
+//                     if(isset($_POST) && $_POST && isset($bypass) && $bypass)
+                       if($bypass)
                        {
                                $boadmin_entity         = 
CreateObject('property.boadmin_entity');
                                $location_code          = 
phpgw::get_var('location_code');

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2011-03-28 12:40:11 UTC 
(rev 7145)
+++ trunk/property/inc/class.uiworkorder.inc.php        2011-03-28 14:26:38 UTC 
(rev 7146)
@@ -867,6 +867,17 @@
                                $values['location_data'] = 
$ticket['location_data'];
                        }
 
+                       if ( preg_match("/(^.entity.|^.catch.)/i", $origin) && 
$origin_id )
+                       {
+                               $_origin = explode('.', $origin);
+                               $_boentity= CreateObject('property.boentity', 
false, $_origin[1], $_origin[2], $_origin[3]);
+                               $_entity = 
$_boentity->read_single(array('entity_id'=> 
$_origin[2],'cat_id'=>$_origin[3],'id'=>$origin_id, 'view' => true));
+                               $values['location_data'] = 
$_entity['location_data'];
+                               unset($_origin);
+                               unset($_boentity);
+                               unset($_entity);
+                       }
+
                        if(isset($values['origin']) && $values['origin'])
                        {
                                $origin         = $values['origin'];
@@ -1182,6 +1193,7 @@
                        $table_header_workorder_budget[] = array
                                (
                                        'lang_workorder_id'     => 
lang('Workorder'),
+
                                        'lang_sum'              => lang('Sum')
                                );
 

Modified: trunk/property/templates/base/entity.xsl
===================================================================
--- trunk/property/templates/base/entity.xsl    2011-03-28 12:40:11 UTC (rev 
7145)
+++ trunk/property/templates/base/entity.xsl    2011-03-28 14:26:38 UTC (rev 
7146)
@@ -316,40 +316,49 @@
                        <xsl:choose>
                                <xsl:when test="value_id!=''">
                                        <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
-                                               <xsl:choose>
-                                                       <xsl:when 
test="start_project!=''">
-                                                               <tr>
+                                               <tr>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="start_ticket!=''">
                                                                        <td 
valign="top">
+                                                                               
<xsl:variable name="ticket_link"><xsl:value-of 
select="ticket_link"/></xsl:variable>
+                                                                               
<form method="post" action="{$ticket_link}">
+                                                                               
        <xsl:variable name="lang_start_ticket"><xsl:value-of 
select="lang_start_ticket"/></xsl:variable>
+                                                                               
        <input type="submit" name="location" value="{$lang_start_ticket}">
+                                                                               
                <xsl:attribute name="title">
+                                                                               
                        <xsl:value-of select="lang_start_ticket_statustext"/>
+                                                                               
                </xsl:attribute>
+                                                                               
        </input>
+                                                                               
</form>
+                                                                       </td>
+                                                               </xsl:when>
+                                                       </xsl:choose>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="start_project!=''">
+                                                                       <td 
valign="top">
                                                                                
<xsl:variable name="project_link"><xsl:value-of 
select="project_link"/></xsl:variable>
                                                                                
<form method="post" action="{$project_link}">
-                                                                               
        <xsl:variable name="lang_start_project"><xsl:value-of 
select="lang_start_project"/></xsl:variable>
+                                                                               
<xsl:variable name="lang_start_project"><xsl:value-of 
select="php:function('lang', 'generate new project')" /></xsl:variable>
                                                                                
        <input type="submit" name="location" value="{$lang_start_project}">
                                                                                
                <xsl:attribute name="title">
-                                                                               
                        <xsl:value-of select="lang_start_project_statustext"/>
+                                                                               
                        <xsl:value-of select="php:function('lang', 'click this 
to generate a project with this information')" />
                                                                                
                </xsl:attribute>
                                                                                
        </input>
                                                                                
</form>
                                                                        </td>
-                                                               </tr>
-                                                       </xsl:when>
-                                               </xsl:choose>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="start_ticket!=''">
-                                                               <tr>
                                                                        <td 
valign="top">
-                                                                               
<xsl:variable name="ticket_link"><xsl:value-of 
select="ticket_link"/></xsl:variable>
-                                                                               
<form method="post" action="{$ticket_link}">
-                                                                               
        <xsl:variable name="lang_start_ticket"><xsl:value-of 
select="lang_start_ticket"/></xsl:variable>
-                                                                               
        <input type="submit" name="location" value="{$lang_start_ticket}">
+                                                                               
<xsl:variable name="add_to_project_link"><xsl:value-of 
select="add_to_project_link"/></xsl:variable>
+                                                                               
<form method="post" action="{$add_to_project_link}">
+                                                                               
        <xsl:variable name="lang_add_to_project"><xsl:value-of 
select="php:function('lang', 'add to project')" /></xsl:variable>
+                                                                               
        <input type="submit" name="location" value="{$lang_add_to_project}" 
onMouseout="window.status='';return true;">
                                                                                
                <xsl:attribute name="title">
-                                                                               
                        <xsl:value-of select="lang_start_ticket_statustext"/>
+                                                                               
                        <xsl:value-of select="php:function('lang', 'click this 
to add an order to an existing project')" />
                                                                                
                </xsl:attribute>
                                                                                
        </input>
                                                                                
</form>
                                                                        </td>
-                                                               </tr>
-                                                       </xsl:when>
-                                               </xsl:choose>
+                                                               </xsl:when>
+                                                       </xsl:choose>
+                                               </tr>
                                        </table>
                                </xsl:when>
                        </xsl:choose>




reply via email to

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