PDA

View Full Version : Ticket Source - Addition


JayDee
03-04-2008, 07:29 PM
Hey all,

I am trying to add the source "Counter" to the internal "New Ticket" feature but not having much luck. I was just wondering if someone would possible be able to steer me in the right direction.

I have added the "Counter" to the drop down menu in: /include/staff/newticket.inc.php

with the following code:
<option value="counter" <?=($info['source']=='counter')?'selected':''?>>Counter</option>

and also added the "Counter" to the ticket table Type in the sql.

All this does is tells me that the field is an * Invalid source

I am relatively new to this kind of programming, never done any site scripting before so learning as i go. Any help would be much appreciated.

Just had a quick look through the class.validator.php file but didn't really tell me too much. not really sure what i am looking for though.

Cheers

Jay

JayDee
03-06-2008, 08:42 PM
<pleed>

Even a suggestion at what other files i could look at would be great :)

</pleed>

JayDee
03-10-2008, 09:30 PM
Okay so below i have documented what i had to change to get this to work for me. Open to critasism

First as descriped above i added the Line of code into the newticket.inc.php so the table row source now looks like this

<tr>
<td align="left"><b>Ticket Source:</b></td>
<td>
<select name="source">
<option value="" selected >Select Source</option>
<option value="phone" <?=($info['source']=='phone')?'selected':''?>>Phone</option>
<option value="email" <?=($info['source']=='email')?'selected':''?>>Email</option>
<option value="counter" <?=($info['source']=='counter')?'selected':''?>>Counter</option>
<option value="phone" <?=($info['source']=='other')?'selected':''?>>Other</option>
</select>
&nbsp;<font class="error"><b>*</b>&nbsp;<?=$errors['source']?></font>
</td>
</tr>

Then I added "Counter" to the ticket_table under source so the Type is now enum("Web", "Phone", "Email", "Counter")

And finally the bit i was having trouble with. validating the new source. under scp/tickets.php there is the following statment:

if($_POST['source'] && !in_array($_POST['source'],array('email','phone','other')))
$errors['source']='Invalid source';

and all i did was change it to the following:

if($_POST['source'] && !in_array($_POST['source'],array('email','phone','counter','other')))
$errors['source']='Invalid source';

All pretty basic stuff but as i said i'm new to this, hope this helps anyone else needing to do the same kinda thing.

arrjones85
12-08-2008, 04:39 PM
Would you mind explaining more about how you changed this?

Specifically, I do not understand what you mean by this:

Then I added "Counter" to the ticket_table under source so the Type is now

enum("Web", "Phone", "Email", "Counter")



Where you I find this area of code?

Thanks!

sportykev
01-11-2011, 09:30 PM
Sorry to bring this from the dead, but I'm curious as to how to fix this as well.

ozkr
01-12-2011, 01:34 PM
JayDee solved this

in the part enum("Web", "Phone", "Email", "Counter")
you have to modify your MySql DB to match what jaydee post almost 3 years ago.