Page 1 of 1

[v2.0] HESK - Submit ticket as Open/Closed option?

Posted: Tue Mar 24, 2009 12:24 pm
by MPH2008
Hey folks,

In the previous version we managed to get HESK working to submit a ticket as 'Closed' however in the recent one we have been unable to achieve this - partly due to messing up the CSS formatting and also interfacing with the ticket. Here is our current previous version code which doesn't function with V2.

Old version GUI:

Image

Code: Select all

<form method="POST" action="submit_ticket.php" name="form1" enctype="multipart/form-data">

<table border="0" cellspacing="0" cellpadding="5" size="560">
<tr>
<td>

<!-- Contact info -->
<table border="0">
<tr>
<td align="right" width="150"><font class="important">*</font><?php echo $hesklang['name']; ?> : </td>
<td align="left" width="550"><select name="name">
  <option value=""></option>
  </select></td>
</tr>
</table>

<hr>

<!-- Department and priority -->
<table border="0">
<tr>
<td align="right" width="150"><?php echo $hesklang['category']; ?>: </td>
<td align="left" width="550"><select name="category">
<?php
require_once('inc/database.inc.php');

hesk_dbConnect() or hesk_error("$hesklang[cant_connect_db] $hesklang[contact_webmsater] $hesk_settings[webmaster_mail]!");
$sql = "SELECT * FROM `hesk_categories` ORDER BY `cat_order` ASC";
$result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]");
while ($row=hesk_dbFetchAssoc($result))
{
    if ($_SESSION['c_category'] == $row['id']) {$selected = ' selected';}
    else {$selected = '';}
    echo '<option value="'.$row['id'].'"'.$selected.'>'.$row['name'].'</option>';
}

?>
</select></td>
</tr>
<tr>
<td align="right" width="150"><?php echo $hesklang['priority']; ?>:</td>
<td align="left" width="550"><select name="priority">
<option value="2" <?php if($_SESSION['c_priority']==2) {echo 'selected';} ?>><?php echo $hesklang['medium']; ?></option>
<option value="1" <?php if($_SESSION['c_priority']==1) {echo 'selected';} ?>><?php echo $hesklang['high']; ?></option>
<option value="3" <?php if($_SESSION['c_priority']==3) {echo 'selected';} ?>><?php echo $hesklang['low']; ?></option>
</select></td>
</tr>
</table>



<!-- START CUSTOM BEFORE -->
<?php
/* custom fields BEFORE comments */
if ($hesk_settings['use_custom'] && $hesk_settings['custom_place']==1) {

    echo '<table border="0">';

    foreach ($hesk_settings['custom_fields'] as $k=>$v) {
        if ($v['use']) {
            if ($v['req']) {$v['req']='<font class="important">*</font>';}
            else {$v['req']='';}
            $k_value = stripslashes(hesk_input($_SESSION["c_$k"]));
            echo <<<EOC
    <tr>
    <td align="right" width="150">$v[name]: $v[req]</td>
    <td align="left" width="550"><input type="text" name="$k" size="40" maxlength="$v[maxlen]" value="$k_value"></td>
    </tr>

EOC;
        }
    }

    echo '</table> <hr>';
}
?>
<!-- END CUSTOM BEFORE -->

<!-- ticket info -->
<table border="0">
<tr>
<td align="right" width="150"><font class="important">*</font><?php echo $hesklang['subject']; ?>: </td>
<td align="left" width="550"><input type="text" name="subject" size="40" maxlength="40" value="<?php echo stripslashes(hesk_input($_SESSION['c_subject']));?>"></td>
</tr>
<tr>
<td align="right" valign="top" width="150"><font class="important">*</font><?php echo $hesklang['message']; ?>: </td>
<td align="left" width="550"><p>
  <textarea name="message" rows="12" cols="50"><?php echo stripslashes(hesk_input($_SESSION['c_message']));?></textarea>
</p>
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="50%"><label><input type="radio" name="status" value="3" checked> <font class="resolved"><?php echo $hesklang['closed']; ?></label></td>

</tr>
<tr>
<td width="50%"><label><input type="radio" name="status" value="0"> <font class="open"><?php echo $hesklang['open']; ?></font></label></td>


</table>

</tr>
</table>

<hr>

<!-- START CUSTOM AFTER -->
<?php
/* custom fields AFTER comments */
if ($hesk_settings['use_custom'] && $hesk_settings['custom_place']==0) {

    echo '<table border="0">';

    foreach ($hesk_settings['custom_fields'] as $k=>$v) {
        if ($v['use']) {
            if ($v['req']) {$v['req']='<font class="important">*</font>';}
            else {$v['req']='';}
            $k_value = stripslashes(hesk_input($_SESSION["c_$k"]));
            echo <<<EOC
    <tr>
    <td align="right" width="150">$v[name]: $v[req]</td>
    <td align="left" width="550"><input type="text" name="$k" size="40" maxlength="$v[maxlen]" value="$k_value"></td>
    </tr>

EOC;
        }
    }

    echo '</table> <hr>';
}
?>
<!-- END CUSTOM AFTER -->

<?php
/* attachments */
if ($hesk_settings['attachments']['use']) {

?>
<table border="0">
<tr>
<td align="right" width="150" valign="top"><?php echo $hesklang['attachments']; ?>:</td>
<td align="left" width="550">
<p>

<?php
    for ($i=1;$i<=$hesk_settings['attachments']['max_number'];$i++) {
        echo '<input type="file" name="attachment['.$i.']" size="50"><br>';
    }
?> 

<?php echo$hesklang['accepted_types']; ?>: <?php echo '*'.implode(', *', $hesk_settings['attachments']['allowed_types']); ?><br>
<?php echo $hesklang['max_file_size']; ?>: <?php echo $hesk_settings['attachments']['max_size']; ?> Kb
(<?php echo sprintf("%01.2f",($hesk_settings['attachments']['max_size']/1024)); ?> Mb)</p>
</td>
</tr>
</table>

<hr>
<?php
}
?>

<!-- Submit -->
<div align="center">
<center>
<table border="0">
<tr>
<td>
<?php
if ($hesk_settings['secimg_use']) {
    echo '<p>&nbsp;<br><img src="print_sec_img.php?'.rand(10000,99999).'" width="100" height="20" alt="'.$hesklang['sec_img'].'" border="1"><br>'.
    $hesklang['sec_enter'].': <input type="text" name="mysecnum" size="10" maxlength="5"></p>
    <p>';
} else {
    echo '<p>&nbsp;<br>';
}
?>

</p>

<p align="center"><input type="submit" value="<?php echo $hesklang['sub_ticket']; ?>" class="button"></p>

</form>
Any ideas :oops: ?

TIA (thanks in advance)

Posted: Fri Apr 03, 2009 9:16 am
by MPH2008
Any ideas for the code tweaks to allow the CSS to add the following without screwing up the layout? : :

Code: Select all

<td width="50%"><label><input type="radio" name="status" value="3" checked> <font class="resolved"><?php echo $hesklang['closed']; ?></label></td>

</tr>
<tr>
<td width="50%"><label><input type="radio" name="status" value="0"> <font class="open"><?php echo $hesklang['open']; ?></font></label></td>
And also the correct DB modifications? :?

Posted: Tue Apr 21, 2009 1:18 pm
by MPH2008
I've dropped in the Open/Closed status box now, just need to get my head around what code to modify to get it functioning like the old version of HESK (see original code from 1st post).


Image

Posted: Tue Apr 21, 2009 2:24 pm
by ud2008
MPH2008 wrote:Any ideas for the code tweaks to allow the CSS to add the following without screwing up the layout? : :

Code: Select all

<td width="50%"><label><input type="radio" name="status" value="3" checked> <font class="resolved"><?php echo $hesklang['closed']; ?></label></td>

</tr>
<tr>
<td width="50%"><label><input type="radio" name="status" value="0"> <font class="open"><?php echo $hesklang['open']; ?></font></label></td>
And also the correct DB modifications? :?
You missed the a close FONT on the first font class, maybe a miss typo.

I also think you miss part of a code: (from admin_ticket), I could be wrong but I think your code misses this part. (or part or it)

Code: Select all

<?php
if ($ticket['status']==0||$ticket['status']==1||$ticket['status']==2)
{
  echo '<label><input type="checkbox" name="close" value="1" /> '.$hesklang['close_this_ticket'].'</label><br />';
}
?>