fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6847] property: reffine address


From: Sigurd Nes
Subject: [Fmsystem-commits] [6847] property: reffine address
Date: Wed, 26 Jan 2011 10:03:47 +0000

Revision: 6847
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6847
Author:   sigurdne
Date:     2011-01-26 10:03:47 +0000 (Wed, 26 Jan 2011)
Log Message:
-----------
property: reffine address

Modified Paths:
--------------
    trunk/property/inc/class.sotts.inc.php
    trunk/property/setup/tables_update.inc.php

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2011-01-26 09:04:24 UTC (rev 
6846)
+++ trunk/property/inc/class.sotts.inc.php      2011-01-26 10:03:47 UTC (rev 
6847)
@@ -460,6 +460,8 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $entity = array();
+                       $uicols = array();
                        $i=0;
                        while ($this->db->next_record())
                        {
@@ -547,6 +549,7 @@
 
                function add($ticket)
                {
+
                        if(isset($ticket['location']) && 
is_array($ticket['location']))
                        {
                                foreach ($ticket['location'] as $input_name => 
$value)
@@ -567,29 +570,45 @@
                                                $value_set[$input_name] = 
$value;
                                        }
                                }
+
+                               if($ticket['extra']['p_num'] && 
$ticket['extra']['p_entity_id'] && $ticket['extra']['p_cat_id'])
+                               {
+                                       $entity = 
CreateObject('property.soadmin_entity');
+                                       $entity_category = 
$entity->read_single_category($ticket['extra']['p_entity_id'],$ticket['extra']['p_cat_id']);
+                               }
                        }
 
-                       $address = '';
+                       $_address = array();
                        if(isset($ticket['street_name']) && 
$ticket['street_name'])
                        {
-                               $_address = array($ticket['street_name'], 
$ticket['street_number']);
-                               $address        = 
$this->db->db_addslashes(implode(" ", $_address));
-                               unset($_address);
+                               $_address[] = "{$ticket['street_name']} 
{$ticket['street_number']}";
                        }
 
                        if(isset($ticket['location_name']) && 
$ticket['location_name'])
                        {
-                               $address .= '::' . 
$this->db->db_addslashes($ticket['location_name']);
+                               $_address[] = $ticket['location_name'];
                        }
 
                        if(isset($ticket['additional_info']) && 
$ticket['additional_info'])
                        {
                                foreach($ticket['additional_info'] as $key => 
$value)
                                {
-                                       $address .= "::{$key}|{$value}";
+                                       if($value)
+                                       {
+                                               $_address[] = "{$key}|{$value}";
+                                       }
                                }
                        }
 
+                       if(isset($entity_category) && $entity_category)
+                       {
+                               $_address[] = 
"{$entity_category['name']}::{$ticket['extra']['p_num']}";                      
          
+                       }
+
+                       $address        = 
$this->db->db_addslashes(implode('::', $_address));
+
+                       unset($_address);
+
                        $value_set['priority']          = 
isset($ticket['priority'])?$ticket['priority']:0;
                        $value_set['user_id']           = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $value_set['assignedto']        = $ticket['assignedto'];
@@ -765,12 +784,12 @@
 
                        if($oldcat_id ==0){$oldcat_id ='';}
                        if($old_order_cat_id ==0){$old_order_cat_id ='';}
-                               if($oldassigned ==0){$oldassigned ='';}
-                                       if($oldgroup_id ==0){$oldgroup_id ='';}
+                       if($oldassigned ==0){$oldassigned ='';}
+                       if($oldgroup_id ==0){$oldgroup_id ='';}
 
-                                               // Figure out and last note
+                       // Figure out and last note
 
-                                               $history_values = 
$this->historylog->return_array(array(),array('C'),'history_timestamp','DESC',$id);
+                       $history_values = 
$this->historylog->return_array(array(),array('C'),'history_timestamp','DESC',$id);
                        $old_note = $history_values[0]['new_value'];
 
                        if(!$old_note)
@@ -778,7 +797,6 @@
                                $old_note = $this->db->f('details');
                        }
 
-
                        $this->db->transaction_begin();
 
                        /*
@@ -1003,27 +1021,44 @@
                                {
                                        $value_set      = array();
 
-                                       $address = '';
+                                       $_address = array();
                                        if(isset($ticket['street_name']) && 
$ticket['street_name'])
                                        {
-                                               $_address = 
array($ticket['street_name'], $ticket['street_number']);
-                                               $address        = 
$this->db->db_addslashes(implode(" ", $_address));
-                                               unset($_address);
+                                               $_address[] = 
"{$ticket['street_name']} {$ticket['street_number']}";
                                        }
 
                                        if(isset($ticket['location_name']) && 
$ticket['location_name'])
                                        {
-                                               $address .= '::' . 
$this->db->db_addslashes($ticket['location_name']);
+                                               $_address[] = 
$ticket['location_name'];
                                        }
 
                                        if(isset($ticket['additional_info']) && 
$ticket['additional_info'])
                                        {
                                                
foreach($ticket['additional_info'] as $key => $value)
                                                {
-                                                       $address .= 
"::{$key}|{$value}";
+                                                       if($value)
+                                                       {
+                                                               $_address[] = 
"{$key}|{$value}";
+                                                       }
                                                }
                                        }
 
+
+                                       if(isset($ticket['extra']['p_num']) && 
$ticket['extra']['p_num'] && $ticket['extra']['p_entity_id'] && 
$ticket['extra']['p_cat_id'])
+                                       {
+                                               $entity = 
CreateObject('property.soadmin_entity');
+                                               $entity_category = 
$entity->read_single_category($ticket['extra']['p_entity_id'],$ticket['extra']['p_cat_id']);
+                                       }
+
+                                       if(isset($entity_category) && 
$entity_category)
+                                       {
+                                               $_address[] = 
"{$entity_category['name']}::{$ticket['extra']['p_num']}";                      
          
+                                       }
+
+                                       $address        = 
$this->db->db_addslashes(implode('::', $_address));
+
+                                       unset($_address);
+
                                        $value_set['address'] = $address;
 
                                        if (isset($ticket['location_code']) && 
$ticket['location_code'])

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2011-01-26 09:04:24 UTC (rev 
6846)
+++ trunk/property/setup/tables_update.inc.php  2011-01-26 10:03:47 UTC (rev 
6847)
@@ -4999,4 +4999,24 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.607 to 0.9.17.608
+       * Add more room for address at tickets
+       * 
+       */
 
+/*
+       $test[] = '0.9.17.607';
+       function property_upgrade0_9_17_608()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_tts_tickets','address',array('type'
 => 'varchar','precision' => '255','nullable' => True));
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.608';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+*/
+




reply via email to

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