fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15503] more on helpdesk


From: sigurdne
Subject: [Fmsystem-commits] [15503] more on helpdesk
Date: Thu, 25 Aug 2016 08:20:09 +0000 (UTC)

Revision: 15503
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15503
Author:   sigurdne
Date:     2016-08-25 08:20:09 +0000 (Thu, 25 Aug 2016)
Log Message:
-----------
more on helpdesk

Modified Paths:
--------------
    trunk/helpdesk/inc/class.sotts.inc.php
    trunk/helpdesk/inc/class.uitts.inc.php

Modified: trunk/helpdesk/inc/class.sotts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.sotts.inc.php      2016-08-24 13:38:44 UTC (rev 
15502)
+++ trunk/helpdesk/inc/class.sotts.inc.php      2016-08-25 08:20:09 UTC (rev 
15503)
@@ -505,102 +505,48 @@
                        }
                }
 
-               function add($ticket)
+               function add( &$ticket, $values_attribute = array() )
                {
-                       if(isset($ticket['location']) && 
is_array($ticket['location']))
-                       {
-                               foreach ($ticket['location'] as $input_name => 
$value)
-                               {
-                                       if(isset($value) && $value)
-                                       {
-                                               $cols[] = $input_name;
-                                               $vals[] = $value;
-                                       }
-                               }
-                       }
+                       $table = 'phpgw_helpdesk_tickets';
 
-                       if(isset($ticket['extra']) && 
is_array($ticket['extra']))
+                       $value_set = array();
+                       $data_attribute = $this->custom->prepare_for_db($table, 
$values_attribute);
+                       if (isset($data_attribute['value_set']))
                        {
-                               foreach ($ticket['extra'] as $input_name => 
$value)
+                               foreach ($data_attribute['value_set'] as 
$input_name => $value)
                                {
-                                       if(isset($value) && $value)
+                                       if (isset($value) && $value)
                                        {
-                                               $cols[] = $input_name;
-                                               $vals[] = $value;
+                                               $value_set[$input_name] = 
$value;
                                        }
                                }
                        }
 
-                       if($cols)
-                       {
-                               $cols   = "," . implode(",", $cols);
-                               $vals   = ",'" . implode("','", $vals) . "'";
-                       }
+                       $value_set['priority'] = isset($ticket['priority']) ? 
$ticket['priority'] : 0;
+                       $value_set['user_id'] = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $value_set['assignedto'] = $ticket['assignedto'];
+                       $value_set['group_id'] = $ticket['group_id'];
+                       $value_set['subject'] = 
$this->db->db_addslashes($ticket['subject']);
+                       $value_set['cat_id'] = $ticket['cat_id'];
+                       $value_set['status'] = $ticket['status'];
+                       $value_set['details'] = 
$this->db->db_addslashes($ticket['details']);
+                       $value_set['location_code'] = $ticket['location_code'];
+                       $value_set['entry_date'] = time();
+                       $value_set['modified_date'] = time();
+                       $value_set['finnish_date'] = $ticket['finnish_date'];
+                       $value_set['contact_id'] = $ticket['contact_id'];
+                       $value_set['publish_note'] = 1;
 
-                       $address = '';
-                       if(isset($ticket['street_name']) && 
$ticket['street_name'])
-                       {
-                               $address[]= $ticket['street_name'];
-                               $address[]= $ticket['street_number'];
-                               $address        = 
$this->db->db_addslashes(implode(" ", $address));
-                       }
 
-                       if(!$address)
-                       {
-                               $address = 
$this->db->db_addslashes($ticket['location_name']);
-                       }
-
-                       $values= array
-                               (
-                                       
isset($ticket['priority'])?$ticket['priority']:0,
-                                       
$GLOBALS['phpgw_info']['user']['account_id'],
-                                       $ticket['assignedto'],
-                                       $ticket['group_id'],
-                                       
$this->db->db_addslashes($ticket['subject']),
-                                       $ticket['cat_id'],
-                                       $ticket['status'],
-                                       
$this->db->db_addslashes($ticket['details']),
-                                       $ticket['location_code'],
-                                       $address,
-                                       time(),
-                                       time(),
-                                       $ticket['finnish_date'],
-                                       $ticket['contact_id'],
-                                       1
-                               );
-
-                       $values = $this->db->validate_insert($values);
+                       $cols = implode(',', array_keys($value_set));
+                       $values = 
$this->db->validate_insert(array_values($value_set));
                        $this->db->transaction_begin();
 
-                       $this->db->query("insert into phpgw_helpdesk_tickets 
(priority,user_id,"
-                               . 
"assignedto,group_id,subject,cat_id,status,details,location_code,"
-                               . 
"address,entry_date,modified_date,finnish_date,contact_id,publish_note $cols)"
-                               . "VALUES ($values $vals )",__LINE__,__FILE__);
+                       $this->db->query("INSERT INTO {$table} ({$cols}) VALUES 
({$values})", __LINE__, __FILE__);
 
-                       $id = 
$this->db->get_last_insert_id('phpgw_helpdesk_tickets','id');
-                       if(isset($ticket['extra']['contact_phone']) && 
$ticket['extra']['contact_phone'] && isset($ticket['extra']['tenant_id']) && 
$ticket['extra']['tenant_id'])
-                       {
-                               $this->db->query("update fm_tenant set 
contact_phone='". $ticket['extra']['contact_phone']. "' where id='". 
$ticket['extra']['tenant_id']. "'",__LINE__,__FILE__);
-                       }
+                       $id = $this->db->get_last_insert_id($table, 'id');
 
-                       if(isset($ticket['origin']) && 
is_array($ticket['origin']))
-                       {
-                               if($ticket['origin'][0]['data'][0]['id'])
-                               {
-                                       $interlink_data = array
-                                               (
-                                                       'location1_id'          
=> $GLOBALS['phpgw']->locations->get_id('helpdesk', 
$ticket['origin'][0]['location']),
-                                                       'location1_item_id' => 
$ticket['origin'][0]['data'][0]['id'],
-                                                       'location2_id'          
=> $GLOBALS['phpgw']->locations->get_id('helpdesk', '.ticket'),                 
-                                                       'location2_item_id' => 
$id,
-                                                       'account_id'            
=> $this->account
-                                               );
 
-                                       $interlink      = 
CreateObject('helpdesk.interlink');
-                                       
$interlink->add($interlink_data,$this->db);
-                               }
-                       }
-
                        if($this->db->transaction_commit())
                        {
                                $this->historylog->add('O',$id, time(),'');

Modified: trunk/helpdesk/inc/class.uitts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uitts.inc.php      2016-08-24 13:38:44 UTC (rev 
15502)
+++ trunk/helpdesk/inc/class.uitts.inc.php      2016-08-25 08:20:09 UTC (rev 
15503)
@@ -989,9 +989,17 @@
 
                                $values = 
$this->bocommon->collect_locationdata($values, $insert_record);
 
-                               if (!$values['subject'] && 
isset($this->bo->config->config_data['tts_mandatory_title']) && 
$this->bo->config->config_data['tts_mandatory_title'])
+                               if (!$values['subject'])
                                {
-                                       $receipt['error'][] = array('msg' => 
lang('Please enter a title !'));
+                                       
if(isset($this->bo->config->config_data['tts_mandatory_title']) && 
$this->bo->config->config_data['tts_mandatory_title'])
+                                       {
+                                               $receipt['error'][] = 
array('msg' => lang('Please enter a title !'));
+                                       }
+                                       else
+                                       {
+                                               $_cat = 
$this->cats->return_single($values['cat_id']);
+                                               $values['subject'] = 
$_cat[0]['name'];
+                                       }
                                }
 
                                if (!$values['cat_id'])
@@ -1095,8 +1103,9 @@
                                                        
$bofiles->vfs->override_acl = 0;
                                                }
                                        }
-
-                                       if($_POST['pasted_image'])
+                                       if($_POST['pasted_image'] &&
+                                               $_POST['pasted_image'] 
!='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAPklEQVR4nO3BMQEAAADCoPVPbQsvoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgKcBnKQAAaZ1lY4AAAAASUVORK5CYII='
+                                               )
                                        {
                                                $img = $_POST['pasted_image'];
                                                $img = 
str_replace('data:image/png;base64,', '', $img);




reply via email to

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