<?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; osTicket</title>
	<atom:link href="http://www.openscriptsolution.com/category/ticketsystem/osticket/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 Create 3 New Permissions (Can Post Reply, Can Post Internal Notes, and Can Assign Tickets) into osTicket 1.6 ST</title>
		<link>http://www.openscriptsolution.com/2012/01/20/how-to-create-3-new-permissions-can-post-reply-can-post-internal-notes-and-can-assign-tickets-into-osticket-1-6-st/</link>
		<comments>http://www.openscriptsolution.com/2012/01/20/how-to-create-3-new-permissions-can-post-reply-can-post-internal-notes-and-can-assign-tickets-into-osticket-1-6-st/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 04:19:53 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[assign tickets]]></category>
		<category><![CDATA[post internal notes]]></category>
		<category><![CDATA[post reply]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[staff panel]]></category>
		<category><![CDATA[staff-side]]></category>
		<category><![CDATA[user groups]]></category>
		<category><![CDATA[v1.6 ST]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1495</guid>
		<description><![CDATA[osTicket does very good job to restrict the certain permissions to the staff by implementing the User Groups feature. There are seven permissions that have been provided in the User Groups. They are: Can Create Tickets, Can Edit Tickets, Can Close Tickets, Can Transfer Tickets, Can Delete Tickets, Can Ban Emails, and Can Manage Premade. [...]]]></description>
			<content:encoded><![CDATA[<p>osTicket does very good job to restrict the certain permissions to the staff by implementing the User Groups feature. There are seven permissions that have been provided in the User Groups. They are: Can Create Tickets, Can Edit Tickets, Can Close Tickets, Can Transfer Tickets, Can Delete Tickets, Can Ban Emails, and Can Manage Premade. Unfortunately, up to osTicket version 1.6 ST, there are no permissions for the following action: Can Post Reply, Can Post Internal Notes, and Can Assign Tickets. In this article, I will show you how you can add those three new permissions into the User Groups feature. They are very useful whenever you want to create a User Group and then assign it to the certain users which do not have the abilities for that three new permissions. By default, these three new permissions are all set to 1 (Enabled). If you want to change the values or disable those three new permissions, then you have to login as Administrator, and then go to Admin Panel -> Staff -> User Groups, then edit a user group record from the list which you want to disable them.</p>
<ol>
<li>
First of all, alter your <strong>ost_groups</strong> table by adding the three new fields called by using the following script into your osTicket database (please adjust the table prefix if you are using the different one with mine using <strong>ost_</strong>):</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`ost_groups`</span> <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">COLUMN</span> <span style="color: #ff0000;">`can_post_reply`</span> tinyint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #cc66cc;">1</span> AFTER <span style="color: #ff0000;">`can_create_tickets`</span>;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`ost_groups`</span> <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">COLUMN</span> <span style="color: #ff0000;">`can_post_internal_notes`</span> tinyint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #cc66cc;">1</span> AFTER <span style="color: #ff0000;">`can_post_reply`</span>;
<span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`ost_groups`</span> <span style="color: #993333; font-weight: bold;">ADD</span> <span style="color: #993333; font-weight: bold;">COLUMN</span> <span style="color: #ff0000;">`can_assign_tickets`</span> tinyint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #cc66cc;">1</span> AFTER <span style="color: #ff0000;">`can_post_internal_notes`</span>;</pre></div></div>

</li>
<li>
Open your <strong>/include/staff/group.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        &lt;tr&gt;&lt;th&gt;Can &lt;b&gt;Create&lt;/b&gt; Tickets&lt;/th&gt;
            &lt;td&gt;
                &lt;input type=&quot;radio&quot; name=&quot;can_create_tickets&quot;  value=&quot;1&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;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Yes 
                &lt;input type=&quot;radio&quot; name=&quot;can_create_tickets&quot;  value=&quot;0&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #339933;">!</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;No
                &amp;nbsp;&amp;nbsp;&lt;i&gt;Ability to open tickets on behalf of users!&lt;/i&gt;
            &lt;/td&gt;
        &lt;/tr&gt;</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
        <span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;&lt;</span>th<span style="color: #339933;">&gt;</span>Can <span style="color: #339933;">&lt;</span>b<span style="color: #339933;">&gt;</span>Post Reply<span style="color: #339933;">&lt;/</span>b<span style="color: #339933;">&gt;&lt;/</span>th<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;can_post_reply&quot;</span>  value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span>   <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;">'can_post_reply'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Yes 
                &lt;input type=&quot;radio&quot; name=&quot;can_post_reply&quot;  value=&quot;0&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #339933;">!</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_reply'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;No
                &amp;nbsp;&amp;nbsp;&lt;i&gt;Ability to post replies!&lt;/i&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;th&gt;Can &lt;b&gt;Post Internal Notes&lt;/b&gt;&lt;/th&gt;
            &lt;td&gt;
                &lt;input type=&quot;radio&quot; name=&quot;can_post_internal_notes&quot;  value=&quot;1&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;">'can_post_internal_notes'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Yes 
                &lt;input type=&quot;radio&quot; name=&quot;can_post_internal_notes&quot;  value=&quot;0&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #339933;">!</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_internal_notes'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;No
                &amp;nbsp;&amp;nbsp;&lt;i&gt;Ability to post Internal Notes!&lt;/i&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;th&gt;Can &lt;b&gt;Assign&lt;/b&gt; Tickets&lt;/th&gt;
            &lt;td&gt;
                &lt;input type=&quot;radio&quot; name=&quot;can_assign_tickets&quot;  value=&quot;1&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;">'can_assign_tickets'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Yes 
                &lt;input type=&quot;radio&quot; name=&quot;can_assign_tickets&quot;  value=&quot;0&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #339933;">!</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_assign_tickets'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;No
                &amp;nbsp;&amp;nbsp;&lt;i&gt;Ability to assign tickets!&lt;/i&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">', can_create_tickets='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">', can_create_tickets='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012</span>
				 <span style="color: #0000ff;">', can_post_reply='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_reply'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
				 <span style="color: #0000ff;">', can_post_internal_notes='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_internal_notes'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>				 
				 <span style="color: #0000ff;">', can_assign_tickets='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_assign_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> canCreateTickets<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: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">udata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_create_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012</span>
    <span style="color: #000000; font-weight: bold;">function</span> canPostReply<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: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">udata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_reply'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>    
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> canPostInternalNotes<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: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">udata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_post_internal_notes'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>    
    <span style="color: #009900;">&#125;</span>	
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> canAssignTickets<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: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">udata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'can_assign_tickets'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>    
    <span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;reply&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tabbertab&quot;</span> align<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;left&quot;</span><span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Post Reply<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span></pre></div></div>

<p>before the first line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canPostReply</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                        <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>
                            <span style="color: #339933;">&lt;</span>div  style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;margin-left: 50px; margin-top: 30px; margin-bottom: 10px;border: 0px;&quot;</span><span style="color: #339933;">&gt;</span>
                                <span style="color: #339933;">&lt;</span>input <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">'submit'</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">'Post Reply'</span> <span style="color: #339933;">/&gt;</span>
                                <span style="color: #339933;">&lt;</span>input <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">'reset'</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">'Reset'</span> <span style="color: #339933;">/&gt;</span>
                                <span style="color: #339933;">&lt;</span>input <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;button&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">'button'</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">'Cancel'</span> onClick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;history.go(-1)&quot;</span> <span style="color: #339933;">/&gt;</span>
                            <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
                        <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
                    <span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span>                
                <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;notes&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tabbertab&quot;</span>  align<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;left&quot;</span><span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Post Internal Note<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span></pre></div></div>

<p>before the first line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canPostInternalNotes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                        &lt;div style=&quot;margin-top: 3px;&quot;&gt;
                            &lt;b&gt;Ticket Status:&lt;/b&gt;
                            <span style="color: #000000; font-weight: bold;">&lt;?</span>
                            <span style="color: #000088;">$checked</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//not selected by default.</span>
                            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isOpen</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                            &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;ticket_status&quot; id=&quot;ticket_status&quot; value=&quot;Close&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$checked</span><span style="color: #000000; font-weight: bold;">?&gt;</span> &gt; Close Ticket&lt;/label&gt;
                            <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                            &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;ticket_status&quot; id=&quot;ticket_status&quot; value=&quot;Reopen&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$checked</span><span style="color: #000000; font-weight: bold;">?&gt;</span> &gt; Reopen Ticket&lt;/label&gt;
                            <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                        &lt;/div&gt;
                        <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                        &lt;p&gt;
                            &lt;div  align=&quot;left&quot; style=&quot;margin-left: 50px;margin-top: 10px; margin-bottom: 10px;border: 0px;&quot;&gt;
                                &lt;input class=&quot;button&quot; type='submit' value='Submit' /&gt;
                                &lt;input class=&quot;button&quot; type='reset' value='Reset' /&gt;
                                &lt;input class=&quot;button&quot; type='button' value='Cancel' onClick=&quot;history.go(-1)&quot; /&gt;
                            &lt;/div&gt;
                        &lt;/p&gt;
                    &lt;/form&gt;
                &lt;/p&gt;
            &lt;/div&gt;</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #000000; font-weight: bold;">&lt;?</span>
             <span style="color: #666666; font-style: italic;">//When the ticket is assigned Allow assignee, admin or ANY dept manager to reassign the ticket.</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAssigned</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>  <span style="color: #339933;">||</span> <span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStaffId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                 <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;div id=&quot;assign&quot; class=&quot;tabbertab&quot;  align=&quot;left&quot;&gt;
&nbsp;
                &lt;h2&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$staff</span>?<span style="color: #0000ff;">'Re Assign Ticket'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'Assign to Staff'</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;</pre></div></div>

<p>before the first line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canAssignTickets</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/staff/viewticket.inc.php</strong> file, find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                        &lt;p&gt;
                            &lt;div  style=&quot;margin-left: 50px; margin-top: 5px; margin-bottom: 10px;border: 0px;&quot; align=&quot;left&quot;&gt;
                                &lt;input class=&quot;button&quot; type='submit' value='Assign' /&gt;
                                &lt;input class=&quot;button&quot; type='reset' value='Reset' /&gt;
                                &lt;input class=&quot;button&quot; type='button' value='Cancel' onClick=&quot;history.go(-1)&quot; /&gt;
                            &lt;/div&gt;
                        &lt;/p&gt;
                    &lt;/form&gt;
                &lt;/p&gt;
            &lt;/div&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span>
         <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Adding 3 New Permissions, by Masino Sinaga, January 20, 2012 ?&gt;</span></pre></div></div>

</li>
</ol>
<p>Hopefully you find it useful. <img src='http://www.openscriptsolution.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </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%2F2012%2F01%2F20%2Fhow-to-create-3-new-permissions-can-post-reply-can-post-internal-notes-and-can-assign-tickets-into-osticket-1-6-st%2F&amp;title=How%20to%20Create%203%20New%20Permissions%20%28Can%20Post%20Reply%2C%20Can%20Post%20Internal%20Notes%2C%20and%20Can%20Assign%20Tickets%29%20into%20osTicket%201.6%20ST" 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/2012/01/20/how-to-create-3-new-permissions-can-post-reply-can-post-internal-notes-and-can-assign-tickets-into-osticket-1-6-st/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mandatory Attachments for Client Side of osTicket 1.6 ST</title>
		<link>http://www.openscriptsolution.com/2011/10/08/mandatory-attachments-for-client-side-of-osticket-1-6-st/</link>
		<comments>http://www.openscriptsolution.com/2011/10/08/mandatory-attachments-for-client-side-of-osticket-1-6-st/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 10:39:07 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[attachment]]></category>
		<category><![CDATA[browse for file]]></category>
		<category><![CDATA[client-side]]></category>
		<category><![CDATA[lampiran]]></category>
		<category><![CDATA[mandatory]]></category>
		<category><![CDATA[multiple]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1465</guid>
		<description><![CDATA[This following modification will answer the request that being asked via this thread in osTicket Discussion Forum. Since I created this modification based on my Multiple Attachments for Client Side of osTicket 1.6 RC5 modification (this mod also works fine in 1.6 ST version), then you have to implement that multiple attachments mod first before [...]]]></description>
			<content:encoded><![CDATA[<p>This following modification will answer the request that being asked via <a href="http://www.osticket.com/forums/showthread.php?t=6579" title="MOD Request - Mandatory Attachments" target="_blank">this thread</a> in osTicket Discussion Forum. Since I created this modification based on my <a href="http://www.openscriptsolution.com/2009/10/25/multiple-attachments-for-client-side-of-osticket-v1-6-rc5/" title="Multiple Attachments for Client Side of osTicket 1.6 RC5" target="_blank">Multiple Attachments for Client Side of osTicket 1.6 RC5</a> modification (this mod also works fine in 1.6 ST version), then you have to implement that multiple attachments mod first before implementing the following modification below. Well, here is the important things that you need to know regarding the mandatory attachments modification below. I added a new setting from the Admin Panel -> Settings -> Attachments in order to set whether you will allow the mandatory attachments when your client submitting a ticket or not. For this purpose, I alter the ost_config table by adding a new field. After implementing the modification code below, then you have to go first to your <strong>Admin Panel</strong> -> <strong>Settings</strong> -> <strong>Attachments</strong>, and make sure you have already given a tick mark at the &#8220;Mandatory Attachments&#8221; -> &#8220;Allow Mandatory Attachments&#8221; in that page. You can enable or disable this mandatory attachments feature anytime you want.</p>
<ol>
<li>
First of all, alter your <strong>ost_config</strong> table by adding a new field called <strong>allow_mandatory_attachments</strong> by using the following script into your osTicket database (please adjust the table prefix if you are using the different one with mine using ost_):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">ALTER TABLE `ost_config` ADD COLUMN `allow_mandatory_attachments` TINYINT(1)  NOT NULL DEFAULT '0' AFTER `allow_attachments`;</pre></div></div>

</li>
<li>
Open your <strong>/include/client/open.inc.php</strong> file, and find this code (you will never find this code if you have not implemented the Multiple Attachments for Client Side of osTicket 1.6 RC5 mod above):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        &lt;td&gt;
            &lt;!-- &lt;input type=&quot;file&quot; name=&quot;attachment&quot;&gt;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt; --&gt;
            &lt;input id=&quot;my_file_element&quot; type=&quot;file&quot; name=&quot;file_1&quot; &gt;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file_1'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;
        &lt;/td&gt;</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        &lt;td&gt;
            &lt;!-- &lt;input type=&quot;file&quot; name=&quot;attachment&quot;&gt;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt; --&gt;
            &lt;input id=&quot;my_file_element&quot; type=&quot;file&quot; name=&quot;file_1&quot; value=&quot;document.getElementById( 'my_file_element' )&quot;&gt;&lt;font class=&quot;error&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011  </span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">allowMandatoryAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
			  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&amp;nbsp;*'</span><span style="color: #339933;">;</span> 
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> 
			  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> 
			<span style="color: #009900;">&#125;</span> 
			<span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011 ?&gt;&amp;nbsp;&lt;?=$errors['file_1']</span>
			<span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;/font&gt;
        &lt;/td&gt;</pre></div></div>

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

<div class="wp_syntax"><div 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></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">allowAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">allowMandatoryAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$totalsize</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;">$_FILES</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #000088;">$totalsize</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$totalsize</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'size'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
          <span style="color: #009900;">&#125;</span>
          <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$totalsize</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
             <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file_1'</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;">'string'</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;">'Attachment file(s) required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span></pre></div></div>

<p>So here is the idea for this mod. First of all, we checked whether the system is allowing the attachments and the mandatory attachments. Secondly, it will check the file size of the attachments in order to make sure the current ticket has the attachments file attached to it. If the conditions in first step are met but the file size is equal with zero, then system reject or cancel the submission and inform the client of a missing attachment.
</li>
<li>
Open your <strong>/include/class.config.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> allowAttachments<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;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span>
    <span style="color: #000000; font-weight: bold;">function</span> allowMandatoryAttachments<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;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_mandatory_attachments'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span></pre></div></div>

</li>
<li>
Open your <strong>/include/staff/attachment.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">          &lt;tr&gt;
            &lt;th width=&quot;165&quot;&gt;Allow Attachments:&lt;/th&gt;
            &lt;td&gt;
              &lt;input type=&quot;checkbox&quot; name=&quot;allow_attachments&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span> ?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;&lt;b&gt;Allow Attachments&lt;/b&gt;
                &amp;nbsp; (&lt;i&gt;Global Setting&lt;/i&gt;)
                &amp;nbsp;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;
            &lt;/td&gt;
          &lt;/tr&gt;</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">          <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011 ?&gt;</span>
          <span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>th width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;165&quot;</span><span style="color: #339933;">&gt;</span>Mandatory Attachments<span style="color: #339933;">:&lt;/</span>th<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>
              <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;allow_mandatory attachments&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_mandatory_attachments'</span><span style="color: #009900;">&#93;</span> ?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;&lt;b&gt;Allow Mandatory Attachments&lt;/b&gt;  &amp;nbsp;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_mandatory_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;
            &lt;/td&gt;
          &lt;/tr&gt;
          <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011 ?&gt;</span></pre></div></div>

</li>
<li>
Open your <strong>/scp/admin.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">               <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>CONFIG_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET allow_attachments='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
                    <span style="color: #0000ff;">',upload_dir='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'upload_dir'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">               <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>CONFIG_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET allow_attachments='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
                     <span style="color: #0000ff;">',allow_mandatory_attachments='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'allow_mandatory_attachments'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #666666; font-style: italic;">// MOD Mandatory Attachments, by Masino Sinaga, October 8, 2011</span>
                    <span style="color: #0000ff;">',upload_dir='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'upload_dir'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></div></div>

</li>
</ol>
<p>Once again, I remind you, please do not forget to set Mandatory Attachments after implementing the modification code above. Go to your <strong>Admin Panel</strong> -> <strong>Settings</strong> -> <strong>Attachments</strong>, and give a tick mark at the &#8220;Mandatory Attachments&#8221; -> &#8220;Allow Mandatory Attachments&#8221;, and save the settings, afterwards you will be able to allow the mandatory attachments for your client on submitting a ticket via your osTicket system.</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%2F2011%2F10%2F08%2Fmandatory-attachments-for-client-side-of-osticket-1-6-st%2F&amp;title=Mandatory%20Attachments%20for%20Client%20Side%20of%20osTicket%201.6%20ST" id="wpa2a_4"><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/2011/10/08/mandatory-attachments-for-client-side-of-osticket-1-6-st/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to List All Attachment Files in the View Ticket Page of osTicket 1.6 ST</title>
		<link>http://www.openscriptsolution.com/2011/09/12/how-to-list-all-attachment-files-in-the-view-ticket-page-of-osticket-1-6-st/</link>
		<comments>http://www.openscriptsolution.com/2011/09/12/how-to-list-all-attachment-files-in-the-view-ticket-page-of-osticket-1-6-st/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 16:34:57 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[attachment]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[v1.6 ST]]></category>
		<category><![CDATA[viewticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1429</guid>
		<description><![CDATA[Because the number of the attachment files in a ticket could be increasing anytime, which these attachment files can be derived from the client when creating and reply to a ticket, as well as uploaded by staff when replying to ticket, then consider the situation where your staff someday wants to see or to search [...]]]></description>
			<content:encoded><![CDATA[<p>Because the number of the attachment files in a ticket could be increasing anytime, which these attachment files can be derived from the client when creating and reply to a ticket, as well as uploaded by staff when replying to ticket, then consider the situation where your staff someday wants to see or to search the certain attachment files simply from a list that contains all those attachment files for the current ticket. The benefits of this feature for your staff is very pronounced, especially if they want to search and download the certain attachment files without having to seek it from or browse for them one by one from the messages that located in the Ticket Thread section. This following modifications will solve the problem in osTicket 1.6 ST. After implementing this modification, now your staff will be easier to find the certain attachment files from a list. You will see that there is a new tab appear named &#8220;Attachments&#8221; in the view ticket page. This tab will only appear if the current ticket has at least one attachment file.</p>
<ol>
<li>
Open your <strong>/include/staff/viewticket.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tabber&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD List Attachment Files in View Ticket, by Masino Sinaga, September 12, 2011 ?&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">checkAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;div id=&quot;attachments&quot; class=&quot;tabbertab&quot;&gt;
      &lt;h2&gt;Attachments&lt;/h2&gt;		
        &lt;table align=&quot;center&quot; class=&quot;message&quot; cellspacing=&quot;0&quot; cellpadding=&quot;1&quot; width=&quot;100%&quot; border=0&gt;
         &lt;tr class=&quot;header&quot;&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;">getAttachments</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/td&gt;&lt;/tr&gt; 
		&lt;/table&gt;
    &lt;/div&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD List Attachment Files in View Ticket, by Masino Sinaga, September 12, 2011 ?&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> getAttachmentStr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$refid</span><span style="color: #339933;">,</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// Begin of MOD List Attachment Files in View Ticket, by Masino Sinaga, September 8, 2011</span>
    <span style="color: #000000; font-weight: bold;">function</span> getAttachments<span style="color: #009900;">&#40;</span><span style="color: #000088;">$refid</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>        
        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT attach_id,ref_id,file_size,file_name FROM '</span><span style="color: #339933;">.</span>TICKET_ATTACHMENT_TABLE<span style="color: #339933;">.</span>
             <span style="color: #0000ff;">' WHERE deleted=0 AND ticket_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">' ORDER BY attach_id DESC'</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$res</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span> <span style="color: #339933;">&amp;&amp;</span> db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span><span style="color: #000088;">$refid</span><span style="color: #339933;">,</span><span style="color: #000088;">$size</span><span style="color: #339933;">,</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span>db_fetch_row<span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$hash</span><span style="color: #339933;">=</span><span style="color: #990000;">MD5</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #000088;">$refid</span><span style="color: #339933;">.</span><span style="color: #990000;">session_id</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$size</span><span style="color: #339933;">=</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">file_size</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$name</span><span style="color: #339933;">=</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">htmlchars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$attachstr</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;a class='Icon file' href='attachment.php?id=<span style="color: #006699; font-weight: bold;">$id</span>&amp;ref=<span style="color: #006699; font-weight: bold;">$hash</span>' target='_blank'&gt;&lt;b&gt;<span style="color: #006699; font-weight: bold;">$name</span>&lt;/b&gt;&lt;/a&gt;&amp;nbsp;(&lt;i&gt;<span style="color: #006699; font-weight: bold;">$size</span>&lt;/i&gt;)&amp;nbsp;&amp;nbsp;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$attachstr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> checkAttachments<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT file_name FROM '</span><span style="color: #339933;">.</span>TICKET_ATTACHMENT_TABLE<span style="color: #339933;">.</span>
             <span style="color: #0000ff;">' WHERE deleted=0 AND ticket_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$res</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span> <span style="color: #339933;">&amp;&amp;</span> db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$res</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
           <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
           <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// End of MOD List Attachment Files in View Ticket, by Masino Sinaga, September 8, 2011</span></pre></div></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%2F2011%2F09%2F12%2Fhow-to-list-all-attachment-files-in-the-view-ticket-page-of-osticket-1-6-st%2F&amp;title=How%20to%20List%20All%20Attachment%20Files%20in%20the%20View%20Ticket%20Page%20of%20osTicket%201.6%20ST" id="wpa2a_6"><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/2011/09/12/how-to-list-all-attachment-files-in-the-view-ticket-page-of-osticket-1-6-st/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to Collapse Both the Internal Notes and the Ticket Thread as Default in osTicket 1.6 ST</title>
		<link>http://www.openscriptsolution.com/2011/09/04/how-to-collapse-both-the-internal-notes-and-the-ticket-thread-as-default-in-osticket-1-6-st/</link>
		<comments>http://www.openscriptsolution.com/2011/09/04/how-to-collapse-both-the-internal-notes-and-the-ticket-thread-as-default-in-osticket-1-6-st/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 05:30:09 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[collapse]]></category>
		<category><![CDATA[expand]]></category>
		<category><![CDATA[Internal Notes]]></category>
		<category><![CDATA[Ticket Thread]]></category>
		<category><![CDATA[v1.6 ST]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1425</guid>
		<description><![CDATA[For those of you who want to collapse both the Internal Notes and the Ticket Thread sections as default in osTicket 1.6 ST, then this following modification is definitely right for you. Now each time your staff views a ticket, then the Internal Notes and the Ticket Thread sections will automatically be collapsed as default. [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who want to collapse both the Internal Notes and the Ticket Thread sections as default in osTicket 1.6 ST, then this following modification is definitely right for you. Now each time your staff views a ticket, then the Internal Notes and the Ticket Thread sections will automatically be collapsed as default. Staff has to click on its title in order to expand the content of it (toggle link). As this is a simple modification, there is only one file that you need to edit in order to implement this, it&#8217;s a <strong>viewticket.inc.php</strong> that located in the <strong>/include/staff/</strong> sub-directory. <span id="more-1425"></span></p>
<ol>
<li>
Open your <strong>/include/staff/viewticket.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div id='ticketnotes' style=&quot;display:<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$display</span><span style="color: #000000; font-weight: bold;">?&gt;</span>;text-align:center;&quot;&gt;</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">'ticketnotes'</span> style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;display:none;text-align:center;&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

</li>
<li>
Still in the same file above, find again this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;ticketthread&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;ticketthread&quot;</span> style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;display:none&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

</li>
</ol>
<p>Hope it helps.</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%2F2011%2F09%2F04%2Fhow-to-collapse-both-the-internal-notes-and-the-ticket-thread-as-default-in-osticket-1-6-st%2F&amp;title=How%20to%20Collapse%20Both%20the%20Internal%20Notes%20and%20the%20Ticket%20Thread%20as%20Default%20in%20osTicket%201.6%20ST" id="wpa2a_8"><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/2011/09/04/how-to-collapse-both-the-internal-notes-and-the-ticket-thread-as-default-in-osticket-1-6-st/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Implement Simple Time Spent by Staff on Ticket in osTicket 1.6 ST</title>
		<link>http://www.openscriptsolution.com/2011/08/31/how-to-implement-simple-time-spent-by-staff-on-ticket-in-osticket-1-6-st/</link>
		<comments>http://www.openscriptsolution.com/2011/08/31/how-to-implement-simple-time-spent-by-staff-on-ticket-in-osticket-1-6-st/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 03:38:18 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[staff panel]]></category>
		<category><![CDATA[staff-side]]></category>
		<category><![CDATA[time spent]]></category>
		<category><![CDATA[v1.6 ST]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1414</guid>
		<description><![CDATA[After a few months not involved in osTicket discussion forum, today I saw some requests asking about how to implement the simple time spent on a ticket in osTicket 1.6 ST (stable version) as good as it has been implemented in osTicket 1.6 RC5. Since the author of that mod is busy nowadays and he [...]]]></description>
			<content:encoded><![CDATA[<p>After a few months not involved in osTicket discussion forum, today I saw some requests asking about how to implement the simple time spent on a ticket in osTicket 1.6 ST (stable version) as good as <a href="http://www.osticket.com/forums/showthread.php?t=3579" title="Simple Time Spent on Ticket in osTicket 1.6 RC5" target="_blank">it has been implemented in osTicket 1.6 RC5</a>. Since the author of that mod is busy nowadays and he has not much time to upgrade that modification, so I tried to help osTicket community to make it come true. Now I have successfully created the same modification for osTicket 1.6 ST version. Please note that actually I have implemented the <a href="http://www.openscriptsolution.com/2009/11/08/add-auto-staff-time-sheet-feature-into-osticket-v1-6-rc5/" title="Auto Staff Time Sheet Feature in osTicket 1.6 RC5" target="_blank">similar modification</a> with that one above, so please be kind to choose one of them that suits with your needs. Hopefully this will be helpful for you. <span id="more-1414"></span></p>
<ol>
<li>
First of all, alter your <strong>ost_ticket</strong> table by adding a new field called <strong>time_spent</strong> by using the following script into your osTicket database (please adjust the table prefix if you are using the different one with mine using ost_):</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ALTER TABLE `ost_ticket` ADD COLUMN `time_spent` FLOAT(4,2)  NOT NULL DEFAULT '0.00' AFTER `closed`;</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                                <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$appendDeptSig</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                                &lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;signature&quot; value=&quot;dept&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;">'signature'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'dept'</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> &gt; Dept Signature&lt;/label&gt;
                                <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                           &lt;/div&gt;
                         <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                        &lt;div style=&quot;margin-top: 3px;&quot;&gt;</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isOpen</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;br /&gt;
&lt;label for=&quot;current_time_spent&quot;&gt;&lt;b&gt;Current Time Spent:&lt;/b&gt;&lt;/label&gt; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTimeSpent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// show the current time spent (if any) ?&gt;</span>
<span style="color: #339933;">&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;time_spent&quot;</span><span style="color: #339933;">&gt;&lt;</span>b<span style="color: #339933;">&gt;</span>Time Spent<span style="color: #339933;">:&lt;/</span>b<span style="color: #339933;">&gt;&lt;/</span>label<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;time_spent&quot;</span> size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;5&quot;</span>
    value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php if(isset(<span style="color: #006699; font-weight: bold;">$_POST</span>['time_spent'])) echo <span style="color: #006699; font-weight: bold;">$_POST</span>['time_spent'];?&gt;&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #009900;">&#40;</span><span style="color:#800080;">0.75</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">45</span> minutes<span style="color: #009900;">&#41;</span>
<span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div 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></div></div>

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

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

</li>
<li>
Still in the <strong>/include/class.ticket.php</strong>, find again this code:</p>

<div class="wp_syntax"><div 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></div></div>

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

<div class="wp_syntax"><div 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;">timeSpent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time_spent'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>
Still in the <strong>/include/class.ticket.php</strong> file, find again this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> getStatus<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;">status</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> getTimeSpent<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;">formatTime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">timeSpent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> formatTime<span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$formatted</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$time</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$formatted</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">' Minutes'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$formatted</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$time</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' Hour'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$formatted</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$time</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' Hours'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$formatted</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> timeSpent<span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <span style="color:#800080;">0.00</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <span style="color:#800080;">0.25</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$time</span> <span style="color: #339933;">=</span> <span style="color: #990000;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET time_spent='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' WHERE ticket_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> db_affected_rows<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span> 
    <span style="color: #009900;">&#125;</span></pre></div></div>

</li>
<li>
Open your <strong>/scp/tickets.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></div></div>

<p>before the line of that code, insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">               <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">timeSpent</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time_spent'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>
Still in the <strong>/scp/tickets.php</strong> file, find again this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></pre></div></div>

<p>before the line of that code, insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">               <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">timeSpent</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time_spent'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
<li>
<strong>Updated:</strong> the next step, we will add an additional column in the ticket list page named <strong>Time Spent</strong>.<br />
Open your <strong>/include/staff/tickets.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$qselect</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,subject,name,email,dept_name '</span><span style="color: #339933;">.</span>
           <span style="color: #0000ff;">',ticket.status,ticket.source,isoverdue,isanswered,ticket.created,pri.* ,count(attach.attach_id) as attachments '</span><span style="color: #339933;">;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$qselect</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,subject,name,email,dept_name '</span><span style="color: #339933;">.</span>
           <span style="color: #0000ff;">',ticket.status,ticket.source,isoverdue,isanswered,ticket.created,pri.* ,count(attach.attach_id) as attachments, time_spent '</span><span style="color: #339933;">;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #339933;">&lt;</span>th width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;180&quot;</span> <span style="color: #339933;">&gt;</span>From<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #339933;">&lt;</span>th width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;120&quot;</span> <span style="color: #339933;">&gt;</span>From<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>th width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;160&quot;</span> <span style="color: #339933;">&gt;</span>Time Spent<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                &lt;td nowrap&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">truncate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">22</span><span style="color: #339933;">,</span><span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'@'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&amp;nbsp;&lt;/td&gt;</pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>INCLUDE_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">'class.ticket.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Ticket<span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_id'</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>
                <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$the_time_spent</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTimeSpent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                &lt;td nowrap&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$the_time_spent</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&amp;nbsp;&lt;/td&gt;</pre></div></div>

</li>
<li>
<strong>Updated on November 14, 2011</strong>: This following step will add the ability of summing of time. As we know, the existing condition will overide the old value with the new value. With the new condition below, now each staff input the new value, then the new value will be summed to the old value. Let&#8217;s get started now! Open your <strong>/include/staff/viewticket.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;label for=&quot;current_time_spent&quot;&gt;&lt;b&gt;Current Time Spent:&lt;/b&gt;&lt;/label&gt; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTimeSpent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// show the current time spent (if any) ?&gt;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;label for=&quot;current_time_spent&quot;&gt;&lt;b&gt;Current Time Spent:&lt;/b&gt;&lt;/label&gt; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTimeSpent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' ('</span><span style="color: #339933;">.</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRealTimeSpent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')&lt;br /&gt;'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// show the current time spent (if any) ?&gt;</span></pre></div></div>

</li>
<li>
<strong>Updated on November 14, 2011</strong>: Open your <strong>/include/class.ticket.php</strong> file, and find this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">function</span> getTimeSpent<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;">formatTime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">timeSpent</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>before the first line of that code, please insert this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #000000; font-weight: bold;">function</span> getRealTimeSpent<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;">timeSpent</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

</li>
<li>
<strong>Updated on November 14, 2011</strong>: Still in the <strong>/include/class.ticket.php</strong> file, find again this code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET time_spent='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' WHERE ticket_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET time_spent=time_spent+'</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' WHERE ticket_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That SQL code above will sum up the existing time value with the new time value.
</li>
</ol>
<p>Enjoy the result, everyone! <img src='http://www.openscriptsolution.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </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%2F2011%2F08%2F31%2Fhow-to-implement-simple-time-spent-by-staff-on-ticket-in-osticket-1-6-st%2F&amp;title=How%20to%20Implement%20Simple%20Time%20Spent%20by%20Staff%20on%20Ticket%20in%20osTicket%201.6%20ST" id="wpa2a_10"><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/2011/08/31/how-to-implement-simple-time-spent-by-staff-on-ticket-in-osticket-1-6-st/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to Make Header Menu of osTicket Become Left-Align</title>
		<link>http://www.openscriptsolution.com/2010/08/16/how-to-make-header-menu-of-osticket-become-left-align/</link>
		<comments>http://www.openscriptsolution.com/2010/08/16/how-to-make-header-menu-of-osticket-become-left-align/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 10:07:36 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[left-align]]></category>
		<category><![CDATA[rata-kanan]]></category>
		<category><![CDATA[rata-kiri]]></category>
		<category><![CDATA[right-align]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1267</guid>
		<description><![CDATA[This following modification will make the header links menu of your osTicket become left-align. As we know, the menu in the menu header of osTicket which has three links with the right-align style. They are: &#8220;&#8221;Home, New Ticket, Ticket Status&#8221;. Now you can make those three links menu become left-align. I have successfully changed it [...]]]></description>
			<content:encoded><![CDATA[<p>This following modification will make the header links menu of your osTicket become left-align. As we know, the menu in the menu header of osTicket which has three links with the right-align style. They are: &#8220;&#8221;Home, New Ticket, Ticket Status&#8221;. Now you can make those three links menu become left-align. I have successfully changed it by modifying two files. They are: <strong>/styles/main.css</strong> and <strong>/include/client/header.inc.php</strong>. <span id="more-1267"></span></p>
<ol>
<li>
Open your <strong>/styles/main.css</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>111
112
113
114
115
116
117
118
119
120
121
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">#nav li a {
</span>      height<span style="color: #339933;">:</span>24px<span style="color: #339933;">;</span>
      line<span style="color: #339933;">-</span>height<span style="color: #339933;">:</span>24px<span style="color: #339933;">;</span>
      display<span style="color: #339933;">:</span>block<span style="color: #339933;">;</span>
      float<span style="color: #339933;">:</span>left<span style="color: #339933;">;</span>
      padding<span style="color: #339933;">-</span>left<span style="color: #339933;">:</span>25px<span style="color: #339933;">;</span>
      margin<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> 10px <span style="color: #cc66cc;">0</span> 10px<span style="color: #339933;">;</span>
      text<span style="color: #339933;">-</span>decoration<span style="color: #339933;">:</span>none<span style="color: #339933;">;</span>
      font<span style="color: #339933;">-</span>weight<span style="color: #339933;">:</span>bold<span style="color: #339933;">;</span>
      float<span style="color: #339933;">:</span>right<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</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>111
112
113
114
115
116
117
118
119
120
121
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">#nav li a {
</span>      height<span style="color: #339933;">:</span>24px<span style="color: #339933;">;</span>
      line<span style="color: #339933;">-</span>height<span style="color: #339933;">:</span>24px<span style="color: #339933;">;</span>
      display<span style="color: #339933;">:</span>block<span style="color: #339933;">;</span>
      float<span style="color: #339933;">:</span>left<span style="color: #339933;">;</span>
      padding<span style="color: #339933;">-</span>left<span style="color: #339933;">:</span>25px<span style="color: #339933;">;</span>
      margin<span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span> 10px <span style="color: #cc66cc;">0</span> 10px<span style="color: #339933;">;</span>
      text<span style="color: #339933;">-</span>decoration<span style="color: #339933;">:</span>none<span style="color: #339933;">;</span>
      font<span style="color: #339933;">-</span>weight<span style="color: #339933;">:</span>bold<span style="color: #339933;">;</span>
      float<span style="color: #339933;">:</span>left<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">     &lt;ul id=&quot;nav&quot;&gt;
         <span style="color: #000000; font-weight: bold;">&lt;?</span>
         <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisclient</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisclient</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$thisclient</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isValid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
         &lt;li&gt;&lt;a class=&quot;log_out&quot; href=&quot;logout.php&quot;&gt;Log Out&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a class=&quot;my_tickets&quot; href=&quot;tickets.php&quot;&gt;My Tickets&lt;/a&gt;&lt;/li&gt;
         <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
         &lt;li&gt;&lt;a class=&quot;ticket_status&quot; href=&quot;tickets.php&quot;&gt;Ticket Status&lt;/a&gt;&lt;/li&gt;
         <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
         &lt;li&gt;&lt;a class=&quot;new_ticket&quot; href=&quot;open.php&quot;&gt;New Ticket&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a class=&quot;home&quot; href=&quot;index.php&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;</pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">     &lt;ul id=&quot;nav&quot;&gt;
         &lt;li&gt;&lt;a class=&quot;home&quot; href=&quot;index.php&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a class=&quot;new_ticket&quot; href=&quot;open.php&quot;&gt;New Ticket&lt;/a&gt;&lt;/li&gt;
         <span style="color: #000000; font-weight: bold;">&lt;?</span>
         <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisclient</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisclient</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$thisclient</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isValid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
         &lt;li&gt;&lt;a class=&quot;my_tickets&quot; href=&quot;tickets.php&quot;&gt;My Tickets&lt;/a&gt;&lt;/li&gt;
         &lt;li&gt;&lt;a class=&quot;log_out&quot; href=&quot;logout.php&quot;&gt;Log Out&lt;/a&gt;&lt;/li&gt;
         <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
         &lt;li&gt;&lt;a class=&quot;ticket_status&quot; href=&quot;tickets.php&quot;&gt;Ticket Status&lt;/a&gt;&lt;/li&gt;
         <span style="color: #000000; font-weight: bold;">&lt;?</span><span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;/ul&gt;</pre></td></tr></table></div>

</li>
</ol>
<p>That&#8217;s all. Enjoy the code!</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%2F2010%2F08%2F16%2Fhow-to-make-header-menu-of-osticket-become-left-align%2F&amp;title=How%20to%20Make%20Header%20Menu%20of%20osTicket%20Become%20Left-Align" id="wpa2a_12"><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/2010/08/16/how-to-make-header-menu-of-osticket-become-left-align/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Set Auto Focus on The Username TextBox in Staff Login Form of osTicket</title>
		<link>http://www.openscriptsolution.com/2010/03/01/how-to-set-auto-focus-on-the-username-textbox-in-staff-login-form-of-osticket/</link>
		<comments>http://www.openscriptsolution.com/2010/03/01/how-to-set-auto-focus-on-the-username-textbox-in-staff-login-form-of-osticket/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 00:21:38 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[auto focus]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[staff-side]]></category>
		<category><![CDATA[textbox]]></category>
		<category><![CDATA[ticket]]></category>
		<category><![CDATA[username]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1151</guid>
		<description><![CDATA[Each time I open the staff login form in osTicket, I have to move the mouse&#8217;s cursor and then clicking my mouse to the first textbox on that form in order to make it focus then ready to enter the login information. Unfortunately, this condition is really annoying me, although it looks like not too [...]]]></description>
			<content:encoded><![CDATA[<p>Each time I open the staff login form in osTicket, I have to move the mouse&#8217;s cursor and then clicking my mouse to the first textbox on that form in order to make it focus then ready to enter the login information. Unfortunately, this condition is really annoying me, although it looks like not too difficult to do this activity. It should be automatically set focus by system each time staff visit the page. So I modify the login form in staff panel in order to set focus automatically each time staff visit that page. <span id="more-1151"></span></p>
<ol>
<li>
Open <strong>/include/staff/login.tpl.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>body id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;loginBody&quot;</span><span style="color: #339933;">&gt;</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>11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>body id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;loginBody&quot;</span> onload<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;document.frmLogin.username.focus()&quot;</span><span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">&lt;</span>form action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;login.php&quot;</span> method<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span><span style="color: #339933;">&gt;</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>16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">&lt;</span>form name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;frmLogin&quot;</span> action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;login.php&quot;</span> method<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span><span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

</li>
</ol>
<p>Now each time you open or visit the login form page in your osTicket system, then you do not have to move your mouse and click the username textbox. Enjoy it!</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%2F2010%2F03%2F01%2Fhow-to-set-auto-focus-on-the-username-textbox-in-staff-login-form-of-osticket%2F&amp;title=How%20to%20Set%20Auto%20Focus%20on%20The%20Username%20TextBox%20in%20Staff%20Login%20Form%20of%20osTicket" id="wpa2a_14"><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/2010/03/01/how-to-set-auto-focus-on-the-username-textbox-in-staff-login-form-of-osticket/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Auto Staff Time Sheet in Editing Ticket of osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2010/02/28/auto-staff-time-sheet-in-editing-ticket-of-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2010/02/28/auto-staff-time-sheet-in-editing-ticket-of-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 08:38:36 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[edit]]></category>
		<category><![CDATA[otomatis]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[ticket]]></category>
		<category><![CDATA[time sheet]]></category>
		<category><![CDATA[waktu kerja]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1146</guid>
		<description><![CDATA[This following modification is the continuation of another modification that I created in the article: Add Auto Staff Time Sheet Feature into osTicket v1.6 RC5. Since I received the feedback from osTicket Discussion Forum that informed me about the SQL error after editing a ticket by staff, then I found that the original one need [...]]]></description>
			<content:encoded><![CDATA[<p>This following modification is the continuation of another modification that I created in the article: <a href="http://www.openscriptsolution.com/2009/11/08/add-auto-staff-time-sheet-feature-into-osticket-v1-6-rc5/" target="_blank">Add Auto Staff Time Sheet Feature into osTicket v1.6 RC5</a>. Since I received <a href="http://www.osticket.com/forums/showthread.php?t=3619" target="_blank">the feedback from osTicket Discussion Forum</a> that informed me about the SQL error after editing a ticket by staff, then I found that the original one need to be improved. So, here is the additional modification that you should apply if you want to avoid SQL error after implementing the first modification while editing a ticket. Please note that if you want to implement the modification in this article, first of all, you have to implement the original modification via that link above. <span id="more-1146"></span></p>
<ol>
<li>Open your <strong>/include/staff/editticket.inc.php</strong> file, and find this code:

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>36
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">'hidden'</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">'a'</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">'update'</span><span style="color: #339933;">&gt;</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>37
38
39
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Begin of MOD Auto Staff Time Sheet, by Masino Sinaga, February 28, 2010 ?&gt;</span>
    <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hidden&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;start_time&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo date('Y-m-d H:i:s'); ?&gt;&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// End of MOD Auto Staff Time Sheet, by Masino Sinaga, February 28, 2010 ?&gt;</span></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>1183
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,&amp;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</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>1183
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,&amp;</span><span style="color: #000088;">$errors</span><span style="color: #339933;">,</span><span style="color: #000088;">$start_time</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  <span style="color: #666666; font-style: italic;">// MOD Auto Staff Time Sheet, by Masino Sinaga, February 28, 2010</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1249
</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;">postNote</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Ticket Edit'</span><span style="color: #339933;">,</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note'</span><span style="color: #009900;">&#93;</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>1249
</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;">postNote</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Ticket Edit'</span><span style="color: #339933;">,</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'true'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$start_time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// MOD Auto Staff Time Sheet, by Masino Sinaga, February 28, 2010</span></pre></td></tr></table></div>

</li>
<li>
Open your <strong>/scp/tickets.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>216
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #339933;">,</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</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>216
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #339933;">,</span><span style="color: #000088;">$errors</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'start_time'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// MOD Auto Staff Time Sheet, by Masino Sinaga, February 28, 2010</span></pre></td></tr></table></div>

</li>
</ol>
<p>Now you should not receive SQL error anymore after editing a ticket if you implement the Auto Staff Time Sheet modification that I created above. Have a nice code, everyone!</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%2F2010%2F02%2F28%2Fauto-staff-time-sheet-in-editing-ticket-of-osticket-v1-6-rc5%2F&amp;title=Auto%20Staff%20Time%20Sheet%20in%20Editing%20Ticket%20of%20osTicket%20v1.6%20RC5" id="wpa2a_16"><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/2010/02/28/auto-staff-time-sheet-in-editing-ticket-of-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Closed Ticket Alert for All Department Members in osTicket v1.6 ST (Stable)</title>
		<link>http://www.openscriptsolution.com/2010/02/27/closed-ticket-alert-for-all-department-members-in-osticket-v1-6-st-stable/</link>
		<comments>http://www.openscriptsolution.com/2010/02/27/closed-ticket-alert-for-all-department-members-in-osticket-v1-6-st-stable/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 11:23:46 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[alert]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[closed ticket]]></category>
		<category><![CDATA[customer]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[notify]]></category>
		<category><![CDATA[reply]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[ticket system]]></category>
		<category><![CDATA[v1.6 ST]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1123</guid>
		<description><![CDATA[It does make sense when a ticket is closed by your customer or client, then all department members will be automatically notified by your ticketing system via email. I made the modification to implement this requirement into osTicket v1.6 ST (Stable), including the related setting in order to enable or disable this feature, just in [...]]]></description>
			<content:encoded><![CDATA[<p>It does make sense when a ticket is closed by your customer or client, then all department members will be automatically notified by your ticketing system via email. I made the modification to implement this requirement into osTicket v1.6 ST (Stable), including the related setting in order to enable or disable this feature, just in case whether this feature is necessary to be implemented, and sometimes it is not. Besides that, you will be able to define the email template for the notification that sent to your customer via Admin Panel. This modification also will answer <a href="http://www.osticket.com/forums/showthread.php?t=3602" target="_blank">the related question in osTicket Discussion Forum</a>. <span id="more-1123"></span></p>
<ol>
<li>
First of all, you have to alter your <strong>ost_config</strong> table by adding four additional new fields into it, simply by executing this following SQL script into your osTicket database. Please note that in this example, I use <strong>ost_</strong> as the table prefix. Adjust it in case it differs with yours:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">ALTER TABLE ost_config 
ADD COLUMN `closed_alert_active` tinyint(1) default 0 NOT NULL,
ADD COLUMN `closed_alert_assigned` tinyint(1) default 0 NOT NULL,
ADD COLUMN `closed_alert_dept_manager` tinyint(1) default 0 NOT NULL,
ADD COLUMN `closed_alert_dept_members` tinyint(1) default 0 NOT NULL;</pre></div></div>

</li>
<li>
You also have to alter the <strong>ost_email_template</strong> by adding two new fields in order to create new email template for closing alert ticket. Simply run this following SQL script to your osTicket database as well as the first step above:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">ALTER TABLE ost_email_template 
ADD COLUMN `ticket_closed_subj` varchar(255) default '' NOT NULL,
ADD COLUMN `ticket_closed_body` text NOT NULL;</pre></div></div>

</li>
<li>Open your <strong>/include/staff/preference.inc.php</strong> file, and find this code:

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>478
479
480
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;input type=&quot;checkbox&quot; name=&quot;overdue_alert_dept_members&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'overdue_alert_dept_members'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt; Department Members (spammy)
            &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>482
483
484
485
486
487
488
489
490
491
492
493
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010 ?&gt;</span>
        <span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;&lt;</span>th valign<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;top&quot;</span><span style="color: #339933;">&gt;</span>Closed Ticket Alert<span style="color: #339933;">:&lt;/</span>th<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>
              <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;closed_alert_active&quot;</span>  value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span>   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_active'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Enable
              &lt;input type=&quot;radio&quot; name=&quot;closed_alert_active&quot;  value=&quot;0&quot;   <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #339933;">!</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_active'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span> /&gt;Disable
              &lt;br&gt;&lt;i&gt;Admin Email gets an alert by default. Select additional recipients below&lt;/i&gt;&amp;nbsp;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_active'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;&lt;br&gt;
              &lt;input type=&quot;checkbox&quot; name=&quot;closed_alert_assigned&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_assigned'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt; Assigned Staff
              &lt;input type=&quot;checkbox&quot; name=&quot;closed_alert_dept_manager&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_dept_manager'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt; Department Manager
              &lt;input type=&quot;checkbox&quot; name=&quot;closed_alert_dept_members&quot; <span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_dept_members'</span><span style="color: #009900;">&#93;</span>?<span style="color: #0000ff;">'checked'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt; Department Members (spammy)
            &lt;/td&gt;
        &lt;/tr&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010 ?&gt;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>376
377
378
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> alertDeptMembersONOverdueTicket<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;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'overdue_alert_dept_members'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</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>380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span>
    <span style="color: #000000; font-weight: bold;">function</span> alertONClosedTicket<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;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_active'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> alertAssignedONClosedTicket<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;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_assigned'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> alertDeptManagerONClosedTicket<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;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_dept_manager'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> alertDeptMembersONClosedTicket<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;">config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_dept_members'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>511
512
513
514
515
516
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note_alert_active'</span><span style="color: #009900;">&#93;</span>
                <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note_alert_laststaff'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note_alert_assigned'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note_alert_dept_manager'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note_alert_active'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'No target recipient(s) selected'</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>518
519
520
521
522
523
524
525
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_active'</span><span style="color: #009900;">&#93;</span>
                <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_assigned'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_dept_manager'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_dept_members'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_active'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'No target recipient(s) selected'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>599
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #0000ff;">',overdue_alert_dept_members='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'overdue_alert_dept_members'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>599
600
601
602
603
604
605
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #0000ff;">',overdue_alert_dept_members='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'overdue_alert_dept_members'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010            </span>
            <span style="color: #0000ff;">',closed_alert_active='</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;">'closed_alert_active'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>            
			<span style="color: #0000ff;">',closed_alert_assigned='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_assigned'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
            <span style="color: #0000ff;">',closed_alert_dept_manager='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_dept_manager'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
            <span style="color: #0000ff;">',closed_alert_dept_members='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'closed_alert_dept_members'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #cc66cc;">1</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>385
386
387
388
389
390
391
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">//Close the ticket</span>
    <span style="color: #000000; font-weight: bold;">function</span> close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET status='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'closed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">',staff_id=0,isoverdue=0,duedate=NULL,updated=NOW(),closed=NOW() '</span><span style="color: #339933;">.</span>
              <span style="color: #0000ff;">' WHERE ticket_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> db_affected_rows<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</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>385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">//Close the ticket</span>
    <span style="color: #000000; font-weight: bold;">function</span> close<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET status='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'closed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">',staff_id=0,isoverdue=0,duedate=NULL,updated=NOW(),closed=NOW() '</span><span style="color: #339933;">.</span>
              <span style="color: #0000ff;">' WHERE ticket_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//return (db_query($sql) &amp;&amp; db_affected_rows())?true:false;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010 NOT FINISHED YET        </span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> db_affected_rows<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">//echo $sql;</span>
            <span style="color: #000088;">$dept</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDept</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$dept</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tplId</span><span style="color: #339933;">=</span><span style="color: #000088;">$dept</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTemplateId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$tplId</span><span style="color: #339933;">=</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDefaultTemplateId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">//if requested &amp;&amp; enabled fire nasty alerts.</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">alertONClosedTicket</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT ticket_closed_subj,ticket_closed_body FROM '</span><span style="color: #339933;">.</span>EMAIL_TEMPLATE_TABLE<span style="color: #339933;">.</span>
                     <span style="color: #0000ff;">' WHERE cfg_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' AND tpl_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$tplId</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resp</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$resp</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$subj</span><span style="color: #339933;">,</span><span style="color: #000088;">$body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span>db_fetch_row<span style="color: #009900;">&#40;</span><span style="color: #000088;">$resp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
                    <span style="color: #000088;">$body</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replaceTemplateVars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000088;">$subj</span><span style="color: #339933;">=</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">replaceTemplateVars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$subj</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #339933;">=</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAlertEmail</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                        <span style="color: #000088;">$email</span><span style="color: #339933;">=</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDefaultEmail</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #666666; font-style: italic;">//Fire and email to admin. No questions asked.</span>
                        <span style="color: #000088;">$alert</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%s</span>taff&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Admin'</span><span style="color: #339933;">,</span><span style="color: #000088;">$body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000088;">$email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAdminEmail</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$subj</span><span style="color: #339933;">,</span><span style="color: #000088;">$alert</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #666666; font-style: italic;">/*** Build list of recipients and fire the alerts ***/</span>
                        <span style="color: #000088;">$recipients</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #666666; font-style: italic;">//Assigned staff... if any</span>
                        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAssigned</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">alertAssignedONClosedTicket</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                            <span style="color: #000088;">$recipients</span><span style="color: #009900;">&#91;</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;">getStaff</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: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">alertDeptMembersONClosedTicket</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//Alert assigned or dept members not both</span>
                            <span style="color: #666666; font-style: italic;">//All dept members.</span>
                            <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT staff_id FROM '</span><span style="color: #339933;">.</span>STAFF_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' WHERE dept_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dept</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$users</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$users</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">=</span>db_fetch_row<span style="color: #009900;">&#40;</span><span style="color: #000088;">$users</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                                    <span style="color: #000088;">$recipients</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Staff<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>     <span style="color: #666666; font-style: italic;">//possible mem issues with a large number of staff?</span>
                            <span style="color: #009900;">&#125;</span>
                        <span style="color: #009900;">&#125;</span>
                        <span style="color: #666666; font-style: italic;">//Always blame the manager</span>
                        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">alertDeptManagerONClosedTicket</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$dept</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            <span style="color: #000088;">$recipients</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$dept</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getManager</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;">//Ok...we are ready to go....</span>
                        <span style="color: #000088;">$sentlist</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$recipients</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$staff</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$staff</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_object</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$staff</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #000088;">$staff</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isAvailable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span>
                            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$staff</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEmail</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$sentlist</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">continue</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//avoid duplicate emails.</span>
                            <span style="color: #000088;">$alert</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%s</span>taff&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$staff</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getFirstName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                            <span style="color: #000088;">$email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$staff</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getEmail</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #000088;">$subj</span><span style="color: #339933;">,</span><span style="color: #000088;">$alert</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                    Sys<span style="color: #339933;">::</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span>LOG_WARNING<span style="color: #339933;">,</span><span style="color: #0000ff;">'Template Fetch Error'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;Unable to fetch 'closed' alert template #<span style="color: #006699; font-weight: bold;">$tplId</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010 NOT FINISHED YET</span>
&nbsp;
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</li>
<li>
Open your <strong>/include/staff/template.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>173
174
175
176
177
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            &lt;tr&gt;
                &lt;th&gt;Message Body:&lt;/th&gt;
                &lt;td&gt;&lt;textarea rows=&quot;7&quot; cols=&quot;75&quot; name=&quot;ticket_overdue_body&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_overdue_body'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;
                    &amp;nbsp;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_overdue_body'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;&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>179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010 ?&gt;</span>
            <span style="color: #339933;">&lt;</span>tr <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;header&quot;</span><span style="color: #339933;">&gt;&lt;</span>td colspan<span style="color: #339933;">=</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">&gt;</span>Closed Ticket Alert<span style="color: #339933;">/</span>Notice<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;&lt;/</span>tr<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>tr <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;subheader&quot;</span><span style="color: #339933;">&gt;&lt;</span>td colspan<span style="color: #339933;">=</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">&gt;</span>Alert sent to staff on closed tickets<span style="color: #339933;">.&lt;/</span>td<span style="color: #339933;">&gt;&lt;/</span>tr<span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>tr<span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>th<span style="color: #339933;">&gt;</span>Subject<span style="color: #339933;">&lt;/</span>th<span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span>
                    <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> size<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;65&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;ticket_closed_subj&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?=<span style="color: #006699; font-weight: bold;">$tpl</span>['ticket_closed_subj']?&gt;&quot;</span><span style="color: #339933;">&gt;</span>
                            <span style="color: #339933;">&amp;</span>nbsp<span style="color: #339933;">;&lt;</span>font <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;error&quot;</span><span style="color: #339933;">&gt;&amp;</span>nbsp<span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_closed_subj'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;th&gt;Message Body:&lt;/th&gt;
                &lt;td&gt;&lt;textarea rows=&quot;7&quot; cols=&quot;75&quot; name=&quot;ticket_closed_body&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$tpl</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_closed_body'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;
                    &amp;nbsp;&lt;font class=&quot;error&quot;&gt;&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_closed_body'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;&lt;/td&gt;
            &lt;/tr&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010 ?&gt;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>104
105
</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;">'ticket_overdue_subj'</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;">'string'</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;">'Subject 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;">'ticket_overdue_body'</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;">'string'</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;">'Template message required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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>107
108
109
110
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010        </span>
        <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_closed_subj'</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;">'string'</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;">'Subject 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;">'ticket_closed_body'</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;">'string'</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;">'Template message required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>143
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',ticket_overdue_body='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_overdue_body'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</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>143
144
145
146
147
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',ticket_overdue_body='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_overdue_body'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span>
                 <span style="color: #0000ff;">',ticket_closed_subj='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_closed_subj'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
                 <span style="color: #0000ff;">',ticket_closed_body='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_closed_body'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>213
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',ticket_overdue_body='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_overdue_body'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</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>213
214
215
216
217
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',ticket_overdue_body='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_overdue_body'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span>
                 <span style="color: #0000ff;">',ticket_closed_subj='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_closed_subj'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
                 <span style="color: #0000ff;">',ticket_closed_body='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">striptags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_closed_body'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
<span style="color: #666666; font-style: italic;">// Closed Ticket Alert for Department Members, modified by Masino Sinaga, February 27, 2010</span></pre></td></tr></table></div>

</li>
</ol>
<p>That&#8217;s all for the modification! <img src='http://www.openscriptsolution.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>After you completed doing that modification, now you HAVE TO define the email template that will be sent to the staff when a ticket is closed. You can set it up via: <strong>Admin Panel -> Emails -> Templates</strong>, and then fill in the <strong>Closed Ticket Alert:</strong> directive.</p>
<p>For instance, in the <strong>Subject:</strong> directive, please fill ini with this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Closed Ticket Alert</pre></div></div>

<p>and in the <strong>Body:</strong> directive, fill in with this template:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">A ticket, #%ticket assigned to you or in your department has been closed.
&nbsp;
%url/scp/tickets.php?id=%id
&nbsp;
Thank you for your kindly cooperation so far.
&nbsp;
- Support Ticket System - powered by osTicket.</pre></div></div>

<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2010%2F02%2F27%2Fclosed-ticket-alert-for-all-department-members-in-osticket-v1-6-st-stable%2F&amp;title=Closed%20Ticket%20Alert%20for%20All%20Department%20Members%20in%20osTicket%20v1.6%20ST%20%28Stable%29" id="wpa2a_18"><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/2010/02/27/closed-ticket-alert-for-all-department-members-in-osticket-v1-6-st-stable/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Add Attachment on Internal Note in osTicket v1.6 ST (Stable)</title>
		<link>http://www.openscriptsolution.com/2010/02/26/add-attachment-on-internal-note-in-osticket-v1-6-st-stable/</link>
		<comments>http://www.openscriptsolution.com/2010/02/26/add-attachment-on-internal-note-in-osticket-v1-6-st-stable/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 14:03:56 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[attachment]]></category>
		<category><![CDATA[catatan internal]]></category>
		<category><![CDATA[Internal Note]]></category>
		<category><![CDATA[lampiran]]></category>
		<category><![CDATA[reply]]></category>
		<category><![CDATA[staff-side]]></category>
		<category><![CDATA[ticket system]]></category>
		<category><![CDATA[v1.6 ST]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1116</guid>
		<description><![CDATA[Since there are a little bit differences code in /scp/tickets.php file between osTicket v1.6 RC5 and osTicket v1.6 ST (Stable; the last version while I am writing this article), and also there is a new request to me from this post in osTicket Discussion Forums, then this following modification I made to be intended to [...]]]></description>
			<content:encoded><![CDATA[<p>Since there are a little bit differences code in <strong>/scp/tickets.php</strong> file between osTicket v1.6 RC5 and osTicket v1.6 ST (Stable; the last version while I am writing this article), and also there is a new request to me from <a href="http://www.osticket.com/forums/showthread.php?p=13513#post13513" target="_blank">this post in osTicket Discussion Forums</a>, then this following modification I made to be intended to those of you who want to implement the Attachment on Internal Note in osTicket v1.6 ST. <span id="more-1116"></span></p>
<ol>
<li>
First of all, alter the <strong>ticket_attachment</strong> table by adding a new enum value, that is: “<strong>N</strong>” into <strong>ref_type</strong> field, besides the existing value: <strong>M</strong> and <strong>R</strong>. The <strong>N</strong> value means: <strong>Note</strong> or <strong>Internal Note</strong> in this case. And make sure you don’t miss this step!
</li>
<li>
Open <strong>\include\staff\viewticket.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>219
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            &lt;tr&gt;&lt;td&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span>Format<span style="color: #339933;">::</span><span style="color: #004000;">display</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note'</span><span style="color: #009900;">&#93;</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 above, please add this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>220
221
222
223
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// added by Masino Sinaga, Februari 26, 2010, attachment on Internal Notes osTicket v1.6 ST ?&gt;</span>
            <span style="color: #339933;">&lt;</span>tr <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;header&quot;</span><span style="color: #339933;">&gt;</span>
              <span style="color: #339933;">&lt;</span>td<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getAttachmentStr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'N'</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>
<li>
Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>363
364
365
366
367
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                        &lt;div style=&quot;margin-top: 3px;&quot;&gt;
                            &lt;label for=&quot;note&quot; valign=&quot;top&quot;&gt;Enter note content.
                                &lt;font class=&quot;error&quot;&gt;*&amp;nbsp;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;&lt;/label&gt;&lt;br/&gt;
                            &lt;textarea name=&quot;note&quot; id=&quot;note&quot; cols=&quot;80&quot; rows=&quot;7&quot; wrap=&quot;soft&quot; style=&quot;width:90%&quot;&gt;<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;">'note'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;
                        &lt;/div&gt;</pre></td></tr></table></div>

<p>after the last line of the code above, please add this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>368
369
370
371
372
373
374
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                        <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canUploadFiles</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//TODO: may be allow anyways and simply email out attachment?? ?&gt;</span>
                        <span style="color: #339933;">&lt;</span>div style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;margin-top: 3px;&quot;</span><span style="color: #339933;">&gt;</span>
                            <span style="color: #339933;">&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment&quot;</span> <span style="color: #339933;">&gt;</span>Attach <span style="color: #990000;">File</span><span style="color: #339933;">:&lt;/</span>label<span style="color: #339933;">&gt;</span>
                            <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;file&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment2&quot;</span> size<span style="color: #339933;">=</span>30px value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo <span style="color: #006699; font-weight: bold;">$info</span>['attachment']; ?&gt;&quot;</span> <span style="color: #339933;">/&gt;</span> 
                                <span style="color: #339933;">&lt;</span>font <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;error&quot;</span><span style="color: #339933;">&gt;&amp;</span>nbsp<span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;
                        &lt;/div&gt;
                        <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

</li>
<li>
Open <strong>\scp\tickets.php</strong> file and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'postnote'</span><span style="color: #339933;">:</span>
            <span style="color: #000088;">$fields</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</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;">'title'</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;">'string'</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;">'Title 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;">'note'</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;">'string'</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;">'Note message required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Validator<span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$errors</span><span style="color: #339933;">=</span><span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #339933;">,</span><span style="color: #000088;">$params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errors</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">postNote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Internal note posted'</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStatus</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">reload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$msg</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">' and status set to '</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isClosed</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'closed'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'open'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isClosed</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                            <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Going back to main listing.</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Error(s) occured. Unable to post the note.'</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">break</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>173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'postnote'</span><span style="color: #339933;">:</span>
            <span style="color: #000088;">$fields</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</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;">'title'</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;">'string'</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;">'Title 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;">'note'</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;">'string'</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;">'Note message required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Validator<span style="color: #009900;">&#40;</span><span style="color: #000088;">$fields</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">validate</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$errors</span><span style="color: #339933;">=</span><span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #339933;">,</span><span style="color: #000088;">$params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errors</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Added by Masino Sinaga, February 26, 2010 for attachment on Internal Notes</span>
            <span style="color: #666666; font-style: italic;">//Check attachments restrictions.  </span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'size'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Invalid attachment'</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canUploadFiles</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//TODO: saved vs emailed attachments...admin config??</span>
                    <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'upload dir invalid. Contact admin.'</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canUploadFileType</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                    <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Invalid file type'</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// Added by Masino Sinaga, February 26, 2010 attachment on Internal Notes</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$noteID</span><span style="color: #339933;">=</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">postNote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'note'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'alert_assigned'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  
                <span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Internal note posted'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setStatus</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ticket_status'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">reload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$msg</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">' and status set to '</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isClosed</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'closed'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'open'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isClosed</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
                            <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Going back to main listing.</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span> 
                <span style="color: #666666; font-style: italic;">// Added by Masino Sinaga, February 26, 2010, attachment on Internal Notes</span>
                <span style="color: #666666; font-style: italic;">//Finally upload attachment if any</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'size'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uploadAttachment</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'attachment'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$noteID</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'N'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span>?<span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'Error(s) occured. Unable to post the note.'</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</li>
</ol>
<p>That&#8217;s all. I have tested it, and everything seemed okay. Have a nice code!</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%2F2010%2F02%2F26%2Fadd-attachment-on-internal-note-in-osticket-v1-6-st-stable%2F&amp;title=Add%20Attachment%20on%20Internal%20Note%20in%20osTicket%20v1.6%20ST%20%28Stable%29" id="wpa2a_20"><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/2010/02/26/add-attachment-on-internal-note-in-osticket-v1-6-st-stable/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
