Home > HESK > How to Avoid Duplicate Ticket Content Saved in HESK v2.1

How to Avoid Duplicate Ticket Content Saved in HESK v2.1

Actually, this modification I created was being intended for a friend of mine who implemented HESK for his department. I was interested with its interface, so I tried to create a new ticket and tested after submitting the ticket, I reload the “thank-you” page. In fact, a new ticket then would be created, the same condition that occured in osTicket, which I have created the modification regarding it to fix the same problem.

  1. Open your submit_ticket.php file, and find this code:

    192
    
    hesk_dbConnect();

    then after that line, please insert this following code:

    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    
    /* MOD: Avoid duplicate ticket (identified by its Subject & Message) */
    /* modified by Masino Sinaga, November 30, 2009 */
    $sqlcek = "SELECT `subject`,`message` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` 
            WHERE `subject`='".hesk_dbEscape($subject)."' AND `message`='".hesk_dbEscape($message)."'";
    $rescek = hesk_dbQuery($sqlcek);
    if (hesk_dbNumRows($rescek) > 0) {
        //header('Location: index.php?a=add');
        header('Location: sorry.php');
        echo "This ticket content already exists in database!";
        exit();	
    }
    /* MOD: Avoid duplicate ticket (identified by its Subject & Message) */
  2. Create a new php file, and name it with sorry.php, copy and paste this code below, and put this file to your HESK’s root directory:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    
    <?php
     
    /* Created by Masino Sinaga, http://www.openscriptsolution.com, November 30, 2009 */
     
    define('IN_SCRIPT',1);
    define('HESK_PATH','');
     
    /* Get all the required files and functions */
    require(HESK_PATH . 'hesk_settings.inc.php');
    require(HESK_PATH . 'inc/common.inc.php');
     
    /* Print header */
    require_once(HESK_PATH . 'inc/header.inc.php');
    ?>
     
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="3"><img src="img/headerleftsm.jpg" width="3" height="25" alt="" /></td>
    <td class="headersm"><?php hesk_showTopBar($hesklang['invalid_action']); ?></td>
    <td width="3"><img src="img/headerrightsm.jpg" width="3" height="25" alt="" /></td>
    </tr>
    </table>
     
    <table width="100%" border="0" cellspacing="0" cellpadding="3">
    <tr>
    <td><span class="smaller"><a href="<?php echo $hesk_settings['site_url']; ?>" class="smaller"><?php echo $hesk_settings['site_title']; ?></a> >
    <a href="<?php echo $hesk_settings['hesk_url']; ?>" class="smaller"><?php echo $hesk_settings['hesk_title']; ?></a>
    > <?php echo $hesklang['invalid_action']; ?></span></td>
    </tr>
    </table>
     
    </td>
    </tr>
    <tr>
    <td>
     
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    	<td width="7" height="7"><img src="img/roundcornerslt.jpg" width="7" height="7" alt="" /></td>
    	<td class="roundcornerstop"></td>
    	<td><img src="img/roundcornersrt.jpg" width="7" height="7" alt="" /></td>
    </tr>
    <tr>
    	<td class="roundcornersleft">&nbsp;</td>
    	<td>
     
    	<p>&nbsp;</p>
    	<p align="center"><?php echo "Sorry, the ticket you have just sent already exists in our database."; ?></p>
    	<p>&nbsp;</p>
    	<p align="center"><a href="<?php echo $hesk_settings['hesk_url']; ?>"><?php echo $hesk_settings['hesk_title']; ?></a></p>
    	<p>&nbsp;</p>
     
    	</td>
    	<td class="roundcornersright">&nbsp;</td>
    </tr>
    <tr>
    	<td><img src="img/roundcornerslb.jpg" width="7" height="7" alt="" /></td>
    	<td class="roundcornersbottom"></td>
    	<td width="7" height="7"><img src="img/roundcornersrb.jpg" width="7" height="7" alt="" /></td>
    </tr>
    </table>
     
    <?php
     
    require_once(HESK_PATH . 'inc/footer.inc.php');
    exit();
  • Share/Bookmark
132 views Print This Post Print This Post

Categories: HESK Tags: , , , , , , ,
  1. No comments yet.
  1. No trackbacks yet.