' . $hesklang['e_cdir']; + } + } else { + echo '' . $hesklang['no_exists'] . ', ' . $hesklang['not_writable'] . '
' . $hesklang['e_cdir']; + } + ?> +
- -
-- - -
- | - | - | - - | -- | - | - | - - | -- | - |
- - - |
- - - - ' . $hesklang['opt'] . ' - | - - - '; - } // End FOR - ?> -
---|
Common Properties
+Customer View
Admin Panel
'; +foreach ($hesk_settings['custom_fields'] as $k=>$v) { + if ($v['use'] && hesk_is_custom_field_in_category($k, $tmpvar['category'])) { + if ($v['type'] == 'checkbox') { + $tmpvar[$k]=''; + + if (isset($_POST[$k]) && is_array($_POST[$k])) { + foreach ($_POST[$k] as $myCB) { + $tmpvar[$k] .= ( is_array($myCB) ? '' : hesk_input($myCB) ) . '
';; + } + $tmpvar[$k]=substr($tmpvar[$k],0,-6); + } else { + if ($v['req'] == 2) { + $hesk_error_buffer[$k]=$hesklang['fill_all'].': '.$v['name']; + } + $_POST[$k] = ''; + } + } elseif ($v['type'] == 'date') { + $tmpvar[$k] = hesk_POST($k); + $_SESSION["as_$k"] = ''; + if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $tmpvar[$k])) { + $date = strtotime($tmpvar[$k] . ' t00:00:00'); + $dmin = strlen($v['value']['dmin']) ? strtotime($v['value']['dmin'] . ' t00:00:00') : false; + $dmax = strlen($v['value']['dmax']) ? strtotime($v['value']['dmax'] . ' t00:00:00') : false; + + $_SESSION["as_$k"] = $tmpvar[$k]; + + if ($dmin && $dmin > $date) { + $hesk_error_buffer[$k] = sprintf($hesklang['d_emin'], $v['name'], hesk_custom_date_display_format($dmin, $v['value']['date_format'])); + } elseif ($dmax && $dmax < $date) { + $hesk_error_buffer[$k] = sprintf($hesklang['d_emax'], $v['name'], hesk_custom_date_display_format($dmax, $v['value']['date_format'])); + } else { + $tmpvar[$k] = $date; + } + } else { + $tmpvar[$k] = ''; + + if ($v['req'] == 2) { + $hesk_error_buffer[$k]=$hesklang['fill_all'].': '.$v['name']; + } + } + } elseif ($v['type'] == 'email') + { + $tmp = $hesk_settings['multi_eml']; + $hesk_settings['multi_eml'] = $v['value']['multiple']; + $tmpvar[$k] = hesk_validateEmail( hesk_POST($k), 'ERR', 0); + $hesk_settings['multi_eml'] = $tmp; + + if ($tmpvar[$k] != '') { + $_SESSION["as_$k"] = hesk_input($tmpvar[$k]); + } else { + $_SESSION["as_$k"] = ''; + + if ($v['req'] == 2) { + $hesk_error_buffer[$k] = $v['value']['multiple'] ? sprintf($hesklang['cf_noem'], $v['name']) : sprintf($hesklang['cf_noe'], $v['name']); + } + } + } elseif ($v['req'] == 2) { + $tmpvar[$k]=hesk_makeURL(nl2br(hesk_input( hesk_POST($k) ))); + if ($tmpvar[$k] == '') { + $hesk_error_buffer[$k]=$hesklang['fill_all'].': '.$v['name']; } - $tmpvar[$k] = substr($tmpvar[$k], 0, -6); } else { - $tmpvar[$k] = hesk_makeURL(nl2br(hesk_input($_POST[$k]))); + $tmpvar[$k]=hesk_makeURL(nl2br(hesk_input(hesk_POST($k)))); } } else { $tmpvar[$k] = ''; @@ -202,7 +278,6 @@ if (count($hesk_error_buffer) != 0) { $_SESSION['as_name'] = hesk_POST('name'); $_SESSION['as_email'] = hesk_POST('email'); - $_SESSION['as_category'] = hesk_POST('category'); $_SESSION['as_priority'] = $tmpvar['priority']; $_SESSION['as_subject'] = hesk_POST('subject'); $_SESSION['as_message'] = hesk_POST('message'); @@ -211,7 +286,7 @@ if (count($hesk_error_buffer) != 0) { $_SESSION['as_show'] = $show; foreach ($hesk_settings['custom_fields'] as $k => $v) { - if ($v['use']) { + if ($v['use'] && ! in_array($v['type'], array('date', 'email'))) { $_SESSION["as_$k"] = ($v['type'] == 'checkbox') ? hesk_POST_array($k) : hesk_POST($k); } } @@ -228,7 +303,7 @@ if (count($hesk_error_buffer) != 0) { } $hesk_error_buffer = $hesklang['pcer'] . '
- ' . $hesk_error_buffer . '
@@ -1025,15 +1060,19 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); '; + if ( ! $ticket['owner']) + { + echo ''; + } + echo '
'; echo isset($admins[$ticket['owner']]) ? $admins[$ticket['owner']] : - ($can_assign_self ? $hesklang['unas'] . ' [' . $hesklang['asss'] . ']' : $hesklang['unas']); + ($can_assign_self ? $hesklang['unas'] . ' [' . $hesklang['asss'] . ']' : $hesklang['unas']); echo '
'; } - echo '' . $hesklang['category'] . '
'; - if ($can_change_cat) { + if (strlen($categories_options) && ($can_change_cat || $can_change_own_cat)) { echo '+
@@ -1419,7 +1458,7 @@ function hesk_getAdminButtons($category_id) $isClosable = $isTicketClosedRow['Closable'] == 'yes' || $isTicketClosedRow['Closable'] == 'sonly'; $mgr = $isManager ? '&isManager=1' : ''; - if ($isTicketClosed == 0 && $isClosable) // Ticket is still open + if ($isTicketClosed == 0 && $isClosable && $can_resolve) // Ticket is still open { $dropdown .= '
- '.$hesk_error_buffer.'
- '.$hesk_error_buffer.'
'; + } + $tmpvar[$k]=substr($tmpvar[$k],0,-6); + } else { + if ($v['req'] == 2) { + $hesk_error_buffer[$k]=$hesklang['fill_all'].': '.$v['name']; + } + $_POST[$k] = ''; + } + } elseif ($v['type'] == 'date') { + $tmpvar[$k] = hesk_POST($k); + $_SESSION["as_$k"] = ''; + + if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $tmpvar[$k])) { + $date = strtotime($tmpvar[$k] . ' t00:00:00'); + $dmin = strlen($v['value']['dmin']) ? strtotime($v['value']['dmin'] . ' t00:00:00') : false; + $dmax = strlen($v['value']['dmax']) ? strtotime($v['value']['dmax'] . ' t00:00:00') : false; + + $_SESSION["as_$k"] = $tmpvar[$k]; + + if ($dmin && $dmin > $date) { + $hesk_error_buffer[$k] = sprintf($hesklang['d_emin'], $v['name'], hesk_custom_date_display_format($dmin, $v['value']['date_format'])); + } elseif ($dmax && $dmax < $date) { + $hesk_error_buffer[$k] = sprintf($hesklang['d_emax'], $v['name'], hesk_custom_date_display_format($dmax, $v['value']['date_format'])); + } else { + $tmpvar[$k] = $date; + } + } else { + if ($v['req'] == 2) { + $hesk_error_buffer[$k]=$hesklang['fill_all'].': '.$v['name']; + } + } + } elseif ($v['type'] == 'email') { + $tmp = $hesk_settings['multi_eml']; + $hesk_settings['multi_eml'] = $v['value']['multiple']; + $tmpvar[$k] = hesk_validateEmail( hesk_POST($k), 'ERR', 0); + $hesk_settings['multi_eml'] = $tmp; + + if ($tmpvar[$k] != '') { + $_SESSION["as_$k"] = hesk_input($tmpvar[$k]); + } else { + $_SESSION["as_$k"] = ''; + + if ($v['req'] == 2) { + $hesk_error_buffer[$k] = $v['value']['multiple'] ? sprintf($hesklang['cf_noem'], $v['name']) : sprintf($hesklang['cf_noe'], $v['name']); + } + } + } elseif ($v['req'] == 2) { + $tmpvar[$k]=hesk_makeURL(nl2br(hesk_input( hesk_POST($k) ))); + if ($tmpvar[$k] == '') { + $hesk_error_buffer[$k]=$hesklang['fill_all'].': '.$v['name']; + } + } else { + $tmpvar[$k]=hesk_makeURL(nl2br(hesk_input(hesk_POST($k)))); + } + } else { + $tmpvar[$k] = ''; + } + } + if (count($hesk_error_buffer)) { $myerror = '
- ';
foreach ($hesk_error_buffer as $error) {
@@ -139,51 +237,20 @@ if (isset($_POST['save'])) {
$tmpvar['message'] = nl2br($tmpvar['message']);
}
- foreach ($hesk_settings['custom_fields'] as $k => $v) {
- if ($v['use'] && isset($_POST[$k])) {
- if ($v['type'] == 'date' && $_POST[$k] != '') {
- $tmpvar[$k] = strtotime($_POST[$k]);
- } elseif (is_array($_POST[$k])) {
- $tmpvar[$k] = '';
- foreach ($_POST[$k] as $myCB) {
- $tmpvar[$k] .= (is_array($myCB) ? '' : hesk_input($myCB)) . '
'; - } - $tmpvar[$k] = substr($tmpvar[$k], 0, -6); - } else { - $tmpvar[$k] = hesk_makeURL(nl2br(hesk_input($_POST[$k]))); - } - } else { - $tmpvar[$k] = ''; - } + $custom_SQL = ''; + for ($i = 1; $i <= 50; $i++) { + $custom_SQL .= '`custom'.$i.'`=' . (isset($tmpvar['custom'.$i]) ? "'".hesk_dbEscape($tmpvar['custom'.$i])."'" : "''") . ','; } + $custom_SQL = rtrim($custom_SQL, ','); hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `name`='" . hesk_dbEscape($tmpvar['name']) . "', `email`='" . hesk_dbEscape($tmpvar['email']) . "', `subject`='" . hesk_dbEscape($tmpvar['subject']) . "', `message`='" . hesk_dbEscape($tmpvar['message']) . "', - `custom1`='" . hesk_dbEscape($tmpvar['custom1']) . "', - `custom2`='" . hesk_dbEscape($tmpvar['custom2']) . "', - `custom3`='" . hesk_dbEscape($tmpvar['custom3']) . "', - `custom4`='" . hesk_dbEscape($tmpvar['custom4']) . "', - `custom5`='" . hesk_dbEscape($tmpvar['custom5']) . "', - `custom6`='" . hesk_dbEscape($tmpvar['custom6']) . "', - `custom7`='" . hesk_dbEscape($tmpvar['custom7']) . "', - `custom8`='" . hesk_dbEscape($tmpvar['custom8']) . "', - `custom9`='" . hesk_dbEscape($tmpvar['custom9']) . "', - `custom10`='" . hesk_dbEscape($tmpvar['custom10']) . "', - `custom11`='" . hesk_dbEscape($tmpvar['custom11']) . "', - `custom12`='" . hesk_dbEscape($tmpvar['custom12']) . "', - `custom13`='" . hesk_dbEscape($tmpvar['custom13']) . "', - `custom14`='" . hesk_dbEscape($tmpvar['custom14']) . "', - `custom15`='" . hesk_dbEscape($tmpvar['custom15']) . "', - `custom16`='" . hesk_dbEscape($tmpvar['custom16']) . "', - `custom17`='" . hesk_dbEscape($tmpvar['custom17']) . "', - `custom18`='" . hesk_dbEscape($tmpvar['custom18']) . "', - `custom19`='" . hesk_dbEscape($tmpvar['custom19']) . "', - `custom20`='" . hesk_dbEscape($tmpvar['custom20']) . "', `language`='" . hesk_dbEscape($tmpvar['language']) . "', - `html`='" . hesk_dbEscape($tmpvar['html']) . "' + `html`='" . hesk_dbEscape($tmpvar['html']) . "', + $custom_SQL WHERE `id`='" . intval($ticket['id']) . "' LIMIT 1"); } @@ -222,15 +289,21 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');