<?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; staff</title>
	<atom:link href="http://www.openscriptsolution.com/tag/staff/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>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_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/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>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_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/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_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/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>Giving Permission to Specified Staff to Add New Staff Based on Current Department in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/12/08/giving-permission-to-specified-staff-to-add-new-staff-based-on-current-department-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/12/08/giving-permission-to-specified-staff-to-add-new-staff-based-on-current-department-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 14:30:33 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[staff-side]]></category>
		<category><![CDATA[ticket]]></category>
		<category><![CDATA[user groups]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=976</guid>
		<description><![CDATA[This article will show you how to modify your osTicket System in order to give the ability for the certain staff to add new staff record based on his/her department. As we know, only staff which has Admin account type can do this, since there are only two account type in osTicket up to v1.6 [...]]]></description>
			<content:encoded><![CDATA[<p>This article will show you how to modify your osTicket System in order to give the ability for the certain staff to add new staff record based on his/her department. As we know, only staff which has Admin account type can do this, since there are only two account type in osTicket up to v1.6 RC5; they are: <strong>Staff</strong> and <strong>Admin</strong>. If you set the certain staff&#8217;s account type which has <strong>Managers</strong> user-group become <strong>Admin</strong> account type (in order to give him/her the ability to add his/her new staff from Admin Panel), then they will be able to access all features that located on Admin Panel. So, instead of to give full access for that Manager, then we should create the new permission in user group basis, afterwards, we assign <strong>Yes</strong> to the <strong>Managers</strong> user group, so they will be able to add their own new staff without having to access Admin Panel. There will be a new tab in Staff Panel named <strong>My Staff</strong>. This new tab will have two new sub-tabs, they are: <strong>My Staff Members</strong> and <strong>Add My New Staff</strong> in order to make it different with the Staff tab at Admin Panel. <span id="more-976"></span></p>
<ol>
<li>
First of all, you have to alter your <strong>ost_groups</strong> table by using this following SQL query. Please note that <strong>ost_</strong> is the table prefix name. If it differs with yours, then adjust it by yourself.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">ALTER TABLE ost_groups 
ADD COLUMN `can_manage_staff` tinyint(1) default 0 NOT NULL;</pre></div></div>

</li>
<li>
Download this file: <a href="http://www.openscriptsolution.com/wp-content/uploads/2009/12/my_dept_staff.zip"><strong>my_dept_staff.zip</strong></a>. Extract it, there are two files inside, afterwards, put those two files to your <strong>\include\staff\</strong> sub directory of your osTicket.
</li>
<li>
Open your <strong>\include\staff\group.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>99
100
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;/</span>table<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>99
100
101
102
103
104
105
106
107
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        &lt;/tr&gt;
        &lt;tr&gt;&lt;th&gt;Can Manage Staff&lt;/th&gt; &lt;!-- added by Masino Sinaga, December 8, 2009 --&gt;
            &lt;td&gt;
                &lt;input type=&quot;radio&quot; name=&quot;can_manage_staff&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_manage_staff'</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_manage_staff&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_manage_staff'</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 add/update/disable/delete staff of your current department.&lt;/i&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;</pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>227
228
229
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> canManageKb<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//kb = knowledge base.</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_manage_kb'</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></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>230
231
232
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> canManageStaff<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// added by Masino Sinaga, December 8, 2009</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_manage_staff'</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></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>39
40
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">             <span style="color: #000088;">$tabs</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'kbase'</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;">'desc'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Knowledge Base'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'href'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'kb.php'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Knowledge Base: Premade'</span><span style="color: #009900;">&#41;</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>41
42
43
</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;">$thisuser</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canManageStaff</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;">$tabs</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'staffdept'</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;">'desc'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'My Staff'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'href'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'mystaff.php'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Staff'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>59
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">', can_manage_kb='</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_manage_kb'</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 it with this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>59
60
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">', can_manage_kb='</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_manage_kb'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
		 <span style="color: #0000ff;">', can_manage_staff='</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_manage_staff'</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;">// added by Masino Sinaga, December 8, 2009</span></pre></td></tr></table></div>

</li>
<li>
Create a new php file named <strong>mystaff.php</strong>, then put this file to your \scp\ sub directory after you copy, paste, and save this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</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;">/*********************************************************************
    mystaff.php
&nbsp;
    Staff Base handle
    Based on the kb.php file  
    Original code by: Peter Rotich &lt;peter@osticket.com&gt;
    Modified code by: Masino Sinaga, http://www.openscriptsolution.com
    Copyright (c)  2006,2007,2008,2009 osTicket
    http://www.osticket.com
&nbsp;
    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.
&nbsp;
    vim: expandtab sw=4 ts=4 sts=4:
    $Id: $
**********************************************************************/</span>
&nbsp;
<span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'staff.inc.php'</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;">$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;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canManageStaff</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Staff Access Page Denied'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// modified by Masino Sinaga, Dec 8, 2009) die('Access denied');</span>
&nbsp;
<span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</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;">$page</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'add'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$replyID</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'staffdept.inc.php'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$inc</span><span style="color: #339933;">=</span><span style="color: #000088;">$page</span>?<span style="color: #000088;">$page</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'staffdeptmembers.inc.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$nav</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTabActive</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'staffdept'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$nav</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addSubMenu</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desc'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'My Staff Members'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'href'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'mystaff.php'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iconclass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'users'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$nav</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addSubMenu</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desc'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Add My New Staff'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'href'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'mystaff.php?a=add'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iconclass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'newuser'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>STAFFINC_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">'header.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>STAFFINC_DIR<span style="color: #339933;">.</span><span style="color: #000088;">$inc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>STAFFINC_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">'footer.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>19
</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: #339933;">!</span><span style="color: #000088;">$thisuser</span> or <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: #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"><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: #339933;">!</span><span style="color: #000088;">$thisuser</span> and <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> and <span style="color: #339933;">!</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canManageStaff</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;">// modified by Masino Sinaga, December 8, 2009</span></pre></div></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>452
453
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'dept'</span><span style="color: #339933;">:</span>
        <span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span>INCLUDE_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">'class.dept.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'staffdept'</span><span style="color: #339933;">:</span>  <span style="color: #666666; font-style: italic;">// added by Masino Sinaga, MOD Create My Staff Under My Dept (for Managers), added by Masino Sinaga, December 8, 2009</span>
        <span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span>INCLUDE_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">'class.staff.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$do</span><span style="color: #339933;">=</span><span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'do'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$do</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'update'</span><span style="color: #339933;">:</span>
                <span style="color: #000088;">$staff</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;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'staff_id'</span><span style="color: #009900;">&#93;</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;">$staff</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$staff</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: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$staff</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: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Staff profile updated successfully'</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;">$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: #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 updating the user'</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;">$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;">'Internal error'</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'create'</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;">$uID</span><span style="color: #339933;">=</span>Staff<span style="color: #339933;">::</span><span style="color: #004000;">create</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;">&#41;</span>
                    <span style="color: #000088;">$msg</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;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'firstname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lastname'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' added successfully'</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;">$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: #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;">'Unable to add the user. Internal error'</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mass_process'</span><span style="color: #339933;">:</span>
                <span style="color: #666666; font-style: italic;">//ok..at this point..look WMA.</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uids'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uids'</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;">$ids</span><span style="color: #339933;">=</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uids'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000088;">$selected</span><span style="color: #339933;">=</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uids'</span><span style="color: #009900;">&#93;</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: #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;">'enable'</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;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>STAFF_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET isactive=1,updated=NOW() WHERE isactive=0 AND staff_id IN('</span><span style="color: #339933;">.</span><span style="color: #000088;">$ids</span><span style="color: #339933;">.</span><span style="color: #0000ff;">')'</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: #000088;">$msg</span><span style="color: #339933;">=</span>db_affected_rows<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; of  <span style="color: #006699; font-weight: bold;">$selected</span> selected users enabled&quot;</span><span style="color: #339933;">;</span>
&nbsp;
                    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</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;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uids'</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;">//sucker...watch what you are doing...why don't you just DROP the DB?</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;">'You can not lock or delete yourself!'</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: #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;">'disable'</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;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>STAFF_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET isactive=0, updated=NOW() '</span><span style="color: #339933;">.</span>
                            <span style="color: #0000ff;">' WHERE isactive=1 AND staff_id IN('</span><span style="color: #339933;">.</span><span style="color: #000088;">$ids</span><span style="color: #339933;">.</span><span style="color: #0000ff;">') AND staff_id!='</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>
                        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: #000088;">$msg</span><span style="color: #339933;">=</span>db_affected_rows<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; of  <span style="color: #006699; font-weight: bold;">$selected</span> selected users locked&quot;</span><span style="color: #339933;">;</span>
                        <span style="color: #666666; font-style: italic;">//Release tickets assigned to the user?? NO? could be a temp thing </span>
                        <span style="color: #666666; font-style: italic;">// May be auto-release if not logged in for X days? </span>
                    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</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;">'delete'</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>
                        db_query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'DELETE FROM '</span><span style="color: #339933;">.</span>STAFF_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' WHERE staff_id IN('</span><span style="color: #339933;">.</span><span style="color: #000088;">$ids</span><span style="color: #339933;">.</span><span style="color: #0000ff;">') AND staff_id!='</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: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000088;">$msg</span><span style="color: #339933;">=</span>db_affected_rows<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; of  <span style="color: #006699; font-weight: bold;">$selected</span> selected users deleted&quot;</span><span style="color: #339933;">;</span>
                        <span style="color: #666666; font-style: italic;">//Demote the user </span>
                        db_query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>DEPT_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET manager_id=0 WHERE manager_id IN('</span><span style="color: #339933;">.</span><span style="color: #000088;">$ids</span><span style="color: #339933;">.</span><span style="color: #0000ff;">') '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        db_query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UPDATE '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' SET staff_id=0 WHERE staff_id IN('</span><span style="color: #339933;">.</span><span style="color: #000088;">$ids</span><span style="color: #339933;">.</span><span style="color: #0000ff;">') '</span><span style="color: #009900;">&#41;</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;">$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;">'Uknown command!'</span><span style="color: #339933;">;</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>
                    <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;">'No users selected.'</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">default</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: #339933;">=</span><span style="color: #0000ff;">'Uknown command!'</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>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>738
739
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">//Departments</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'dept'</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">//lazy</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'staffdept'</span><span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// added by Masino Sinaga, MOD Create Staff Under My Dept (for Managers), added by Masino Sinaga, December 8, 2009</span>
        <span style="color: #000088;">$group</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;">//Tab and Nav options.</span>
        <span style="color: #000088;">$nav</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setTabActive</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'staffdept'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$nav</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addSubMenu</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desc'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'My Staff Members'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'href'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'admin.php?t=staffdept'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iconclass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'users'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$nav</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addSubMenu</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desc'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Add My New Staff'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'href'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'admin.php?t=staffdept&amp;a=new'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iconclass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'newuser'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thistab</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'staffdept'</span><span style="color: #339933;">:</span>
                <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'staffdeptmembers.inc.php'</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;">$id</span><span style="color: #339933;">=</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span>?<span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</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;">'staff_id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_numeric</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$staff</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: #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: #000088;">$staff</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;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$staff</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</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: #339933;">=</span><span style="color: #0000ff;">'Unable to fetch info on rep ID#'</span><span style="color: #339933;">.</span><span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$staff</span> or <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">'new'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$uID</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'staffdept.inc.php'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'staffdeptmembers.inc.php'</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
                <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'staffdeptmembers.inc.php'</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>After you applied all of the modification code, go to your <strong>Admin Panel</strong> -> <strong>Staff</strong> -> <strong>User Groups</strong>, then click on the <strong>Managers</strong> item, then choose <strong>Yes</strong> at the <strong>Can Manage Staff</strong> directive, and click on the <strong>Submit</strong> button to save the changes. </p>
<p>Then create a new staff, assign that staff with <strong>Managers</strong> user group, and make sure you choose <strong>Staff</strong> as the account type, afterwards, login by using that staff account, so now you should see a new tab in Staff Panel named <strong>My Staff</strong>. You can test it by adding some new staff records, and now you can see that there is only one department option (based on the current logged-in staff&#8217;s department) at the <strong>Department</strong> directive, and there is only one option for the <strong>User Group</strong> directive; it is <strong>Staff</strong>. </p>
<p>The conclusion for this MOD is: this My Staff tab is very useful if you want to give the ability for the certain staff which has the Staff account type to create a new staff without having to access the Panel Admin (of course, since that account type of that staff is not admin).</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F12%2F08%2Fgiving-permission-to-specified-staff-to-add-new-staff-based-on-current-department-in-osticket-v1-6-rc5%2F&amp;title=Giving%20Permission%20to%20Specified%20Staff%20to%20Add%20New%20Staff%20Based%20on%20Current%20Department%20in%20osTicket%20v1.6%20RC5" 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/2009/12/08/giving-permission-to-specified-staff-to-add-new-staff-based-on-current-department-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Time Spent at the Bottom of Each Staff&#8217;s Page of osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/12/05/add-time-spent-at-the-bottom-of-each-staffs-page-of-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/12/05/add-time-spent-at-the-bottom-of-each-staffs-page-of-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 01:23:56 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[panel]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[staff-side]]></category>
		<category><![CDATA[ticket]]></category>
		<category><![CDATA[time spent]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=962</guid>
		<description><![CDATA[For those of you who have implemented the modification I made about: Add Auto Staff Time Sheet Feature into osTicket v1.6 RC5, then this following modification is for you. It has the relationship with that modification above. After you implemented the previous one, and then if you wanted to display the time spent of each [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who have implemented the modification I made about: <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>, then this following modification is for you. It has the relationship with that modification above. After you implemented the previous one, and then if you wanted to display the time spent of each your staff at the bottom of staff&#8217;s page, simply access from Admin Panel -> Staff -> Staff Members, then click one of the records on the list. This modification will add some information that useful to know, especially for admin or manager. They are: Total time spent on tickets, Average time spent per ticket, Time spent within the last 14 days, Time spent within the last 7 days, Time spent on yesterday, and then Time spent on today. <span id="more-962"></span></p>
<p>Open your <strong>\include\staff\staff.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>147
148
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #339933;">&lt;/</span>tr<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;/</span>table<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>147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        &lt;/tr&gt;
&nbsp;
        <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;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">'new'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        &lt;tr class=&quot;header&quot;&gt;&lt;td colspan=2&gt;Employee Rating&lt;/td&gt;&lt;/tr&gt;
        &lt;tr class=&quot;subheader&quot;&gt;&lt;td colspan=2&gt;
            Time Spent on tickets&lt;/b&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;th&gt;Total&lt;/th&gt;
            &lt;td class=&quot;mainTableAlt&quot;&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
            <span style="color: #000088;">$sql1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                     FROM '</span><span style="color: #339933;">.</span>TICKET_RESPONSE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</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;">$sql2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                     FROM '</span><span style="color: #339933;">.</span>TICKET_NOTE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</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;">$res1</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$res2</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$row1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$row2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$total_time</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
            <span style="color: #000088;">$total_tick</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$total_time_format</span> <span style="color: #339933;">=</span> Ticket<span style="color: #339933;">::</span><span style="color: #004000;">formatStaffTimeSheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$total_time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>              
            <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$total_time_format</span><span style="color: #339933;">;</span>            
            <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;th&gt;Average Time per Ticket&lt;/th&gt;
            &lt;td class=&quot;mainTableAlt&quot;&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span>
            <span style="color: #000088;">$avg_time_per_ticket</span> <span style="color: #339933;">=</span> <span style="color: #990000;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$total_time</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$total_tick</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$avg_time_per_ticket_format</span> <span style="color: #339933;">=</span> Ticket<span style="color: #339933;">::</span><span style="color: #004000;">formatStaffTimeSheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$avg_time_per_ticket</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$avg_time_per_ticket_format</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;/td&gt;
        &lt;/tr&gt;   
&nbsp;
        &lt;tr&gt;&lt;th&gt;Last 14 Days&lt;/th&gt;
            &lt;td class=&quot;mainTableAlt&quot;&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span>
             <span style="color: #000088;">$sql1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                      FROM '</span><span style="color: #339933;">.</span>TICKET_RESPONSE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                      WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
                      AND 14 &gt;= TIMESTAMPDIFF(DAY,created,NOW())'</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$sql2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                      FROM '</span><span style="color: #339933;">.</span>TICKET_NOTE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                      WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
                      AND 14 &gt;= TIMESTAMPDIFF(DAY,created,NOW())'</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$res1</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$res2</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$row1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$row2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$total_time</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
             <span style="color: #000088;">$total_tick</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$total_time_format</span> <span style="color: #339933;">=</span> Ticket<span style="color: #339933;">::</span><span style="color: #004000;">formatStaffTimeSheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$total_time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>              
             <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$total_time_format</span><span style="color: #339933;">;</span>                                        
             <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;/td&gt;
        &lt;/tr&gt;        
&nbsp;
&nbsp;
        &lt;tr&gt;&lt;th&gt;Last 7 Days&lt;/th&gt;
            &lt;td class=&quot;mainTableAlt&quot;&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span>
            <span style="color: #000088;">$sql1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                     FROM '</span><span style="color: #339933;">.</span>TICKET_RESPONSE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     AND 7 &gt;= TIMESTAMPDIFF(DAY,created,NOW())'</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$sql2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                     FROM '</span><span style="color: #339933;">.</span>TICKET_NOTE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     AND 7 &gt;= TIMESTAMPDIFF(DAY,created,NOW())'</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$res1</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$res2</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$row1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$row2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$total_time</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
            <span style="color: #000088;">$total_tick</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$total_time_format</span> <span style="color: #339933;">=</span> Ticket<span style="color: #339933;">::</span><span style="color: #004000;">formatStaffTimeSheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$total_time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>              
            <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$total_time_format</span><span style="color: #339933;">;</span>                          
            <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;/td&gt;
        &lt;/tr&gt;        
&nbsp;
        &lt;tr&gt;&lt;th&gt;Yesterday&lt;/th&gt;
            &lt;td class=&quot;mainTableAlt&quot;&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
            <span style="color: #000088;">$yday</span><span style="color: #339933;">=</span><span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-1day&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$yesterday</span><span style="color: #339933;">=</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Y-m-d&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$yday</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #000088;">$sql1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                     FROM '</span><span style="color: #339933;">.</span>TICKET_RESPONSE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' 
                     AND created LIKE &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$yesterday</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'%&quot;'</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$sql2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                     FROM '</span><span style="color: #339933;">.</span>TICKET_NOTE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' 
                     AND created LIKE &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$yesterday</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'%&quot;'</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$res1</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$res2</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$row1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$row2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$total_time</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
            <span style="color: #000088;">$total_tick</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$total_time_format</span> <span style="color: #339933;">=</span> Ticket<span style="color: #339933;">::</span><span style="color: #004000;">formatStaffTimeSheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$total_time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>              
            <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$total_time_format</span><span style="color: #339933;">;</span>                          
            <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;/td&gt;
        &lt;/tr&gt;        
&nbsp;
        &lt;tr&gt;&lt;th&gt;Today&lt;/th&gt;
            &lt;td class=&quot;mainTableAlt&quot;&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span>
            <span style="color: #000088;">$sql1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                     FROM '</span><span style="color: #339933;">.</span>TICKET_RESPONSE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     AND 0 = TIMESTAMPDIFF(DAY,created,NOW())'</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$sql2</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT SUM( time_spent ), COUNT( time_spent )
                     FROM '</span><span style="color: #339933;">.</span>TICKET_NOTE_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     WHERE staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$rep</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;staff_id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
                     AND 0 = TIMESTAMPDIFF(DAY,created,NOW())'</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$res1</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$res2</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$row1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$row2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$res2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$total_time</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
            <span style="color: #000088;">$total_tick</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row1</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$row2</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$total_time_format</span> <span style="color: #339933;">=</span> Ticket<span style="color: #339933;">::</span><span style="color: #004000;">formatStaffTimeSheet</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$total_time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>              
            <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$total_time_format</span><span style="color: #339933;">;</span>                          
            <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;/td&gt;
        &lt;/tr&gt;        
&nbsp;
        <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>
&nbsp;
    &lt;/table&gt;</pre></td></tr></table></div>

<p>Enjoy the result!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F12%2F05%2Fadd-time-spent-at-the-bottom-of-each-staffs-page-of-osticket-v1-6-rc5%2F&amp;title=Add%20Time%20Spent%20at%20the%20Bottom%20of%20Each%20Staff%26%238217%3Bs%20Page%20of%20osTicket%20v1.6%20RC5" 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/2009/12/05/add-time-spent-at-the-bottom-of-each-staffs-page-of-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Only The Assignee Staff or Admin Can Close and Reopen Ticket in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/12/04/only-the-assignee-staff-or-admin-can-close-and-reopen-ticket-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/12/04/only-the-assignee-staff-or-admin-can-close-and-reopen-ticket-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 03:17:27 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[assignee]]></category>
		<category><![CDATA[close]]></category>
		<category><![CDATA[reopen]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[ticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=957</guid>
		<description><![CDATA[This following modification will add a small feature to limit the ability for staff to close the opened ticket or to reopen the closed ticket in osTicket v1.6 RC5. Only the assignee staff or admin can close and reopen the ticket. It means that if the current ticket has not been assigned to any staff, [...]]]></description>
			<content:encoded><![CDATA[<p>This following modification will add a small feature to limit the ability for staff to close the opened ticket or to reopen the closed ticket in osTicket v1.6 RC5. Only the assignee staff or admin can close and reopen the ticket. It means that if the current ticket has not been assigned to any staff, then only admin can close that ticket. Since there is no staff_id information for the closed tickets, then the closed ticket handling is similar with the unassigned tickets. Thus, this rule will be automatically being applied to such tickets. <span id="more-957"></span></p>
<ol>
<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>361
362
363
364
365
366
367
368
369
370
371
372
373
</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>
    <span style="color: #666666; font-style: italic;">//set status to open on a closed ticket.</span>
    <span style="color: #000000; font-weight: bold;">function</span> reopen<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;">$thisuser</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;">'open'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">',isanswered=0,updated=NOW(),reopened=NOW() 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>361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
</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: #666666; font-style: italic;">// MOD Only The Assignee Staff Or Admin Can Close The Ticket, </span>
	<span style="color: #666666; font-style: italic;">// by Masino Sinaga (http://www.openscriptsolution.com), December 4, 2009</span>
    	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$thisuser</span><span style="color: #339933;">;</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;">getStaffId</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;">&amp;&amp;</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: #009900;">&#41;</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: #b1b100;">else</span> <span style="color: #009900;">&#123;</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: #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>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">//set status to open on a closed ticket.</span>
    <span style="color: #000000; font-weight: bold;">function</span> reopen<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    	<span style="color: #666666; font-style: italic;">// MOD Only The Assignee Staff Or Admin Can ReOpen The Ticket, </span>
	<span style="color: #666666; font-style: italic;">// by Masino Sinaga (http://www.openscriptsolution.com), December 4, 2009</span>
        <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$thisuser</span><span style="color: #339933;">;</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;">getStaffId</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;">&amp;&amp;</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: #009900;">&#41;</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: #b1b100;">else</span> <span style="color: #009900;">&#123;</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;">'open'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">',isanswered=0,updated=NOW(),reopened=NOW() 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>
    <span style="color: #009900;">&#125;</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>210
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><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;">'Problems closing the ticket. Try again'</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>210
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><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;">'Problems closing the ticket or you are not allowed to close tickets.'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>224
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><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;">'Problems reopening the ticket. Try again'</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>224
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><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;">'Problems reopening the ticket or you are not allowed to reopen tickets.'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</li>
</ol>
<p>That&#8217;s all, everyone! Enjoy the code and its result. <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%2F2009%2F12%2F04%2Fonly-the-assignee-staff-or-admin-can-close-and-reopen-ticket-in-osticket-v1-6-rc5%2F&amp;title=Only%20The%20Assignee%20Staff%20or%20Admin%20Can%20Close%20and%20Reopen%20Ticket%20in%20osTicket%20v1.6%20RC5" 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/2009/12/04/only-the-assignee-staff-or-admin-can-close-and-reopen-ticket-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Displaying Help Topic Based on Selected Department in New Ticket Form at Client Side of osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/12/03/displaying-help-topic-based-on-selected-department-in-new-ticket-form-at-client-side-of-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/12/03/displaying-help-topic-based-on-selected-department-in-new-ticket-form-at-client-side-of-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 05:23:40 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[department]]></category>
		<category><![CDATA[help topic]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[ticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=943</guid>
		<description><![CDATA[One of the advantages of osTicket after comparing to another ticketing system is the ability to clasify the tickets based on its department and its help topic. For those of you who implement osTicket for such company which has several departments, which is each department has several help topics, you need to filter the related [...]]]></description>
			<content:encoded><![CDATA[<p>One of the advantages of osTicket after comparing to another ticketing system is the ability to clasify the tickets based on its department and its help topic. For those of you who implement osTicket for such company which has several departments, which is each department has several help topics, you need to filter the related help topic based on the department that selected by your customer or client. Since the help topic is the part of department, then the ticket will be able being sent to the right topic and also to the related department. This modification will add the department selection in the open or new ticket form at the client side. When the particular department selected by client, then at the Help Topic directive will automatically display all help topics belong to the selected department. <span id="more-943"></span></p>
<ol>
<li>
Open your <strong>\include\client\open.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    &lt;tr&gt;
        &lt;th&gt;Help Topic:&lt;/th&gt;
        &lt;td&gt;
            &lt;select name=&quot;topicId&quot;&gt;
                &lt;option value=&quot;&quot; selected &gt;Select One&lt;/option&gt;
                <span style="color: #000000; font-weight: bold;">&lt;?</span>
                 <span style="color: #000088;">$services</span><span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT topic_id,topic FROM '</span><span style="color: #339933;">.</span>TOPIC_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' WHERE isactive=1 ORDER BY topic'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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;">$topicId</span><span style="color: #339933;">,</span><span style="color: #000088;">$topic</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;">$services</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$selected</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'topicId'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #000088;">$topicId</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'selected'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                    &lt;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$topicId</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$selected</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$topic</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/option&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;option value=&quot;0&quot; &gt;General Inquiry&lt;/option&gt;
            &lt;/select&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;">'topicId'</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>then replace with this following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    &lt;tr&gt;
        &lt;th&gt;Department:&lt;/th&gt;
        &lt;td&gt;
            &lt;select name=&quot;deptId&quot; onChange=&quot;getTopic('findtopic.php?topic_id='+this.value)&quot;&gt;
                &lt;option value=&quot;&quot; selected &gt;Select Department&lt;/option&gt;
                <span style="color: #000000; font-weight: bold;">&lt;?</span>
                 <span style="color: #000088;">$services</span><span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT dept_id,dept_name FROM '</span><span style="color: #339933;">.</span>DEPT_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' ORDER BY dept_name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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;">$deptId</span><span style="color: #339933;">,</span><span style="color: #000088;">$dept</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;">$services</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$selected</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'deptId'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #000088;">$deptId</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'selected'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                    &lt;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$deptId</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$selected</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$dept</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/option&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;/select&gt;
            &amp;nbsp;&lt;font class=&quot;error&quot;&gt;&lt;b&gt;*&lt;/b&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;">'deptId'</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;
&nbsp;
    &lt;tr&gt;
        &lt;th&gt;Help Topic:&lt;/th&gt;
        &lt;td&gt;          		         
            &lt;div id=&quot;topicdiv&quot;&gt;
		&lt;select name=&quot;topicId&quot;&gt;
                &lt;option value=&quot;&quot; selected &gt;Select Help Topic&lt;/option&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;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;deptId&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">''</span> <span style="color: #339933;">||</span> <span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;deptId&quot;</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;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;deptId&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'0'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
                 <span style="color: #000088;">$services</span><span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SELECT topic_id,topic FROM '</span><span style="color: #339933;">.</span>TOPIC_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' WHERE isactive=1 AND dept_id = '</span><span style="color: #339933;">.</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;deptId&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' ORDER BY topic'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</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;">$topicId</span><span style="color: #339933;">,</span><span style="color: #000088;">$topic</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;">$services</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$selected</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'topicId'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #000088;">$topicId</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'selected'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                    &lt;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$topicId</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$selected</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$topic</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/option&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;!-- &lt;option value=&quot;0&quot; &gt;General Inquiry&lt;/option&gt; --&gt;
            &lt;/select&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;">'topicId'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;
            &lt;/div&gt;                      
        &lt;/td&gt;
    &lt;/tr&gt;</pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>137
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;/</span>form<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>138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> getXMLHTTP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//fuction to return the xml http object</span>
		<span style="color: #000000; font-weight: bold;">var</span> xmlhttp<span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>	
		try<span style="color: #009900;">&#123;</span>
			xmlhttp<span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> XMLHttpRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		catch<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span>	<span style="color: #009900;">&#123;</span>		
			try<span style="color: #009900;">&#123;</span>			
				xmlhttp<span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Microsoft.XMLHTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			catch<span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				try<span style="color: #009900;">&#123;</span>
				xmlhttp <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Msxml2.XMLHTTP&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
				catch<span style="color: #009900;">&#40;</span>e1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
					xmlhttp<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: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> xmlhttp<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> getTopic<span style="color: #009900;">&#40;</span>strURL<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>         
     <span style="color: #000000; font-weight: bold;">var</span> req <span style="color: #339933;">=</span> getXMLHTTP<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// fuction to get xmlhttp object</span>
     <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req<span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#123;</span>
      req<span style="color: #339933;">.</span>onreadystatechange <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</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>req<span style="color: #339933;">.</span>readyState <span style="color: #339933;">==</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//data is retrieved from server</span>
       <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>req<span style="color: #339933;">.</span>status <span style="color: #339933;">==</span> <span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// which reprents ok status                    </span>
         document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'topicdiv'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>innerHTML<span style="color: #339933;">=</span>req<span style="color: #339933;">.</span>responseText<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">else</span>
      <span style="color: #009900;">&#123;</span> 
         alert<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;There was a problem while using XMLHTTP:<span style="color: #000099; font-weight: bold;">\n</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: #009900;">&#125;</span>        
    req<span style="color: #339933;">.</span>open<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;GET&quot;</span><span style="color: #339933;">,</span> strURL<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//open url using get method</span>
    req<span style="color: #339933;">.</span>send<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">null</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: #000000; font-weight: bold;">&lt;/script&gt;</span></pre></td></tr></table></div>

</li>
<li>
Create a new file named <strong>findtopic.php</strong>, then put it to the root directory of your osTicket. Copy-paste this following code into that file:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* File   : findtopic.php */</span>
<span style="color: #666666; font-style: italic;">/* Purpose: This file will help you to display the help topic */</span> 
<span style="color: #666666; font-style: italic;">/*          automatically based on the selected department */</span>
<span style="color: #666666; font-style: italic;">/*          in the open or new ticket form at the client side */</span>
<span style="color: #666666; font-style: italic;">/* Author : Masino Sinaga, http://www.openscriptsolution.com */</span>
<span style="color: #666666; font-style: italic;">/* Created: December 2, 2009 */</span>
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main.inc.php'</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: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'INCLUDE_DIR'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Fatal Error'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'CLIENTINC_DIR'</span><span style="color: #339933;">,</span>INCLUDE_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">'client/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'OSTCLIENTINC'</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//make includes happy</span>
&nbsp;
<span style="color: #000088;">$topic_id</span><span style="color: #339933;">=</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'topic_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$query</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;SELECT topic_id,topic FROM &quot;</span><span style="color: #339933;">.</span>TOPIC_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; 
        WHERE isactive=1 AND dept_id = &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$topic_id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; 
				ORDER BY topic&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$result</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;select name=&quot;topicId&quot;&gt;
  &lt;option value=&quot;&quot;&gt;Select Help Topic&lt;/option&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</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;">$topicId</span><span style="color: #339933;">,</span><span style="color: #000088;">$topic</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;">$result</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;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$topicId</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$topic</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/option&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>
&lt;/select&gt;</pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'deptId'</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;">'emailId'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Just Making sure we don't accept crap...only topicId is expected.</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>22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// $_POST['deptId']=$_POST['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected.</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>1051
</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: #990000;">strcasecmp</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$origin</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'web'</span><span style="color: #009900;">&#41;</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: #666666; font-style: italic;">//Help topic only applicable on web tickets.</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>1052
</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;">'deptId'</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;">'int'</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;">'Dept. required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1151
</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: #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;">'topicId'</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: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'deptId'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//Ticket created via web by user</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>1151
</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: #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;">'topicId'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'deptId'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//Ticket created via web by user</span></pre></td></tr></table></div>

</li>
</ol>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F12%2F03%2Fdisplaying-help-topic-based-on-selected-department-in-new-ticket-form-at-client-side-of-osticket-v1-6-rc5%2F&amp;title=Displaying%20Help%20Topic%20Based%20on%20Selected%20Department%20in%20New%20Ticket%20Form%20at%20Client%20Side%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/2009/12/03/displaying-help-topic-based-on-selected-department-in-new-ticket-form-at-client-side-of-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Displaying the Staff Name in the Reply Email of osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/12/02/displaying-the-staff-name-in-reply-email-of-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/12/02/displaying-the-staff-name-in-reply-email-of-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 02:22:55 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[name]]></category>
		<category><![CDATA[reply]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[ticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=937</guid>
		<description><![CDATA[This modification will display the staff name in the reply email that sent by the current staff. As default, osTicket have not included the %staff variable in the reply or response email template. So here is the modification to implement it. Open your \include\class.ticket.php file, and find this code: 752 $body = str_replace&#40;'%response',$response,$body&#41;; after that [...]]]></description>
			<content:encoded><![CDATA[<p>This modification will display the staff name in the reply email that sent by the current staff. As default, osTicket have not included the <strong>%staff</strong> variable in the reply or response email template. So here is the modification to implement it. <span id="more-937"></span></p>
<ol>
<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>752
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$body</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%response'</span><span style="color: #339933;">,</span><span style="color: #000088;">$response</span><span style="color: #339933;">,</span><span style="color: #000088;">$body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>753
754
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$staff</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;">$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: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$body</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></pre></td></tr></table></div>

</li>
<li>
Go to your <strong>Admin Panel -> Emails -> Templates</strong>, then select your email template record, go to the <strong>Ticket Response/Reply</strong> section.</p>
<p>Change this email template regarding the ticket response/reply at the <strong>Message Body</strong> directive, from this code:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">%name,
&nbsp;
Our customer support team personnel has replied to your support request #%ticket 
&nbsp;
%response
&nbsp;
We hope this response has sufficiently answered your questions. If not, please do not send another email. Instead, reply to this email or login to your account for a complete archive of all your support request and responses.
&nbsp;
%url/view.php?e=%email&amp;t=%ticket
&nbsp;
%signature</pre></div></div>

<p>become this following code:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">%name,
&nbsp;
%staff has replied to your support request #%ticket 
&nbsp;
%response
&nbsp;
We hope this response has sufficiently solved your request. If not, please do not send another email. Instead, reply to this email or login to your account for a complete archive of all your support request and responses.
&nbsp;
%url/view.php?e=%email&amp;t=%ticket
&nbsp;
%signature</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%2F2009%2F12%2F02%2Fdisplaying-the-staff-name-in-reply-email-of-osticket-v1-6-rc5%2F&amp;title=Displaying%20the%20Staff%20Name%20in%20the%20Reply%20Email%20of%20osTicket%20v1.6%20RC5" 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/2009/12/02/displaying-the-staff-name-in-reply-email-of-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Response Alert for All Department Members in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/11/14/new-response-alert-for-all-department-members-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/11/14/new-response-alert-for-all-department-members-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 01:36:30 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[alert]]></category>
		<category><![CDATA[department]]></category>
		<category><![CDATA[Internal Note]]></category>
		<category><![CDATA[members]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[ticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=853</guid>
		<description><![CDATA[This following modification is being intended to answer the question about the similar modification that asking about the title of this article. You may enable or disable this feature from admin panel. If you want your osTicket also send an alert to all department members when new response that being sent by staff comes to [...]]]></description>
			<content:encoded><![CDATA[<p>This following modification is being intended to answer the question about <a href="http://www.openscriptsolution.com/2009/10/24/new-message-alert-for-all-department-members-in-osticket-v1-6-rc5/comment-page-1/#comment-718">the similar modification</a> that asking about the title of this article. You may enable or disable this feature from admin panel. If you want your osTicket also send an alert to all department members when new response that being sent by staff comes to the system, then this following modification is for you! <span id="more-853"></span></p>
<ol>
<li>
First of all, you have to alter the <strong>ost_config</strong> table by adding a new field named <strong>note_alert_dept_members</strong>. You may use this SQL script from phpMyAdmin or your another MySQL tool. Please note that <strong>ost_</strong> is the table name prefix. Adjust it by yourself 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 `note_alert_dept_members` tinyint(1) default 0 NOT NULL;</pre></div></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>435
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">              &lt;input type=&quot;checkbox&quot; name=&quot;note_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;">'note_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 (spammy)</pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>436
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">              &lt;input type=&quot;checkbox&quot; name=&quot;note_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;">'note_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)</pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>322
323
324
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> alertDeptManagerONNewNote<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;">'note_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></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>326
327
328
329
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// MOD Alert Dept Members on New Note, added by Masino Sinaga, November 14, 2009</span>
    <span style="color: #000000; font-weight: bold;">function</span> alertDeptMembersONNewNote<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;">'note_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>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>476
477
478
479
</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></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>476
477
478
479
480
</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: #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_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: #666666; font-style: italic;">// added by Masino Sinaga, Nov 14, 2009</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>536
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #0000ff;">',note_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;">'note_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></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>536
537
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #0000ff;">',note_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;">'note_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;">',note_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;">'note_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;">// added by Masino Sinaga, Nov 14, 2009</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>827
828
829
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                        <span style="color: #666666; font-style: italic;">//Dept 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;">alertDeptManagerONNewNote</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: #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></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>831
832
833
834
835
836
837
838
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                        <span style="color: #666666; font-style: italic;">//Dept members, added by Masino Sinaga, Nov 14, 2009</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;">alertDeptMembersONNewNote</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;">$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 onvacation=0 AND 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: #009900;">&#125;</span>													
			<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</li>
</ol>
<p>That&#8217;s all. Hope it helps you.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F11%2F14%2Fnew-response-alert-for-all-department-members-in-osticket-v1-6-rc5%2F&amp;title=New%20Response%20Alert%20for%20All%20Department%20Members%20in%20osTicket%20v1.6%20RC5" 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/2009/11/14/new-response-alert-for-all-department-members-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
