From 9295cf4e142f0e9d9075f9edf9e0c9fe928751a3 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Wed, 26 Oct 2016 13:42:42 -0400 Subject: [PATCH] Rest of b3 updates --- admin/new_ticket.php | 67 ++++---------------------------------------- admin/profile.php | 2 ++ admin/reports.php | 17 ++++++++++- inc/common.inc.php | 9 ++++-- index.php | 23 +++++++++------ language/en/text.php | 3 ++ 6 files changed, 48 insertions(+), 73 deletions(-) diff --git a/admin/new_ticket.php b/admin/new_ticket.php index 707369f5..3b01b7d4 100644 --- a/admin/new_ticket.php +++ b/admin/new_ticket.php @@ -344,13 +344,8 @@ $show_quick_help = $show['show']; $v) { if ($v['use'] && $v['place'] == 0 && hesk_is_custom_field_in_category($k, $category)) { - if ($modsForHesk_settings['custom_field_setting']) { - $v['name'] = $hesklang[$v['name']]; - } - $v['req'] = $v['req']==2 ? '*' : ''; if ($v['type'] == 'checkbox' && !isset($_GET["c_$k"])) { @@ -381,7 +376,10 @@ $show_quick_help = $show['show']; foreach ($v['value']['radio_options'] as $option) { - if (strlen($k_value) == 0 || $k_value == $option) { + if (strlen($k_value) == 0) { + $k_value = $option; + $checked = empty($v['value']['no_default']) ? 'checked="checked"' : ''; + } elseif ($k_value == $option) { $k_value = $option; $checked = 'checked="checked"'; } else { @@ -509,36 +507,9 @@ $show_quick_help = $show['show']; break; + // Hidden and read-only should work the same as text case 'hidden': - //Clean up multiple dashes or whitespaces - $formattedId = preg_replace("/[\s-]+/", " ", $v['name']); - $formattedId = preg_replace("/[\s_]/", "-", $formattedId); - - if (strlen($k_value) != 0) { - $v['value']['hidden_default_value'] = $k_value; - } - $hidden_cf_buffer .= ''; - break; - case 'readonly': - //Clean up multiple dashes or whitespaces - $formattedId = preg_replace("/[\s-]+/", " ", $v['name']); - $formattedId = preg_replace("/[\s_]/", "-", $formattedId); - - if (strlen($k_value) != 0) { - $v['value'] = $k_value; - } - - $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; - - echo '
- -
-
'; - - break; - - /* Default text input */ default: //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\s-]+/", " ", $v['name']); @@ -926,35 +897,7 @@ $show_quick_help = $show['show']; break; case 'hidden': - //Clean up multiple dashes or whitespaces - $formattedId = preg_replace("/[\s-]+/", " ", $v['name']); - $formattedId = preg_replace("/[\s_]/", "-", $formattedId); - - if (strlen($k_value) != 0) { - $v['value']['hidden_default_value'] = $k_value; - } - $hidden_cf_buffer .= ''; - break; - case 'readonly': - //Clean up multiple dashes or whitespaces - $formattedId = preg_replace("/[\s-]+/", " ", $v['name']); - $formattedId = preg_replace("/[\s_]/", "-", $formattedId); - - if (strlen($k_value) != 0) { - $v['value'] = $k_value; - } - - $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; - - echo '
- -
-
'; - - break; - - /* Default text input */ default: //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\s-]+/", " ", $v['name']); diff --git a/admin/profile.php b/admin/profile.php index f8a54e57..4d294a3a 100644 --- a/admin/profile.php +++ b/admin/profile.php @@ -244,6 +244,8 @@ function update_profile() if ($_SESSION['new']['autoreload'] < 0 || $_SESSION['new']['autoreload'] > 65535) { $_SESSION['new']['autoreload'] = 30; } + } else { + hesk_setcookie('autorefresh', ''); } /* Auto-start ticket timer */ diff --git a/admin/reports.php b/admin/reports.php index 1f8fa928..54c9e06d 100644 --- a/admin/reports.php +++ b/admin/reports.php @@ -530,7 +530,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); // Some variables we will need $tickets = array(); - $totals = array('asstickets' => 0, 'resolved' => 0, 'tickets' => 0, 'replies' => 0, 'worked' => 0); + $totals = array('asstickets' => 0, 'resolved' => 0, 'tickets' => 0, 'replies' => 0, 'worked' => 0, 'openedby' => 0); // Get list of users $admins = array(); @@ -550,6 +550,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); 'tickets' => 0, 'replies' => 0, 'worked' => '', + 'openedby' => 0, ); } @@ -625,10 +626,21 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); // Convert total seconds worked to HH:MM:SS $totals['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($totals['worked']) : 0; + // Get total opened by tickets + $res = hesk_dbQuery("SELECT `openedby`, COUNT(*) AS `cnt` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `openedby` IN ('" . implode("','", array_keys($admins) ) . "') AND DATE(`dt`) BETWEEN '" . hesk_dbEscape($date_from) . "' AND '" . hesk_dbEscape($date_to) . "' GROUP BY `openedby`"); + + // -> update ticket list values + while ($row = hesk_dbFetchAssoc($res)) + { + $tickets[$row['openedby']]['openedby'] += $row['cnt']; + $totals['openedby'] += $row['cnt']; + } + ?> + @@ -647,6 +659,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?> + @@ -666,6 +679,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?> + @@ -682,6 +696,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ?> + diff --git a/inc/common.inc.php b/inc/common.inc.php index 12739df6..83c8f1df 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -35,8 +35,13 @@ if (!defined('IN_SCRIPT')) { #error_reporting(E_ALL); -// Set correct Content-Type header -if (!defined('NO_HTTP_HEADER')) { +/* + * If code is executed from CLI, don't force SSL + * else set correct Content-Type header + */ +if (defined('NO_HTTP_HEADER')) { + $hesk_settings['force_ssl'] = false; +} else { header('Content-Type: text/html; charset=utf-8'); // Don't allow HESK to be loaded in a frame on third party domains diff --git a/index.php b/index.php index e59b24c9..84ad3523 100644 --- a/index.php +++ b/index.php @@ -473,8 +473,10 @@ function print_add_ticket() foreach ($v['value']['radio_options'] as $option) { - if (strlen($k_value) == 0 || $k_value == $option) - { + if (strlen($k_value) == 0) { + $k_value = $option; + $checked = empty($v['value']['no_default']) ? 'checked="checked"' : ''; + } elseif ($k_value == $option) { $k_value = $option; $checked = 'checked="checked"'; } @@ -597,11 +599,11 @@ function print_add_ticket() // Hidden case 'hidden': - if (strlen($k_value) != 0) + if (strlen($k_value) != 0 || isset($_SESSION["c_$k"])) { - $v['value']['hidden_default_value'] = $k_value; + $v['value']['default_value'] = $k_value; } - $hidden_cf_buffer .= ''; + $hidden_cf_buffer .= ''; break; /* Default text input */ @@ -766,8 +768,10 @@ function print_add_ticket() foreach ($v['value']['radio_options'] as $option) { - if (strlen($k_value) == 0 || $k_value == $option) - { + if (strlen($k_value) == 0) { + $k_value = $option; + $checked = empty($v['value']['no_default']) ? 'checked="checked"' : ''; + } elseif ($k_value == $option) { $k_value = $option; $checked = 'checked="checked"'; } @@ -890,7 +894,10 @@ function print_add_ticket() // Hidden case 'hidden': - $hidden_cf_buffer .= ''; + if (strlen($k_value) != 0 || isset($_SESSION["c_$k"])) { + $v['value']['default_value'] = $k_value; + } + $hidden_cf_buffer .= ''; break; /* Default text input */ diff --git a/language/en/text.php b/language/en/text.php index 55d81043..f514a8d3 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -2045,6 +2045,9 @@ $hesklang['status_limit']='You have 100 custom statuses, no new can be created.' $hesklang['public_link']='Public link'; // Link to the public KB article in the private KB pages $hesklang['frames']='Frames'; $hesklang['frames2']='Prevent loading HESK in frames on third party domains'; +$hesklang['numsub']='Submitted tickets'; // Will show how many tickets this user submitted +$hesklang['hidf']='Hidden inputs are not visible to customers on the Submit a ticket form (the value will still be visible on ticket details page if they are set as public). They behave as normal text fields for staff members.'; +$hesklang['rcheck']='Do not select a default option'; // DO NOT CHANGE BELOW if (!defined('IN_SCRIPT')) die('PHP syntax OK!');