ACCORD5
Add a reply

ACCORD5 Company Forums » Trellis Desk » Peer-to-Peer Support

Ticket Filters and Group Tickets

 
  • Started 7 years ago by abeltran
  • 8 posts in this topic
  • Latest reply from serpe8742
  1. User has not uploaded an avatar

    abeltran
    Member

    I needed a couple of things in my setup:
    1 - The possibility for members to filter their tickets, similar to what staff members can do when managing tickets.
    2 - The possibility for members to view all tickets in their group, not just their own.
    **************************************
    The way I went about it for the filter portion was basically copying the code from ad_tickets in the admin section to the tickets in the main section.
    For the group tickets I modified the tickets table and added a gid ( Group ID ) field.
    I also added a couple of fields to the members table in order for the administrator to be able to decide who can see tickets from the entire group and who can't.

    Since the gid field needs to be populated, I added a maintenance script which must be run from the Tools & Maintenance section for everything to work.
    After that, any ticket created by the user or by a staff member ( via View Member | Add Ticket ) automatically has its gid value set.
    I don't receive Tickets via email, so I didn't change any of that code.

    Since my setup is in Spanish, I added language elements where needed. Also, I changed the url for the mini-filter image so that it shows up in spanish or english. You need to create folders for your languages inside the images folder and upload the images there.

    Finally, I only changed the default (s1) skin, but changes to any other should be simple enough.
    **************************************
    Not knowing when v.2 will come out, I decided to post this MOD.
    If anyone needs the files, clarification or has a comment, please write.
    Also, please try this out in a test environment before putting it in production.
    I'm using this MOD in my production environment, but mistakes happen.

    **************************************
    Add the following fields to your Members table:
    display_name, varchar(255), ALLOW NULL-TRUE
    view_group_tickets, tinyint(1), Default 0, ALLOW NULL-FALSE
    group_manager, tinyint(1), Default 0, ALLOW NULL-FALSE
    **************************************
    Add the following fields to your Tickets table:
    gid, int(11), Default 0, ALLOW NULL-FALSE
    **************************************
    File: admin\tools\ad_maint.php
    Function: show_recount
    Section : Do Output
    After :
    <div class='option2'>/admin.php?section=tools&act=maint&code=dorecount&type=rsettings'>Settings <span class='desc'>-- The number of settings per settings group.</span></div>
    Add :
    <div class='option1'>/admin.php?section=tools&act=maint&code=dorecount&type=rgrouptickets'>Groups in Tickets <span class='desc'>-- Assign tickets to the corresponding group.</span></div>";

    **************************************
    File: admin\tools\ad_maint.php
    Function: do_recount
    Section : Perform Our Action
    After :
    elseif ( $this->ifthd->input['type'] == 'rtassign' )
    {
    $this->r_tassigned();
    }
    Add :
    elseif ( $this->ifthd->input['type'] == 'rgrouptickets' )
    {
    $this->r_grouptickets();
    }
    **************************************
    File: admin\tools\ad_maint.php
    Function: r_grouptickets
    After function :
    r_tassigned
    Add :
    #=======================================
    # @ Recount: Tickets Assigned to Groups
    # Assigns the proper group id
    # to tickets that don't have one.
    #=======================================

    function r_grouptickets()
    {
    #=============================
    # Grab Tickets
    #=============================

    $this->ifthd->core->db->construct( array(
    'select' => array( 't' => array( 'id', 'mid' ),
    'm' => array( 'mgroup' ),
    ),
    'from' => array( 't' => 'tickets' ),
    'join' => array( array( 'from' => array( 'm' => 'members' ), 'where' => array( 't' => 'mid', '=', 'm' => 'id' ) ) ),
    'where' => array( array( 't' => 'gid' ), '=', 0 ),
    ) );

    $this->ifthd->core->db->execute();

    if ( $this->ifthd->core->db->get_num_rows() )
    {
    $fetched_groups = NULL;
    while( $t = $this->ifthd->core->db->fetch_row() )
    {
    $fetched_groups[] = array( 'group'=> $t['mgroup'], 'id' => $t['id'] );
    }

    #=============================
    # Update Tickets
    #=============================

    foreach ( $fetched_groups as $f )
    {
    if ( $f['group'] )
    {
    $this->ifthd->core->db->construct( array(
    'update' => 'tickets',
    'set' => array( 'gid' => $f['group'] ),
    'where' => array( 'id', '=', $f['id'] ),
    ) );

    $this->ifthd->core->db->execute();
    }
    }
    }

    $this->ifthd->log( 'admin', "Assigned Tickets to Groups" );

    }

    **************************************
    File: includes\class_session.php
    Function: load_session
    Section : Load Member
    Change :
    'm' => array( 'id', 'name', 'email', 'login_key', 'mgroup', 'title', 'joined', 'ipadd', 'open_tickets', 'tickets', 'email_notify', 'email_html', 'email_new_ticket', 'email_ticket_reply', 'email_announce', 'email_staff_ticket_reply', 'email_staff_new_ticket', 'ban_ticket_center', 'ban_ticket_open', 'ban_ticket_escalate', 'ban_ticket_rate', 'ban_kb', 'ban_kb_comment', 'ban_kb_rate', 'time_zone', 'dst_active', 'lang', 'skin', 'use_rte', 'cpfields' ),
    For :
    'm' => array( 'id', 'name', 'email', 'login_key', 'mgroup', 'title', 'joined', 'ipadd', 'open_tickets', 'tickets', 'email_notify', 'email_html', 'email_new_ticket', 'email_ticket_reply', 'email_announce', 'email_staff_ticket_reply', 'email_staff_new_ticket', 'ban_ticket_center', 'ban_ticket_open', 'ban_ticket_escalate', 'ban_ticket_rate', 'ban_kb', 'ban_kb_comment', 'ban_kb_rate', 'time_zone', 'dst_active', 'lang', 'skin', 'use_rte', 'cpfields', 'display_name', 'view_group_tickets', 'group_manager' ),
    **************************************
    File: includes\class_session.php
    Function: load_session
    Section : Load Member, inside of section : If We Have A Remember Cookie
    Change :
    'select' => array( 'm' => array( 'id', 'name', 'email', 'login_key', 'mgroup', 'title', 'joined', 'ipadd', 'open_tickets', 'tickets', 'email_notify', 'email_html', 'email_new_ticket', 'email_ticket_reply', 'email_announce', 'email_staff_new_ticket', 'email_staff_ticket_reply', 'ban_ticket_center', 'ban_ticket_open', 'ban_ticket_escalate', 'ban_ticket_rate', 'ban_kb', 'ban_kb_comment', 'ban_kb_rate', 'time_zone', 'dst_active', 'lang', 'skin', 'use_rte', 'cpfields' ),
    For :
    'select' => array( 'm' => array( 'id', 'name', 'email', 'login_key', 'mgroup', 'title', 'joined', 'ipadd', 'open_tickets', 'tickets', 'email_notify', 'email_html', 'email_new_ticket', 'email_ticket_reply', 'email_announce', 'email_staff_new_ticket', 'email_staff_ticket_reply', 'ban_ticket_center', 'ban_ticket_open', 'ban_ticket_escalate', 'ban_ticket_rate', 'ban_kb', 'ban_kb_comment', 'ban_kb_rate', 'time_zone', 'dst_active', 'lang', 'skin', 'use_rte', 'cpfields', 'display_name', 'view_group_tickets', 'group_manager' ),
    **************************************
    File: admin\manage\ad_member.php
    Function: view_member
    Section : Do Output
    After :
    $mem_time = $this->ifthd->ift_date( time(), '', 0, 0, 1, $mem_offset, 1 );
    Add:
    $mem_view_group_tickets = ( $m['view_group_tickets'] ) ? 'Yes' : 'No';
    $mem_group_manager = ( $m['group_manager'] ) ? 'Yes' : 'No';
    **************************************
    File: admin\manage\ad_member.php
    Function: view_member
    Section : Do Output
    Change :
    <div class='groupbox'>Viewing Member: {$m['name']}</div>
    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <td class='option1' width='20%'>Username</td>
    <td class='option1' width='80%' style='font-weight: normal'>{$m['name']}</td>
    </tr>
    <tr>
    <td class='option2'>Email</td>
    <td class='option2' style='font-weight: normal'>{$m['email']}</td>
    </tr>
    <tr>
    <td class='option1'>Group</td>
    <td class='option1' style='font-weight: normal'>{$this->ifthd->core->cache['group'][ $m['mgroup'] ]['g_name']}</td>
    </tr>
    <tr>
    <td class='option2'>Local Time</td>
    <td class='option2' style='font-weight: normal'>{$mem_time}</td>
    </tr>
    <tr>
    <td class='option1'>Joined</td>
    <td class='option1' style='font-weight: normal'>{$mem_joined}</td>
    </tr>
    <tr>
    <td class='option2'>Open Tickets</td>
    <td class='option2' style='font-weight: normal'>{$m['open_tickets']}</td>
    </tr>
    <tr>
    <td class='option1'>Tickets</td>
    <td class='option1' style='font-weight: normal'>{$m['tickets']}</td>
    </tr>
    <tr>
    <td class='option2'>Rating</td>
    <td class='option2'>{$m['rating']}</td>
    </tr>
    {$cpfields}
    </table>
    <div class='formtail'><div class='fb_pad'>/admin.php?section=manage&act=member&code=edit&id={$m['id']}' class='fake_button'>Modify Account  /admin.php?section=manage&act=member&code=sig&id={$m['id']}' class='fake_button'>Edit Signature  /admin.php?section=manage&act=tickets&code=list&mid={$m['id']}' class='fake_button'>View Tickets  /admin.php?section=manage&act=tickets&code=add&mid={$m['id']}' class='fake_button'>Submit A Ticket{$approve_link}  /admin.php?section=manage&act=member&code=dodel&id={$m['id']}' class='fake_button' onclick='return sure_delete()'>Delete Account</div></div>";

    For:
    <div class='groupbox'>Viewing Member: {$m['name']}</div>
    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <td class='option1' width='20%'>Username</td>
    <td class='option1' width='80%' style='font-weight: normal'>{$m['name']}</td>
    </tr>
    <tr>
    <td class='option2'>Display Name</td>
    <td class='option2' style='font-weight: normal'>{$m['display_name']}</td>
    </tr>
    <tr>
    <td class='option1'>Email</td>
    <td class='option1' style='font-weight: normal'>{$m['email']}</td>
    </tr>
    <tr>
    <td class='option2'>Group</td>
    <td class='option2' style='font-weight: normal'>{$this->ifthd->core->cache['group'][ $m['mgroup'] ]['g_name']}</td>
    </tr>
    <tr>
    <td class='option1'>View Group Tickets</td>
    <td class='option1' style='font-weight: normal'>{$mem_view_group_tickets}</td>
    </tr>
    <tr>
    <td class='option2'>Group Manager</td>
    <td class='option2' style='font-weight: normal'>{$mem_group_manager}</td>
    </tr>
    <tr>
    <td class='option1'>Local Time</td>
    <td class='option1' style='font-weight: normal'>{$mem_time}</td>
    </tr>
    <tr>
    <td class='option2'>Joined</td>
    <td class='option2' style='font-weight: normal'>{$mem_joined}</td>
    </tr>
    <tr>
    <td class='option1'>Open Tickets</td>
    <td class='option1' style='font-weight: normal'>{$m['open_tickets']}</td>
    </tr>
    <tr>
    <td class='option2'>Tickets</td>
    <td class='option2' style='font-weight: normal'>{$m['tickets']}</td>
    </tr>
    <tr>
    <td class='option1'>Rating</td>
    <td class='option1'>{$m['rating']}</td>
    </tr>
    {$cpfields}
    </table>
    <div class='formtail'><div class='fb_pad'>/admin.php?section=manage&act=member&code=edit&id={$m['id']}' class='fake_button'>Modify Account  /admin.php?section=manage&act=member&code=sig&id={$m['id']}' class='fake_button'>Edit Signature  /admin.php?section=manage&act=tickets&code=list&mid={$m['id']}' class='fake_button'>View Tickets  /admin.php?section=manage&act=tickets&code=add&mid={$m['id']}' class='fake_button'>Submit A Ticket{$approve_link}  /admin.php?section=manage&act=member&code=dodel&id={$m['id']}' class='fake_button' onclick='return sure_delete()'>Delete Account</div></div>";

    **************************************
    File: admin\manage\ad_member.php
    Function: add_member
    Change :
    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <td class='option1' width='22%'><label for='username'>Username</label></td>
    <td class='option1' width='78%'><input type='text' name='username' id='username' value='{$this->ifthd->input['username']}' size='35' /></td>
    </tr>
    <tr>
    <td class='option2'><label for='email'>Email</label></td>
    <td class='option2'><input type='text' name='email' id='email' value='{$this->ifthd->input['email']}' size='35' /></td>
    </tr>
    <tr>
    <td class='option1'><label for='password'>Password</label></td>
    <td class='option1'><input type='text' name='password' id='password' value='{$this->ifthd->input['password']}' size='35' /></td>
    </tr>
    <tr>
    <td class='option2'><label for='title'>Title</label></td>
    <td class='option2'><input type='text' name='title' id='title' value='{$this->ifthd->input['title']}' size='35' /></td>
    </tr>
    <tr>
    <td class='option1'><label for='mgroup'>Group</label></td>
    <td class='option1'><select name='mgroup' id='mgroup'>{$mem_group_drop}</select></td>
    </tr>
    <tr>
    <td class='option2'><label for='time_zone'>Time Zone</label></td>
    <td class='option2'><select name='time_zone' id='time_zone'>{$time_zone_drop}</select></td>
    </tr>
    <tr>
    <td class='option1'>DST Active</td>
    <td class='option1' style='font-weight: normal'>
    ". $this->ifthd->skin->yes_no_radio( 'dst_active', $this->ifthd->input['dst_active'] ) ."
    </td>
    </tr>
    <tr>
    <td class='option2'><label for='lang'>Language</label></td>
    <td class='option2'><select name='lang' id='lang'>{$lang_drop}</select></td>
    </tr>
    <tr>
    <td class='option1'><label for='skin'>Skin</label></td>
    <td class='option1'><select name='skin' id='skin'>{$skin_drop}</select></td>
    </tr>
    <tr>
    <td class='option2'>Rich Text Editor</td>
    <td class='option2' style='font-weight: normal'>
    ". $this->ifthd->skin->enabled_disabled_radio( 'use_rte', $this->ifthd->input['use_rte'] ) ."
    </td>
    </tr>
    {$cpfields}
    </table>

    For:
    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <td class='option1' width='22%'><label for='username'>Username</label></td>
    <td class='option1' width='78%'><input type='text' name='username' id='username' value='{$this->ifthd->input['username']}' size='35' /></td>
    </tr>
    <tr>
    <td class='option2' width='22%'><label for='display_name'>Display Name</label></td>
    <td class='option2' width='78%'><input type='text' name='display_name' id='display_name' value='{$this->ifthd->input['display_name']}' size='35' /></td>
    </tr>
    <tr>
    <td class='option1'><label for='email'>Email</label></td>
    <td class='option1'><input type='text' name='email' id='email' value='{$this->ifthd->input['email']}' size='35' /></td>
    </tr>
    <tr>
    <td class='option2'><label for='password'>Password</label></td>
    <td class='option2'><input type='text' name='password' id='password' value='{$this->ifthd->input['password']}' size='35' /></td>
    </tr>
    <tr>
    <td class='option1'><label for='title'>Title</label></td>
    <td class='option1'><input type='text' name='title' id='title' value='{$this->ifthd->input['title']}' size='35' /></td>
    </tr>
    <tr>
    <td class='option2'><label for='mgroup'>Group</label></td>
    <td class='option2'><select name='mgroup' id='mgroup'>{$mem_group_drop}</select></td>
    </tr>
    <tr>
    <td class='option1'><label for='mgroup'>View Group Tickets</label></td>
    <td class='option1' style='font-weight: normal'>
    ". $this->ifthd->skin->yes_no_radio( 'view_group_tickets', $this->ifthd->input['view_group_tickets'] ) ."
    </td>
    </tr>
    <tr>
    <td class='option2'><label for='mgroup'>Group Manager</label></td>
    <td class='option2' style='font-weight: normal'>
    ". $this->ifthd->skin->yes_no_radio( 'group_manager', $this->ifthd->input['group_manager'] ) ."
    </td>
    </tr>
    <tr>
    <td class='option1'><label for='time_zone'>Time Zone</label></td>
    <td class='option1'><select name='time_zone' id='time_zone'>{$time_zone_drop}</select></td>
    </tr>
    <tr>
    <td class='option2'>DST Active</td>
    <td class='option2' style='font-weight: normal'>
    ". $this->ifthd->skin->yes_no_radio( 'dst_active', $this->ifthd->input['dst_active'] ) ."
    </td>
    </tr>
    <tr>
    <td class='option1'><label for='lang'>Language</label></td>
    <td class='option1'><select name='lang' id='lang'>{$lang_drop}</select></td>
    </tr>
    <tr>
    <td class='option2'><label for='skin'>Skin</label></td>
    <td class='option2'><select name='skin' id='skin'>{$skin_drop}</select></td>
    </tr>
    <tr>
    <td class='option1'>Rich Text Editor</td>
    <td class='option1' style='font-weight: normal'>
    ". $this->ifthd->skin->enabled_disabled_radio( 'use_rte', $this->ifthd->input['use_rte'] ) ."
    </td>
    </tr>
    {$cpfields}
    </table>

    **************************************
    File: admin\manage\ad_member.php
    Function: edit_member
    Section : Do Output
    After :
    $mem_name = $m['name'];
    Add:
    $mem_display_name = $m['display_name'];
    **************************************
    File: admin\manage\ad_member.php
    Function: edit_member
    Section : Do Output
    After :
    $mem_group_drop = $this->ifthd->build_group_drop( $m['mgroup'] );
    Add:
    $mem_view_group_tickets = $m['view_group_tickets'];
    $mem_group_manager = $m['group_manager'];
    **************************************
    File: admin\manage\ad_member.php
    Function: edit_member
    Change :
    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <td class='option1' width='22%'><label for='username'>Username</label></td>
    <td class='option1' width='78%'><input type='text' name='username' id='username' value='{$mem_name}' size='35' /></td>
    </tr>
    <tr>
    <td class='option2'><label for='email'>Email</label></td>
    <td class='option2'><input type='text' name='email' id='email' value='{$mem_email}' size='35' /></td>
    </tr>
    <tr>
    <td class='option1'><label for='password'>Password</label></td>
    <td class='option1' style='font-weight: normal'><input type='text' name='password' id='password' value='' size='35' /> (Leave blank to not edit)</td>
    </tr>
    <tr>
    <td class='option2'><label for='title'>Title</label></td>
    <td class='option2'><input type='text' name='title' id='title' value='{$mem_title}' size='35' /></td>
    </tr>
    <tr>
    <td class='option1'><label for='mgroup'>Group</label></td>
    <td class='option1'><select name='mgroup' id='mgroup'>{$mem_group_drop}</select></td>
    </tr>
    <tr>
    <td class='option2'><label for='time_zone'>Time Zone</label></td>
    <td class='option2'><select name='time_zone' id='time_zone'>{$mem_time_zone_drop}</select></td>
    </tr>
    <tr>
    <td class='option1'>DST Active</td>
    <td class='option1' style='font-weight: normal'>
    ". $this->ifthd->skin->yes_no_radio( 'dst_active', $mem_dst_active ) ."
    </td>
    </tr>
    <tr>
    <td class='option2'><label for='lang'>Language</label></td>
    <td class='option2'><select name='lang' id='lang'>{$mem_lang_drop}</select></td>
    </tr>
    <tr>
    <td class='option1'><label for='skin'>Skin</label></td>
    <td class='option1'><select name='skin' id='skin'>{$mem_skin_drop}</select></td>
    </tr>
    <tr>
    <td class='option2'>Rich Text Editor</td>
    <td class='option2' style='font-weight: normal'>
    ". $this->ifthd->skin->enabled_disabled_radio( 'use_rte', $mem_use_rte ) ."
    </td>
    </tr>
    {$cpfields}
    </table>

    For:
    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <td class='option1' width='22%'><label for='username'>Username</label></td>
    <td class='option1' width='78%'><input type='text' name='username' id='username' value='{$mem_name}' size='35' /></td>
    </tr>
    <tr>
    <td class='option2' width='22%'><label for='display_name'>Display Name</label></td>
    <td class='option2' width='78%'><input type='text' name='display_name' id='display_name' value='{$mem_display_name}' size='35' /></td>
    </tr>
    <tr>
    <td class='option1'><label for='email'>Email</label></td>
    <td class='option1'><input type='text' name='email' id='email' value='{$mem_email}' size='35' /></td>
    </tr>
    <tr>
    <td class='option2'><label for='password'>Password</label></td>
    <td class='option2' style='font-weight: normal'><input type='text' name='password' id='password' value='' size='35' /> (Leave blank to not edit)</td>
    </tr>
    <tr>
    <td class='option1'><label for='title'>Title</label></td>
    <td class='option1'><input type='text' name='title' id='title' value='{$mem_title}' size='35' /></td>
    </tr>
    <tr>
    <td class='option2'><label for='mgroup'>Group</label></td>
    <td class='option2'><select name='mgroup' id='mgroup'>{$mem_group_drop}</select></td>
    </tr>
    <tr>
    <td class='option1'><label for='view_group_tickets'>View Group Tickets</label></td>
    <td class='option1' style='font-weight: normal'>
    ". $this->ifthd->skin->yes_no_radio( 'view_group_tickets', $mem_view_group_tickets ) ."
    </td>
    </tr>
    <tr>
    <td class='option2'><label for='group_manager'>Group Manager</label></td>
    <td class='option2' style='font-weight: normal'>
    ". $this->ifthd->skin->yes_no_radio( 'group_manager', $mem_group_manager ) ."
    </td>
    </tr>
    <tr>
    <td class='option1'><label for='time_zone'>Time Zone</label></td>
    <td class='option1'><select name='time_zone' id='time_zone'>{$mem_time_zone_drop}</select></td>
    </tr>
    <tr>
    <td class='option2'>DST Active</td>
    <td class='option2' style='font-weight: normal'>
    ". $this->ifthd->skin->yes_no_radio( 'dst_active', $mem_dst_active ) ."
    </td>
    </tr>
    <tr>
    <td class='option1'><label for='lang'>Language</label></td>
    <td class='option1'><select name='lang' id='lang'>{$mem_lang_drop}</select></td>
    </tr>
    <tr>
    <td class='option2'><label for='skin'>Skin</label></td>
    <td class='option2'><select name='skin' id='skin'>{$mem_skin_drop}</select></td>
    </tr>
    <tr>
    <td class='option1'>Rich Text Editor</td>
    <td class='option1' style='font-weight: normal'>
    ". $this->ifthd->skin->enabled_disabled_radio( 'use_rte', $mem_use_rte ) ."
    </td>
    </tr>
    {$cpfields}
    </table>
    **************************************
    File: admin\manage\ad_member.php
    Function: do_add
    Section : Insert Member
    After :
    'rss_key' => md5( 'rk' . uniqid( rand(), true ) ),
    Add:
    'display_name' => $this->ifthd->input['username'],
    'view_group_tickets' => $this->ifthd->input['view_group_tickets'],
    'group_manager' => $this->ifthd->input['group_manager'],
    **************************************
    File: admin\manage\ad_member.php
    Function: do_edit
    Section : Update Member
    After :
    'cpfields' => serialize($cpfvalues),
    Add:
    'display_name' => $this->ifthd->input['display_name'],
    'view_group_tickets' => $this->ifthd->input['view_group_tickets'],
    'group_manager' => $this->ifthd->input['group_manager'],
    **************************************
    File: language\en\lang_global.php
    At the endo of the array add :

    'nclosed' => 'All But Closed',
    'all' => 'All',
    'search_action' => 'Search',
    'submitted_by' => 'Submitted By',
    'message' => 'Description',
    'email' => 'Email',
    'ticket_list' => 'Ticket List',
    'all_tickets' => 'All Tickets',
    'assigned_tickets' => 'My Assigned Tickets',
    'group_tickets' => 'Group Tickets',
    'my_tickets' => 'My Tickets',
    **************************************
    File: sources\tickets.php
    Function: do_pre_search
    Section : Create Ticket
    After :
    'cdfields' => serialize($cdfvalues),
    Add:
    'gid' => $this->ifthd->member['mgroup'],
    **************************************
    File: sources\tickets.php
    Function: view_ticket
    Section : Security Checks
    Change :
    if ( ! $this->ifthd->member['id'] && $this->ifthd->member['s_tkey'] )
    {
    $this->ifthd->core->db->construct( array(
    'select' => 'all',
    'from' => 'tickets',
    'where' => array( array( 'id', '=', $this->ifthd->input['id'] ), array( 'email', '=', $this->ifthd->member['s_email'], 'and' ), array( 'guest', '=', 1, 'and' ) ),
    'limit' => array( 0, 1 ),
    ) );
    }
    else
    {
    $this->ifthd->core->db->construct( array(
    'select' => array( 't' => 'all', 'a' => array( 'original_name', 'size' ) ),
    'from' => array( 't' => 'tickets' ),
    'join' => array( array( 'from' => array( 'a' => 'attachments' ), 'where' => array( 't' => 'attach_id', '=', 'a' => 'id' ) ) ),
    'where' => array( array( array( 't' => 'id' ), '=', $this->ifthd->input['id'] ), array( array( 't' => 'mid' ), '=', $this->ifthd->member['id'], 'and' ) ),
    'limit' => array( 0, 1 ),
    ) );
    }

    For:
    if ( ! $this->ifthd->member['id'] && $this->ifthd->member['s_tkey'] )
    {
    $this->ifthd->core->db->construct( array(
    'select' => 'all',
    'from' => 'tickets',
    'where' => array( array( 'id', '=', $this->ifthd->input['id'] ), array( 'email', '=', $this->ifthd->member['s_email'], 'and' ), array( 'guest', '=', 1, 'and' ) ),
    'limit' => array( 0, 1 ),
    ) );
    }
    else
    {

    if ( $this->ifthd->member['view_group_tickets'] || $this->ifthd->member['group_manager'] )
    {
    $this->ifthd->core->db->construct( array(
    'select' => array( 't' => 'all', 'a' => array( 'original_name', 'size' ) ),
    'from' => array( 't' => 'tickets' ),
    'join' => array( array( 'from' => array( 'a' => 'attachments' ), 'where' => array( 't' => 'attach_id', '=', 'a' => 'id' ) ) ),
    'where' => array( array( array( 't' => 'id' ), '=', $this->ifthd->input['id'] ), array( array( 't' => 'gid' ), '=', $this->ifthd->member['mgroup'], 'and' ) ),
    'limit' => array( 0, 1 ),
    ) );
    }
    else
    {
    $this->ifthd->core->db->construct( array(
    'select' => array( 't' => 'all', 'a' => array( 'original_name', 'size' ) ),
    'from' => array( 't' => 'tickets' ),
    'join' => array( array( 'from' => array( 'a' => 'attachments' ), 'where' => array( 't' => 'attach_id', '=', 'a' => 'id' ) ) ),
    'where' => array( array( array( 't' => 'id' ), '=', $this->ifthd->input['id'] ), array( array( 't' => 'mid' ), '=', $this->ifthd->member['id'], 'and' ) ),
    'limit' => array( 0, 1 ),
    ) );
    }
    }

    **************************************
    File: sources\tickets.php
    Function: generate_link
    Before Function: show_history
    Add:
    #=======================================
    # @ Generate Link
    # Generates link for ticket history
    #=======================================

    function generate_link( $key='', $value='', $append='' )
    {
    $link = $this->ifthd->core->cache['config']['hd_url'].'/index.php?act=tickets&code=history';

    if ( $this->ifthd->input['status'] ) $status = $this->ifthd->input['status'];
    if ( $this->ifthd->input['depart'] ) $depart = $this->ifthd->input['depart'];
    if ( $this->ifthd->input['sort'] ) $sort = $this->ifthd->input['sort'];
    if ( $this->ifthd->input['order'] ) $order = $this->ifthd->input['order'];
    if ( $this->ifthd->input['mid'] ) $mid = $this->ifthd->input['mid'];
    if ( $this->ifthd->input['search'] ) $search = $this->ifthd->input['search'];
    if ( $this->ifthd->input['field'] ) $field = $this->ifthd->input['field'];
    if ( $this->ifthd->input['group'] ) $group = $this->ifthd->input['group'];

    if( $key ) $$key = $value;

    if ( $status ) $link .= '&status='. $status;
    if ( $depart ) $link .= '&depart='. $depart;
    if ( $sort ) $link .= '&sort='. $sort;
    if ( $order ) $link .= '&order='. $order;
    if ( $mid ) $link .= '&mid='. $mid;
    if ( $search ) $link .= '&search='. $search;
    if ( $field ) $link .= '&field='. $field;
    if ( $group ) $link .= '&group='. $group;

    if ( $append ) $link .= $append;

    return $link;
    }

    **************************************
    File: sources\tickets.php
    Function: generate_link
    Before Function: show_history
    Add:
    #=======================================
    # @ Build Search Drop
    # Builds a search field drop-down list.
    #=======================================

    function build_search_drop($select='')
    {
    $fields = array( 'id' => $this->ifthd->lang['ticket_id'], 'subject' => $this->ifthd->lang['subject'], 'message' => $this->ifthd->lang['message'], 'mname' => $this->ifthd->lang['submitted_by']);

    $ift_html = "<select name='field' id='field'>";

    foreach( $fields as $id => $name )
    {
    if ( $select == $id )
    {
    $ift_html .= "<option value='{$id}' selected='yes'>{$name}</option>";
    }
    else
    {
    $ift_html .= "<option value='{$id}'>{$name}</option>";
    }
    }

    $ift_html .= "</select>";

    return $ift_html;
    }

    **************************************
    File: sources\tickets.php
    Function: show_history
    Section : After Security Checks
    Change :
    if ( $this->ifthd->member['id'] )
    {
    $this->ifthd->core->db->construct( array(
    'select' => array( 'id', 'dname', 'subject', 'priority', 'date', 'status' ),
    'from' => 'tickets',
    'where' => array( 'mid', '=', $this->ifthd->member['id'] ),
    'order' => array( 'date' => 'desc' ),
    ) );
    }
    else
    {
    $this->ifthd->core->db->construct( array(
    'select' => array( 'id', 'dname', 'subject', 'priority', 'date', 'status' ),
    'from' => 'tickets',
    'where' => array( array( 'email', '=', $this->ifthd->member['s_email'] ), array( 'guest', '=', 1, 'and' ) ),
    'order' => array( 'date' => 'desc' ),
    ) );
    }

    $this->ifthd->core->db->execute();

    For:
    #=============================
    # Filter Options
    #=============================

    $sql_where = array();
    $filters = array();

    if ( $this->ifthd->input['status'] && $this->ifthd->input['status'] != 'all' && $this->ifthd->input['status'] != 'nclosed' )
    {
    $filters[] = array( 'status', '=', $this->ifthd->input['status'] );
    }
    elseif( ! $this->ifthd->input['status'] || $this->ifthd->input['status'] == 'nclosed' )
    {
    #$filters[] = array( 'status', '!=', 4 );
    #$filters[] = array( 'status', '!=', 6, 'and' );
    $filters[] = array( 'status', '!=', 6 );
    }

    if ( $this->ifthd->input['depart'] )
    {
    $filters[] = array( 'did', '=', $this->ifthd->input['depart'] );
    }

    if ( $this->ifthd->input['search'] )
    {
    if ( ! $this->ifthd->input['field'] ) $this->ifthd->input['field'] = 'subject';

    $filters[] = array( $this->ifthd->input['field'], 'like', $this->ifthd->input['search'] );
    }

    #=============================
    # Sorting Options
    #=============================

    if ( $this->ifthd->input['sort'] )
    {
    $sort = $this->ifthd->input['sort'];
    }
    else
    {
    $sort = 'date';
    }

    $order_var = "order_". $sort;
    $img_var = "img_". $sort;

    if ( $this->ifthd->input['order'] )
    {
    $order = strtoupper( $this->ifthd->input['order'] );
    }
    elseif ( $sort == 'date' )
    {
    $order = 'DESC';
    }

    if ( $order == 'DESC' )
    {
    $$order_var = "&order=asc";
    $$img_var = " ifthd->skin->data['img_dir']."/arrow_down.gif' alt='DOWN' />";
    }
    else
    {
    $$order_var = "&order=desc";
    $$img_var = " ifthd->skin->data['img_dir']."/arrow_up.gif' alt='UP' />";
    }

    ( $sort == 'id' ) ? ( $order == 'DESC' ) ? $raw_link_id = $this->generate_link( 'order', 'asc' ) : $raw_link_id = $this->generate_link( 'order', 'desc' ) : $raw_link_id = $this->generate_link( 'sort', 'id' );
    ( $sort == 'subject' ) ? ( $order == 'DESC' ) ? $raw_link_subject = $this->generate_link( 'order', 'asc' ) : $raw_link_subject = $this->generate_link( 'order', 'desc' ) : $raw_link_subject = $this->generate_link( 'sort', 'subject' );
    ( $sort == 'priority' ) ? ( $order == 'DESC' ) ? $raw_link_priority = $this->generate_link( 'order', 'asc' ) : $raw_link_priority = $this->generate_link( 'order', 'desc' ) : $raw_link_priority = $this->generate_link( 'sort', 'priority' );
    ( $sort == 'dname' ) ? ( $order == 'DESC' ) ? $raw_link_dname = $this->generate_link( 'order', 'asc' ) : $raw_link_dname = $this->generate_link( 'order', 'desc' ) : $raw_link_dname = $this->generate_link( 'sort', 'dname' );
    ( $sort == 'date' ) ? ( $order == 'DESC' ) ? $raw_link_date = $this->generate_link( 'order', 'asc' ) : $raw_link_date = $this->generate_link( 'order', 'desc' ) : $raw_link_date = $this->generate_link( 'sort', 'date' );
    ( $sort == 'status' ) ? ( $order == 'DESC' ) ? $raw_link_status = $this->generate_link( 'order', 'asc' ) : $raw_link_status = $this->generate_link( 'order', 'desc' ) : $raw_link_status = $this->generate_link( 'sort', 'status' );

    $link_id = "".$this->ifthd->lang['id']. $img_id ."";
    $link_subject = "".$this->ifthd->lang['subject']. $img_subject ."";
    $link_priority = "".$this->ifthd->lang['priority']. $img_priority ."";
    $link_dname = "".$this->ifthd->lang['department']. $img_dname ."";
    $link_date = "".$this->ifthd->lang['submitted']. $img_date ."";
    $link_status = "".$this->ifthd->lang['status']. $img_status ."";

    #=============================
    # Grab Tickets
    #=============================

    if ( $this->ifthd->input['group'] )
    {

    if ( $this->ifthd->member['view_group_tickets'] || $this->ifthd->member['group_manager'] )
    {
    $filters[] = array( 'gid', '=', $this->ifthd->member['mgroup'] );
    }
    elseif( $this->ifthd->member['id'] )
    {
    $filters[] = array( 'mid', '=', $this->ifthd->member['id'] );
    }
    else
    {
    $filters[] = array( array( 'email', '=', $this->ifthd->member['s_email'] ), array( 'guest', '=', 1, 'and' ) );
    }

    }
    else
    {
    if ( $this->ifthd->member['id'] )
    {
    $filters[] = array( 'mid', '=', $this->ifthd->member['id'] );
    }
    else
    {
    $filters[] = array( array( 'email', '=', $this->ifthd->member['s_email'] ), array( 'guest', '=', 1, 'and' ) );
    }

    }

    // Combine Filters
    $filter_count = 0;

    while( list( , $fdata ) = each( $filters ) )
    {
    if ( $filter_count )
    {
    $fdata[] = 'and';
    }

    $sql_where[] = $fdata;

    $filter_count ++;
    }

    if ( $this->ifthd->input['st'] )
    {
    $start = $this->ifthd->input['st'];
    }
    else
    {
    $start = 0;
    }

    $db_array = array(
    'select' => array( 'id' ),
    'from' => 'tickets',
    'order' => array( $sort => $order ),
    );

    if ( $sql_where )
    {
    $db_array['where'] = $sql_where;
    }

    $this->ifthd->core->db->construct( $db_array );

    $this->ifthd->core->db->execute();

    $ticket_count = $this->ifthd->core->db->get_num_rows();

    $db_array = array(
    'select' => array( 'id', 'dname', 'subject', 'priority', 'date', 'status' ),
    'from' => 'tickets',
    'order' => array( $sort => $order ),
    );

    if ( $sql_where )
    {
    $db_array['where'] = $sql_where;
    }

    $this->ifthd->core->db->construct( $db_array );

    $this->ifthd->core->db->execute();

    **************************************
    File: sources\tickets.php
    Function: show_history
    Section : Antes de Do Output
    Add :
    #=============================
    # Department Filters
    #=============================

    $depart_links = ""; // Initialize for Security

    if ( is_array( unserialize( $this->ifthd->member['g_depart_perm'] ) ) )
    {
    $g_depart_perms = unserialize( $this->ifthd->member['g_depart_perm'] );
    }

    while ( list( $id, $d ) = each( $this->ifthd->core->cache['depart'] ) )
    {
    if ( $g_depart_perms && $g_depart_perms[ $id ] )
    {
    $depart_links .= "generate_link( 'depart', $id )."'>".$d['name']." | ";
    }
    elseif ( ! $g_depart_perms )
    {
    $depart_links .= "generate_link( 'depart', $id )."'>".$d['name']." | ";
    }
    }

    $depart_links .= "generate_link( 'depart', 0 )."'>".$this->ifthd->lang['all']."";

    **************************************
    File: sources\tickets.php
    Function: show_history
    Section : Do Output
    Before :
    $this->nav = array(
    "ifthd->core->cache['config']['hd_url']}/index.php?act=tickets'>{$this->ifthd->lang['tickets']}",
    "ifthd->core->cache['config']['hd_url']}/index.php?act=tickets&code=history'>{$this->ifthd->lang['history']}",
    );

    Add :
    ( $this->ifthd->input['group'] ) ? $my_link = $this->generate_link( 'group', 0 ) : $my_link = $this->generate_link( 'group', 1 );
    ( $this->ifthd->input['group'] ) ? $my_link_text = $this->ifthd->lang['my_tickets'] : $my_link_text = $this->ifthd->lang['group_tickets'];

    $img_dir = 'images/'.$this->ifthd->skin->data['img_dir'].'/'.$this->ifthd->member['lang'];
    $sort = '&order='.$order;
    $order = '&order='.$order;
    $this->ifthd->core->template->set_var( 'img_dir', $img_dir );
    $this->ifthd->core->template->set_var( 'sort', $sort );
    $this->ifthd->core->template->set_var( 'order', $order );
    $this->ifthd->core->template->set_var( 'ticket_count', $ticket_count );
    $this->ifthd->core->template->set_var( 'sql_string', $sql_string );
    $this->ifthd->core->template->set_var( 'depart_links', $depart_links );
    $this->ifthd->core->template->set_var( 'search_drop', $this->build_search_drop( $this->ifthd->input['field'] ) );
    $this->ifthd->core->template->set_var( 'search_action', $this->generate_link() );
    $this->ifthd->core->template->set_var( 'link_id', $link_id );
    $this->ifthd->core->template->set_var( 'link_subject', $link_subject );
    $this->ifthd->core->template->set_var( 'link_priority', $link_priority );
    $this->ifthd->core->template->set_var( 'link_dname', $link_dname );
    $this->ifthd->core->template->set_var( 'link_date', $link_date );
    $this->ifthd->core->template->set_var( 'link_status', $link_status );
    $this->ifthd->core->template->set_var( 'my_link', $my_link );
    $this->ifthd->core->template->set_var( 'my_link_text', $my_link_text );

    **************************************
    File: skins\s1\tck_history.tpl
    Change For:
    <div class='content_block'>
    <h1>{$lang['tickets']}</h1>

    <div class='groupbox'>
    <div style='float: right'>

    Filters

    </div>
    {$lang['ticket_list']}
    </div>

    <div id='filterbox'{$filterbox_hide}>
    <div class='option1' style='font-weight: normal'>
    {$lang['status']}:
    {$lang['open']} |
    {$lang['in_progress']} |
    {$lang['on_hold']} |
    {$lang['aca']} |
    {$lang['escalated']} |
    {$lang['close']} |
    {$lang['nclosed']} |
    {$lang['all']}
    {$lang['department']}: {$depart_links}
    <form action='{$search_action}' name='tsearch' method='post'>
    <div style='padding-top:8px'>
    {$lang['search']}:
    <input type='text' name='search' id='search' value='{$this->ifthd->input['search']}' size='25' /> {$search_drop}
    <input type='submit' name='go' id='search_go' value='{$lang['search_action']}' />
    </div>
    </form>
    </div>
    </div>

    <div class='groupbox'>{$ticket_count} {$lang['tickets']} </div>

    <table width='100%' cellpadding='0' cellspacing='0'>
    <tr>
    <th width='5%' align='left'>{$link_id}</th>
    <th width='28%' align='left'>{$link_subject}</th>
    <th width='11%' align='left'>{$link_priority}</th>
    <th width='22%' align='left'>{$link_dname}</th>
    <th width='20%' align='left'>{$link_date}</th>
    <th width='14%' align='left'>{$link_status}</th>
    </tr>
    {if $htickets}
    {foreach $htickets $t}
    <tr>
    <td class='option{$t['class']}-mini'>{$t['id']}</td>
    <td class='option{$t['class']}-mini'>{$t['subject']}</td>
    <td class='option{$t['class']}-mini'>{$t['p_img']}{$t['priority']}</td>
    <td class='row{$t['class']}-mini'>{$t['dname']}</td>
    <td class='row{$t['class']}-mini'>{$t['date']}</td>
    <td class='option{$t['class']}-mini'>{$t['status']}</td>
    </tr>
    {/foreach}
    {else}
    <tr>
    <td class='option1' colspan='6'>{$lang['no_tickets']}</td>
    </tr>
    {/if}
    </table>

    <div class='formtail'>
    <div style='padding-top: 3px; text-align:left;'>
    {$my_link_text}
    </div>
    </div>

    </div>

    **************************************
    File: admin\manage\ad_tickets.php
    Function: add_ticket
    Change :
    'select' => array( 'id', 'name', 'email', 'email_notify', 'email_new_ticket', 'time_zone', 'dst_active' ),

    For:
    'select' => array( 'id', 'name', 'email', 'email_notify', 'email_new_ticket', 'time_zone', 'dst_active', 'mgroup' ),

    **************************************
    File: admin\manage\ad_tickets.php
    Function: add_ticket
    After :
    $db_array = array(
    'did' => $d['id'],
    'dname' => $d['name'],
    'mid' => $mem['id'],
    'mname' => $mem['name'],
    'email' => $mem['email'],
    'subject' => $this->ifthd->input['subject'],
    'priority' => intval( $this->ifthd->input['priority'] ),
    'message' => $this->ifthd->input['message'],
    'date' => time(),
    'last_r

    Posted 7 years ago #
  2. User has not uploaded an avatar

    fcocarrero
    Member

    Hello.

    I would like to have the changes you made. I have tried to implement following the information in this post, but it seems incomplete. Could you send me all the changed files, please?.

    No problem with language, because I also need them in Spanish.

    Greetings

    Posted 7 years ago #
  3. User has not uploaded an avatar

    wgmx
    Member

    Hello,
    the same here, Id like to try your changes. Could you put the modified files online to downoad them?
    Thanks a lot.
    Wieland

    Posted 7 years ago #
  4. User has not uploaded an avatar

    abeltran
    Member

    I'm working on sending you the changes. I've made many mods to my files, so I don't want to send you the wrong ones. The other thing I can do is send you ALL my changes.
    Besides the filters for the member area and the ability to see all tickets within the group, I've added:
    1 - Automatically sends an email to the staff member to which the ticket was auto-assigned, instead of the entire staff group
    2 - Departments can be defined to require (or not) approval.
    If the dept requires approval, a notification is sent to the group manager. When he/she logs in, he will see a special area where the tickets pending approval are display. He/she can then approve or not. In the mean time, both the staff and the member who opened the ticket can see whether the ticket has been approved or not. Again, this is optional. Each department can be set separately. By default, no dept requires approval so everything works as the original installation.
    3 - I added a few email notifications that I felt were missing. For example, when the person who opens a ticket replies, the staff member assigned to the ticket receives a notification.
    4 - I fixed a bug that doesn't allow attachments with lowercase extensions to be added.
    5 - I incorporated Brian Clifton's color coding of the tickets depending on the status.
    6 - I modified the Spanish translation to use the word "Requerimiento" for Ticket 'cause this was more suitable to my installation.

    If you don't mind having all those changes, I can upload my files for you.

    Posted 7 years ago #
  5. User has not uploaded an avatar

    fcocarrero
    Member

    The changes you mention seem to me perfect and I am still keen to try them. Notify me when you ready and able to download them.

    Thanks in advance.

    Posted 7 years ago #
  6. User has not uploaded an avatar

    fcocarrero
    Member

    Hi, abeltran. Any news about the changes?

    Posted 7 years ago #
  7. User has not uploaded an avatar

    andyb
    Member

    If I could get the files also, it would be appreciated- not sure if you can upload them to here in .txt format, or the changes in .txt format (some of it is missing in the view I get)

    Posted 7 years ago #
  8. User has not uploaded an avatar

    serpe8742
    Member

    Hi,
    I am also interested in the changes you've made ​​to the code... Is it possible to have them?

    Thank you.
    Sandro

    Posted 5 years ago #

RSS feed for this topic

Reply

You must log in to post.