<?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; batch</title>
	<atom:link href="http://www.openscriptsolution.com/tag/batch/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>Showing Staff Members of Current Department on Batch Ticket Assign Modification in osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/12/15/showing-staff-members-of-current-department-on-batch-ticket-assign-modification-in-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/12/15/showing-staff-members-of-current-department-on-batch-ticket-assign-modification-in-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 16:07:01 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[assign]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[department]]></category>
		<category><![CDATA[staff-side]]></category>
		<category><![CDATA[ticket]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1031</guid>
		<description><![CDATA[For those of you who have implemented the modification I created about how to Add Batch Ticket Assign Feature into osTicket v1.6 RC5, and you want to display or show only staff members of current department on the staff selection list, then this modification is for you! Before you apply the following code, please remember [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who have implemented the modification I created about how to <a href="http://www.openscriptsolution.com/2009/11/01/add-batch-ticket-assign-feature-into-osticket-v1-6-rc5/">Add Batch Ticket Assign Feature into osTicket v1.6 RC5</a>, and you want to display or show only staff members of current department on the staff selection list, then this modification is for you! Before you apply the following code, please remember that you have to implement the previous modification that shown via the link above. <span id="more-1031"></span></p>
<p>Open your <strong>\include\staff\tickets.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>491
492
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                                <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">' SELECT staff_id,CONCAT_WS(&quot;, &quot;,lastname,firstname) as name FROM '</span><span style="color: #339933;">.</span>STAFF_TABLE<span style="color: #339933;">.</span>
                                     <span style="color: #0000ff;">' WHERE isactive=1 AND onvacation=0 '</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>491
492
493
494
495
496
497
498
499
500
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                                <span style="color: #000088;">$depts</span><span style="color: #339933;">=</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDepts</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;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">isadmin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                	<span style="color: #000088;">$where</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'WHERE isactive=1 AND onvacation=0 AND dept.dept_id=staff.dept_id '</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;">$where</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'WHERE isactive=1 AND onvacation=0 AND dept.dept_id=staff.dept_id '</span><span style="color: #339933;">.</span>
		                                      <span style="color: #0000ff;">'AND (staff.dept_id IN ('</span><span style="color: #339933;">.</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span><span style="color: #000088;">$depts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">') OR staff.staff_id='</span><span style="color: #339933;">.</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">') '</span><span style="color: #339933;">;</span>
                                <span style="color: #009900;">&#125;</span>
                                <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT staff.staff_id,CONCAT_WS(&quot;, &quot;,staff.lastname,staff.firstname) as name '</span><span style="color: #339933;">.</span>
				       <span style="color: #0000ff;">' FROM '</span><span style="color: #339933;">.</span>DEPT_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' dept, '</span><span style="color: #339933;">.</span>STAFF_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' staff '</span><span style="color: #339933;">.</span>
                                       <span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$where</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F12%2F15%2Fshowing-staff-members-of-current-department-on-batch-ticket-assign-modification-in-osticket-v1-6-rc5%2F&amp;title=Showing%20Staff%20Members%20of%20Current%20Department%20on%20Batch%20Ticket%20Assign%20Modification%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/12/15/showing-staff-members-of-current-department-on-batch-ticket-assign-modification-in-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Batch Ticket Assign Feature into osTicket v1.6 RC5</title>
		<link>http://www.openscriptsolution.com/2009/11/01/add-batch-ticket-assign-feature-into-osticket-v1-6-rc5/</link>
		<comments>http://www.openscriptsolution.com/2009/11/01/add-batch-ticket-assign-feature-into-osticket-v1-6-rc5/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 15:02:24 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[osTicket]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[assign]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[manager]]></category>
		<category><![CDATA[panel]]></category>
		<category><![CDATA[staff]]></category>
		<category><![CDATA[ticket]]></category>
		<category><![CDATA[unassigned]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=753</guid>
		<description><![CDATA[I am sure that this following new feature will be very useful, especially for admin and or manager, to do their job in osTicket System. It is a new feature about Batch Ticket Assign. Now admin and or manager will become easier in order to assign one or more tickets to a specified staff by [...]]]></description>
			<content:encoded><![CDATA[<p>I am sure that this following new feature will be very useful, especially for admin and or manager, to do their job in osTicket System. It is a new feature about Batch Ticket Assign. Now admin and or manager will become easier in order to assign one or more tickets to a specified staff by using this batch assign ticket feature. I have successfully created this modification, by adding a new sub tab named <strong>Unassigned Ticket</strong> under the <strong>Tickets</strong> tab in Staff Panel. </p>
<p>Edited on August 14, 2011: This modification also works fine with osTicket version 1.6 ST. I have tested it and make sure everything is okay. Also, I have just modified the line from 347 to 353 in my modification below, so it will fix the blank page problem. Please re-apply that line for those of you who encountered it.<br />
<span id="more-753"></span></p>
<ol>
<li>
Open your <strong>\include\staff\tickets.inc.php</strong> file, and find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$showoverdue</span><span style="color: #339933;">=</span><span style="color: #000088;">$showanswered</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">false</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>25
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$showunassigned</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// added by Masino Sinaga, Nov 1, 2009</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>41
42
43
44
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'assigned'</span><span style="color: #339933;">:</span>
        <span style="color: #666666; font-style: italic;">//$status='Open'; //</span>
        <span style="color: #000088;">$staffId</span><span style="color: #339933;">=</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>45
46
47
48
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'unassigned'</span><span style="color: #339933;">:</span>  <span style="color: #666666; font-style: italic;">// added by Masino Sinaga, Nov 1, 2009</span>
        <span style="color: #000088;">$showunassigned</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$staffId</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</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>108
109
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000088;">$qwhere</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">' AND isanswered=0 '</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>108
109
110
111
112
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000088;">$qwhere</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">' AND isanswered=0 '</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$showunassigned</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Unassigned by Masino Sinaga, Nov 1, 2009</span>
    <span style="color: #000088;">$results_type</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Unassigned Tickets'</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$qwhere</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">' AND ticket.staff_id=0 AND ticket.status=&quot;open&quot; '</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>456
457
458
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'open'</span><span style="color: #339933;">:</span>
                <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'answered'</span><span style="color: #339933;">:</span>
                <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'assigned'</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>455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                case 'unassigned':
                ?&gt;
			&lt;input type=&quot;hidden&quot; name=&quot;a&quot; value=&quot;mass_process&quot; &gt;                        
                        &lt;div&gt;
                            &lt;span for=&quot;staffId&quot;&gt;Staff Member:&lt;/span&gt;
                            &lt;select id=&quot;staffId&quot; name=&quot;staffId&quot;&gt;
                                &lt;option value=&quot;0&quot; selected=&quot;selected&quot;&gt;-Select Staff Member.-&lt;/option&gt;
                                <span style="color: #000000; font-weight: bold;">&lt;?</span>
                                <span style="color: #666666; font-style: italic;">//TODO: make sure the user's group is also active....DO a join.</span>
                                <span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">' SELECT staff_id,CONCAT_WS(&quot;, &quot;,lastname,firstname) as name FROM '</span><span style="color: #339933;">.</span>STAFF_TABLE<span style="color: #339933;">.</span>
                                     <span style="color: #0000ff;">' WHERE isactive=1 AND onvacation=0 '</span><span style="color: #339933;">;</span>
                                <span style="color: #000088;">$depts</span><span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' ORDER BY lastname,firstname '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$staffId</span><span style="color: #339933;">,</span><span style="color: #000088;">$staffName</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;">$depts</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
                                    <span style="color: #000088;">$selected</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'staffId'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #000088;">$staffId</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'selected'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
                                    &lt;option value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$staffId</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$selected</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$staffName</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/option&gt;
                                <span style="color: #000000; font-weight: bold;">&lt;?</span>
                                <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
                            &lt;/select&gt;&lt;font class='error'&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;">'staffId'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;
                        &lt;/div&gt;
                        &lt;div&gt;
                            &lt;span &gt;Comments/message for assignee. &amp;nbsp;(&lt;i&gt;Saved as internal note&lt;/i&gt;)
                                &lt;font class='error'&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;">'assign_message'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/font&gt;&lt;/span&gt;
                            &lt;textarea name=&quot;assign_message&quot; id=&quot;assign_message&quot; cols=&quot;50&quot; rows=&quot;7&quot; 
                                wrap=&quot;soft&quot; style=&quot;width:60%;&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?=</span><span style="color: #000088;">$info</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'assign_message'</span><span style="color: #009900;">&#93;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;
                        &lt;/div&gt;
                        &lt;input class=&quot;button&quot; type='submit' name='batchassign' value='Batch Assign' /&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>                    
                    <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>337
338
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                        <span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$i</span> of <span style="color: #006699; font-weight: bold;">$count</span> selected tickets deleted&quot;</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>337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">                        <span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$i</span> of <span style="color: #006699; font-weight: bold;">$count</span> selected tickets deleted&quot;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'batchassign'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  <span style="color: #666666; font-style: italic;">// MOD Batch Assign, added by Masino Sinaga, Nov 1, 2009</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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'staffId'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'assign_message'</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: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tids'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            <span style="color: #000088;">$t</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Ticket<span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$errors</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$t</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assignStaff</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'staffId'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'assign_message'</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;">$i</span><span style="color: #339933;">++;</span>
                            <span style="color: #009900;">&#125;</span>                            
                          <span style="color: #009900;">&#125;</span>
			  <span style="color: #000088;">$staff</span><span style="color: #339933;">=</span><span style="color: #000088;">$t</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getStaff</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                          <span style="color: #000088;">$msg</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$i</span> of <span style="color: #006699; font-weight: bold;">$count</span> selected ticket(s) assigned to &quot;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$staff</span>?<span style="color: #000088;">$staff</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: #339933;">:</span><span style="color: #0000ff;">'staff'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>						  
                          <span style="color: #666666; font-style: italic;">//Check access. This can be happened when the user reassigns the ticket.</span>
                          <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'staffId'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">canAccessDept</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$t</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDeptId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                            <span style="color: #000088;">$page</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'tickets.inc.php'</span><span style="color: #339933;">;</span>
                            <span style="color: #000088;">$ticket</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">;</span>
                          <span style="color: #009900;">&#125;</span> 
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                          <span style="color: #000088;">$errors</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'err'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Unable to batch assign the ticket(s), select assignee and or enter the message!'</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>428
429
430
431
432
433
434
435
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*quick stats...*/</span>
<span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT count(open.ticket_id) as open, count(answered.ticket_id) as answered '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">',count(overdue.ticket_id) as overdue, count(assigned.ticket_id) as assigned '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">' FROM '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' ticket '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">'LEFT JOIN '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' open ON open.ticket_id=ticket.ticket_id AND open.status=\'Open\' AND open.isanswered=0 '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">'LEFT JOIN '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' answered ON answered.ticket_id=ticket.ticket_id AND answered.status=\'Open\' AND answered.isanswered=1 '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">'LEFT JOIN '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' overdue ON overdue.ticket_id=ticket.ticket_id AND overdue.status=\'Open\' AND overdue.isoverdue=1 '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">'LEFT JOIN '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' assigned ON assigned.ticket_id=ticket.ticket_id AND assigned.staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>428
429
430
431
432
433
434
435
436
437
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*quick stats...*/</span>
<span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'SELECT count(open.ticket_id) as open, count(answered.ticket_id) as answered '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">',count(overdue.ticket_id) as overdue, count(assigned.ticket_id) as assigned '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">',count(unassigned.ticket_id) as unassigned '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">' FROM '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' ticket '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">'LEFT JOIN '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' open ON open.ticket_id=ticket.ticket_id AND open.status=\'Open\' AND open.isanswered=0 '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">'LEFT JOIN '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' answered ON answered.ticket_id=ticket.ticket_id AND answered.status=\'Open\' AND answered.isanswered=1 '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">'LEFT JOIN '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' overdue ON overdue.ticket_id=ticket.ticket_id AND overdue.status=\'Open\' AND overdue.isoverdue=1 '</span><span style="color: #339933;">.</span>
     <span style="color: #0000ff;">'LEFT JOIN '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' unassigned ON unassigned.ticket_id=ticket.ticket_id AND unassigned.staff_id=0 AND unassigned.status=\'open\' '</span><span style="color: #339933;">.</span> <span style="color: #666666; font-style: italic;">// Modified by Masino Sinaga, Nov 1, 2009</span>
     <span style="color: #0000ff;">'LEFT JOIN '</span><span style="color: #339933;">.</span>TICKET_TABLE<span style="color: #339933;">.</span><span style="color: #0000ff;">' assigned ON assigned.ticket_id=ticket.ticket_id AND assigned.staff_id='</span><span style="color: #339933;">.</span>db_input<span style="color: #009900;">&#40;</span><span style="color: #000088;">$thisuser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getId</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Find again this code (if you are running 1.6 RC5):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>460
461
462
463
</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;">$stats</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'assigned'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$nav</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addSubMenu</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desc'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'My Tickets ('</span><span style="color: #339933;">.</span><span style="color: #000088;">$stats</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'assigned'</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: #0000ff;">'title'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Assigned Tickets'</span><span style="color: #339933;">,</span>
                    <span style="color: #0000ff;">'href'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tickets.php?status=assigned'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iconclass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'assignedTickets'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>or if you are running 1.6 ST, then please find this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>479
480
481
482
483
484
485
</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;">$stats</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'assigned'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$sysnotice</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$stats</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'assigned'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$sysnotice</span><span style="color: #339933;">=</span><span style="color: #000088;">$stats</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'assigned'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' assigned to you!'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$nav</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addSubMenu</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desc'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'My Tickets ('</span><span style="color: #339933;">.</span><span style="color: #000088;">$stats</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'assigned'</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: #0000ff;">'title'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Assigned Tickets'</span><span style="color: #339933;">,</span>
                    <span style="color: #0000ff;">'href'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tickets.php?status=assigned'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iconclass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'assignedTickets'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

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

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>465
466
467
468
</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;">$stats</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'unassigned'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$nav</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addSubMenu</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'desc'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Unassigned Tickets ('</span><span style="color: #339933;">.</span><span style="color: #000088;">$stats</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'unassigned'</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: #0000ff;">'title'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'Unassigned Tickets'</span><span style="color: #339933;">,</span>
                    <span style="color: #0000ff;">'href'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tickets.php?status=unassigned'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'iconclass'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'assignedTickets'</span><span style="color: #009900;">&#41;</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; all. Enjoy the result, everyone! </p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.openscriptsolution.com%2F2009%2F11%2F01%2Fadd-batch-ticket-assign-feature-into-osticket-v1-6-rc5%2F&amp;title=Add%20Batch%20Ticket%20Assign%20Feature%20into%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/11/01/add-batch-ticket-assign-feature-into-osticket-v1-6-rc5/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
