Page 1 of 1

2.4 add time_worked field to the new ticket form

Posted: Fri Aug 17, 2012 7:04 pm
by dr_patso
I'm going to start working on this mod if anyone wants to contribute that may have better php/mysql knowledge than me.

We don't use the tool in a traditional sense, a lot of times we are pumping tickets in from our support queue that have already been completely or time has already been worked on them. Another thing that I might add is an option to submit the ticket as resolved already much like the option in the reply box.

Re: 2.4 add time_worked field to the new ticket form

Posted: Fri Aug 17, 2012 10:12 pm
by dr_patso
Image

I'm kind of getting there, I have it retaining entered values for hours right now, but for some reason they don't clear out after sucessfully submitting ticket like other retained fields upon error. Still need to figure out how to enter the values for h m and s into the database in the admin_submit_ticket.php

just under priority in /admin/new_ticket.php

Code: Select all

	<tr>
	<td style="text-align:right" width="150"><?php echo $hesklang['ts']; ?>:</td>
	<td><a href="Javascript:void(0)" onclick="Javascript:hesk_toggleLayerDisplay('modifytime')"></a>
	<div id="modifytime" style="display">
			<br />

			<form method="post" action="admin_ticket.php" style="margin:0px; padding:0px;">
			<table class="white">
			<tr>
				<td class="admin_gray"><?php echo $hesklang['hh']; ?>:</td>
				<td class="admin_gray"><input type="text" name="h" <?php if (in_array('priority',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> value="<?php if (isset($_SESSION['as_h'])) {echo stripslashes(hesk_input($_SESSION['as_h']));} ?>" <?php if (in_array('name',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> size="3" /></td>
			</tr>
			<tr>
				<td class="admin_gray"><?php echo $hesklang['mm']; ?>:</td>
				<td class="admin_gray"><input type="text" name="m" value="<?php echo $t[1]; ?>" size="3" /></td>
			</tr>
			<tr>
				<td class="admin_gray"><?php echo $hesklang['ss']; ?>:</td>
				<td class="admin_gray"><input type="text" name="s" value="<?php echo $t[2]; ?>" size="3" /></td>
			</tr>
			</table>

            <br />
	
	</tr>
	</table>
	<hr />
admin_submit_ticket.php under $hesk_error_buffer = array();

Code: Select all

$tmpvar['h'] = hesk_input($_POST['time_worked']);
$tmpvar['m'] = hesk_input($_POST['time_worked']);
$tmpvar['s'] = hesk_input($_POST['time_worked']);
admin_submit_ticket.php under

Code: Select all

// If we have any errors lets store info in session to avoid re-typing everything
if (count($hesk_error_buffer)!=0)

I have this below

Code: Select all

$_SESSION['as_h']  = $_POST['h'];

Re: 2.4 add time_worked field to the new ticket form

Posted: Sun Aug 19, 2012 3:41 am
by dr_patso
I cannot figure out what it takes to get the value into the database, I even created a blank field with the name time_worked and that doesn't work even if I put in the format 00:15:00

on /admin/new_ticket.php

Code: Select all

	<tr>
	<td style="text-align:right" width="150"><?php echo $hesklang['ts']; ?>: <font class="important">*</font></td>
	<td width="80%"><input type="text" name="time_worked" size="40" maxlength="70" value="<?php if (isset($_SESSION['as_time_worked'])) {echo stripslashes(hesk_input($_SESSION['as_time_worked']));} ?>" <?php if (in_array('time_worked',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> /></td>
	</tr>
and in /admin/admin_submit_ticket.php

Code: Select all

$tmpvar['time_worked'] = intval($_POST['time_worked']);
I'll keep toying but I think this is over my head.

Re: 2.4 add time_worked field to the new ticket form

Posted: Sun Aug 19, 2012 6:19 am
by Klemen
Did you modify SQL code in function hesk_newTicket (inc/posting_functions.inc.php) to insert the value in time_worked column?

By default HESK isn't inserting anything for the time_worked column because MySQL is using the default '00:00:00' value.

Re: 2.4 add time_worked field to the new ticket form

Posted: Sun Aug 19, 2012 6:55 am
by dr_patso
cool I will try that tonight.

Re: 2.4 add time_worked field to the new ticket form

Posted: Sun Aug 19, 2012 7:49 am
by dr_patso
damn! still can't get a time in there. I'm just putting 00:15:00 in the text field i made for "time_worked" between these 3 files I cannot tell what's different about this and the other fields that work, like subject/name etc...

/admin/admin_submit_ticket.php

Code: Select all

$tmpvar['name']	    = hesk_input($_POST['name']) or $hesk_error_buffer['name']=$hesklang['enter_your_name'];
$tmpvar['email']	= hesk_validateEmail($_POST['email'],'ERR',0) or $hesk_error_buffer['email']=$hesklang['enter_valid_email'];
$tmpvar['category'] = hesk_input($_POST['category']) or $hesk_error_buffer['category']=$hesklang['sel_app_cat'];
$tmpvar['priority'] = intval($_POST['priority']);
$tmpvar['time_worked'] = intval($_POST['time_worked']);
/admin/new_ticket.php

Code: Select all

	<tr>
	<td style="text-align:right" width="150"><?php echo $hesklang['ts']; ?>: <font class="important">*</font></td>
	<td width="80%"><input type="text" name="time_worked" size="40" maxlength="70" value="" /></td>
	</tr>
/inc/posting_functions.inc.php

Code: Select all

INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets`
	(
		`trackid`,
		`name`,
		`email`,
		`category`,
		`priority`,
		`subject`,
		`message`,
		`dt`,
		`lastchange`,
		`ip`,
		`language`,
		`owner`,
		`time_worked`,
		`attachments`,
		`merged`,
		`history`,
		`custom1`,
		`custom2`,
		`custom3`,
		`custom4`,
		`custom5`,
		`custom6`,
		`custom7`,
		`custom8`,
		`custom9`,
		`custom10`,
		`custom11`,
		`custom12`,
		`custom13`,
		`custom14`,
		`custom15`,
		`custom16`,
		`custom17`,
		`custom18`,
		`custom19`,
		`custom20`
	)
	VALUES
	(
		'".hesk_dbEscape($ticket['trackid'])."',
		'".hesk_dbEscape($ticket['name'])."',
		'".hesk_dbEscape($ticket['email'])."',
		'".hesk_dbEscape($ticket['category'])."',
		'".hesk_dbEscape($ticket['priority'])."',
		'".hesk_dbEscape($ticket['subject'])."',
		'".hesk_dbEscape($ticket['message'])."',
		NOW(),
		NOW(),
		'".hesk_dbEscape($_SERVER['REMOTE_ADDR'])."',
		$language,
		'".hesk_dbEscape($ticket['owner'])."',
		'".hesk_dbEscape($ticket['time_worked'])."',
		'".hesk_dbEscape($ticket['attachments'])."',
		'',
		'".hesk_dbEscape($ticket['history'])."',
		'".hesk_dbEscape($ticket['custom1'])."',
		'".hesk_dbEscape($ticket['custom2'])."',
		'".hesk_dbEscape($ticket['custom3'])."',
		'".hesk_dbEscape($ticket['custom4'])."',
		'".hesk_dbEscape($ticket['custom5'])."',
		'".hesk_dbEscape($ticket['custom6'])."',
		'".hesk_dbEscape($ticket['custom7'])."',
		'".hesk_dbEscape($ticket['custom8'])."',
		'".hesk_dbEscape($ticket['custom9'])."',
		'".hesk_dbEscape($ticket['custom10'])."',
		'".hesk_dbEscape($ticket['custom11'])."',
		'".hesk_dbEscape($ticket['custom12'])."',
		'".hesk_dbEscape($ticket['custom13'])."',
		'".hesk_dbEscape($ticket['custom14'])."',
		'".hesk_dbEscape($ticket['custom15'])."',
		'".hesk_dbEscape($ticket['custom16'])."',
		'".hesk_dbEscape($ticket['custom17'])."',
		'".hesk_dbEscape($ticket['custom18'])."',
		'".hesk_dbEscape($ticket['custom19'])."',
		'".hesk_dbEscape($ticket['custom20'])."'
	)
	";

Re: 2.4 add time_worked field to the new ticket form

Posted: Sun Aug 19, 2012 10:21 am
by Klemen
You're almost there, the problem is

Code: Select all

$tmpvar['time_worked'] = intval($_POST['time_worked']);
intval of "00:15:00" is "0"
http://php.net/manual/en/function.intval.php

You should try similar code as inside "admin_reply_ticket.php":

Code: Select all

$tmpvar['time_worked'] = hesk_getTime($_POST['time_worked']);

Re: 2.4 add time_worked field to the new ticket form

Posted: Sun Aug 19, 2012 10:24 am
by Klemen
Also two important things:

1. make sure the file using hesk_getTime() has "inc/admin_functions.inc.php" included.

2. before your "INSERT INTO ... " code I would add something like

Code: Select all

if ( ! isset($ticket['time_worked']) ) 
{
   $ticket['time_worked'] = '00:00:00';
}
so if a ticket is submitted using customer form or email piping/pop3 fetching it doesn't show notices/errors because $ticket['time_worked'] is not set.

Re: 2.4 add time_worked field to the new ticket form

Posted: Sun Aug 19, 2012 10:25 pm
by dr_patso
cool!

having

Code: Select all

$tmpvar['time_worked'] = hesk_getTime($_POST['time_worked']);
in /admin/submit_ticket.php works in that text field which means I could make a drop down with 15 minute intervals like I had before.

I have no idea what I would use to insert this data from my /admin/new_ticket.php

Code: Select all

	<tr>
	<td style="text-align:right" width="150"><?php echo $hesklang['ts']; ?>:</td>
	<td><a href="Javascript:void(0)" onclick="Javascript:hesk_toggleLayerDisplay('modifytime')"></a>

			<br />

			<form method="post" action="admin_submit_ticket.php" name="form1" enctype="multipart/form-data" style="margin:0px; padding:0px;">
			<table class="white">
			<tr>
				<td class="admin_gray"><?php echo $hesklang['hh']; ?>:</td>
				<td class="admin_gray"><input type="text" name="h" value="" size="3" /></td>
			</tr>
			<tr>
				<td class="admin_gray"><?php echo $hesklang['mm']; ?>:</td>
				<td class="admin_gray"><input type="text" name="m" value="" size="3" /></td>
			</tr>
			<tr>
				<td class="admin_gray"><?php echo $hesklang['ss']; ?>:</td>
				<td class="admin_gray"><input type="text" name="s" value="" size="3" /></td>
			</tr>
			</table>

            <br />
	
	</tr>
	</table>
	<hr />
I took out the php code in the value for "h" "m" and "s" because I figured it would be trying to pull from a non existent entry... I have tried plopping these codes around the /admin/new_ticket.php and /admin/admin_submit_ticket.php

Code: Select all

if ( ($can_reply || $can_edit) && isset($_POST['h']) && isset($_POST['m']) && isset($_POST['s']) && hesk_token_check($_POST['token']))
{
	$h = intval($_POST['h']);
	$m = intval($_POST['m']);
	$s = intval($_POST['s']);

	/* Get time worked in proper format */
    $time_worked = hesk_getTime($h . ':' . $m . ':' . $s);
that didn't really get me anywhere and then I tried mixing it in with some new $tmpvar in /admin/admin_submit_ticket.php

Code: Select all

$tmpvar['h'] = hesk_getHHMMSS($_POST['time_worked']);
$tmpvar['m'] = hesk_getHHMMSS($_POST['time_worked']);
$tmpvar['s'] = hesk_getHHMMSS($_POST['time_worked']);

also tried
$tmpvar['h'] = intval($_POST['h']);
$tmpvar['m'] = intval($_POST['m']);
$tmpvar['s'] = intval($_POST['s']);

and

$tmpvar['h'] = hesk_getTime($_POST['time_worked']);
anyway, maybe I'll keep cracking, most likely I will settle for the drop down, because I am now smoking more cigarettes. I thought if I could atleast get some of the 'h' 'm' 's' values inserted even in a wrong way I could start to get somewhere, just constant 00:00:00 for me after submitting ticket while experimenting with the hour minute second boxes

Re: 2.4 add time_worked field to the new ticket form

Posted: Mon Aug 20, 2012 1:17 pm
by dr_patso
well my mind is officially blown.

I have given up on the idea of hours minutes and seconds and gone with a drop down.. I have it fully functioning with error handling, yay!

To accomplish this fist add `time_worked`, to /inc/posting_functions.inc.php around line 62 just under `owner`

Code: Select all

		`owner`,
		`time_worked`,
in the same file /inc/posting_functions.inc.php add a similar entry for time_worked just under owner around line 101

Code: Select all

		'".hesk_dbEscape($ticket['owner'])."',
		'".hesk_dbEscape($ticket['time_worked'])."',
Then I add some stuff to /admin/admin_submit_ticket.php
add this code which is a single line around line 71

Code: Select all

$tmpvar['time_worked'] = hesk_input($_POST['time_worked']) or $hesk_error_buffer['time_worked']="Please select time worked";
just below

Code: Select all

$tmpvar['message']  = hesk_input($_POST['message']) or $hesk_error_buffer['message']=$hesklang['enter_message'];
in the same file /admin/admin_submit_ticket.php add

Code: Select all

	$_SESSION['as_time_worked']  = $_POST['time_worked'];
around line 200 just below

Code: Select all

    $_SESSION['as_message']  = $_POST['message'];
Now we get to add the field to /admin/new_ticket.php
add

Code: Select all

	<tr>
	<td style="text-align:right" width="150"><?php echo $hesklang['ts']; ?>: <font class="important">*</font></td>
	<td width="80%"> <select name="time_worked" <?php if (in_array('time_worked',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> >
	<option value=""/>-- Please select --</option>
	<option value="00:00:00" <?php if ($_SESSION['as_time_worked']=="00:00:00") {echo 'selected="selected"';} ?>/>00:00:00</option>
	<option value="00:15:00" <?php if ($_SESSION['as_time_worked']=="00:15:00") {echo 'selected="selected"';} ?>/>00:15:00</option>
	<option value="00:30:00" <?php if ($_SESSION['as_time_worked']=="00:30:00") {echo 'selected="selected"';} ?>/>00:30:00</option>
	<option value="00:45:00" <?php if ($_SESSION['as_time_worked']=="00:45:00") {echo 'selected="selected"';} ?>/>00:45:00</option>
	<option value="01:00:00" <?php if ($_SESSION['as_time_worked']=="01:00:00") {echo 'selected="selected"';} ?>/>01:00:00</option>
	<option value="01:15:00" <?php if ($_SESSION['as_time_worked']=="01:15:00") {echo 'selected="selected"';} ?>/>01:15:00</option>
	<option value="01:30:00" <?php if ($_SESSION['as_time_worked']=="01:30:00") {echo 'selected="selected"';} ?>/>01:30:00</option>
	<option value="01:45:00" <?php if ($_SESSION['as_time_worked']=="01:45:00") {echo 'selected="selected"';} ?>/>01:45:00</option>
	<option value="02:00:00" <?php if ($_SESSION['as_time_worked']=="02:00:00") {echo 'selected="selected"';} ?>/>02:00:00</option>
	<option value="02:15:00" <?php if ($_SESSION['as_time_worked']=="02:15:00") {echo 'selected="selected"';} ?>/>02:15:00</option>
	<option value="02:30:00" <?php if ($_SESSION['as_time_worked']=="02:30:00") {echo 'selected="selected"';} ?>/>02:30:00</option>
	<option value="02:45:00" <?php if ($_SESSION['as_time_worked']=="02:45:00") {echo 'selected="selected"';} ?>/>02:45:00</option>
	<option value="03:00:00" <?php if ($_SESSION['as_time_worked']=="03:00:00") {echo 'selected="selected"';} ?>/>03:00:00</option>
	<option value="03:15:00" <?php if ($_SESSION['as_time_worked']=="03:15:00") {echo 'selected="selected"';} ?>/>03:15:00</option>
	<option value="03:30:00" <?php if ($_SESSION['as_time_worked']=="03:30:00") {echo 'selected="selected"';} ?>/>03:30:00</option>
	<option value="03:45:00" <?php if ($_SESSION['as_time_worked']=="03:45:00") {echo 'selected="selected"';} ?>/>03:45:00</option>
	<option value="04:00:00" <?php if ($_SESSION['as_time_worked']=="04:00:00") {echo 'selected="selected"';} ?>/>04:00:00</option>
	<option value="04:15:00" <?php if ($_SESSION['as_time_worked']=="04:15:00") {echo 'selected="selected"';} ?>/>04:15:00</option>
	<option value="04:30:00" <?php if ($_SESSION['as_time_worked']=="04:30:00") {echo 'selected="selected"';} ?>/>04:30:00</option>
	<option value="04:45:00" <?php if ($_SESSION['as_time_worked']=="04:45:00") {echo 'selected="selected"';} ?>/>04:45:00</option>
	<option value="05:00:00" <?php if ($_SESSION['as_time_worked']=="05:00:00") {echo 'selected="selected"';} ?>/>05:00:00</option>
	<option value="05:15:00" <?php if ($_SESSION['as_time_worked']=="05:15:00") {echo 'selected="selected"';} ?>/>05:15:00</option>
	<option value="05:30:00" <?php if ($_SESSION['as_time_worked']=="05:30:00") {echo 'selected="selected"';} ?>/>05:30:00</option>
	<option value="05:45:00" <?php if ($_SESSION['as_time_worked']=="05:45:00") {echo 'selected="selected"';} ?>/>05:45:00</option>
	<option value="06:00:00" <?php if ($_SESSION['as_time_worked']=="06:00:00") {echo 'selected="selected"';} ?>/>06:00:00</option>
	<option value="06:15:00" <?php if ($_SESSION['as_time_worked']=="06:15:00") {echo 'selected="selected"';} ?>/>06:15:00</option>
	<option value="06:30:00" <?php if ($_SESSION['as_time_worked']=="06:30:00") {echo 'selected="selected"';} ?>/>06:30:00</option>
	<option value="06:45:00" <?php if ($_SESSION['as_time_worked']=="06:45:00") {echo 'selected="selected"';} ?>/>06:45:00</option>
	<option value="07:00:00" <?php if ($_SESSION['as_time_worked']=="07:00:00") {echo 'selected="selected"';} ?>/>07:00:00</option>
	<option value="07:15:00" <?php if ($_SESSION['as_time_worked']=="07:15:00") {echo 'selected="selected"';} ?>/>07:15:00</option>
	<option value="07:30:00" <?php if ($_SESSION['as_time_worked']=="07:30:00") {echo 'selected="selected"';} ?>/>07:30:00</option>
	<option value="07:45:00" <?php if ($_SESSION['as_time_worked']=="07:45:00") {echo 'selected="selected"';} ?>/>07:45:00</option>
	<option value="08:00:00" <?php if ($_SESSION['as_time_worked']=="08:00:00") {echo 'selected="selected"';} ?>/>08:00:00</option>
	<option value="08:15:00" <?php if ($_SESSION['as_time_worked']=="08:15:00") {echo 'selected="selected"';} ?>/>08:15:00</option>
	<option value="08:30:00" <?php if ($_SESSION['as_time_worked']=="08:30:00") {echo 'selected="selected"';} ?>/>08:30:00</option>
	<option value="08:45:00" <?php if ($_SESSION['as_time_worked']=="08:45:00") {echo 'selected="selected"';} ?>/>08:45:00</option>
	<option value="09:00:00" <?php if ($_SESSION['as_time_worked']=="09:00:00") {echo 'selected="selected"';} ?>/>09:00:00</option>
	<option value="09:15:00" <?php if ($_SESSION['as_time_worked']=="09:15:00") {echo 'selected="selected"';} ?>/>09:15:00</option>
	<option value="09:30:00" <?php if ($_SESSION['as_time_worked']=="09:30:00") {echo 'selected="selected"';} ?>/>09:30:00</option>
	<option value="09:45:00" <?php if ($_SESSION['as_time_worked']=="09:45:00") {echo 'selected="selected"';} ?>/>09:45:00</option>
	<option value="10:00:00" <?php if ($_SESSION['as_time_worked']=="10:00:00") {echo 'selected="selected"';} ?>/>10:00:00</option>
	<option value="10:15:00" <?php if ($_SESSION['as_time_worked']=="10:15:00") {echo 'selected="selected"';} ?>/>10:15:00</option>
	<option value="10:30:00" <?php if ($_SESSION['as_time_worked']=="10:30:00") {echo 'selected="selected"';} ?>/>10:30:00</option>
	<option value="10:45:00" <?php if ($_SESSION['as_time_worked']=="10:45:00") {echo 'selected="selected"';} ?>/>10:45:00</option>
	<option value="11:00:00" <?php if ($_SESSION['as_time_worked']=="11:00:00") {echo 'selected="selected"';} ?>/>11:00:00</option>
	<option value="11:15:00" <?php if ($_SESSION['as_time_worked']=="11:15:00") {echo 'selected="selected"';} ?>/>11:15:00</option>
	<option value="11:30:00" <?php if ($_SESSION['as_time_worked']=="11:30:00") {echo 'selected="selected"';} ?>/>11:30:00</option>
	<option value="11:45:00" <?php if ($_SESSION['as_time_worked']=="11:45:00") {echo 'selected="selected"';} ?>/>11:45:00</option>
	<option value="12:00:00" <?php if ($_SESSION['as_time_worked']=="12:00:00") {echo 'selected="selected"';} ?>/>12:00:00</option>
	<option value="12:15:00" <?php if ($_SESSION['as_time_worked']=="12:15:00") {echo 'selected="selected"';} ?>/>12:15:00</option>
	<option value="12:30:00" <?php if ($_SESSION['as_time_worked']=="12:30:00") {echo 'selected="selected"';} ?>/>12:30:00</option>
	<option value="12:45:00" <?php if ($_SESSION['as_time_worked']=="12:45:00") {echo 'selected="selected"';} ?>/>12:45:00</option>
	<option value="13:00:00" <?php if ($_SESSION['as_time_worked']=="13:00:00") {echo 'selected="selected"';} ?>/>13:00:00</option>
	<option value="13:15:00" <?php if ($_SESSION['as_time_worked']=="13:15:00") {echo 'selected="selected"';} ?>/>13:15:00</option>
	<option value="13:30:00" <?php if ($_SESSION['as_time_worked']=="13:30:00") {echo 'selected="selected"';} ?>/>13:30:00</option>
	<option value="13:45:00" <?php if ($_SESSION['as_time_worked']=="13:45:00") {echo 'selected="selected"';} ?>/>13:45:00</option>
	<option value="14:00:00" <?php if ($_SESSION['as_time_worked']=="14:00:00") {echo 'selected="selected"';} ?>/>14:00:00</option>
	<option value="14:15:00" <?php if ($_SESSION['as_time_worked']=="14:15:00") {echo 'selected="selected"';} ?>/>14:15:00</option>
	<option value="14:30:00" <?php if ($_SESSION['as_time_worked']=="14:30:00") {echo 'selected="selected"';} ?>/>14:30:00</option>
	<option value="14:45:00" <?php if ($_SESSION['as_time_worked']=="14:45:00") {echo 'selected="selected"';} ?>/>14:45:00</option>
	<option value="15:00:00" <?php if ($_SESSION['as_time_worked']=="15:00:00") {echo 'selected="selected"';} ?>/>15:00:00</option>
	</td>
	</tr>
just below priority

Code: Select all

	<tr>
	<td style="text-align:right" width="150"><?php echo $hesklang['priority']; ?>: <font class="important">*</font></td>
	<td width="80%"><select name="priority" <?php if (in_array('priority',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> >
	<option value="3" <?php if(isset($_SESSION['as_priority']) && $_SESSION['as_priority']==3) {echo 'selected="selected"';} ?>><?php echo $hesklang['low']; ?></option>
	<option value="2" <?php if(isset($_SESSION['as_priority']) && $_SESSION['as_priority']==2) {echo 'selected="selected"';} ?>><?php echo $hesklang['medium']; ?></option>
	<option value="1" <?php if(isset($_SESSION['as_priority']) && $_SESSION['as_priority']==1) {echo 'selected="selected"';} ?>><?php echo $hesklang['high']; ?></option>
	<option value="0" <?php if(isset($_SESSION['as_priority']) && $_SESSION['as_priority']==0) {echo 'selected="selected"';} ?>><?php echo $hesklang['critical']; ?></option>
	</select></td>
	</tr>
and it goes just above the end of that table: example below

Code: Select all

	</table>
	<hr />

Re: 2.4 add time_worked field to the new ticket form

Posted: Mon Aug 20, 2012 1:21 pm
by dr_patso
something is wrong with the way the form retains data.

In testing when I do error on another field while submitting the ticket say, i forget a subject line. The selection under time_worked is retained. However upon successful submission, when I go back to create a new ticket it's still stuck on the same selection.

I have no idea how this is happening as the session is no longer ['as_time_worked']

Code: Select all

<option value="00:00:00" <?php if ($_SESSION['as_time_worked']=="00:00:00") {echo 'selected="selected"';} ?>/>00:00:00</option>

Re: 2.4 add time_worked field to the new ticket form

Posted: Mon Aug 20, 2012 5:31 pm
by Klemen
In admin_submit_ticket find

Code: Select all

hesk_cleanSessionVars
and somewhere along those lines add

Code: Select all

hesk_cleanSessionVars('as_time_worked');
then try submitting a new ticket.

Re: 2.4 add time_worked field to the new ticket form

Posted: Mon Aug 20, 2012 6:52 pm
by dr_patso
oh that makes sense, thanks Klemen! kinda bummed I couldn't figure out how in admin_submit_ticket to grab data from the ['h'] ['m'] ['s'] fields in /admin/new_ticket.php and submit to time_worked.. I bought a php mysql book though so maybe I can figure it out down the road, after I become a 4 pack a day smoker.