<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Open Script Solution&#187; HESK</title>
	<atom:link href="http://www.openscriptsolution.com/tag/hesk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.openscriptsolution.com</link>
	<description>... where solutions for script programming are found ...</description>
	<lastBuildDate>Tue, 31 Jan 2012 03:22:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to Avoid Duplicate Ticket Content Saved in HESK v2.1</title>
		<link>http://www.openscriptsolution.com/2009/12/16/how-to-avoid-duplicate-ticket-content-saved-in-hesk-v2-1/</link>
		<comments>http://www.openscriptsolution.com/2009/12/16/how-to-avoid-duplicate-ticket-content-saved-in-hesk-v2-1/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 16:51:12 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[HESK]]></category>
		<category><![CDATA[avoid]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[refresh]]></category>
		<category><![CDATA[reload]]></category>
		<category><![CDATA[ticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1035</guid>
		<description><![CDATA[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 &#8220;thank-you&#8221; page. In fact, a new ticket then would be created, the same [...]]]></description>
			<content:encoded><![CDATA[<p>Actually, this modification I created was being intended for a friend of mine who implemented <a href="http://www.hesk.com" target="_blank">HESK</a> 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 &#8220;thank-you&#8221; page. In fact, a new ticket then would be created, <a href="http://www.openscriptsolution.com/2009/09/03/how-to-avoid-duplicate-ticket-content-in-osticket-system/" target="_blank">the same condition that occured in osTicket</a>, which I have created the modification regarding it to fix the same problem. <span id="more-1035"></span></p>
<ol>
<li>
Open your <strong>submit_ticket.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>192
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">hesk_dbConnect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>then after that line, please insert this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>193
194
195
196
197
198
199
200
201
202
203
204
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* MOD: Avoid duplicate ticket (identified by its Subject &amp; Message) */</span>
<span style="color: #666666; font-style: italic;">/* modified by Masino Sinaga, November 30, 2009 */</span>
<span style="color: #000088;">$sqlcek</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT `subject`,`message` FROM `&quot;</span><span style="color: #339933;">.</span>hesk_dbEscape<span style="color: #009900;">&#40;</span><span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db_pfix'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;tickets` 
        WHERE `subject`='&quot;</span><span style="color: #339933;">.</span>hesk_dbEscape<span style="color: #009900;">&#40;</span><span style="color: #000088;">$subject</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' AND `message`='&quot;</span><span style="color: #339933;">.</span>hesk_dbEscape<span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$rescek</span> <span style="color: #339933;">=</span> hesk_dbQuery<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqlcek</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>hesk_dbNumRows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rescek</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//header('Location: index.php?a=add');</span>
    <span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Location: sorry.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;This ticket content already exists in database!&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">/* MOD: Avoid duplicate ticket (identified by its Subject &amp; Message) */</span></pre></td></tr></table></div>

</li>
<li>
Create a new php file, and name it with <strong>sorry.php</strong>, copy and paste this code below, and put this file to your HESK&#8217;s root directory:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Created by Masino Sinaga, http://www.openscriptsolution.com, November 30, 2009 */</span>
&nbsp;
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IN_SCRIPT'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HESK_PATH'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Get all the required files and functions */</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>HESK_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'hesk_settings.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>HESK_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'inc/common.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* Print header */</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>HESK_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'inc/header.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tr&gt;
&lt;td width=&quot;3&quot;&gt;&lt;img src=&quot;img/headerleftsm.jpg&quot; width=&quot;3&quot; height=&quot;25&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
&lt;td class=&quot;headersm&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> hesk_showTopBar<span style="color: #009900;">&#40;</span><span style="color: #000088;">$hesklang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'invalid_action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;
&lt;td width=&quot;3&quot;&gt;&lt;img src=&quot;img/headerrightsm.jpg&quot; width=&quot;3&quot; height=&quot;25&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&nbsp;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot;&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class=&quot;smaller&quot;&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'site_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;smaller&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'site_title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt; &gt;
&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hesk_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;smaller&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hesk_title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
&gt; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesklang</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'invalid_action'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&nbsp;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&nbsp;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tr&gt;
	&lt;td width=&quot;7&quot; height=&quot;7&quot;&gt;&lt;img src=&quot;img/roundcornerslt.jpg&quot; width=&quot;7&quot; height=&quot;7&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
	&lt;td class=&quot;roundcornerstop&quot;&gt;&lt;/td&gt;
	&lt;td&gt;&lt;img src=&quot;img/roundcornersrt.jpg&quot; width=&quot;7&quot; height=&quot;7&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td class=&quot;roundcornersleft&quot;&gt;&amp;nbsp;&lt;/td&gt;
	&lt;td&gt;
&nbsp;
	&lt;p&gt;&amp;nbsp;&lt;/p&gt;
	&lt;p align=&quot;center&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Sorry, the ticket you have just sent already exists in our database.&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
	&lt;p&gt;&amp;nbsp;&lt;/p&gt;
	&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hesk_url'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$hesk_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hesk_title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/p&gt;
	&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&nbsp;
	&lt;/td&gt;
	&lt;td class=&quot;roundcornersright&quot;&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
	&lt;td&gt;&lt;img src=&quot;img/roundcornerslb.jpg&quot; width=&quot;7&quot; height=&quot;7&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
	&lt;td class=&quot;roundcornersbottom&quot;&gt;&lt;/td&gt;
	&lt;td width=&quot;7&quot; height=&quot;7&quot;&gt;&lt;img src=&quot;img/roundcornersrb.jpg&quot; width=&quot;7&quot; height=&quot;7&quot; alt=&quot;&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>HESK_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'inc/footer.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</li>
</ol>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F12%2F16%2Fhow-to-avoid-duplicate-ticket-content-saved-in-hesk-v2-1%2F&amp;title=How%20to%20Avoid%20Duplicate%20Ticket%20Content%20Saved%20in%20HESK%20v2.1" id="wpa2a_2"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/12/16/how-to-avoid-duplicate-ticket-content-saved-in-hesk-v2-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
