[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16514] Helpdesk: start implementing email out
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16514] Helpdesk: start implementing email out |
Date: |
Sat, 1 Apr 2017 12:50:08 -0400 (EDT) |
Revision: 16514
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16514
Author: sigurdne
Date: 2017-04-01 12:50:07 -0400 (Sat, 01 Apr 2017)
Log Message:
-----------
Helpdesk: start implementing email out
Modified Paths:
--------------
trunk/helpdesk/inc/class.menu.inc.php
trunk/helpdesk/inc/class.sogeneric.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.boemail_out.inc.php
trunk/helpdesk/inc/class.soemail_out.inc.php
trunk/helpdesk/inc/class.uiemail_out.inc.php
trunk/helpdesk/inc/model/
trunk/helpdesk/inc/model/class.email_out.inc.php
trunk/helpdesk/js/portico/email_out.edit.js
Added: trunk/helpdesk/inc/class.boemail_out.inc.php
===================================================================
--- trunk/helpdesk/inc/class.boemail_out.inc.php
(rev 0)
+++ trunk/helpdesk/inc/class.boemail_out.inc.php 2017-04-01 16:50:07 UTC
(rev 16514)
@@ -0,0 +1,162 @@
+<?php
+ /**
+ * phpGroupWare
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 Free Software Foundation
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License v2 or later
+ * @internal
+ * @package helpdesk
+ * @subpackage email_out
+ * @version $Id:$
+ */
+
+ /*
+ This program 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.
+
+ This program 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ phpgw::import_class('phpgwapi.bocommon');
+ phpgw::import_class('helpdesk.soemail_out');
+
+ include_class('helpdesk', 'email_out', 'inc/model/');
+
+ class helpdesk_boemail_out extends phpgwapi_bocommon
+ {
+ protected static
+ $bo,
+ $fields,
+ $acl_location;
+
+ public function __construct()
+ {
+ $this->fields = helpdesk_email_out::get_fields();
+ $this->acl_location = helpdesk_email_out::acl_location;
+ }
+
+ /**
+ * Implementing classes must return an instance of itself.
+ *
+ * @return the class instance.
+ */
+ public static function get_instance()
+ {
+ if (self::$bo == null)
+ {
+ self::$bo = new helpdesk_boemail_out();
+ }
+ return self::$bo;
+ }
+
+ public function store($object)
+ {
+ $this->store_pre_commit($object);
+ $ret =
helpdesk_soemail_out::get_instance()->store($object);
+ $this->store_post_commit($object);
+ return $ret;
+ }
+
+ public function read($params)
+ {
+ if(empty($params['filters']['active']))
+ {
+ $params['filters']['active'] = 1;
+ }
+ else
+ {
+ unset($params['filters']['active']);
+ }
+ $values =
helpdesk_soemail_out::get_instance()->read($params);
+ // $status_text = helpdesk_email_out::get_status_list();
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ foreach ($values['results'] as &$entry)
+ {
+ // $entry['status'] =
$status_text[$entry['status']];
+ $entry['created'] =
$GLOBALS['phpgw']->common->show_date($entry['created']);
+ $entry['modified'] =
$GLOBALS['phpgw']->common->show_date($entry['modified']);
+ }
+ return $values;
+ }
+
+ public function read_single($id, $return_object = true)
+ {
+ if ($id)
+ {
+ $values =
helpdesk_soemail_out::get_instance()->read_single($id, $return_object);
+ }
+ else
+ {
+ $values = new helpdesk_email_out();
+ }
+
+ return $values;
+ }
+
+ public function get_composite_candidates( $composite_id )
+ {
+ return
helpdesk_soemail_out::get_instance()->get_composite_candidates($composite_id);
+ }
+
+ function set_candidates($id, $ids)
+ {
+ return
helpdesk_soemail_out::get_instance()->set_candidates($id, $ids);
+ }
+
+ function delete_recipients($id, $ids)
+ {
+ return
helpdesk_soemail_out::get_instance()->delete_recipients($id, $ids);
+ }
+
+ public function get_recipients( $email_out_id )
+ {
+ return
helpdesk_soemail_out::get_instance()->get_recipients($email_out_id);
+ }
+
+ public function send_email( $id, $ids = array() )
+ {
+ $email_out = $this->read_single($id);
+ $subject = $email_out->subject;
+ $content = $email_out->content;
+ phpgw::import_class('helpdesk.soparty');
+ $email_validator =
CreateObject('phpgwapi.EmailAddressValidator');
+ if (!is_object($GLOBALS['phpgw']->send))
+ {
+ $GLOBALS['phpgw']->send =
CreateObject('phpgwapi.send');
+ }
+
+ $cc ='';
+ $bcc = '';
+ $from_email = '';
+ $from_name = '';
+ foreach ($ids as $party_id)
+ {
+ $party =
helpdesk_soparty::get_instance()->get_single($party_id);
+ $to_email = $party->get_email();
+ if
(!$email_validator->check_email_address($to_email) )
+ {
+
helpdesk_soemail_out::get_instance()->set_status($id, $party_id,
helpdesk_email_out::STATUS_ERROR);
+ continue;
+ }
+
+ try
+ {
+ $rcpt =
$GLOBALS['phpgw']->send->msg('email', $to_email, $subject,
stripslashes($content), '', $cc, $bcc, $from_email, $from_name, 'html');
+
helpdesk_soemail_out::get_instance()->set_status($id, $party_id,
helpdesk_email_out::STATUS_SENT);
+ }
+ catch (Exception $exc)
+ {
+
helpdesk_soemail_out::get_instance()->set_status($id, $party_id,
helpdesk_email_out::STATUS_ERROR);
+ }
+ }
+ }
+ }
\ No newline at end of file
Modified: trunk/helpdesk/inc/class.menu.inc.php
===================================================================
--- trunk/helpdesk/inc/class.menu.inc.php 2017-03-31 15:27:30 UTC (rev
16513)
+++ trunk/helpdesk/inc/class.menu.inc.php 2017-04-01 16:50:07 UTC (rev
16514)
@@ -163,6 +163,19 @@
'image' => array('helpdesk', 'helpdesk')
);
+ $menus['navigation']['email_out'] = array(
+ 'text' => lang('email out'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'helpdesk.uiemail_out.index')),
+ 'image' => array('helpdesk',
'helpdesk'),
+ 'children' => array(
+ 'email_template' => array(
+ 'text' => lang('email
template'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'helpdesk.uigeneric.index',
+ 'type' =>
'email_template', 'admin' => true))
+ )
+ )
+ );
+
$custom_menu_items =
CreateObject('helpdesk.sogeneric','custom_menu_items')->read_tree(array('type'
=> 'custom_menu_items',
'filter' =>
array('location' => '.ticket')));
Added: trunk/helpdesk/inc/class.soemail_out.inc.php
===================================================================
--- trunk/helpdesk/inc/class.soemail_out.inc.php
(rev 0)
+++ trunk/helpdesk/inc/class.soemail_out.inc.php 2017-04-01 16:50:07 UTC
(rev 16514)
@@ -0,0 +1,249 @@
+<?php
+ /**
+ * phpGroupWare - property: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 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/
+ * @package helpdesk
+ * @subpackage email_out
+ * @version $Id: $
+ */
+ phpgw::import_class('phpgwapi.socommon');
+
+ class helpdesk_soemail_out extends phpgwapi_socommon
+ {
+
+ protected static $so;
+
+ public function __construct()
+ {
+ parent::__construct('phpgw_helpdesk_email_out',
helpdesk_email_out::get_fields());
+ }
+
+ /**
+ * Implementing classes must return an instance of itself.
+ *
+ * @return the class instance.
+ */
+ public static function get_instance()
+ {
+ if (self::$so == null)
+ {
+ self::$so =
CreateObject('helpdesk.soemail_out');
+ }
+ return self::$so;
+ }
+
+
+ protected function populate( array $data )
+ {
+ $object = new helpdesk_email_out();
+ foreach ($this->fields as $field => $field_info)
+ {
+ $object->set_field($field, $data[$field]);
+ }
+
+ return $object;
+ }
+
+ protected function update( $object )
+ {
+ $this->db->transaction_begin();
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $lang_active = lang('active');
+ $lang_inactive = lang('inactive');
+
+ $original =
$this->read_single($object->get_id());//returned as array()
+ foreach ($this->fields as $field => $params)
+ {
+ $new_value = $object->$field;
+ $old_value = $original[$field];
+ if (!empty($params['history']) && ($new_value
!= $old_value))
+ {
+ $label = !empty($params['label']) ?
lang($params['label']) : $field;
+ $value_set = array
+ (
+ 'email_out_id' =>
$object->get_id(),
+ 'time' => time(),
+ 'author' =>
$GLOBALS['phpgw_info']['user']['fullname'],
+ 'comment' => $label . '::
' . lang('old value') . ': ' . $this->db->db_addslashes($old_value) . ', '
.lang('new value') . ': ' . $this->db->db_addslashes($new_value),
+ 'type' => 'history',
+ );
+
+ $this->db->query( 'INSERT INTO
helpdesk_email_out_comment (' . implode( ',', array_keys( $value_set ) ) .
') VALUES ('
+ . $this->db->validate_insert(
array_values( $value_set ) ) . ')',__LINE__,__FILE__);
+ }
+
+ }
+
+ parent::update($object);
+
+ return $this->db->transaction_commit();
+ }
+
+ public function get_composite_candidates( $composite_id )
+ {
+ $composite_id = (int) $composite_id;
+ $values = array();
+ $ts_query = strtotime(date('Y-m-d')); // timestamp for
query (today)
+
+ $sql = "SELECT email, first_name, last_name,
company_name, helpdesk_party.id"
+ . " FROM helpdesk_contract_composite"
+ . " {$this->join} helpdesk_contract ON
helpdesk_contract_composite.contract_id = helpdesk_contract.id"
+ . " {$this->join} helpdesk_contract_party ON
helpdesk_contract_party.contract_id = helpdesk_contract.id"
+ . " {$this->join} helpdesk_party ON
helpdesk_contract_party.party_id = helpdesk_party.id"
+ . " WHERE
helpdesk_contract_composite.composite_id = {$composite_id}"
+ . " AND helpdesk_contract.date_start <=
{$ts_query} AND ( helpdesk_contract.date_end >= {$ts_query} OR
helpdesk_contract.date_end IS NULL)";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ while ($this->db->next_record())
+ {
+ $first_name = $this->db->f('first_name',true);
+ $last_name = $this->db->f('last_name',true);
+ $company_name =
$this->db->f('company_name',true);
+
+ $name = '';
+ if($last_name)
+ {
+ $name .= "$last_name, $first_name";
+ }
+ if($last_name && $company_name)
+ {
+ $name .= " ({$company_name})";
+ }
+ else if($company_name)
+ {
+ $name = $company_name;
+ }
+
+ $values[] = array(
+ 'id' => $this->db->f('id'),
+ 'name' => $name,
+ 'email' => $this->db->f('email',true),
+ );
+ }
+ return $values;
+ }
+
+ public function get_recipients( $email_out_id )
+ {
+
+ $status_list = helpdesk_email_out::get_status_list();
+
+ $email_out_id = (int) $email_out_id;
+ $values = array();
+
+ $sql = "SELECT email, first_name, last_name,
company_name, helpdesk_party.id, status"
+ . " FROM phpgw_helpdesk_email_out_party"
+ . " {$this->join} phpgw_helpdesk_party ON
phpgw_helpdesk_email_out_party.party_id = phpgw_helpdesk_party.id"
+ . " WHERE
phpgw_helpdesk_email_out_party.email_out_id = {$email_out_id}";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ while ($this->db->next_record())
+ {
+ $first_name = $this->db->f('first_name',true);
+ $last_name = $this->db->f('last_name',true);
+ $company_name =
$this->db->f('company_name',true);
+
+ $name = '';
+ if($last_name)
+ {
+ $name .= "$last_name, $first_name";
+ }
+ if($last_name && $company_name)
+ {
+ $name .= " ({$company_name})";
+ }
+ else if($company_name)
+ {
+ $name = $company_name;
+ }
+
+ $values[] = array(
+ 'id' => $this->db->f('id'),
+ 'name' => $name,
+ 'email' => $this->db->f('email',true),
+ 'status' =>
$status_list[$this->db->f('status')]
+ );
+ }
+ return $values;
+ }
+
+ function set_candidates($id, $ids)
+ {
+ $recipients = $this->get_recipients($id);
+
+ $check_duplicates = array();
+ foreach ($recipients as $entry)
+ {
+ $check_duplicates[] = $entry['id'];
+ }
+
+
+ $sql = 'INSERT INTO phpgw_helpdesk_email_out_party
(email_out_id, party_id)'
+ . ' VALUES(?, ?)';
+ foreach ($ids as $party_id)
+ {
+ if(in_array($party_id, $check_duplicates))
+ {
+ continue;
+ }
+
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' => (int)$id,
+ 'type' => PDO::PARAM_INT
+ ),
+ 2 => array
+ (
+ 'value' => $party_id,
+ 'type' => PDO::PARAM_INT
+ )
+ );
+ }
+ if($valueset)
+ {
+ return $GLOBALS['phpgw']->db->insert($sql,
$valueset, __LINE__, __FILE__);
+ }
+ }
+
+ function delete_recipients($id, $ids = array())
+ {
+ $id = (int) $id;
+ if($ids)
+ {
+ $parties = implode(',', $ids);
+ $sql = "DELETE FROM
phpgw_helpdesk_email_out_party WHERE email_out_id = {$id} AND party_id IN
({$parties})";
+ return $this->db->query($sql,__LINE__,__FILE__);
+ }
+ }
+
+ function set_status($id, $party_id, $status)
+ {
+ $id = (int) $id;
+ $party_id = (int) $party_id;
+ $status = (int) $status;
+ $sql = "UPDATE phpgw_helpdesk_email_out_party SET
status = {$status} WHERE email_out_id = {$id} AND party_id = {$party_id}";
+ return $this->db->query($sql,__LINE__,__FILE__);
+ }
+ }
\ No newline at end of file
Modified: trunk/helpdesk/inc/class.sogeneric.inc.php
===================================================================
--- trunk/helpdesk/inc/class.sogeneric.inc.php 2017-03-31 15:27:30 UTC (rev
16513)
+++ trunk/helpdesk/inc/class.sogeneric.inc.php 2017-04-01 16:50:07 UTC (rev
16514)
@@ -1,5 +1,5 @@
<?php
-/**
+ /**
* phpGroupWare - eventplanner: a part of a Facilities Management
System.
*
* @author Sigurd Nes <address@hidden>
@@ -30,6 +30,7 @@
class helpdesk_sogeneric extends property_sogeneric_
{
+
var $appname = 'helpdesk';
function __construct( $type = '', $type_id = 0 )
@@ -37,7 +38,6 @@
parent::__construct($type, $type_id);
}
-
public function get_location_info( $type, $type_id = 0 )
{
@@ -155,6 +155,49 @@
);
break;
+ case 'email_template':
+ $info = array
+ (
+ 'table' =>
'phpgw_helpdesk_email_template',
+ 'id' => array('name' => 'id',
'type' => 'auto'),
+ 'fields' => array
+ (
+ array
+ (
+ 'name' =>
'name',
+ 'descr' =>
lang('name'),
+ 'type' =>
'varchar'
+ ),
+ array
+ (
+ 'name' =>
'content',
+ 'descr' =>
lang('content'),
+ 'type' => 'text'
+ ),
+ array
+ (
+ 'name' =>
'public',
+ 'descr' =>
lang('public'),
+ 'type' =>
'checkbox'
+ )
+ ),
+ 'edit_msg' => lang('edit'),
+ 'add_msg' => lang('add'),
+ 'name' => lang('email
template'),
+ 'acl_app' => 'helpdesk',
+ 'system_location' =>
'.email_out.email_template',
+ 'acl_location' => '.email_out',
+ 'menu_selection' =>
'helpdesk::email_out::email_template',
+ 'default' => array
+ (
+ 'user_id' =>
array('add' => '$this->account'),
+ 'created' =>
array('add' => 'time()'),
+ 'modified' =>
array('edit' => 'time()'),
+ ),
+ 'check_grant' => true
+ );
+
+ break;
case 'custom_menu_items':
$info = array
(
@@ -240,7 +283,8 @@
'mapping' => array('name' =>
'text')
);
- break; default:
+ break;
+ default:
$message = lang('ERROR: illegal type
%1', $type);
phpgwapi_cache::message_set($message,
'error');
// throw new Exception(lang('ERROR: illegal type
%1', $type));
@@ -249,6 +293,4 @@
$this->location_info = $info;
return $info;
}
-
-
}
\ No newline at end of file
Added: trunk/helpdesk/inc/class.uiemail_out.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uiemail_out.inc.php
(rev 0)
+++ trunk/helpdesk/inc/class.uiemail_out.inc.php 2017-04-01 16:50:07 UTC
(rev 16514)
@@ -0,0 +1,474 @@
+<?php
+/**
+ * phpGroupWare - helpdesk: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 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/ and Nordlandssykehuset
+ * @package helpdesk
+ * @subpackage email_out
+ * @version $Id: $
+ */
+ phpgw::import_class('phpgwapi.uicommon');
+ phpgw::import_class('phpgwapi.datetime');
+
+ include_class('helpdesk', 'email_out', 'inc/model/');
+
+ class helpdesk_uiemail_out extends phpgwapi_uicommon
+ {
+
+ public $public_functions = array(
+ 'add' => true,
+ 'index' => true,
+ 'query' => true,
+ 'view' => true,
+ 'edit' => true,
+ 'save' => true,
+ 'get' => true,
+ 'get_candidates' => true,
+ 'set_candidates' => true,
+ 'delete_recipients' => true,
+ 'get_recipients'=> true,
+ 'set_email' => true,
+ 'send_email' => true
+ );
+
+ protected
+ $fields,
+ $permissions;
+
+ public function __construct()
+ {
+ parent::__construct();
+ self::set_active_menu('helpdesk::email_out');
+ $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' .
lang('email out');
+ $this->bo = createObject('helpdesk.boemail_out');
+ $this->fields = helpdesk_email_out::get_fields();
+ $this->permissions =
helpdesk_email_out::get_instance()->get_permission_array();
+ }
+
+
+ public function index()
+ {
+ if (empty($this->permissions[PHPGW_ACL_READ]))
+ {
+ phpgw::no_access();
+ }
+
+ if (phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+
+ phpgwapi_jquery::load_widget('autocomplete');
+
+ $function_msg = lang('email out');
+
+ $data = array(
+ 'datatable_name' => $function_msg,
+ 'form' => array(
+ 'toolbar' => array(
+ )
+ ),
+ 'datatable' => array(
+ 'source' => self::link(array(
+ 'menuaction' =>
'helpdesk.uiemail_out.index',
+ 'phpgw_return_as' => 'json'
+ )),
+ 'allrows' => true,
+ 'new_item' =>
self::link(array('menuaction' => 'helpdesk.uiemail_out.add')),
+ 'editor_action' => '',
+ 'field' => parent::_get_fields()
+ )
+ );
+
+ $parameters = array(
+ 'parameter' => array(
+ array(
+ 'name' => 'id',
+ 'source' => 'id'
+ )
+ )
+ );
+
+ $data['datatable']['actions'][] = array
+ (
+ 'my_name' => 'view',
+ 'text' => lang('show'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php', array
+ (
+ 'menuaction' =>
'helpdesk.uiemail_out.view'
+ )),
+ 'parameters' => json_encode($parameters)
+ );
+
+ $data['datatable']['actions'][] = array
+ (
+ 'my_name' => 'edit',
+ 'text' => lang('edit'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php', array
+ (
+ 'menuaction' =>
'helpdesk.uiemail_out.edit'
+ )),
+ 'parameters' => json_encode($parameters)
+ );
+
+ self::add_javascript('helpdesk', 'portico',
'email_out.index.js');
+ phpgwapi_jquery::load_widget('numberformat');
+
+ self::render_template_xsl('datatable_jquery', $data);
+ }
+
+ /*
+ * Edit the price item with the id given in the http variable
'id'
+ */
+
+ public function edit( $values = array(), $mode = 'edit' )
+ {
+ $active_tab = !empty($values['active_tab']) ?
$values['active_tab'] : phpgw::get_var('active_tab', 'string', 'REQUEST',
'first_tab');
+ $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' .
lang('edit');
+ if (empty($this->permissions[PHPGW_ACL_ADD]))
+ {
+ phpgw::no_access();
+ }
+
+ if (!empty($values['object']))
+ {
+ $email_out = $values['object'];
+ }
+ else
+ {
+ $id = !empty($values['id']) ? $values['id'] :
phpgw::get_var('id', 'int');
+ $email_out = $this->bo->read_single($id);
+ }
+
+ $tabs = array();
+ $tabs['first_tab'] = array(
+ 'label' => lang('email out'),
+ 'link' => '#first_tab'
+ );
+ $tabs['recipient'] = array(
+ 'label' => lang('recipient'),
+ 'link' => '#recipient',
+ 'disable' => $email_out->get_id() ? false :
true,
+ );
+
+
+ $bocommon = CreateObject('property.bocommon');
+
+ $comments = (array)$email_out->comments;
+ foreach ($comments as $key => &$comment)
+ {
+ $comment['value_count'] = $key +1;
+ $comment['value_date'] =
$GLOBALS['phpgw']->common->show_date($comment['time']);
+ }
+
+ $comments_def = array(
+ array('key' => 'value_count', 'label' => '#',
'sortable' => true, 'resizeable' => true),
+ array('key' => 'value_date', 'label' =>
lang('Date'), 'sortable' => true, 'resizeable' => true),
+ array('key' => 'author', 'label' =>
lang('User'), 'sortable' => true, 'resizeable' => true),
+ array('key' => 'comment', 'label' =>
lang('Note'), 'sortable' => true, 'resizeable' => true)
+ );
+
+ $datatable_def[] = array(
+ 'container' => 'datatable-container_0',
+ 'requestUrl' => "''",
+ 'ColumnDefs' => $comments_def,
+ 'data' => json_encode($comments),
+ 'config' => array(
+ array('disableFilter' => true),
+ array('disablePagination' => true)
+ )
+ );
+
+ $parties_def = array(
+ array('key' => 'id', 'label' => 'ID',
'sortable' => true, 'resizeable' => true,'formatter' =>
'JqueryPortico.formatLink'),
+ array('key' => 'name', 'label' => lang('name'),
'sortable' => true, 'resizeable' => true),
+ array('key' => 'email', 'label' =>
lang('email'), 'sortable' => true, 'resizeable' => true, 'editor' =>true),
+ );
+
+ $tabletools = array
+ (
+ array('my_name' => 'select_all'),
+ array('my_name' => 'select_none')
+ );
+
+ $tabletools_candidate = array();
+ $tabletools_candidate[] = array
+ (
+ 'my_name' => 'add',
+ 'text' => lang('add'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var api = oTable1.api();
+ var selected = api.rows( {
selected: true } ).data();
+
+ var numSelected =
selected.length;
+
+ if (numSelected ==0){
+ alert('None selected');
+ return false;
+ }
+ var ids = [];
+ for ( var n = 0; n <
selected.length; ++n )
+ {
+ var aData = selected[n];
+ ids.push(aData['id']);
+ }
+
onActionsClick_candidates('add', ids);
+ "
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_1',
+ 'requestUrl' => "''",
+// 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'property.notify.update_data',
+// 'location_id' => $location_id,
'location_item_id' => $id, 'action' => 'refresh_notify_contact',
+// 'phpgw_return_as' => 'json'))),
+ 'ColumnDefs' => $parties_def,
+ 'data' => json_encode(array()),
+ 'tabletools' =>
array_merge($tabletools,$tabletools_candidate),
+ 'config' => array(
+ array('disableFilter' => true),
+ array('disablePagination' => true),
+ array('editor_action' =>
self::link(array('menuaction' => 'helpdesk.uiemail_out.set_email')))
+ )
+ );
+
+
+ $tabletools_recipient = array();
+ $tabletools_recipient[] = array
+ (
+ 'my_name' => 'delete',
+ 'text' => lang('delete'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var api = oTable2.api();
+ var selected = api.rows( {
selected: true } ).data();
+
+ var numSelected =
selected.length;
+
+ if (numSelected ==0){
+ alert('None selected');
+ return false;
+ }
+ var ids = [];
+ for ( var n = 0; n <
selected.length; ++n )
+ {
+ var aData = selected[n];
+ ids.push(aData['id']);
+ }
+
onActionsClick_recipient('delete_recipients', ids);
+ "
+ );
+ $tabletools_recipient[] = array
+ (
+ 'my_name' => 'send_email',
+ 'text' => lang('send email'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var api = oTable2.api();
+ var selected = api.rows( {
selected: true } ).data();
+
+ var numSelected =
selected.length;
+
+ if (numSelected ==0){
+ alert('None selected');
+ return false;
+ }
+ var ids = [];
+ for ( var n = 0; n <
selected.length; ++n )
+ {
+ var aData = selected[n];
+ ids.push(aData['id']);
+ }
+
onActionsClick_recipient('send_email', ids);
+ "
+ );
+
+
+ $parties_def[] = array('key' => 'status', 'label' =>
lang('status'), 'sortable' => true, 'resizeable' => true);
+
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_2',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' =>
'helpdesk.uiemail_out.get_recipients',
+ 'id' => $id,'phpgw_return_as'
=> 'json'))),
+ 'ColumnDefs' => $parties_def,
+ 'data' => json_encode(array()),
+ 'tabletools' =>
array_merge($tabletools,$tabletools_recipient),
+ 'config' => array(
+ array('disableFilter' => true),
+ array('disablePagination' => true),
+ array('editor_action' =>
self::link(array('menuaction' => 'helpdesk.uiemail_out.set_email')))
+ )
+ );
+
+ $data = array(
+ 'datatable_def' => $datatable_def,
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'helpdesk.uiemail_out.save')),
+ 'cancel_url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'helpdesk.uiemail_out.index',)),
+ 'email_out' => $email_out,
+ 'mode' => $mode,
+ 'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+ 'value_active_tab' => $active_tab
+ );
+ phpgwapi_jquery::load_widget('autocomplete');
+ phpgwapi_jquery::formvalidator_generate(array());
+ self::add_javascript('helpdesk', 'portico',
'email_out.edit.js');
+ self::render_template_xsl(array('email_out',
'datatable_inline'), array($mode => $data));
+ }
+
+ /*
+ * Get the email_out with the id given in the http variable 'id'
+ */
+
+ public function get( $id = 0 )
+ {
+ if (empty($this->permissions[PHPGW_ACL_ADD]))
+ {
+ phpgw::no_access();
+ }
+
+ $id = !empty($id) ? $id : phpgw::get_var('id', 'int');
+
+ $email_out = $this->bo->read_single($id)->toArray();
+
+ unset($email_out['secret']);
+
+ return $email_out;
+ }
+
+ public function save()
+ {
+ parent::save();
+ }
+
+ public function get_candidates( )
+ {
+ if (empty($this->permissions[PHPGW_ACL_ADD]))
+ {
+ phpgw::no_access();
+ }
+ $type = phpgw::get_var('type', 'string');
+ $id = phpgw::get_var('id', 'int');
+
+ switch ($type)
+ {
+ case 'composite':
+ $values =
$this->bo->get_composite_candidates($id);
+ array_walk($values, array($this,
"_add_links"), "helpdesk.uiparty.edit");
+
+ break;
+
+ default:
+ $values = array();
+ break;
+ }
+
+ return $this->jquery_results(array('results' =>
$values));
+ }
+
+ public function set_candidates()
+ {
+ if (empty($this->permissions[PHPGW_ACL_EDIT]))
+ {
+ phpgw::no_access();
+ }
+ $id = phpgw::get_var('id', 'int');
+ $ids = (array) phpgw::get_var('ids', 'int');
+ $ret = $this->bo->set_candidates($id, $ids);
+ }
+
+ public function delete_recipients()
+ {
+ if (empty($this->permissions[PHPGW_ACL_EDIT]))
+ {
+ phpgw::no_access();
+ }
+ $id = phpgw::get_var('id', 'int');
+ $ids = (array) phpgw::get_var('ids', 'int');
+ $ret = $this->bo->delete_recipients($id, $ids);
+ }
+
+ public function get_recipients()
+ {
+ if (empty($this->permissions[PHPGW_ACL_EDIT]))
+ {
+ phpgw::no_access();
+ }
+ $id = phpgw::get_var('id', 'int');
+ $values = $this->bo->get_recipients($id);
+ array_walk($values, array($this, "_add_links"),
"helpdesk.uiparty.edit");
+ return $this->jquery_results(array('results' =>
$values));
+
+ }
+
+ public function send_email( )
+ {
+ if (empty($this->permissions[PHPGW_ACL_EDIT]))
+ {
+ phpgw::no_access();
+ }
+ $id = phpgw::get_var('id', 'int');
+ $ids = (array) phpgw::get_var('ids', 'int');
+ $ret = $this->bo->send_email($id, $ids);
+ }
+
+ public function set_email( )
+ {
+ if (empty($this->permissions[PHPGW_ACL_EDIT]))
+ {
+ phpgw::no_access();
+ }
+
+ phpgw::import_class('helpdesk.soparty');
+
+ $field_name = phpgw::get_var('field_name');
+ $email = phpgw::get_var('value');
+ $id = phpgw::get_var('id');
+ $email_validator =
CreateObject('phpgwapi.EmailAddressValidator');
+ $message = array();
+ if (!$email_validator->check_email_address($email) )
+ {
+ $message['error'][] = array('msg' => lang('data
has not validated'));
+ return $message;
+ }
+
+ $party =
helpdesk_soparty::get_instance()->get_single($id);
+ $party->set_field('email', $email);
+ $result =
helpdesk_soparty::get_instance()->store($party);
+
+ $message = array();
+ if ($result)
+ {
+ $message['message'][] = array('msg' =>
lang('data has been saved'));
+ }
+ else
+ {
+ $message['error'][] = array('msg' => lang('data
has not been saved'));
+ }
+
+ return $message;
+
+ }
+ }
\ No newline at end of file
Added: trunk/helpdesk/inc/model/class.email_out.inc.php
===================================================================
--- trunk/helpdesk/inc/model/class.email_out.inc.php
(rev 0)
+++ trunk/helpdesk/inc/model/class.email_out.inc.php 2017-04-01 16:50:07 UTC
(rev 16514)
@@ -0,0 +1,160 @@
+<?php
+ /**
+ * phpGroupWare - helpdesk: a part of a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2016 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/ and Nordlandssykehuset
+ * @package helpdesk
+ * @subpackage email_out
+ * @version $Id: $
+ */
+
+ phpgw::import_class('helpdesk.boemail_out');
+
+ include_class('phpgwapi', 'model', 'inc/model/');
+
+ class helpdesk_email_out extends phpgwapi_model
+ {
+
+ const STATUS_PENDING = 0;
+ const STATUS_SENT = 1;
+ const STATUS_ERROR = 2;
+ const acl_location = '.email_out';
+
+ protected
+ $id,
+ $name,
+ $remark,
+ $subject,
+ $content,
+ $user_id,
+ $created,
+ $modified;
+
+
+ protected $field_of_responsibility_name = '.email_out';
+
+ public function __construct( int $id = null )
+ {
+ parent::__construct((int)$id);
+ $this->field_of_responsibility_name =
self::acl_location;
+ }
+
+ /**
+ * Implementing classes must return an instance of itself.
+ *
+ * @return the class instance.
+ */
+ public static function get_instance()
+ {
+ return new helpdesk_email_out();
+ }
+
+ public static function get_status_list()
+ {
+ return array(
+ self::STATUS_PENDING => lang('planned'),
+ self::STATUS_SENT => lang('sent'),
+ self::STATUS_ERROR => lang('error')
+ );
+ }
+
+ public static function get_fields($debug = true)
+ {
+ $fields = array(
+ 'id' => array('action'=> PHPGW_ACL_READ,
+ 'type' => 'int',
+ 'label' => 'id',
+ 'sortable'=> true,
+ 'formatter' =>
'JqueryPortico.formatLink',
+ ),
+ 'name' => array(
+ 'action'=> PHPGW_ACL_READ |
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+ 'type' => 'string',
+ 'label' => 'name',
+ 'required' => true,
+ 'query' => true,
+ ),
+ 'subject' => array(
+ 'action'=> PHPGW_ACL_READ |
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+ 'type' => 'string',
+ 'label' => 'subject',
+ 'required' => true,
+ 'query' => true,
+ ),
+ 'content' => array(
+ 'action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string',
+ 'label' => 'content',
+ 'required' => true,
+ 'query' => true,
+ ),
+ 'remark' => array('action'=> PHPGW_ACL_ADD |
PHPGW_ACL_EDIT,
+ 'type' => 'string',
+ 'label' => 'description',
+ 'sortable' => false,
+// 'history' => true
+ ),
+ 'modified' => array('action'=> PHPGW_ACL_READ |
PHPGW_ACL_EDIT,
+ 'type' => 'date',
+ 'label' => 'modified',
+ 'sortable' => true,
+ )
+ );
+
+ if($debug)
+ {
+ foreach ($fields as $field => $field_info)
+ {
+
if(!property_exists('helpdesk_email_out', $field))
+ {
+
phpgwapi_cache::message_set('$'."{$field},", 'error');
+ }
+
+ }
+ }
+ return $fields;
+ }
+
+ /**
+ * Implement in subclasses to perform actions on entity before
validation
+ */
+ protected function preValidate( &$entity )
+ {
+ $entity->modified = time();
+ }
+
+
+ public function serialize()
+ {
+ return self::toArray();
+ }
+
+ public function store()
+ {
+ return
helpdesk_boemail_out::get_instance()->store($this);
+ }
+
+ public function read_single($id)
+ {
+ return
helpdesk_boemail_out::get_instance()->read_single($id, true);
+ }
+ }
Added: trunk/helpdesk/js/portico/email_out.edit.js
===================================================================
--- trunk/helpdesk/js/portico/email_out.edit.js (rev 0)
+++ trunk/helpdesk/js/portico/email_out.edit.js 2017-04-01 16:50:07 UTC (rev
16514)
@@ -0,0 +1,125 @@
+var oArgs = {
+ menuaction: 'rental.uicomposite.index',
+ type: 'all_composites',
+ furnished_status: 4,
+ has_contract: 'has_contract',
+ is_active: 'active'
+};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'composite_name', 'composite_id',
'composite_container', 'name');
+
+$(window).on('load', function ()
+{
+ composite_id = $('#composite_id').val();
+ if (composite_id)
+ {
+ composite_id_selection = composite_id;
+ }
+ $("#composite_name").on("autocompleteselect", function (event, ui)
+ {
+ var composite_id = ui.item.value;
+// if (composite_id != composite_id_selection)
+// {
+ populateCandidates('composite', composite_id);
+// }
+ });
+});
+
+function populateCandidates(type, composite_id)
+{
+ composite_id = composite_id || $('#composite_id').val();
+
+ if (!composite_id)
+ {
+ return;
+ }
+
+ oArgs = {
+ menuaction: 'rental.uiemail_out.get_candidates',
+ type: type,
+ id: composite_id
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ JqueryPortico.updateinlineTableHelper(oTable1, requestUrl);
+
+}
+
+this.onActionsClick_candidates = function (type, ids)
+{
+// console.log(ids);
+ oArgs = {
+ menuaction: 'rental.uiemail_out.set_candidates',
+ id: $('#id').val()
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ data: {ids: ids, type: type},
+ success: function (data)
+ {
+ if (data != null)
+ {
+
+ }
+ oArgs = {
+ menuaction: 'rental.uiemail_out.get_recipients',
+ id: $('#id').val()
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ JqueryPortico.updateinlineTableHelper(oTable2,
requestUrl);
+ oArgs = {
+ menuaction: 'rental.uiemail_out.get_candidates',
+ type: 'dummy',
+ id: 0
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ JqueryPortico.updateinlineTableHelper(oTable1,
requestUrl);
+ }
+ });
+
+}
+this.onActionsClick_recipient = function (type, ids)
+{
+ oArgs = {
+ menuaction: 'rental.uiemail_out.' + type,
+ id: $('#id').val()
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ data: {ids: ids, type: type},
+ success: function (data)
+ {
+ if (data != null)
+ {
+
+ }
+ oArgs = {
+ menuaction: 'rental.uiemail_out.get_recipients',
+ id: $('#id').val()
+ };
+
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+ JqueryPortico.updateinlineTableHelper(oTable2,
requestUrl);
+ }
+ });
+
+}
+
+function template_lookup()
+{
+ var oArgs = {menuaction: 'rental.uilookup.email_template'};
+ var strURL = phpGWLink('index.php', oArgs);
+ TINY.box.show({iframe: strURL, boxid: "frameless", width: 750, height:
450, fixed: false, maskid: "darkmask", maskopacity: 40, mask: true, animate:
true, close: true});
+}
Modified: trunk/helpdesk/setup/phpgw_no.lang
===================================================================
--- trunk/helpdesk/setup/phpgw_no.lang 2017-03-31 15:27:30 UTC (rev 16513)
+++ trunk/helpdesk/setup/phpgw_no.lang 2017-04-01 16:50:07 UTC (rev 16514)
@@ -181,4 +181,15 @@
inbox helpdesk no Innboks
standard text helpdesk no Standardtekst
custom menu items helpdesk no Tilpassede menyer
-reports helpdesk no Rapporter
\ No newline at end of file
+reports helpdesk no Rapporter
+email out helpdesk no Epost ut
+recipient helpdesk no Mottaker
+recipients helpdesk no Mottakere
+candidates helpdesk no Kandidater
+send email helpdesk no Send epost
+remark helpdesk no Merknad
+subject helpdesk no Overskrift
+content helpdesk no Innhold
+select all helpdesk no Velg alle
+planned helpdesk no Planlagt
+email template helpdesk no Standardtekster
\ No newline at end of file
Modified: trunk/helpdesk/setup/setup.inc.php
===================================================================
--- trunk/helpdesk/setup/setup.inc.php 2017-03-31 15:27:30 UTC (rev 16513)
+++ trunk/helpdesk/setup/setup.inc.php 2017-04-01 16:50:07 UTC (rev 16514)
@@ -3,7 +3,7 @@
* phpGroupWare - helpdesk.
*
* @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003-2009 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @copyright Copyright (C) 2003-2017 Free Software Foundation, Inc.
http://www.fsf.org/
* @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 helpdesk
@@ -49,7 +49,10 @@
'phpgw_helpdesk_tickets',
'phpgw_helpdesk_views',
'phpgw_helpdesk_response_template',
- 'phpgw_helpdesk_custom_menu_items'
+ 'phpgw_helpdesk_custom_menu_items',
+ 'phpgw_helpdesk_email_template',
+ 'phpgw_helpdesk_email_out',
+ 'phpgw_helpdesk_email_out_party'
);
/* The hooks this app includes, needed for hooks registration */
Modified: trunk/helpdesk/setup/tables_current.inc.php
===================================================================
--- trunk/helpdesk/setup/tables_current.inc.php 2017-03-31 15:27:30 UTC (rev
16513)
+++ trunk/helpdesk/setup/tables_current.inc.php 2017-04-01 16:50:07 UTC (rev
16514)
@@ -119,6 +119,50 @@
'fk' => array(),
'ix' => array(),
'uc' => array()
+ ),
+ 'phpgw_helpdesk_email_out' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'precision' =>
4, 'nullable' => False),
+ 'name' => array('type' => 'varchar',
'precision' => 255, 'nullable' => False),
+ 'remark' => array('type' => 'text', 'nullable'
=> True),
+ 'subject' => array('type' => 'text', 'nullable'
=> false),
+ 'content' => array('type' => 'text', 'nullable'
=> True),
+ 'user_id' => array('type' => 'int', 'precision'
=> 4, 'nullable' => True),
+ 'created' => array('type' => 'int', 'precision'
=> 8, 'nullable' => True, 'default' => 'current_timestamp'),
+ 'modified' => array('type' => 'int',
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'phpgw_helpdesk_email_out_party' => array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto', 'precision' =>
4, 'nullable' => False),
+ 'email_out_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
+ 'email_address' => array('type' => 'varchar',
'precision' => 255, 'nullable' => True),
+ 'status' => array('type' => 'int', 'precision'
=> 2, 'nullable' => True, 'default' => '0'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(
+ 'phpgw_helpdesk_email_out' =>
array('email_out_id' => 'id'),
+ ),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'phpgw_helpdesk_email_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'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
)
-
);
Modified: trunk/helpdesk/setup/tables_update.inc.php
===================================================================
--- trunk/helpdesk/setup/tables_update.inc.php 2017-03-31 15:27:30 UTC (rev
16513)
+++ trunk/helpdesk/setup/tables_update.inc.php 2017-04-01 16:50:07 UTC (rev
16514)
@@ -103,4 +103,76 @@
$GLOBALS['setup_info']['helpdesk']['currentver'] =
'0.9.18.003';
return $GLOBALS['setup_info']['helpdesk']['currentver'];
}
+ }
+
+ /**
+ * Update helpdesk version from 0.9.18.003 to 0.9.18.004
+ */
+ $test[] = '0.9.18.003';
+
+ function helpdesk_upgrade0_9_18_003()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
+ $GLOBALS['phpgw']->locations->add('.email_out', 'email out',
'helpdesk');
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'phpgw_helpdesk_email_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),
+ 'created' => array('type' => 'int',
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+ 'modified' => array('type' => 'int',
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'phpgw_helpdesk_email_out', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => False),
+ 'name' => array('type' => 'varchar',
'precision' => 255, 'nullable' => False),
+ 'remark' => array('type' => 'text',
'nullable' => True),
+ 'subject' => array('type' => 'text',
'nullable' => false),
+ 'content' => array('type' => 'text',
'nullable' => True),
+ 'user_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
+ 'created' => array('type' => 'int',
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+ 'modified' => array('type' => 'int',
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'phpgw_helpdesk_email_out_party', array(
+ 'fd' => array(
+ 'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => False),
+ 'email_out_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => True),
+ 'email_address' => array('type' =>
'varchar', 'precision' => 255, 'nullable' => True),
+ 'status' => array('type' => 'int',
'precision' => 2, 'nullable' => True, 'default' => '0'),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(
+ 'phpgw_helpdesk_email_out' =>
array('email_out_id' => 'id'),
+ ),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['helpdesk']['currentver'] =
'0.9.18.004';
+ return $GLOBALS['setup_info']['helpdesk']['currentver'];
+ }
}
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16514] Helpdesk: start implementing email out,
sigurdne <=