<?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; extra</title>
	<atom:link href="http://www.openscriptsolution.com/tag/extra/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 Add Extra Fields on the Open Ticket Form of Client Side in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/11/15/how-to-add-extra-fields-on-the-open-ticket-form-of-client-side-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/11/15/how-to-add-extra-fields-on-the-open-ticket-form-of-client-side-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 12:32:19 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[client-side]]></category>
		<category><![CDATA[extra]]></category>
		<category><![CDATA[field]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[ticket]]></category>
		<category><![CDATA[viewticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=856</guid>
		<description><![CDATA[There are lots of question that asking about how to add extra or new fields into the open ticket form and display them onto the viewticket page in osTicket System. One of the questions that you can see is by clicking on this link. This following modification was being made by myself to answer such [...]]]></description>
			<content:encoded><![CDATA[<p>There are lots of question that asking about how to add extra or new fields into the open ticket form and display them onto the viewticket page in osTicket System. One of the questions that you can see is <a href="http://www.osticket.com/forums/showthread.php?t=3055" target="_blank">by clicking on this link</a>. This following modification was being made by myself to answer such question. In this example, we will add set of checkboxes that contains of 5 checkboxes, plus one textbox, and groupped them into two additional fields (<strong>applications</strong> and <strong>productkey</strong>), onto the form on the client-side. We will make it also for the staff-side in the separate article, later. <span id="more-856"></span></p>
<ol>
<li>
First of all, alter your <strong>ost_ticket</strong> table, by adding two new fields: <strong>applications</strong> and <strong>productkey</strong>. You may use this following SQL script (please note that <strong>ost_</strong> is the table prefix name, in case it differents with yours, adjust it by yourself):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">ALTER TABLE ost_ticket
ADD COLUMN `applications` varchar(100) default '' NOT NULL,
ADD COLUMN `productkey` varchar(50) default'' NOT NULL;</pre></div></div>

</li>
<li>
Open your <strong>\include\client\open.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>95
96
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    &lt;tr&gt;
      &lt;td&gt;Applications: &lt;/td&gt;
      &lt;td&gt;
        &lt;input name=applications[] type=checkbox value=&quot;Application 1&quot; &gt;Application 1
        &lt;input name=applications[] type=checkbox value=&quot;Application 2&quot; &gt;Application 2
        &lt;input name=applications[] type=checkbox value=&quot;Application 3&quot; &gt;Application 3
        &lt;input name=applications[] type=checkbox value=&quot;Application 4&quot; &gt;Application 4
        &lt;input name=applications[] type=checkbox value=&quot;Application 5&quot; &gt;Application 5
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Product Key: &lt;/td&gt;
      &lt;td&gt;
        &lt;input type=&quot;text&quot; name=&quot;productkey&quot; size=&quot;35&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'productkey'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
      &lt;/td&gt;    
    &lt;/tr&gt;</pre></td></tr></table></div>

</li>
<li>
Open your <strong>\include\class.ticket.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>44
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$overdue</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>45
46
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$applications</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$productkey</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>88
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">overdue</span> <span style="color: #339933;">=</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'isoverdue'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>then replace with this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>88
89
90
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">overdue</span> <span style="color: #339933;">=</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'isoverdue'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">applications</span> <span style="color: #339933;">=</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'applications'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">productkey</span> <span style="color: #339933;">=</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'productkey'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>140
141
142
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> getSubject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">subject</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>143
144
145
146
147
148
149
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> getApplications<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">applications</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> getProductKey<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">productkey</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1107
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span>     <span style="color: #0000ff;">'required'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'error'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Message required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1108
1109
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'applications'</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span>     <span style="color: #0000ff;">'required'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'error'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Applications required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'productkey'</span><span style="color: #009900;">&#93;</span>  <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'text'</span><span style="color: #339933;">,</span>     <span style="color: #0000ff;">'required'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'error'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Product key required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1197
1198
1199
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                Sys<span style="color: #339933;">::</span><span style="color: #004000;">alertAdmin</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Overlimit Notice'</span><span style="color: #339933;">,</span><span style="color: #000088;">$msg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1201
1202
1203
1204
1205
1206
1207
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$mycounter</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'applications'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$app</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
	  <span style="color: #000088;">$strapp</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$mycounter</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$app</span><span style="color: #339933;">:</span><span style="color: #0000ff;">&quot;, &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$app</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	  <span style="color: #000088;">$mycounter</span><span style="color: #339933;">++;</span>          	
        <span style="color: #009900;">&#125;</span>
        <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$app</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1260
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #0000ff;">',ip_address='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipaddress</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></td></tr></table></div>

<p>then replace with this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1260
1261
1262
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #0000ff;">',ip_address='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ipaddress</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
		<span style="color: #0000ff;">',applications='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$strapp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
		<span style="color: #0000ff;">',productkey='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'productkey'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></td></tr></table></div>

</li>
<li>
Open your <strong>\include\client\viewticket.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>27
28
29
30
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	&lt;tr&gt;
                &lt;th&gt;Create Date:&lt;/th&gt;
                &lt;td&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">db_datetime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getCreateDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;
            &lt;/tr&gt;</pre></td></tr></table></div>

<p>after the last line of that code, please insert this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>31
32
33
34
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">      &lt;tr&gt;
                &lt;th&gt;Applications:&lt;/th&gt;
                &lt;td&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getApplications</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;
      &lt;/tr&gt;</pre></td></tr></table></div>

<p>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>43
44
45
46
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            &lt;tr&gt;
                &lt;th&gt;Phone:&lt;/th&gt;
                &lt;td&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">phone</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getPhoneNumber</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;
            &lt;/tr&gt;</pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>47
48
49
50
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            &lt;tr&gt;
                &lt;th&gt;Product Key:&lt;/th&gt;
                &lt;td&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getProductKey</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;
            &lt;/tr&gt;</pre></td></tr></table></div>

</li>
</ol>
<p>That&#8217;s all. Hopefully this will be helpful.</p>
<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%2F11%2F15%2Fhow-to-add-extra-fields-on-the-open-ticket-form-of-client-side-in-osticket-v1-6-rc5%2F&amp;title=How%20to%20Add%20Extra%20Fields%20on%20the%20Open%20Ticket%20Form%20of%20Client%20Side%20in%20osTicket%20v1.6%20RC5" 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/11/15/how-to-add-extra-fields-on-the-open-ticket-form-of-client-side-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
