Browse Source

Closes #74: A new ticket can be modeled after an existing ticket

A dropdown on creation was not feasible, but this works just as well and can be used outside of HESK
merge-requests/2/head
Mike Koch 7 years ago
parent
commit
219b722917
  1. 34
      admin/admin_ticket.php
  2. 43
      admin/new_ticket.php
  3. 1
      css/hesk_newStyle.php
  4. 1
      css/hesk_newStyleRTL.php
  5. 1
      language/en/text.php

34
admin/admin_ticket.php

@ -630,13 +630,13 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
</div>
</div>
<div class="row">
<div class="col-md-3 col-sm-12">
<div class="col-md-3 col-sm-12" style="padding-top: 6px">
<p><?php echo $hesklang['created_on'].': '.hesk_date($ticket['dt']); ?></p>
</div>
<div class="col-md-3 col-sm-12">
<div class="col-md-3 col-sm-12" style="padding-top: 6px">
<p><?php echo $hesklang['last_update'].': '.hesk_date($ticket['lastchange']); ?></p>
</div>
<div class="col-md-2 col-md-offset-4 col-sm-12 close-ticket">
<div class="col-md-6 col-sm-12 close-ticket">
<?php
$random=rand(10000,99999);
@ -659,16 +659,40 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
$isTicketClosedRow = hesk_dbQuery($isTicketClosedSql)->fetch_assoc();
$isTicketClosed = $isTicketClosedRow['IsClosed'];
echo '<div class="btn-group" role="group">';
if ($isTicketClosed == 0) // Ticket is still open
{
echo '<a
href="change_status.php?track='.$trackingID.'&amp;s='.$staffClosedOptionStatus['ID'].'&amp;Refresh='.$random.'&amp;token='.hesk_token_echo(0).'">'.$hesklang['close_action'].'</a>';
class="btn btn-default btn-sm" href="change_status.php?track='.$trackingID.'&amp;s='.$staffClosedOptionStatus['ID'].'&amp;Refresh='.$random.'&amp;token='.hesk_token_echo(0).'">
<i class="fa fa-check-circle"></i> '.$hesklang['close_action'].'</a>';
}
else
{
echo '<a
href="change_status.php?track='.$trackingID.'&amp;s='.$staffReopenedStatus['ID'].'&amp;Refresh='.$random.'&amp;token='.hesk_token_echo(0).'">'.$hesklang['open_action'].'</a>';
class="btn btn-default btn-sm" href="change_status.php?track='.$trackingID.'&amp;s='.$staffReopenedStatus['ID'].'&amp;Refresh='.$random.'&amp;token='.hesk_token_echo(0).'">
<i class="fa fa-check-circle"></i> '.$hesklang['open_action'].'</a>';
}
$linkText = 'new_ticket.php?name='.$ticket['name'].'&email='.$ticket['email'].'&catid='.$category['id'].'&priority='.$ticket['priority'];
foreach ($hesk_settings['custom_fields'] as $k=>$v)
{
if ($v['use'] == 1)
{
if ($v['type'] == 'checkbox')
{
$value = str_replace('<br />', '-CHECKBOX-', $ticket[$k]);
} else {
$value = $ticket[$k];
}
$linkText .= '&c_'.$k.'='.$value;
}
}
echo '<a class="btn btn-default btn-sm" href="'.$linkText.'">
<i class="fa fa-plus"></i> '.$hesklang['create_based_on_contact'].'
</a>';
echo '</div>';
?>
</div>
</div>

43
admin/new_ticket.php

@ -116,13 +116,19 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<?php if (in_array('name',$_SESSION['iserror'])) {echo '<div class="form-group has-error">';} else {echo '<div class="form-group">';} ?>
<label for="name" class="col-sm-3 control-label"><?php echo $hesklang['name']; ?>: <font class="important">*</font></label>
<div class="col-sm-9">
<input type="text" class="form-control" name="name" size="40" maxlength="30" value="<?php if (isset($_SESSION['as_name'])) {echo stripslashes(hesk_input($_SESSION['as_name']));} ?>" placeholder="<?php echo $hesklang['name']; ?>"/>
<input type="text" class="form-control" name="name" size="40" maxlength="30"
value="<?php if (isset($_SESSION['as_name'])) {echo stripslashes(hesk_input($_SESSION['as_name']));}
else if (isset($_GET['name'])) {echo hesk_GET('name');} ?>"
placeholder="<?php echo $hesklang['name']; ?>">
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-3 control-label"><?php echo $hesklang['email']; ?>: </label>
<div class="col-sm-9">
<input type="text" class="form-control" name="email" size="40" maxlength="255" value="<?php if (isset($_SESSION['as_email'])) {echo stripslashes(hesk_input($_SESSION['as_email']));} ?>" <?php if($hesk_settings['detect_typos']) { echo ' onblur="Javascript:hesk_suggestEmail(1)"'; } ?> placeholder="<?php echo $hesklang['email']; ?>"/>
<input type="text" class="form-control" name="email" size="40" maxlength="255"
value="<?php if (isset($_SESSION['as_email'])) {echo stripslashes(hesk_input($_SESSION['as_email']));}
else if (isset($_GET['email'])) {echo hesk_GET('email');} ?>" <?php if($hesk_settings['detect_typos']) { echo ' onblur="Javascript:hesk_suggestEmail(1)"'; } ?>
placeholder="<?php echo $hesklang['email']; ?>">
</div>
</div>
@ -154,10 +160,18 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<label for="priority" class="col-sm-3 control-label"><?php echo $hesklang['priority']; ?>: <font class="important">*</font></label>
<div class="col-sm-9">
<select name="priority" class="form-control">
<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>
<option value="3" <?php
if((isset($_SESSION['as_priority']) && $_SESSION['as_priority']==3)
|| (isset($_GET['priority']) && $_GET['priority']==3)) {echo 'selected="selected"';} ?>><?php echo $hesklang['low']; ?></option>
<option value="2" <?php
if((isset($_SESSION['as_priority']) && $_SESSION['as_priority']==2)
|| (isset($_GET['priority']) && $_GET['priority']==2)) {echo 'selected="selected"';} ?>><?php echo $hesklang['medium']; ?></option>
<option value="1" <?php
if((isset($_SESSION['as_priority']) && $_SESSION['as_priority']==1)
|| (isset($_GET['priority']) && $_GET['priority']==1)) {echo 'selected="selected"';} ?>><?php echo $hesklang['high']; ?></option>
<option value="0" <?php
if((isset($_SESSION['as_priority']) && $_SESSION['as_priority']==0)
|| (isset($_GET['priority']) && $_GET['priority']==0)) {echo 'selected="selected"';} ?>><?php echo $hesklang['critical']; ?></option>
</select>
</div>
</div>
@ -174,7 +188,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
// Staff doesn't need to fill in required custom fields
$v['req'] = '';
if ($v['type'] == 'checkbox')
if ($v['type'] == 'checkbox' && !isset($_GET["c_$k"]))
{
$k_value = array();
if (isset($_SESSION["c_$k"]) && is_array($_SESSION["c_$k"]))
@ -189,6 +203,16 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
{
$k_value = stripslashes(hesk_input($_SESSION["c_$k"]));
}
elseif (isset($_GET["c_$k"]))
{
if ($v['type'] == 'checkbox')
{
$k_value = explode('-CHECKBOX-', $_GET["c_$k"]);
} else
{
$k_value = stripslashes(hesk_GET("c_$k"));
}
}
else
{
$k_value = '';
@ -254,8 +278,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
/* Checkbox */
case 'checkbox':
echo '<div class="form-group"><label class="col-sm-3 control-label">'.$v['name'].': '.$v['req'].'</label><div align="left" class="col-sm-9">';
$options = explode('#HESK#',$v['value']);
$options = explode('#HESK#',$v['value']);
$cls = in_array($k,$_SESSION['iserror']) ? ' class="isError" ' : '';
foreach ($options as $option)
@ -311,7 +334,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<?php if (in_array('subject',$_SESSION['iserror'])) {echo '<div class="form-group has-error">';} else {echo '<div class="form-group">';} ?>
<label for="subject" class="col-sm-3 control-label"><?php echo $hesklang['subject']; ?>: <font class="important">*</font></label>
<div class="col-sm-9">
<input class="form-control" type="text" name="subject" size="40" maxlength="40" value="<?php if (isset($_SESSION['as_subject'])) {echo stripslashes(hesk_input($_SESSION['as_subject']));} ?>" placeholder="<?php echo $hesklang['subject']; ?>" />
<input class="form-control" type="text" name="subject" size="40" maxlength="40" value="<?php if (isset($_SESSION['as_subject']) || isset($_GET['subject'])) {echo stripslashes(hesk_input($_SESSION['as_subject']));} ?>" placeholder="<?php echo $hesklang['subject']; ?>" />
</div>
</div>
<?php if (in_array('message',$_SESSION['iserror'])) {echo '<div class="form-group has-error">';} else {echo '<div class="form-group">';} ?>

1
css/hesk_newStyle.php

@ -39,6 +39,7 @@
@media (min-width:992px) {
.close-ticket {
text-align: right;
padding-bottom: 5px;
}
}

1
css/hesk_newStyleRTL.php

@ -39,6 +39,7 @@
@media (min-width:992px) {
.close-ticket {
text-align: left;
padding-bottom: 5px;
}
}

1
language/en/text.php

@ -25,6 +25,7 @@ $hesklang['EMAIL_HR']='------ Reply above this line ------';
$hesklang['ticket_closed'] = '[#%%TRACK_ID%%] Ticket closed/resolved';
$hesklang['ticket_reopen'] = '[#%%TRACK_ID%%] Ticket reopened';
$hesklang['ticket_reopen_assigned'] = '[#%%TRACK_ID%%] Assigned ticket reopened';
$hesklang['create_based_on_contact'] = 'Create Ticket For Same Contact';
// ADDED OR MODIFIED IN NuMods 1.5.0
$hesklang['ticket_auto_refresh'] = 'Ticket Table Auto-Refresh:';

Loading…
Cancel
Save