<?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; send</title>
	<atom:link href="http://www.openscriptsolution.com/tag/send/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>Alert Destination Department Members of Transfered Ticket in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/10/30/alert-destination-department-members-of-transfered-ticket-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/10/30/alert-destination-department-members-of-transfered-ticket-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 09:43:07 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[alert]]></category>
		<category><![CDATA[department]]></category>
		<category><![CDATA[destination]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[manager]]></category>
		<category><![CDATA[member]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[transfer]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=734</guid>
		<description><![CDATA[There was an interesting request asked to myself about how to send email to the destination department members if a new transfered ticket has come to their department. You can see completely about this request from osTicket Discussion Forum. Well, now I have successfully created the modification for this purpose. You can also now define [...]]]></description>
			<content:encoded><![CDATA[<p>There was an interesting request asked to myself about how to send email to the destination department members if a new transfered ticket has come to their department. You can see completely about this request from <a href="http://www.osticket.com/forums/showthread.php?p=10824#post10824" target="_blank">osTicket Discussion Forum</a>. Well, now I have successfully created the modification for this purpose. You can also now define whether to enable or disable this feature on a Department basis via Admin Panel of your osTicket System, just in case not all department might require it. <span id="more-734"></span></p>
<ol>
<li>
First of all, alter your <strong>ost_department</strong> table by using this following SQL script. Please note that the <strong>ost_</strong> is the table prefix name. It could be different with yours. In case it differs with yours, please adjust it by yourself, and please be kind of it!</p>

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

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>116
117
118
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> autoRespONNewMessage<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;">row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message_auto_response'</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>119
120
121
122
123
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">// MOD Transfer Ticket Auto Alert, by Masino Sinaga, October 30, 2009 </span>
    <span style="color: #000000; font-weight: bold;">function</span> autoRespONTransferTicket<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;">row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'transfer_auto_alert'</span><span style="color: #009900;">&#93;</span>?<span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">:</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// MOD Transfer Ticket Auto Alert, by Masino Sinaga, October 30, 2009</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>252
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',message_auto_response='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message_auto_response'</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>252
253
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',message_auto_response='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message_auto_response'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
                 <span style="color: #0000ff;">',transfer_auto_alert='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'transfer_auto_alert'</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;">// MOD Transfer Ticket Auto Alert, by Masino Sinaga, October 30, 2009</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>126
127
128
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                &lt;input type=&quot;radio&quot; name=&quot;message_auto_response&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;">'message_auto_response'</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;/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>129
130
131
132
133
134
135
136
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        &lt;!-- MOD Transfer Ticket Auto Alert, by Masino Sinaga, October 30, 2009 --&gt;
        &lt;tr&gt;&lt;th&gt;Auto Alert Ticket Transfer:&lt;/th&gt;
            &lt;td&gt;
                &lt;input type=&quot;radio&quot; name=&quot;transfer_auto_alert&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;">'transfer_auto_alert'</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;transfer_auto_alert&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;">'transfer_auto_alert'</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;/td&gt;
        &lt;/tr&gt;
        &lt;!-- MOD Transfer Ticket Auto Alert, by Masino Sinaga, October 30, 2009 --&gt;</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>112
113
114
115
116
117
</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;">$errors</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">transfer</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dept_id'</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;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">reload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//dept manager changed!</span>
                <span style="color: #666666; font-style: italic;">//Send out alerts?? - for now yes....part of internal note!</span>
                <span style="color: #000088;">$title</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Dept. Transfer: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDeptName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' to '</span><span style="color: #339933;">.</span>Dept<span style="color: #339933;">::</span><span style="color: #004000;">getNameById</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dept_id'</span><span style="color: #009900;">&#93;</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;">postNote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Ticket Transfered Sucessfully'</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>112
113
114
115
116
117
118
119
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #666666; font-style: italic;">// MOD Transfer Ticket Auto Alert, by Masino Sinaga, October 30, 2009</span>
            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">transfer</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dept_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDeptName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>Dept<span style="color: #339933;">::</span><span style="color: #004000;">getNameById</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dept_id'</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;">// Send out alerts?? - for now yes....part of internal note!</span>
            <span style="color: #666666; font-style: italic;">// Now department members can also received an alert for incoming transfered ticket!</span>
                <span style="color: #000088;">$title</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Dept. Transfer: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDeptName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' to '</span><span style="color: #339933;">.</span>Dept<span style="color: #339933;">::</span><span style="color: #004000;">getNameById</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dept_id'</span><span style="color: #009900;">&#93;</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;">reload</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;">//dept manager changed!</span>
		<span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">postNote</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'message'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>               
                <span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Ticket Transfered Sucessfully'</span><span style="color: #339933;">;</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>492
493
494
495
496
497
498
499
500
501
502
503
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">//Dept Tranfer...with alert..</span>
    <span style="color: #000000; font-weight: bold;">function</span> transfer<span style="color: #009900;">&#40;</span><span style="color: #000088;">$deptId</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: #666666; font-style: italic;">/*
        TODO:
            1) Figure out what to do when ticket is assigned
                Is the assignee allowed to access target dept?  (At the moment assignee will have access to the ticket anyways regardless of Dept)
            2) Send alerts to new Dept manager/members??
            3) Other crap I don't have time to think about at the moment.
        */</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDeptId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$deptId</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>492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
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;">//Dept Tranfer...with alert..</span>
    <span style="color: #000000; font-weight: bold;">function</span> transfer<span style="color: #009900;">&#40;</span><span style="color: #000088;">$deptId</span><span style="color: #339933;">,</span><span style="color: #000088;">$oldDept</span><span style="color: #339933;">,</span><span style="color: #000088;">$newDept</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: #666666; font-style: italic;">/*
        TODO:
            1) Figure out what to do when ticket is assigned
                Is the assignee allowed to access target dept?  (At the moment assignee will have access to the ticket anyways regardless of Dept)
            2) Send alerts to new Dept manager/members?? (Yes, now your dreams come true! See MOD created by Masino Sinaga below!)
            3) Other crap I don't have time to think about at the moment.
        */</span>
        <span style="color: #666666; font-style: italic;">//return $this-&gt;setDeptId($deptId)?true:false;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// MOD Transfer Ticket Auto Alert, by Masino Sinaga, October 30, 2009</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;">setDeptId</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$deptId</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	    <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dept_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$deptId</span><span style="color: #339933;">;</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>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$dept</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">autoRespONTransferTicket</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;">$helpdesk_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>
              <span style="color: #000088;">$sqls</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT DISTINCT(email) 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;">$deptId</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;">$ress</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqls</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;">$ress</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;">$email</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;">$ress</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                  <span style="color: #000088;">$helpdesk_email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #339933;">,</span>
		  <span style="color: #0000ff;">'New Transfered Ticket #'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getExtId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		  <span style="color: #0000ff;">'A new ticket #'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getExtId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' has been transfered to your department (from '</span><span style="color: #339933;">.</span><span style="color: #000088;">$oldDept</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' to '</span><span style="color: #339933;">.</span><span style="color: #000088;">$newDept</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: #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;">'autoRespONTransferTicket'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Failed while getting autoRespONTransferTicket setting.'</span><span style="color: #009900;">&#41;</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;">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;">// MOD Transfer Ticket Auto Alert, by Masino Sinaga, October 30, 2009</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</li>
</ol>
<p>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%2F10%2F30%2Falert-destination-department-members-of-transfered-ticket-in-osticket-v1-6-rc5%2F&amp;title=Alert%20Destination%20Department%20Members%20of%20Transfered%20Ticket%20in%20osTicket%20v1.6%20RC5" id="wpa2a_2"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/10/30/alert-destination-department-members-of-transfered-ticket-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Send Email to All Staff in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/10/29/send-email-to-all-staff-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/10/29/send-email-to-all-staff-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 14:21:52 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[announcement]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[staff]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=724</guid>
		<description><![CDATA[Have you ever wanted to send email that contains of an announcement to all of your staff from osTicket System? Well, here is the solution I created on osTicket v1.6 RC5. This modification will add a new sub tab named Send Email to Staff under the Emails tab in Admin Panel, also a new email [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to send email that contains of an announcement to all of your staff from osTicket System? Well, here is the solution I created on osTicket v1.6 RC5. This modification will add a new sub tab named <strong>Send Email to Staff</strong> under the <strong>Emails</strong> tab in Admin Panel, also a new email template named <strong>Email to All Staff</strong> which is the email Subject and Body that contains of your email that you will send to all of your staff. You have to define first this two textboxes of the email template for this purpose from Emails -> Templates menu in Admin Panel. <span id="more-724"></span></p>
<ol>
<li>
First of all, alter your <strong>ost_email_template</strong> table by using this following SQL script. Please note that the <strong>ost_</strong> is the table prefix name. It could be different with yours. In case it differs with yours, please adjust it by yourself!</p>

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

</li>
<li>
Create a new file and copy paste this following code into it, and then save it as <strong>sendemailtostaff.inc.php</strong> and put this file into your <strong>\include\staff\</strong> sub directory.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</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: #009933; font-style: italic;">/**
 * @author Masino Sinaga, http://www.openscriptsolution.com
 * @copyright October 29, 2009
 */</span>
&nbsp;
<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;">'OSTADMININC'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</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: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Access Denied'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">;</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>
<span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT alert_all_staff_subj,alert_all_staff_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>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$subj</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$body</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	
  	<span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span>INCLUDE_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">'class.email.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	  <span style="color: #000088;">$helpdesk_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>
    <span style="color: #000088;">$sqls</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT DISTINCT(email) FROM '</span><span style="color: #339933;">.</span>STAFF_TABLE<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: #009900;">&#40;</span><span style="color: #000088;">$ress</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqls</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;">$ress</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;">$email</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;">$ress</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$helpdesk_email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #339933;">,</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>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Email successfully sent!'</span><span style="color: #339933;">;</span>	
  <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Email failed sent. Check the Send Email to All Staff section from your Email Template '</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: #b1b100;">echo</span> <span style="color: #0000ff;">'Failed while getting email template. '</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</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>29
30
31
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;msg&quot;</span><span style="color: #339933;">&gt;</span>User<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>table width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;100%&quot;</span> border<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span> cellspacing<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span> cellpadding<span style="color: #339933;">=</span><span style="color: #cc66cc;">2</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tform tpl&quot;</span><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;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>New Ticket Autoresponse<span style="color: #339933;">&lt;/</span>td<span style="color: #339933;">&gt;&lt;/</span>tr<span style="color: #339933;">&gt;</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>28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	&lt;div class=&quot;eas&quot;&gt;Email to All Staff&lt;/div&gt;
        &lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=0 cellpadding=2 class=&quot;tform tpl&quot;&gt;
            &lt;tr class=&quot;header&quot;&gt;&lt;td colspan=2 &gt;Send Email to All Staff&lt;/td&gt;&lt;/tr&gt;
            &lt;tr class=&quot;subheader&quot;&gt;&lt;td colspan=2 &gt;
                Email to all of your staff
		Meant to send an email to all of your staff (including manager) without any exception.&lt;/td&gt;
                &lt;/tr&gt;
            &lt;tr&gt;
                &lt;th&gt;Subject:&lt;/th&gt;
                &lt;td&gt;&lt;input type=&quot;text&quot; size=&quot;65&quot; name=&quot;alert_all_staff_subj&quot; value=&quot;<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;">'alert_all_staff_subj'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&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;">'alert_all_staff_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;Body:&lt;/th&gt;
                &lt;td&gt;
                    &lt;textarea rows=&quot;7&quot; cols=&quot;75&quot; name=&quot;alert_all_staff_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;">'alert_all_staff_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;">'alert_all_staff_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;
        &lt;/table&gt;
        &lt;/div&gt;</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>83
</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;">'name'</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;">'Name required'</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>83
84
85
86
</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;">'name'</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;">'Name required'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//Send alert sent to all staff</span>
        <span style="color: #000088;">$fields</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'alert_all_staff_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;">'alert_all_staff_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>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>124
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',notes='</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;">'notes'</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>124
125
126
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',notes='</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;">'notes'</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;">',alert_all_staff_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;">'alert_all_staff_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;">',alert_all_staff_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;">'alert_all_staff_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>Find again this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>190
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',notes='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'New template: copy of '</span><span style="color: #339933;">.</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #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>190
191
192
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                 <span style="color: #0000ff;">',notes='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'New template: copy of '</span><span style="color: #339933;">.</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
                 <span style="color: #0000ff;">',alert_all_staff_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;">'alert_all_staff_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;">',alert_all_staff_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;">'alert_all_staff_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>

</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>241
242
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'templates'</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.msgtpl.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>240
241
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'sendemailtostaff'</span><span style="color: #339933;">:</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>621
622
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'email'</span><span style="color: #339933;">:</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'templates'</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>621
622
623
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'email'</span><span style="color: #339933;">:</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'sendemailtostaff'</span><span style="color: #339933;">:</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'templates'</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>628
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <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;">'Templates'</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=templates'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Email Templates'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iconclass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'emailTemplates'</span><span style="color: #009900;">&#41;</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>629
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	<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;">'Send Email to 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=sendemailtostaff'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'title'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Send Email to Staff'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iconclass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'newEmail'</span><span style="color: #009900;">&#41;</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>636
637
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">            <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'templates'</span><span style="color: #339933;">:</span>
                <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'templates.inc.php'</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>635
636
637
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">       	    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'sendemailtostaff'</span><span style="color: #339933;">:</span>
       	        <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'sendemailtostaff.inc.php'</span><span style="color: #339933;">;</span>
       	        <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</li>
</ol>
<p>Have a nice code!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F10%2F29%2Fsend-email-to-all-staff-in-osticket-v1-6-rc5%2F&amp;title=Send%20Email%20to%20All%20Staff%20in%20osTicket%20v1.6%20RC5" 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/2009/10/29/send-email-to-all-staff-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Notify Staff Member of Their New Account in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/10/22/notify-staff-member-of-their-new-account-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/10/22/notify-staff-member-of-their-new-account-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 03:25:30 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[account]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[akun]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[manager]]></category>
		<category><![CDATA[notify]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[username]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=656</guid>
		<description><![CDATA[This following article will show you how you can add a small feature into osTicket version 1.6 RC5 about notify staff members of their accounts right away after they have been created by Admin or their Manager. When Admin or Manager create a new staff account, then osTicket will send email to the staff email [...]]]></description>
			<content:encoded><![CDATA[<p>This following article will show you how you can add a small feature into osTicket version 1.6 RC5 about notify staff members of their accounts right away after they have been created by Admin or their Manager. When Admin or Manager create a new staff account, then osTicket will send email to the staff email that contains of username and password, including the URL for login to the osTicket System. <span id="more-656"></span></p>
<p>Open your <strong>\scp\admin.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>410
411
412
413
</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: #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></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</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: #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: #009900;">&#123;</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: #000088;">$helpdesk_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>
                    <span style="color: #000088;">$helpdesk_url</span><span style="color: #339933;">=</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #000088;">$helpdesk_title</span><span style="color: #339933;">=</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTitle</span><span style="color: #009900;">&#40;</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;">$helpdesk_email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                       <span style="color: #000088;">$helpdesk_email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Your New Account'</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;">'firstname'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">',
&nbsp;
  We have just created you a new account on '</span><span style="color: #339933;">.</span><span style="color: #000088;">$helpdesk_title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">':
&nbsp;
  This is your account detail:
&nbsp;
  Username: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' 
  Password: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'npassword'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'
&nbsp;
  You may login now from: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$helpdesk_url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'scp/
&nbsp;
  Please keep this email securely for your archive.
&nbsp;
  Sincerely,
  '</span><span style="color: #339933;">.</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getName</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: #009900;">&#125;</span>  
                <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Unable to add the user. Internal error'</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Hopefully this will help 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%2F10%2F22%2Fnotify-staff-member-of-their-new-account-in-osticket-v1-6-rc5%2F&amp;title=Notify%20Staff%20Member%20of%20Their%20New%20Account%20in%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/2009/10/22/notify-staff-member-of-their-new-account-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CC Email in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/10/21/cc-email-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/10/21/cc-email-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 05:06:31 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[carbon copy]]></category>
		<category><![CDATA[CC]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[kirim]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[tembusan]]></category>
		<category><![CDATA[ticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=646</guid>
		<description><![CDATA[There are several questions in osTicket Discussion Forum that asking about CC Email in osTicket. If you want to implement CC (Carbon Copy) Email in osTicket v1.6 RC5, you may apply the modification I made. I modified the class.email.php file that located in \include\ sub directory of osTicket System. Open your \include\class.email.php file, and find [...]]]></description>
			<content:encoded><![CDATA[<p>There are several questions in <a href="http://www.osticket.com/forums/" target="_blank">osTicket Discussion Forum</a> that asking about CC Email in osTicket. If you want to implement CC (Carbon Copy) Email in osTicket v1.6 RC5, you may apply the modification I made. I modified the <strong>class.email.php</strong> file that located in <strong>\include\</strong> sub directory of osTicket System. <span id="more-646"></span></p>
<ol>
<li>
Open your <strong>\include\class.email.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>135
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> send<span style="color: #009900;">&#40;</span><span style="color: #000088;">$to</span><span style="color: #339933;">,</span><span style="color: #000088;">$subject</span><span style="color: #339933;">,</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span><span style="color: #000088;">$attachment</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</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>135
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">function</span> send<span style="color: #009900;">&#40;</span><span style="color: #000088;">$to</span><span style="color: #339933;">,</span><span style="color: #000088;">$subject</span><span style="color: #339933;">,</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span><span style="color: #000088;">$attachment</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span><span style="color: #000088;">$cc</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>161
162
163
164
165
166
167
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'From'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$from</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'To'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$to</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Subject'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$subject</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Message-ID'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">.</span>Misc<span style="color: #339933;">::</span><span style="color: #004000;">randCode</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">6</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: #990000;">time</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;">$this</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: #0000ff;">'&gt;'</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'X-Mailer'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'osTicket v 1.6'</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Content-Type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/html; charset=&quot;UTF-8&quot;'</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>161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
</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;">$cc</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'From'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$from</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'To'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$to</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Subject'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$subject</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Cc'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$cc</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Message-ID'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">.</span>Misc<span style="color: #339933;">::</span><span style="color: #004000;">randCode</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">6</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: #990000;">time</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;">$this</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: #0000ff;">'&gt;'</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'X-Mailer'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'osTicket v 1.6'</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Content-Type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/html; charset=&quot;UTF-8&quot;'</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;">$headers</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'From'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$from</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'To'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$to</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Subject'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$subject</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Message-ID'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">.</span>Misc<span style="color: #339933;">::</span><span style="color: #004000;">randCode</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">6</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: #990000;">time</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;">$this</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: #0000ff;">'&gt;'</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'X-Mailer'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'osTicket v 1.6'</span><span style="color: #339933;">,</span>
                          <span style="color: #0000ff;">'Content-Type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/html; charset=&quot;UTF-8&quot;'</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>
Now, if you want to add a CC Email when calling that send function belongs to class.email.php, then you may use the following code, for example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><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;">$email_to</span><span style="color: #339933;">,</span><span style="color: #000088;">$subject</span><span style="color: #339933;">,</span><span style="color: #000088;">$body</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span><span style="color: #000088;">$email_cc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// without attachment</span></pre></div></div>

<p>which <strong>$email_cc</strong> is a variable that contains of the valid email that you want to CC it.</li>
</ol>
<p>Hopefully this will help 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%2F10%2F21%2Fcc-email-in-osticket-v1-6-rc5%2F&amp;title=CC%20Email%20in%20osTicket%20v1.6%20RC5" 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/2009/10/21/cc-email-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Password Needed to Activate A Ticket in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/10/20/password-needed-to-activate-a-ticket-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/10/20/password-needed-to-activate-a-ticket-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 02:45:15 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[activate]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[closed]]></category>
		<category><![CDATA[delay]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[notification]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[page]]></category>
		<category><![CDATA[panel]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[sandi]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[status]]></category>
		<category><![CDATA[ticket]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=632</guid>
		<description><![CDATA[The aim of the title of this article is to provide the additional prerequisite that is password when client obviously wanted to open a new ticket in osTicket System v1.6 RC5. I made this modification by adding a new field named password in ost_ticket table. After client open a new ticket, then osTicket will generate [...]]]></description>
			<content:encoded><![CDATA[<p>The aim of the title of this article is to provide the additional prerequisite that is password when client obviously wanted to open a new ticket in osTicket System v1.6 RC5. I made this modification by adding a new field named <strong>password</strong> in <strong>ost_ticket</strong> table. After client open a new ticket, then osTicket will generate the new password and display a message that inform client about the password that has just been sent to the client&#8217;s email. The ticket will be set to &#8216;delay&#8217; status at this moment, instead of set to &#8216;open&#8217; status. This password then will be automatically being sent by osTicket to the client&#8217;s email including the URL contains of that password. Afterwards, client has to click on that URL link in order to activate the ticket (in this case, osTicket will change the ticket status from &#8216;delay&#8217; become &#8216;open&#8217;). Therefore, staff will be able to see that ticket on the ticket list via staff-panel. <span id="more-632"></span></p>
<ol>
<li>
First of all, you have to alter your <strong>ost_ticket</strong> table, by adding a new field named <strong>password</strong>, and also add a new enum with <strong>delay</strong> value, into the <strong>status</strong> field, besides the existing value: &#8216;open&#8217;, &#8216;closed&#8217;. Please also make sure that you have set &#8216;delay&#8217; as the default value. It means, each time client open a new ticket, the status is become &#8216;delay&#8217; instead of &#8216;open&#8217;.</p>
<p>You may use this SQL from your phpMyAdmin or another MySQL tools:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">ALTER TABLE ost_ticket 
ADD COLUMN `password` varchar(20) NULL;</pre></div></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>17
18
19
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>
     Thank you <span style="color: #b1b100;">for</span> contacting us<span style="color: #339933;">.&lt;</span>br<span style="color: #339933;">&gt;</span>
     A support ticket request has been created and a representative will be getting back to you shortly <span style="color: #b1b100;">if</span> necessary<span style="color: #339933;">.&lt;/</span>p<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>17
18
19
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>
     Thank you <span style="color: #b1b100;">for</span> contacting us<span style="color: #339933;">.&lt;</span>br<span style="color: #339933;">&gt;</span>
     An email has been sent to your email contains of the URL with password to activate this ticket<span style="color: #339933;">.&lt;/</span>p<span style="color: #339933;">&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>1194
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$extId</span><span style="color: #339933;">=</span>Ticket<span style="color: #339933;">::</span><span style="color: #004000;">genExtRandID</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1195
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> Ticket<span style="color: #339933;">::</span><span style="color: #004000;">generatePassword</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Find again this code, and make sure that code located inside the create() function:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1207
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #0000ff;">',source='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</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>1207
1208
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #0000ff;">',source='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$source</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>
                <span style="color: #0000ff;">',password='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// MOD Open Ticket With Password, Added by Masino Sinaga, Oct 19, 2009</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1336
1337
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&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>1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #000000; font-weight: bold;">function</span> generatePassword<span style="color: #009900;">&#40;</span><span style="color: #000088;">$length</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$password</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$chars</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890&quot;</span><span style="color: #339933;">;</span>
     <span style="color: #990000;">srand</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>double<span style="color: #009900;">&#41;</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">1000000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$length</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#123;</span>
       <span style="color: #000088;">$password</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">substr</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$chars</span><span style="color: #339933;">,</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$chars</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
     <span style="color: #b1b100;">return</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">function</span> updateTicketStatus<span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</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>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 status=\'open\', password=\'\' WHERE password='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</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: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
     	 <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></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>20
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$errors</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></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>21
22
23
24
25
26
27
28
29
30
31
</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;">$_GET</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</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;">$password</span><span style="color: #339933;">=</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</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>Ticket<span style="color: #339933;">::</span><span style="color: #004000;">updateTicketStatus</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>CLIENTINC_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;">echo</span> <span style="color: #0000ff;">'Thank you for activating your ticket. We will response it as soon as possible.'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span>CLIENTINC_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>
    <span style="color: #990000;">exit</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;">'Incorrect password or ticket status has been activated.'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</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>42
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000088;">$inc</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'thankyou.inc.php'</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>43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$cfg</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</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: #000088;">$helpdesk_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>
        <span style="color: #000088;">$helpdesk_url</span><span style="color: #339933;">=</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getUrl</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$helpdesk_title</span><span style="color: #339933;">=</span><span style="color: #000088;">$cfg</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getTitle</span><span style="color: #009900;">&#40;</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;">$helpdesk_email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$sqle</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT email, password FROM '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span>
                <span style="color: #0000ff;">' WHERE ticketID='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getExtId</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;">''</span><span style="color: #339933;">;</span>
          <span style="color: #000088;">$respe</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000088;">$countRec</span> <span style="color: #339933;">=</span> db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$respe</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: #000088;">$row</span> <span style="color: #339933;">=</span> db_fetch_array<span style="color: #009900;">&#40;</span><span style="color: #000088;">$respe</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>	
          <span style="color: #000088;">$helpdesk_email</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">send</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Password for Your Ticket #'</span><span style="color: #339933;">.</span><span style="color: #000088;">$ticket</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getExtId</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;">$username</span><span style="color: #339933;">.</span><span style="color: #0000ff;">', You are receiving this notification because you have (or someone pretending to be you has) requested a new ticket on &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$helpdesk_title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;. If you did not request this notification then please ignore it, if you keep receiving it please contact your Administrator. Otherwise, in order to activate your new ticket so that we will receive it, please click on this link: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$helpdesk_url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'open.php?password='</span><span style="color: #339933;">.</span><span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</li>
</ol>
<p>That&#8217;s all. Now each time client open a new ticket, then osTicket will send the password including the URL link to the client&#8217;s email. After the URL link clicked, then the ticket will be activated, and staff will be able to see this ticket on the list. </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%2F10%2F20%2Fpassword-needed-to-activate-a-ticket-in-osticket-v1-6-rc5%2F&amp;title=Password%20Needed%20to%20Activate%20A%20Ticket%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/10/20/password-needed-to-activate-a-ticket-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Send Email to User When The Limit Ticket is Reached in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/10/07/send-email-to-user-when-the-limit-ticket-is-reached-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/10/07/send-email-to-user-when-the-limit-ticket-is-reached-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 12:12:25 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[allow]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[limit]]></category>
		<category><![CDATA[reject]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[ticket]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=510</guid>
		<description><![CDATA[There was a new request that being asked to myself regarding the modification on osTicket System I made through this article: Limiting Tickets Sent by Same Email Within The Last N Days in osTicket. That request was about send email to user when the limit ticket is reached and the last ticket is rejected. So [...]]]></description>
			<content:encoded><![CDATA[<p>There was a new request that being asked to myself regarding the modification on osTicket System I made through this article: <a href="http://www.openscriptsolution.com/2009/09/27/limiting-tickets-sent-by-same-email-within-the-last-n-days-in-osticket/" target="_blank">Limiting Tickets Sent by Same Email Within The Last N Days in osTicket</a>. That request was about send email to user when the limit ticket is reached and the last ticket is rejected. So I made the modification by modifying the code based on that modification above. <span id="more-510"></span></p>
<p>Open <strong>\include\class.ticket.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1151
1152
1153
1154
1155
1156
1157
1158
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000088;">$sqllimit</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT email FROM '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
             WHERE 30 &gt;= TIMESTAMPDIFF(DAY,created,NOW()) 
             AND email='</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;">'email'</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;">$reslimit</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqllimit</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">// Limit only 3 tickets sent within the last 30 days</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reslimit</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'You are not allowed to send the ticket because you have already sent 3 tickets within the last 30 days!'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000088;">$sqllimit</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT email FROM '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
             WHERE 30 &gt;= TIMESTAMPDIFF(DAY,created,NOW()) 
             AND email='</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;">'email'</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;">$reslimit</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqllimit</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">// Limit only 3 tickets in the last 30 days</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reslimit</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</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>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</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;">$var</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Creating Ticket Denied'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'You are not allowed to send the ticket because you have already sent 3 ticket in the last 30 days!'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</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 are not allowed to send the ticket because you have already sent 3 ticket in the last 30 days!'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Hopefully this will be helpful.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F10%2F07%2Fsend-email-to-user-when-the-limit-ticket-is-reached-in-osticket-v1-6-rc5%2F&amp;title=Send%20Email%20to%20User%20When%20The%20Limit%20Ticket%20is%20Reached%20in%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/10/07/send-email-to-user-when-the-limit-ticket-is-reached-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Limiting Tickets Sent by Same Email Within The Last N Days in osTicket</title>
		<link>http://www.openscriptsolution.com/2009/09/27/limiting-tickets-sent-by-same-email-within-the-last-n-days-in-osticket/</link>
		<comments>http://www.openscriptsolution.com/2009/09/27/limiting-tickets-sent-by-same-email-within-the-last-n-days-in-osticket/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 10:17:44 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[limit]]></category>
		<category><![CDATA[reject]]></category>
		<category><![CDATA[send]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=437</guid>
		<description><![CDATA[As Administrator in your osTicket System, you want to limit tickets sent by the same user/email within the last period of days, somehow. For example, you want to limit only 3 tickets a user (determined from the email address) can submit within the last one month. When this condition meet the criteria, osTicket System will [...]]]></description>
			<content:encoded><![CDATA[<p>As Administrator in your osTicket System, you want to limit tickets sent by the same user/email within the last period of days, somehow. For example, you want to limit only 3 tickets a user (determined from the email address) can submit within the last one month. When this condition meet the criteria, osTicket System will display the message such as: &#8220;You are not allowed to send the ticket because you have already sent 3 tickets within the last 30 days!&#8221;, afterwards, the system will reject the ticket that user submitting immediately. So here is the solution that I made. <span id="more-437"></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>1152
1153
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">        <span style="color: #666666; font-style: italic;">//Any error above is fatal.</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$errors</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1151
1152
1153
1154
1155
1156
1157
1158
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000088;">$sqllimit</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT email FROM '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">'
             WHERE 30 &gt;= TIMESTAMPDIFF(DAY,created,NOW()) 
             AND email='</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;">'email'</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;">$reslimit</span><span style="color: #339933;">=</span>db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sqllimit</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">// Limit only 3 tickets sent within the last 30 days</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>db_num_rows<span style="color: #009900;">&#40;</span><span style="color: #000088;">$reslimit</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'You are not allowed to send the ticket because you have already sent 3 tickets within the last 30 days!'</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</li>
</ol>
<p>If somehow you want to change the period of the day (for example you want to change become one week), then you may change it the code above in part of:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">WHERE <span style="color: #cc66cc;">30</span> <span style="color: #339933;">&gt;=</span> TIMESTAMPDIFF<span style="color: #009900;">&#40;</span>DAY<span style="color: #339933;">,</span>created<span style="color: #339933;">,</span>NOW<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>become:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">WHERE <span style="color: #cc66cc;">7</span> <span style="color: #339933;">&gt;=</span> TIMESTAMPDIFF<span style="color: #009900;">&#40;</span>DAY<span style="color: #339933;">,</span>created<span style="color: #339933;">,</span>NOW<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>And don&#8217;t forget to adjust the message above that will be displayed to your client. <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%2F09%2F27%2Flimiting-tickets-sent-by-same-email-within-the-last-n-days-in-osticket%2F&amp;title=Limiting%20Tickets%20Sent%20by%20Same%20Email%20Within%20The%20Last%20N%20Days%20in%20osTicket" id="wpa2a_14"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/09/27/limiting-tickets-sent-by-same-email-within-the-last-n-days-in-osticket/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
