Page 1 of 1

Custom fields retain value from previous ticket entered.

Posted: Mon Jun 07, 2010 9:53 pm
by webduo
Write your message below:

I've used an earlier version of hesk and just started using the 2.1 version. My situation may be different from most as my customers will be entering multiple tickets on their end for their clients.

The issue I'm running into is specific to the customized fields:

1. When a user enters information into a ticket in one of the custom fields all is great until they need to create additional tickets. When opening up a new ticket, the customized fields retain the value entered into the last ticket.

This issue exists even if they close out of their browser and start over again - the custom fields still hold the value entered by them in a previous ticket.

Because my common user will need to be entering multiple tickets for various clients of theirs, the customized fields need to reset to a blank field for every new ticket opened. They'll kill me if I tell them they need to reset their cache before starting a new ticket. Right now it's a test site, so feel free to submit one and then try submitting another one to see that the fields are remaining filled in.

2. Issue #2 - I found something similar on post viewtopic.php?t=3106 (as I seem to be running into the same issue in that post also) but my site does not contain the admin/edit_ticket.php file referenced. I attempted that fix on admin/edit_post.php but it did not fix the issue, so I reverted back to the original edit_post.php file.

LOVE THE SCRIPT - easy to customize - keep up the great work!

Posted: Tue Jun 08, 2010 2:02 pm
by Klemen
Issue 1: Open submit_ticket.php and just above

Code: Select all

require_once(HESK_PATH . 'inc/header.inc.php');
paste this code:

Code: Select all

foreach ($hesk_settings['custom_fields'] as $k=>$v)
{
	if (isset($_SESSION["c_$k"]))
    {
    	unset($_SESSION["c_$k"]);
    }
}
Issue 2: in edit_ticket.php again

Code: Select all

require_once(HESK_PATH . 'inc/header.inc.php');
above try pasting this:

Code: Select all

foreach ($hesk_settings['custom_fields'] as $k=>$v)
{
	if (isset($_SESSION["$k"]))
    {
    	unset($_SESSION["$k"]);
    }
}

Half and half

Posted: Tue Jun 08, 2010 9:12 pm
by webduo
#1. At first the code change seemed to have the non-customized fields retain their previous entered value and the custom fields remained blank when submitting a new ticket (the opposite to the problem I originally reported) - but after taking a break and coming back to it, it now seems to be working correctly. I'll keep you posted.

For #2. I do not have a edit_ticket.php file so I assumed it is the edit_post.php file in the admin folder. Unfortunately the code change did not solve the issue. Still the same issue as the posting above. I did notice that in reference to issue #2, that if I edit the ticket and then post something to it, it still replaces my administrator name with the persons name on the ticket - as if they made the post - however, if I log out and then log back in, and make a post to that same ticket, it will display the correct name with me as the poster. For now I can just log out and then log back in as a temp fix, but any ideas would be great.

Still love this damn thing!

Posted: Wed Jun 09, 2010 12:30 pm
by Klemen
I believe you are having these problems because you have register_globals enabled in your PHP installation. Although some scripts require register_globals enabled, it is nowadays considered a significant security risk and disabled by default.

I would recommend waiting a little so that version 2.2 is officially released (this should happen any day now) and then upgrade 2.1 to 2.2, because version 2.2 handles these variables a bit differently and it should fix the problem automatically.

Thank you

Posted: Wed Jun 09, 2010 5:59 pm
by webduo
Thanks for the update. I'll wait and update to the next version. Again - great script and a very useful tool for places like the non-profit I work for.