fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16517] more on helpdesk


From: sigurdne
Subject: [Fmsystem-commits] [16517] more on helpdesk
Date: Sun, 2 Apr 2017 12:22:21 -0400 (EDT)

Revision: 16517
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16517
Author:   sigurdne
Date:     2017-04-02 12:22:21 -0400 (Sun, 02 Apr 2017)
Log Message:
-----------
more on helpdesk

Modified Paths:
--------------
    trunk/helpdesk/inc/class.boemail_out.inc.php
    trunk/helpdesk/inc/class.menu.inc.php
    trunk/helpdesk/inc/class.soemail_out.inc.php
    trunk/helpdesk/inc/class.sogeneric.inc.php
    trunk/helpdesk/inc/class.uiemail_out.inc.php
    trunk/helpdesk/inc/class.uilookup.inc.php
    trunk/helpdesk/inc/model/class.email_out.inc.php
    trunk/helpdesk/js/portico/email_out.edit.js
    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
    trunk/helpdesk/templates/base/config.tpl
    trunk/helpdesk/templates/base/email_out.xsl
    trunk/property/inc/class.uigeneric.inc.php
    trunk/property/templates/base/generic.xsl

Modified: trunk/helpdesk/inc/class.boemail_out.inc.php
===================================================================
--- trunk/helpdesk/inc/class.boemail_out.inc.php        2017-04-02 12:01:49 UTC 
(rev 16516)
+++ trunk/helpdesk/inc/class.boemail_out.inc.php        2017-04-02 16:22:21 UTC 
(rev 16517)
@@ -102,9 +102,9 @@
                        return $values;
                }
 
-               public function get_composite_candidates( $composite_id )
+               public function get_recipient_candidates( $recipient_set_id, 
$email_out_id)
                {
-                       return 
helpdesk_soemail_out::get_instance()->get_composite_candidates($composite_id);
+                       return 
helpdesk_soemail_out::get_instance()->get_recipient_candidates($recipient_set_id,
 $email_out_id);
                }
 
                function set_candidates($id, $ids)
@@ -126,25 +126,27 @@
                {
                        $email_out = $this->read_single($id);
                        $subject = $email_out->subject;
-                       $content = $email_out->content;
-                       phpgw::import_class('helpdesk.soparty');
+                       $content = nl2br($email_out->content);
+                       $sogeneric = 
CreateObject('helpdesk.sogeneric','email_recipient_list');
                        $email_validator = 
CreateObject('phpgwapi.EmailAddressValidator');
                        if (!is_object($GLOBALS['phpgw']->send))
                        {
                                $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
                        }
+                       $config = 
CreateObject('phpgwapi.config','helpdesk')->read();;
 
                        $cc ='';
                        $bcc = '';
-                       $from_email = '';
+                       $from_email = $config['from_email'];
                        $from_name = '';
-                       foreach ($ids as $party_id)
+                       foreach ($ids as $recipient_id)
                        {
-                               $party = 
helpdesk_soparty::get_instance()->get_single($party_id);
-                               $to_email = $party->get_email();
+                               $recipient = $sogeneric->read_single(array('id' 
=> $recipient_id));
+
+                               $to_email = $recipient['email'];
                                if 
(!$email_validator->check_email_address($to_email) )
                                {
-                                       
helpdesk_soemail_out::get_instance()->set_status($id, $party_id, 
helpdesk_email_out::STATUS_ERROR);
+                                       
helpdesk_soemail_out::get_instance()->set_status($id, $recipient_id, 
helpdesk_email_out::STATUS_ERROR);
                                        continue;
                                }
 
@@ -151,11 +153,11 @@
                                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);
+                                       
helpdesk_soemail_out::get_instance()->set_status($id, $recipient_id, 
helpdesk_email_out::STATUS_SENT);
                                }
                                catch (Exception $exc)
                                {
-                                       
helpdesk_soemail_out::get_instance()->set_status($id, $party_id, 
helpdesk_email_out::STATUS_ERROR);
+                                       
helpdesk_soemail_out::get_instance()->set_status($id, $recipient_id, 
helpdesk_email_out::STATUS_ERROR);
                                }
                        }
                }

Modified: trunk/helpdesk/inc/class.menu.inc.php
===================================================================
--- trunk/helpdesk/inc/class.menu.inc.php       2017-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/helpdesk/inc/class.menu.inc.php       2017-04-02 16:22:21 UTC (rev 
16517)
@@ -168,11 +168,21 @@
                                        'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'helpdesk.uiemail_out.index')),
                                        'image' => array('helpdesk', 
'helpdesk'),
                                        'children' => array(
-                                               'email_template' => array(
+                                               'template' => array(
                                                        'text' => lang('email 
template'),
                                                        'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'helpdesk.uigeneric.index',
                                                                'type' => 
'email_template', 'admin' => true))
-                                               )
+                                               ),
+                                               'recipient_set' => array(
+                                                       'text' => 
lang('recipient set'),
+                                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'helpdesk.uigeneric.index',
+                                                               'type' => 
'email_recipient_set', 'admin' => true))
+                                               ),
+                                               'recipient_list' => array(
+                                                       'text' => 
lang('recipient list'),
+                                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'helpdesk.uigeneric.index',
+                                                               'type' => 
'email_recipient_list', 'admin' => true))
+                                               ),
                                        )
                                );
 

Modified: trunk/helpdesk/inc/class.soemail_out.inc.php
===================================================================
--- trunk/helpdesk/inc/class.soemail_out.inc.php        2017-04-02 12:01:49 UTC 
(rev 16516)
+++ trunk/helpdesk/inc/class.soemail_out.inc.php        2017-04-02 16:22:21 UTC 
(rev 16517)
@@ -99,44 +99,34 @@
                        return  $this->db->transaction_commit();
                }
 
-               public function get_composite_candidates( $composite_id )
+               public function get_recipient_candidates( $recipient_set_id , 
$email_out_id)
                {
-                       $composite_id = (int) $composite_id;
+                       $recipient_set_id = (int) $recipient_set_id;
+                       $email_out_id = (int) $email_out_id;
+
+                       $recipients = array(-1);
+                       $sql = "SELECT recipient_id FROM 
phpgw_helpdesk_email_out_recipient WHERE email_out_id = {$email_out_id}";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $recipients[] = $this->db->f('recipient_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)";
+                       $sql = "SELECT 
phpgw_helpdesk_email_out_recipient_list.id as id,"
+                               . " email, 
phpgw_helpdesk_email_out_recipient_list.name as name"
+                               . " FROM phpgw_helpdesk_email_out_recipient_set"
+                               . " {$this->join} 
phpgw_helpdesk_email_out_recipient_list ON 
phpgw_helpdesk_email_out_recipient_list.set_id = 
phpgw_helpdesk_email_out_recipient_set.id"
+                               . " WHERE 
phpgw_helpdesk_email_out_recipient_set.id = {$recipient_set_id}"
+                               . " AND 
phpgw_helpdesk_email_out_recipient_list.id NOT IN (" . implode(',', 
$recipients) . ")";
 
                        $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,
+                                       'name'  => $this->db->f('name', true),
                                        'email' => $this->db->f('email',true),
                                );
                        }
@@ -151,35 +141,19 @@
                        $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}";
+                       $sql = "SELECT email, 
phpgw_helpdesk_email_out_recipient_list.name as name,"
+                               . " phpgw_helpdesk_email_out_recipient_list.id, 
status"
+                               . " FROM phpgw_helpdesk_email_out"
+                               . " {$this->join} 
phpgw_helpdesk_email_out_recipient ON phpgw_helpdesk_email_out.id = 
phpgw_helpdesk_email_out_recipient.email_out_id"
+                               . " {$this->join} 
phpgw_helpdesk_email_out_recipient_list ON 
phpgw_helpdesk_email_out_recipient_list.id = 
phpgw_helpdesk_email_out_recipient.recipient_id"
+                               . " WHERE phpgw_helpdesk_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,
+                                       'name'  => $this->db->f('name',true),
                                        'email' => $this->db->f('email',true),
                                        'status'        => 
$status_list[$this->db->f('status')]
                                );
@@ -198,11 +172,11 @@
                        }
 
 
-                       $sql = 'INSERT INTO phpgw_helpdesk_email_out_party 
(email_out_id, party_id)'
+                       $sql = 'INSERT INTO phpgw_helpdesk_email_out_recipient 
(email_out_id, recipient_id)'
                                . ' VALUES(?, ?)';
-                       foreach ($ids as $party_id)
+                       foreach ($ids as $recipient_id)
                        {
-                               if(in_array($party_id, $check_duplicates))
+                               if(in_array($recipient_id, $check_duplicates))
                                {
                                        continue;
                                }
@@ -209,14 +183,12 @@
 
                                $valueset[] = array
                                        (
-                                       1 => array
-                                               (
+                                       1 => array(
                                                'value' => (int)$id,
                                                'type' => PDO::PARAM_INT
                                        ),
-                                       2 => array
-                                               (
-                                               'value' => $party_id,
+                                       2 => array(
+                                               'value' => $recipient_id,
                                                'type' => PDO::PARAM_INT
                                        )
                                );
@@ -233,17 +205,18 @@
                        if($ids)
                        {
                                $parties = implode(',', $ids);
-                               $sql = "DELETE FROM 
phpgw_helpdesk_email_out_party WHERE email_out_id = {$id} AND party_id IN 
({$parties})";
+                               $sql = "DELETE FROM 
phpgw_helpdesk_email_out_recipient WHERE email_out_id = {$id} AND recipient_id 
IN ({$parties})"
+                               . " AND (status IS NULL OR status = 0 )";
                                return $this->db->query($sql,__LINE__,__FILE__);
                        }
                }
 
-               function set_status($id, $party_id, $status)
+               function set_status($id, $recipient_id, $status)
                {
                        $id = (int) $id;
-                       $party_id = (int) $party_id;
+                       $recipient_id = (int) $recipient_id;
                        $status = (int) $status;
-                       $sql = "UPDATE phpgw_helpdesk_email_out_party SET 
status = {$status} WHERE email_out_id = {$id} AND party_id = {$party_id}";
+                       $sql = "UPDATE phpgw_helpdesk_email_out_recipient SET 
status = {$status} WHERE email_out_id = {$id} AND recipient_id = 
{$recipient_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-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/helpdesk/inc/class.sogeneric.inc.php  2017-04-02 16:22:21 UTC (rev 
16517)
@@ -166,13 +166,15 @@
                                                                (
                                                                'name' => 
'name',
                                                                'descr' => 
lang('name'),
-                                                               'type' => 
'varchar'
+                                                               'type' => 
'varchar',
+                                                               'nullable' => 
false
                                                        ),
                                                        array
                                                                (
                                                                'name' => 
'content',
                                                                'descr' => 
lang('content'),
-                                                               'type' => 'text'
+                                                               'type' => 
'html',
+                                                               'nullable' => 
false
                                                        ),
                                                        array
                                                                (
@@ -198,6 +200,112 @@
                                        );
 
                                        break;
+                               case 'email_recipient_set':
+                                       $info = array
+                                               (
+                                               'table' => 
'phpgw_helpdesk_email_out_recipient_set',
+                                               'id' => array('name' => 'id', 
'type' => 'auto'),
+                                               'fields' => array
+                                                       (
+                                                       array
+                                                               (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar',
+                                                               'nullable' => 
false
+                                                       ),
+                                                       array(
+                                                               'name' => 
'active',
+                                                               'descr' => 
lang('active'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => 
'checked',
+                                                               'filter' => 
true,
+                                                               'sortable' => 
true,
+                                                               'values_def' => 
array(
+                                                                       
'valueset' => array(array('id' => 1, 'name' => lang('active'))),
+                                                               )
+                                                       )
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => lang('recipient set'),
+                                               'acl_app' => 'helpdesk',
+                                               'system_location' => 
'.email_out.recipient_set',
+                                               'acl_location' => '.email_out',
+                                               'menu_selection' => 
'helpdesk::email_out::recipient_set',
+                                               'default' => array
+                                                       (
+                                                       'user_id' => 
array('add' => '$this->account'),
+                                                       'created' => 
array('add' => 'time()'),
+                                                       'modified' => 
array('edit' => 'time()'),
+                                               ),
+                                               'check_grant' => true
+                                       );
+
+                                       break;
+                               case 'email_recipient_list':
+                                       $info = array
+                                               (
+                                               'table' => 
'phpgw_helpdesk_email_out_recipient_list',
+                                               'id' => array('name' => 'id', 
'type' => 'auto'),
+                                               'fields' => array
+                                                       (
+                                                       array
+                                                               (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar',
+                                                               'nullable' => 
false
+                                                       ),
+                                                       array
+                                                               (
+                                                               'name' => 
'email',
+                                                               'descr' => 
lang('email'),
+                                                               'type' => 
'varchar',
+                                                               'nullable' => 
false
+                                                       ),
+                                                       array(
+                                                               'name' => 
'set_id',
+                                                               'descr' => 
$GLOBALS['phpgw']->translation->translate('recipient set', array(), false, 
'helpdesk'),
+                                                               'type' => 
'select',
+                                                               'filter' => 
true,
+                                                               'nullable' => 
false,
+                                                               'values_def' => 
array(
+                                                                       
'valueset' => false,
+                                                                       
'method' => 'helpdesk.bogeneric.get_list',
+                                                                       
'get_single_value' => 'helpdesk.sogeneric.get_name',
+                                                                       
'method_input' => array('type' => 'email_recipient_set', 'selected' => 
'##set_id##')
+                                                               )
+                                                       ),
+                                                       array(
+                                                               'name' => 
'active',
+                                                               'descr' => 
lang('active'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => 
'checked',
+                                                               'filter' => 
true,
+                                                               'sortable' => 
true,
+                                                               'values_def' => 
array(
+                                                                       
'valueset' => array(array('id' => 1, 'name' => lang('active'))),
+                                                               )
+                                                       )
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => lang('recipient 
list'),
+                                               'acl_app' => 'helpdesk',
+                                               'system_location' => 
'.email_out.recipient_list',
+                                               'acl_location' => '.email_out',
+                                               'menu_selection' => 
'helpdesk::email_out::recipient_list',
+                                               '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
                                                (

Modified: trunk/helpdesk/inc/class.uiemail_out.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uiemail_out.inc.php        2017-04-02 12:01:49 UTC 
(rev 16516)
+++ trunk/helpdesk/inc/class.uiemail_out.inc.php        2017-04-02 16:22:21 UTC 
(rev 16517)
@@ -38,7 +38,6 @@
                        'add' => true,
                        'index' => true,
                        'query' => true,
-                       'view' => true,
                        'edit' => true,
                        'save' => true,
                        'get' => true,
@@ -110,17 +109,6 @@
 
                        $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
@@ -334,6 +322,7 @@
                        );
                        phpgwapi_jquery::load_widget('autocomplete');
                        phpgwapi_jquery::formvalidator_generate(array());
+                       self::rich_text_editor('content');
                        self::add_javascript('helpdesk', 'portico', 
'email_out.edit.js');
                        self::render_template_xsl(array('email_out', 
'datatable_inline'), array($mode => $data));
                }
@@ -370,13 +359,15 @@
                                phpgw::no_access();
                        }
                        $type =  phpgw::get_var('type', 'string');
-                       $id =  phpgw::get_var('id', 'int');
+                       $set_id =  phpgw::get_var('set_id', 'int');
+                       $email_out_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");
+                               case 'recipient_set':
+                                       $values = 
$this->bo->get_recipient_candidates($set_id, $email_out_id);
+                                       array_walk($values, array($this, 
"_add_links"), array('menuaction' => 'helpdesk.uigeneric.edit',
+                                                               'type' => 
'email_recipient_list'));
 
                                        break;
 
@@ -418,7 +409,8 @@
                        }
                        $id =  phpgw::get_var('id', 'int');
                        $values = $this->bo->get_recipients($id);
-                       array_walk($values, array($this, "_add_links"), 
"helpdesk.uiparty.edit");
+                       array_walk($values, array($this, "_add_links"), 
array('menuaction' => 'helpdesk.uigeneric.edit',
+                                                               'type' => 
'email_recipient_list'));
                        return $this->jquery_results(array('results' => 
$values));
 
                }

Modified: trunk/helpdesk/inc/class.uilookup.inc.php
===================================================================
--- trunk/helpdesk/inc/class.uilookup.inc.php   2017-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/helpdesk/inc/class.uilookup.inc.php   2017-04-02 16:22:21 UTC (rev 
16517)
@@ -54,6 +54,7 @@
                        'ecodimb' => true,
                        'order_template' => true,
                        'response_template' => true,
+                       'email_template' => true,
                        'custom' => true
                );
 
@@ -162,4 +163,105 @@
 
                        self::render_template_xsl('datatable_jquery', $data);
                }
+
+               function email_template()
+               {
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               $search = phpgw::get_var('search');
+                               $order = phpgw::get_var('order');
+                               $draw = phpgw::get_var('draw', 'int');
+                               $columns = phpgw::get_var('columns');
+
+                               $params = array(
+                                       'start' => phpgw::get_var('start', 
'int', 'REQUEST', 0),
+                                       'results' => phpgw::get_var('length', 
'int', 'REQUEST', 0),
+                                       'query' => $search['value'],
+                                       'order' => 
$columns[$order[0]['column']]['data'],
+                                       'sort' => $order[0]['dir'],
+                                       'dir' => $order[0]['dir'],
+                                       'allrows' => phpgw::get_var('length', 
'int') == -1,
+                                       'filter' => ''
+                               );
+
+                               $values = array();
+                               $bo = CreateObject('helpdesk.bogeneric');
+                               $bo->get_location_info('email_template');
+                               $values = $bo->read($params);
+
+                               $result_data = array
+                                       (
+                                       'results' => $values,
+                                       'total_records' => $bo->total_records,
+                                       'draw' => $draw
+                               );
+                               return $this->jquery_results($result_data);
+                       }
+
+//                     $action = 'var temp = 
parent.document.getElementById("content").value;' . "\r\n";
+//                     $action .= 'if(temp){temp = temp + "\n";}' . "\r\n";
+//                     $action .= 
'parent.document.getElementById("content").value = temp + aData["content"];' . 
"\r\n";
+//                     $action .= 
'parent.JqueryPortico.onPopupClose("close");' . "\r";
+
+                       $action = <<<JS
+
+                               var encodedStr = aData["content"];
+                               var parser = new DOMParser;
+                               var dom = 
parser.parseFromString(encodedStr,'text/html');
+                               var decodedString = dom.body.textContent;
+                               parent.$.fn.insertAtCaret(decodedString);
+                               parent.JqueryPortico.onPopupClose("close");
+JS;
+
+                       $data = array(
+                               'left_click_action' => $action,
+                               'datatable_name' => '',
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array()
+                                       )
+                               ),
+                               'datatable' => array(
+                                       'source' => self::link(array(
+                                               'menuaction' => 
'helpdesk.uilookup.email_template',
+                                               'query' => $this->query,
+                                               'filter' => $this->filter,
+                                               'cat_id' => $this->cat_id,
+                                               'type' => 'email_template',
+                                               'phpgw_return_as' => 'json'
+                                       )),
+                                       'allrows' => true,
+                                       'editor_action' => '',
+                                       'field' => array()
+                               )
+                       );
+
+                       $uicols = array(
+                               'input_type' => array('text', 'text', 'text'),
+                               'name' => array('id', 'name', 'content'),
+                               'formatter' => array('', '', ''),
+                               'descr' => array(lang('ID'), lang('name'), 
lang('content'))
+                       );
+
+                       $count_uicols_name = count($uicols['name']);
+
+                       for ($k = 0; $k < $count_uicols_name; $k++)
+                       {
+                               $params = array(
+                                       'key' => $uicols['name'][$k],
+                                       'label' => $uicols['descr'][$k],
+                                       'sortable' => $uicols['sortable'][$k],
+                                       'hidden' => false
+                               );
+
+                               array_push($data['datatable']['field'], 
$params);
+                       }
+
+                       $appname = lang('template');
+                       $function_msg = lang('list email template');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('helpdesk') . ' - ' . $appname . ': ' . $function_msg;
+
+                       self::render_template_xsl('datatable_jquery', $data);
+               }
        }
\ No newline at end of file

Modified: trunk/helpdesk/inc/model/class.email_out.inc.php
===================================================================
--- trunk/helpdesk/inc/model/class.email_out.inc.php    2017-04-02 12:01:49 UTC 
(rev 16516)
+++ trunk/helpdesk/inc/model/class.email_out.inc.php    2017-04-02 16:22:21 UTC 
(rev 16517)
@@ -102,7 +102,7 @@
                                        ),
                                'content' => array(
                                        'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
-                                       'type' => 'string',
+                                       'type' => 'html',
                                        'label' => 'content',
                                        'required' => true,
                                        'query' => true,

Modified: trunk/helpdesk/js/portico/email_out.edit.js
===================================================================
--- trunk/helpdesk/js/portico/email_out.edit.js 2017-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/helpdesk/js/portico/email_out.edit.js 2017-04-02 16:22:21 UTC (rev 
16517)
@@ -1,43 +1,50 @@
 var oArgs = {
-       menuaction: 'rental.uicomposite.index',
-       type: 'all_composites',
-       furnished_status: 4,
-       has_contract: 'has_contract',
-       is_active: 'active'
+       menuaction: 'helpdesk.bogeneric.get_autocomplete',
+       type: 'email_recipient_set',
+       active: 1
 };
 var strURL = phpGWLink('index.php', oArgs, true);
-JqueryPortico.autocompleteHelper(strURL, 'composite_name', 'composite_id', 
'composite_container', 'name');
+JqueryPortico.autocompleteHelper(strURL, 'recipient_set_name', 
'recipient_set_id', 'recipient_set_container');
 
+
 $(window).on('load', function ()
 {
-       composite_id = $('#composite_id').val();
-       if (composite_id)
+       recipient_set_id = $('#recipient_set_id').val();
+       if (recipient_set_id)
        {
-               composite_id_selection = composite_id;
+               recipient_set_id_selection = recipient_set_id;
        }
-       $("#composite_name").on("autocompleteselect", function (event, ui)
+       $("#recipient_set_name").on("autocompleteselect", function (event, ui)
        {
-               var composite_id = ui.item.value;
-//             if (composite_id != composite_id_selection)
+               var recipient_set_id = ui.item.value;
+//             if (recipient_set_id != recipient_set_id_selection)
 //             {
-               populateCandidates('composite', composite_id);
+               populateCandidates('recipient_set', recipient_set_id);
 //             }
        });
+
+       $.fn.insertAtCaret = function (myValue)
+       {
+               myValue = myValue.trim();
+               CKEDITOR.instances['content'].insertText(myValue);
+       };
+
 });
 
-function populateCandidates(type, composite_id)
+function populateCandidates(type, recipient_set_id)
 {
-       composite_id = composite_id || $('#composite_id').val();
+       recipient_set_id = recipient_set_id || $('#recipient_set_id').val();
 
-       if (!composite_id)
+       if (!recipient_set_id)
        {
                return;
        }
 
        oArgs = {
-               menuaction: 'rental.uiemail_out.get_candidates',
+               menuaction: 'helpdesk.uiemail_out.get_candidates',
                type: type,
-               id: composite_id
+               set_id: recipient_set_id,
+               id: $('#id').val()
        };
 
        var requestUrl = phpGWLink('index.php', oArgs, true);
@@ -49,7 +56,7 @@
 {
 //             console.log(ids);
        oArgs = {
-               menuaction: 'rental.uiemail_out.set_candidates',
+               menuaction: 'helpdesk.uiemail_out.set_candidates',
                id: $('#id').val()
        };
 
@@ -67,7 +74,7 @@
 
                        }
                        oArgs = {
-                               menuaction: 'rental.uiemail_out.get_recipients',
+                               menuaction: 
'helpdesk.uiemail_out.get_recipients',
                                id: $('#id').val()
                        };
 
@@ -74,9 +81,10 @@
                        var requestUrl = phpGWLink('index.php', oArgs, true);
                        JqueryPortico.updateinlineTableHelper(oTable2, 
requestUrl);
                        oArgs = {
-                               menuaction: 'rental.uiemail_out.get_candidates',
-                               type: 'dummy',
-                               id: 0
+                               menuaction: 
'helpdesk.uiemail_out.get_candidates',
+                               type: 'recipient_set',
+                               set_id: $('#recipient_set_id').val(),
+                               id: $('#id').val()
                        };
 
                        var requestUrl = phpGWLink('index.php', oArgs, true);
@@ -88,7 +96,7 @@
 this.onActionsClick_recipient = function (type, ids)
 {
        oArgs = {
-               menuaction: 'rental.uiemail_out.' + type,
+               menuaction: 'helpdesk.uiemail_out.' + type,
                id: $('#id').val()
        };
 
@@ -106,7 +114,7 @@
 
                        }
                        oArgs = {
-                               menuaction: 'rental.uiemail_out.get_recipients',
+                               menuaction: 
'helpdesk.uiemail_out.get_recipients',
                                id: $('#id').val()
                        };
 
@@ -119,7 +127,7 @@
 
 function template_lookup()
 {
-       var oArgs = {menuaction: 'rental.uilookup.email_template'};
+       var oArgs = {menuaction: 'helpdesk.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-04-02 12:01:49 UTC (rev 16516)
+++ trunk/helpdesk/setup/phpgw_no.lang  2017-04-02 16:22:21 UTC (rev 16517)
@@ -192,4 +192,11 @@
 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
+email template helpdesk        no      Standardtekster
+recipient set  helpdesk        no      mottaker sett
+list   helpdesk        no      List
+recipient list helpdesk        no      Mottaker liste
+select helpdesk        no      Velg
+modified       helpdesk        no      Endret
+sent   helpdesk        no      Sendt
+generic        helpdesk        no      Generelt
\ No newline at end of file

Modified: trunk/helpdesk/setup/setup.inc.php
===================================================================
--- trunk/helpdesk/setup/setup.inc.php  2017-04-02 12:01:49 UTC (rev 16516)
+++ trunk/helpdesk/setup/setup.inc.php  2017-04-02 16:22:21 UTC (rev 16517)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['helpdesk']['name']                 = 'helpdesk';
-       $setup_info['helpdesk']['version']              = '0.9.18.003';
+       $setup_info['helpdesk']['version']              = '0.9.18.004';
        $setup_info['helpdesk']['app_order']    = 8;
        $setup_info['helpdesk']['enable']               = 1;
        $setup_info['helpdesk']['app_group']    = 'office';
@@ -52,7 +52,9 @@
                'phpgw_helpdesk_custom_menu_items',
                'phpgw_helpdesk_email_template',
                'phpgw_helpdesk_email_out',
-               'phpgw_helpdesk_email_out_party'
+               'phpgw_helpdesk_email_out_recipient_set',
+               'phpgw_helpdesk_email_out_recipient_list',
+               'phpgw_helpdesk_email_out_recipient'
        );
 
        /* 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-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/helpdesk/setup/tables_current.inc.php 2017-04-02 16:22:21 UTC (rev 
16517)
@@ -136,16 +136,51 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-               'phpgw_helpdesk_email_out_party' => array(
+               'phpgw_helpdesk_email_out_recipient_set' => 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),
+                               'name' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                               'active' => array('type' => 'int', 'precision' 
=> 2, 'nullable' => True, 'default' => '0'),
+                               '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()
+               ),
+               'phpgw_helpdesk_email_out_recipient_list' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'precision' => 
4, 'nullable' => False),
+                               'set_id' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => False),
+                               'name' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                               'email' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                               'active' => array('type' => 'int', 'precision' 
=> 2, 'nullable' => True, 'default' => '0'),
+                               '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(
+                               'phpgw_helpdesk_email_out_recipient_set' => 
array('set_id' => 'id'),
+                       ),
+                       'ix' => array(),
+                       'uc' => array('set_id', 'email')
+               ),
+               'phpgw_helpdesk_email_out_recipient' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'precision' => 
4, 'nullable' => False),
+                               'email_out_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => False),
+                               'recipient_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => False),
                                'status' => array('type' => 'int', 'precision' 
=> 2, 'nullable' => True, 'default' => '0'),
                        ),
                        'pk' => array('id'),
                        'fk' => array(
                                'phpgw_helpdesk_email_out' => 
array('email_out_id' => 'id'),
+                               'phpgw_helpdesk_email_out_recipient_list' => 
array('recipient_id' => 'id'),
                        ),
                        'ix' => array(),
                        'uc' => array()

Modified: trunk/helpdesk/setup/tables_update.inc.php
===================================================================
--- trunk/helpdesk/setup/tables_update.inc.php  2017-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/helpdesk/setup/tables_update.inc.php  2017-04-02 16:22:21 UTC (rev 
16517)
@@ -153,23 +153,64 @@
                                'uc' => array()
                        )
                );
+
+
                $GLOBALS['phpgw_setup']->oProc->CreateTable(
-                       'phpgw_helpdesk_email_out_party', array(
+                       'phpgw_helpdesk_email_out_recipient_set',  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),
+                                       'name' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                                       'active' => array('type' => 'int', 
'precision' => 2, 'nullable' => True, 'default' => '0'),
+                                       '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_recipient_list',  array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => False),
+                                       'set_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => False),
+                                       'name' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                                       'email' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False),
+                                       'active' => array('type' => 'int', 
'precision' => 2, 'nullable' => True, 'default' => '0'),
+                                       '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(
+                                       
'phpgw_helpdesk_email_out_recipient_set' => array('set_id' => 'id'),
+                               ),
+                               'ix' => array(),
+                               'uc' => array('set_id', 'email')
+               ));
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'phpgw_helpdesk_email_out_recipient',  array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => False),
+                                       'email_out_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => False),
+                                       'recipient_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => False),
                                        'status' => array('type' => 'int', 
'precision' => 2, 'nullable' => True, 'default' => '0'),
                                ),
                                'pk' => array('id'),
                                'fk' => array(
                                        'phpgw_helpdesk_email_out' => 
array('email_out_id' => 'id'),
+                                       
'phpgw_helpdesk_email_out_recipient_list' => array('recipient_id' => 'id'),
                                ),
                                'ix' => array(),
                                'uc' => array()
-                       )
-               );
+               ));
 
+
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
                        $GLOBALS['setup_info']['helpdesk']['currentver'] = 
'0.9.18.004';

Modified: trunk/helpdesk/templates/base/config.tpl
===================================================================
--- trunk/helpdesk/templates/base/config.tpl    2017-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/helpdesk/templates/base/config.tpl    2017-04-02 16:22:21 UTC (rev 
16517)
@@ -19,6 +19,10 @@
                                {lang_default}: {lang_Helpdesk}</td>
                        <td><input name="newsettings[app_name]" 
value="{value_app_name}"></td>
                </tr>
+               <tr>
+                       <td>{lang_from_email}: <br>
+                       <td><input name="newsettings[from_email]" 
value="{value_from_email}"></td>
+               </tr>
                <tr class="row_off">
                        <td>{lang_show_billable_hours}:</td>
                        <td>

Modified: trunk/helpdesk/templates/base/email_out.xsl
===================================================================
--- trunk/helpdesk/templates/base/email_out.xsl 2017-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/helpdesk/templates/base/email_out.xsl 2017-04-02 16:22:21 UTC (rev 
16517)
@@ -117,23 +117,23 @@
                                        <fieldset>
 
                                                <div class="pure-control-group">
-                                                       <xsl:variable 
name="lang_composite">
-                                                               <xsl:value-of 
select="php:function('lang', 'composite')"/>
+                                                       <xsl:variable 
name="lang_recipient_set">
+                                                               <xsl:value-of 
select="php:function('lang', 'recipient set')"/>
                                                        </xsl:variable>
                                                        <label>
-                                                               <xsl:value-of 
select="$lang_composite"/>
+                                                               <xsl:value-of 
select="$lang_recipient_set"/>
                                                        </label>
-                                                       <input type="hidden" 
id="composite_id" name="composite_id"  value="">
+                                                       <input type="hidden" 
id="recipient_set_id" name="recipient_set_id"  value="">
                                                                <xsl:attribute 
name="placeholder">
-                                                                       
<xsl:value-of select="$lang_composite"/>
+                                                                       
<xsl:value-of select="$lang_recipient_set"/>
                                                                </xsl:attribute>
                                                        </input>
-                                                       <input type="text" 
id="composite_name" name="composite_name" value="">
+                                                       <input type="text" 
id="recipient_set_name" name="recipient_set_name" value="">
                                                                <xsl:attribute 
name="placeholder">
-                                                                       
<xsl:value-of select="$lang_composite"/>
+                                                                       
<xsl:value-of select="$lang_recipient_set"/>
                                                                </xsl:attribute>
                                                        </input>
-                                                       <div 
id="composite_container"/>
+                                                       <div 
id="recipient_set_container"/>
                                                </div>
                                                <div class="pure-control-group">
                                                        <label>

Modified: trunk/property/inc/class.uigeneric.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric.inc.php  2017-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/property/inc/class.uigeneric.inc.php  2017-04-02 16:22:21 UTC (rev 
16517)
@@ -109,7 +109,28 @@
                        $id_name = $this->location_info['id']['name'];
 
                        $id = phpgw::get_var($id_name);
-                       $values = phpgw::get_var('values');
+
+       //              $values = phpgw::get_var('values');
+                       $values = array();
+
+                       foreach ($this->location_info['fields'] as $field)
+                       {
+                               switch ($field['type'])
+                               {
+                                       case 'integer':
+                                       case 'int':
+                                               $value_type = 'int';
+                                               break;
+                                       case 'html':
+                                               $value_type = 'html';
+                                               break;
+                                       default:
+                                               $value_type = 'string';
+                                               break;
+                               }
+                               $values[$field['name']] = 
phpgw::clean_value($_POST['values'][$field['name']],$value_type);
+                       }
+
                        $values_attribute = phpgw::get_var('values_attribute');
 
                        if (!$id && !$values[$id_name] && 
$this->location_info['id']['type'] != 'auto')
@@ -130,8 +151,27 @@
 
                        foreach ($this->location_info['fields'] as $_field)
                        {
+
+                               switch ($_field['type'])
+                               {
+                                       case 'integer':
+                                       case 'int':
+                                               $value_type = 'int';
+                                               break;
+                                       case 'html':
+                                               $value_type = 'html';
+                                               break;
+                                       default:
+                                               $value_type = 'string';
+                                               break;
+                               }
+
+                               if($_field['type'] == 'html')
+                               {
+                                       $value_type = 'html';
+                               }
                                $data[$_field['name']] = 
$values[$_field['name']];
-                               $data[$_field['name']] = 
phpgw::clean_value($data[$_field['name']], $_field['type']);
+                               $data[$_field['name']] = 
phpgw::clean_value($data[$_field['name']], $value_type);
 
                                if (isset($_field['nullable']) && 
$_field['nullable'] != true)
                                {
@@ -558,8 +598,21 @@
                        {
                                foreach ($this->location_info['fields'] as 
$field)
                                {
-                                       $values[$field['name']] = 
phpgw::clean_value($_POST['values'][$field['name']]);
+                               switch ($field['type'])
+                               {
+                                       case 'integer':
+                                       case 'int':
+                                               $value_type = 'int';
+                                               break;
+                                       case 'html':
+                                               $value_type = 'html';
+                                               break;
+                                       default:
+                                               $value_type = 'string';
+                                               break;
                                }
+                                       $values[$field['name']] = 
phpgw::clean_value($_POST['values'][$field['name']],$value_type);
+                               }
 
                                if (isset($values_attribute) && 
is_array($values_attribute))
                                {
@@ -627,6 +680,11 @@
                        foreach ($this->location_info['fields'] as & $field)
                        {
                                $field['value'] = 
isset($values[$field['name']]) ? $values[$field['name']] : '';
+
+                               if($field['type'] == 'html')
+                               {
+                                       self::rich_text_editor($field['name']);
+                               }
                                if (isset($field['values_def']))
                                {
                                        if ($field['values_def']['valueset'] && 
is_array($field['values_def']['valueset']))
@@ -912,6 +970,7 @@
                        }
 
                        $id = 
phpgw::get_var($this->location_info['id']['name']);
+
                        $values = phpgw::get_var('values');
 
                        if ($id)

Modified: trunk/property/templates/base/generic.xsl
===================================================================
--- trunk/property/templates/base/generic.xsl   2017-04-02 12:01:49 UTC (rev 
16516)
+++ trunk/property/templates/base/generic.xsl   2017-04-02 16:22:21 UTC (rev 
16517)
@@ -112,8 +112,8 @@
                                                                        
<xsl:value-of select="$descr"/>
                                                                </label>
                                                                <xsl:choose>
-                                                                       
<xsl:when test="type='text'">
-                                                                               
<textarea cols="{//textareacols}" rows="{//textarearows}" name="values[{name}]">
+                                                                       
<xsl:when test="type='text' or type='html'">
+                                                                               
<textarea cols="{//textareacols}" rows="{//textarearows}" name="values[{name}]" 
id="{name}">
                                                                                
        <xsl:value-of select="value"/>
                                                                                
</textarea>
                                                                        
</xsl:when>




reply via email to

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