fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15971] more on helpdesk


From: sigurdne
Subject: [Fmsystem-commits] [15971] more on helpdesk
Date: Wed, 9 Nov 2016 13:51:57 +0000 (UTC)

Revision: 15971
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15971
Author:   sigurdne
Date:     2016-11-09 13:51:57 +0000 (Wed, 09 Nov 2016)
Log Message:
-----------
more on helpdesk

Modified Paths:
--------------
    trunk/helpdesk/inc/class.botts.inc.php
    trunk/helpdesk/inc/class.menu.inc.php
    trunk/helpdesk/inc/class.sogeneric.inc.php
    trunk/helpdesk/setup/default_records.inc.php
    trunk/helpdesk/setup/phpgw_no.lang
    trunk/helpdesk/setup/setup.inc.php
    trunk/helpdesk/setup/tables_current.inc.php
    trunk/helpdesk/setup/tables_update.inc.php

Added Paths:
-----------
    trunk/helpdesk/inc/class.uicustom.inc.php

Modified: trunk/helpdesk/inc/class.botts.inc.php
===================================================================
--- trunk/helpdesk/inc/class.botts.inc.php      2016-11-09 13:51:18 UTC (rev 
15970)
+++ trunk/helpdesk/inc/class.botts.inc.php      2016-11-09 13:51:57 UTC (rev 
15971)
@@ -770,6 +770,7 @@
 
                function mail_ticket($id, $fields_updated, $receipt = 
array(),$location_code='', $get_message = false)
                {
+                       $log_recipients = array();
                        $this->send                     = 
CreateObject('phpgwapi.send');
 
                        $ticket = $this->so->read_single($id);
@@ -876,8 +877,9 @@
 
                        $members = array();
 
-                       if( 
isset($this->config->config_data['groupnotification']) && 
$this->config->config_data['groupnotification'] && $ticket['group_id'] )
+                       if( 
isset($this->config->config_data['groupnotification']) && 
$this->config->config_data['groupnotification']==1 && $ticket['group_id'] )
                        {
+                               $log_recipients[] = $group_name;
                                $members_gross = 
$GLOBALS['phpgw']->accounts->member($ticket['group_id'], true);
                                foreach($members_gross as $user)
                                {
@@ -894,6 +896,7 @@
                        {
                                // add owner to recipients
                                $members[$ticket['user_id']] = 
$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);
+                               $log_recipients[] = 
$GLOBALS['phpgw']->accounts->get($ticket['user_id'])->__toString();
                        }
 
                        
$GLOBALS['phpgw']->preferences->set_account_id($ticket['assignedto'], true);
@@ -905,6 +908,7 @@
                        {
                                // add assigned to recipients
                                $members[$ticket['assignedto']] = 
$GLOBALS['phpgw']->accounts->id2name($ticket['assignedto']);
+                               $log_recipients[] = 
$GLOBALS['phpgw']->accounts->get($ticket['assignedto'])->__toString();
                        }
 
                        $error = array();
@@ -937,6 +941,56 @@
                                }
                        }
 
+                       $notify_list = execMethod('property.notify.read', array
+                               (
+                               'location_id' => 
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location),
+                               'location_item_id' => $id
+                               )
+                       );
+
+                       if 
(isset($GLOBALS['phpgw_info']['user']['apps']['sms']))
+                       {
+
+                               $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'] == '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']}"));
+                                       }
+                               }
+                               unset($entry);
+                               if ($toarray_sms)
+                               {
+                                       $this->historylog->add('MS', $id, 
"{$subject}::" . implode(',', $toarray_sms));
+                               }
+                       }
+
+                       reset($notify_list);
+                       foreach ($notify_list as $entry)
+                       {
+                               /**
+                                * Calculate email from username
+                                */
+                               if(!$entry['email'])
+                               {
+                                       $entry['email'] = 
"{$entry['account_lid'address@hidden";
+                               }
+
+                               if ($entry['is_active'] && 
$entry['notification_method'] == 'email' && $entry['email'])
+                               {
+                                       $toarray[] = "{$entry['first_name']} 
{$entry['last_name']}<{$entry['email']}>";
+                               }
+
+                               $log_recipients[] = "{$entry['first_name']} 
{$entry['last_name']}";
+                       }
+                       unset($entry);
+
+                       $rc = false;
                        if($toarray)
                        {
                                $to = implode(';',$toarray);
@@ -959,23 +1013,11 @@
                                }
                        }
 
-                       if (!$rc && 
($this->config->config_data['groupnotification'] || 
$this->config->config_data['ownernotification'] || 
$this->config->config_data['groupnotification']))
+                       if ($rc && $log_recipients)
                        {
-                               $receipt['error'][] = array('msg'=> lang('Your 
message could not be sent by mail!'));
-                               $receipt['error'][] = array('msg'=> lang('The 
mail server returned'));
-                               $receipt['error'][] = array('msg'=> "From : 
{$current_user_address}");
-                               $receipt['error'][] = array('msg'=> 'to: '.$to);
-                               $receipt['error'][] = array('msg'=> 'subject: 
'.$subject);
-                               $receipt['error'][] = array('msg'=> $body );
-       //                      $receipt['error'][] = array('msg'=> 'cc: ' . 
$cc);
-       //                      $receipt['error'][] = array('msg'=> 'bcc: 
'.$bcc);
-                               $receipt['error'][] = array('msg'=> 'group: 
'.$group_name);
-                               $receipt['error'][] = array('msg'=> 'err_code: 
'.$this->send->err['code']);
-                               $receipt['error'][] = array('msg'=> 'err_msg: 
'. htmlspecialchars($this->send->err['msg']));
-                               $receipt['error'][] = array('msg'=> 'err_desc: 
'. $this->send->err['desc']);
+                               $this->historylog->add('M', $id, implode(';', 
array_unique($log_recipients)));
                        }
 
-                       //_debug_array($receipt);
                        return $receipt;
                }
 

Modified: trunk/helpdesk/inc/class.menu.inc.php
===================================================================
--- trunk/helpdesk/inc/class.menu.inc.php       2016-11-09 13:51:18 UTC (rev 
15970)
+++ trunk/helpdesk/inc/class.menu.inc.php       2016-11-09 13:51:57 UTC (rev 
15971)
@@ -107,6 +107,12 @@
                                                (
                                                        'text'  => 
lang('Configure Access Permissions'),
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'preferences.uiadmin_acl.list_acl', 'acl_app' => 'helpdesk') )
+                                               ),
+                                               'custom_menu_items' => array
+                                                       (
+                                                       'text' => lang('custom 
menu items'),
+                                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'helpdesk.uigeneric.index',
+                                                               'type' => 
'custom_menu_items'))
                                                )
                                        );
                        }
@@ -156,6 +162,23 @@
                                        'text' => lang('response template'),
                                        'image' => array('helpdesk', 'helpdesk')
                                );
+
+                               $custom_menu_items = 
CreateObject('helpdesk.sogeneric','custom_menu_items')->read_tree(array('type' 
=> 'custom_menu_items',
+                                                       'filter' => 
array('location' => '.ticket')));
+
+                               if ($custom_menu_items)
+                               {
+                                       $menus['navigation']['report'] = array
+                                               (
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'helpdesk.uicustom.index')),
+                                                       'text' => 
lang('reports'),
+                                                       'image' => 
array('helpdesk', 'helpdesk')
+                                       );
+                                       foreach ($custom_menu_items as $item)
+                                       {
+                                               
$menus['navigation']['report']['children'][] = $item;
+                                       }
+                               }
                        }
 
                        $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$incoming_app;

Modified: trunk/helpdesk/inc/class.sogeneric.inc.php
===================================================================
--- trunk/helpdesk/inc/class.sogeneric.inc.php  2016-11-09 13:51:18 UTC (rev 
15970)
+++ trunk/helpdesk/inc/class.sogeneric.inc.php  2016-11-09 13:51:57 UTC (rev 
15971)
@@ -154,7 +154,92 @@
                                        );
 
                                        break;
-                               default:
+                               case 'custom_menu_items':
+                                       $info = array
+                                               (
+                                               'table' => 
'phpgw_helpdesk_custom_menu_items',
+                                               'id' => array('name' => 'id', 
'type' => 'auto'),
+                                               'fields' => array
+                                                       (
+                                                       array
+                                                               (
+                                                               'name' => 
'parent_id',
+                                                               'descr' => 
lang('parent'),
+                                                               'type' => 
'select',
+                                                               'sortable' => 
true,
+                                                               'nullable' => 
true,
+                                                               'filter' => 
false,
+                                                               'role' => 
'parent',
+                                                               'values_def' => 
array
+                                                                       (
+                                                                       
'valueset' => false,
+                                                                       
'method' => 'helpdesk.bogeneric.get_list',
+                                                                       
'method_input' => array('type' => 'custom_menu_items', 'role' => 'parent',
+                                                                               
'selected' => '##parent_id##', 'mapping' => array('name' => 'text'))
+                                                               )
+                                                       ),
+                                                       array
+                                                               (
+                                                               'name' => 
'text',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array
+                                                               (
+                                                               'name' => 'url',
+                                                               'descr' => 
lang('url'),
+                                                               'type' => 'text'
+                                                       ),
+                                                       array
+                                                               (
+                                                               'name' => 
'target',
+                                                               'descr' => 
lang('target'),
+                                                               'type' => 
'select',
+                                                               'filter' => 
false,
+                                                               'values_def' => 
array
+                                                                       (
+                                                                       
'valueset' => array(array('id' => '_blank', 'name' => '_blank'), array(
+                                                                               
        'id' => '_parent', 'name' => '_parent')),
+                                                               )
+                                                       ),
+                                                       array
+                                                               (
+                                                               'name' => 
'location',
+                                                               'descr' => 
lang('location'),
+                                                               'type' => 
'select',
+                                                               'filter' => 
true,
+                                                               'values_def' => 
array
+                                                                       (
+                                                                       
'valueset' => false,
+                                                                       
'method' => 'preferences.boadmin_acl.get_locations',
+                                                                       
'method_input' => array('acl_app' => 'helpdesk', 'selected' => '##location##')
+                                                               )
+                                                       ),
+                                                       array
+                                                               (
+                                                               'name' => 
'local_files',
+                                                               'descr' => 
lang('local files'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => ''
+                                                       )
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => lang('custom menu 
items'),
+                                               'acl_app' => 'helpdesk',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::helpdesk::custom_menu_items',
+                                               'default' => array
+                                                       (
+                                                       'user_id' => 
array('add' => '$this->account'),
+                                                       'entry_date' => 
array('add' => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               ),
+                                               'check_grant' => false,
+                                               'mapping' => array('name' => 
'text')
+                                       );
+
+                                       break;                          default:
                                        $message = lang('ERROR: illegal type 
%1', $type);
                                        phpgwapi_cache::message_set($message, 
'error');
 //                             throw new Exception(lang('ERROR: illegal type 
%1', $type));

Added: trunk/helpdesk/inc/class.uicustom.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uicustom.inc.php                           (rev 0)
+++ trunk/helpdesk/inc/class.uicustom.inc.php   2016-11-09 13:51:57 UTC (rev 
15971)
@@ -0,0 +1,42 @@
+<?php
+       /**
+        * phpGroupWare - property: a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+        * @package property
+        * @subpackage custom
+        * @version $Id: class.uicustom.inc.php 14987 2016-05-09 13:02:55Z 
sigurdne $
+        */
+       /**
+        * Description
+        * @package property
+        */
+       phpgw::import_class('property.uicustom');
+
+       class helpdesk_uicustom extends property_uicustom
+       {
+               function __construct()
+               {
+                       parent::__construct();
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'helpdesk::report';
+               }
+       }
\ No newline at end of file

Modified: trunk/helpdesk/setup/default_records.inc.php
===================================================================
--- trunk/helpdesk/setup/default_records.inc.php        2016-11-09 13:51:18 UTC 
(rev 15970)
+++ trunk/helpdesk/setup/default_records.inc.php        2016-11-09 13:51:57 UTC 
(rev 15971)
@@ -31,5 +31,6 @@
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.admin', 'Admin')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr, allow_grant, allow_c_function, allow_c_attrib, c_attrib_table) 
VALUES ({$app_id}, '.ticket', 'Helpdesk', 1, 1, 1, 'phpgw_helpdesk_tickets')");
 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.ticket.order', 'Helpdesk ad hock order')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations (app_id, 
name, descr) VALUES ({$app_id}, '.custom', 'Custom reports')");
 
 $GLOBALS['phpgw_setup']->oProc->query("DELETE from phpgw_config WHERE 
config_app='helpdesk'");

Modified: trunk/helpdesk/setup/phpgw_no.lang
===================================================================
--- trunk/helpdesk/setup/phpgw_no.lang  2016-11-09 13:51:18 UTC (rev 15970)
+++ trunk/helpdesk/setup/phpgw_no.lang  2016-11-09 13:51:57 UTC (rev 15971)
@@ -179,4 +179,6 @@
 picture        helpdesk        no      Bilde
 response template      helpdesk        no      Standardtekster
 inbox  helpdesk        no      Innboks
-standard text  helpdesk        no      Standardtekst
\ No newline at end of file
+standard text  helpdesk        no      Standardtekst
+custom menu items      helpdesk        no      Tilpassede menyer
+reports        helpdesk        no      Rapporter
\ No newline at end of file

Modified: trunk/helpdesk/setup/setup.inc.php
===================================================================
--- trunk/helpdesk/setup/setup.inc.php  2016-11-09 13:51:18 UTC (rev 15970)
+++ trunk/helpdesk/setup/setup.inc.php  2016-11-09 13:51:57 UTC (rev 15971)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['helpdesk']['name']                 = 'helpdesk';
-       $setup_info['helpdesk']['version']              = '0.9.18.002';
+       $setup_info['helpdesk']['version']              = '0.9.18.003';
        $setup_info['helpdesk']['app_order']    = 8;
        $setup_info['helpdesk']['enable']               = 1;
        $setup_info['helpdesk']['app_group']    = 'office';
@@ -48,7 +48,8 @@
                'phpgw_helpdesk_status',
                'phpgw_helpdesk_tickets',
                'phpgw_helpdesk_views',
-               'phpgw_helpdesk_response_template'
+               'phpgw_helpdesk_response_template',
+               'phpgw_helpdesk_custom_menu_items'
        );
 
        /* The hooks this app includes, needed for hooks registration */

Modified: trunk/helpdesk/setup/tables_current.inc.php
===================================================================
--- trunk/helpdesk/setup/tables_current.inc.php 2016-11-09 13:51:18 UTC (rev 
15970)
+++ trunk/helpdesk/setup/tables_current.inc.php 2016-11-09 13:51:57 UTC (rev 
15971)
@@ -102,4 +102,23 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'phpgw_helpdesk_custom_menu_items' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'precision' => 
4, 'nullable' => False),
+                               'parent_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
+                               'text' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                               'url' => array('type' => 'text', 'nullable' => 
True),
+                               'target' => array('type' => 'varchar', 
'precision' => '15', 'nullable' => True),
+                               'location' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                               'local_files' => array('type' => 'int', 
'precision' => 2, 'nullable' => true),
+                               'user_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => True),
+                               'entry_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                               'modified_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               )
+
        );

Modified: trunk/helpdesk/setup/tables_update.inc.php
===================================================================
--- trunk/helpdesk/setup/tables_update.inc.php  2016-11-09 13:51:18 UTC (rev 
15970)
+++ trunk/helpdesk/setup/tables_update.inc.php  2016-11-09 13:51:57 UTC (rev 
15971)
@@ -44,13 +44,13 @@
                $GLOBALS['phpgw_setup']->oProc->CreateTable(
                        'phpgw_helpdesk_response_template', array(
                                'fd' => array(
-                               'id' => array('type' => 'auto', 'precision' => 
4, 'nullable' => False),
-                               'name' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
-                               'content' => array('type' => 'text', 'nullable' 
=> True),
-                               'public' => array('type' => 'int', 'precision' 
=> 2, 'nullable' => True),
-                               'user_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => True),
-                               'entry_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
-                               'modified_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                                       'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => False),
+                                       'name' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                                       'content' => array('type' => 'text', 
'nullable' => True),
+                                       'public' => array('type' => 'int', 
'precision' => 2, 'nullable' => True),
+                                       'user_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                                       'entry_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                                       'modified_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
                                ),
                                'pk' => array('id'),
                                'fk' => array(),
@@ -64,4 +64,43 @@
                        $GLOBALS['setup_info']['helpdesk']['currentver'] = 
'0.9.18.002';
                        return $GLOBALS['setup_info']['helpdesk']['currentver'];
                }
-       }       
\ No newline at end of file
+       }
+
+       /**
+       * Update helpdesk version from 0.9.18.002 to 0.9.18.003
+       */
+       $test[] = '0.9.18.002';
+
+       function helpdesk_upgrade0_9_18_002()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'phpgw_helpdesk_custom_menu_items', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => False),
+                                       'parent_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
+                                       'text' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                                       'url' => array('type' => 'text', 
'nullable' => True),
+                                       'target' => array('type' => 'varchar', 
'precision' => '15', 'nullable' => True),
+                                       'location' => array('type' => 
'varchar', 'precision' => 255, 'nullable' => False),
+                                       'local_files' => array('type' => 'int', 
'precision' => 2, 'nullable' => true),
+                                       'user_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                                       'entry_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                                       'modified_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw']->locations->add('.custom', 'Custom reports', 
'helpdesk', $allow_grant = false, $custom_tbl = false, $c_function = false);
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['helpdesk']['currentver'] = 
'0.9.18.003';
+                       return $GLOBALS['setup_info']['helpdesk']['currentver'];
+               }
+       }
\ No newline at end of file




reply via email to

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