Remove validation from settings save and into manage statuses save
This commit is contained in:
parent
37932b249a
commit
4635050ac6
@ -60,22 +60,6 @@ if ( defined('HESK_DEMO') )
|
|||||||
hesk_process_messages($hesklang['sdemo'], 'admin_settings.php');
|
hesk_process_messages($hesklang['sdemo'], 'admin_settings.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
//-- Before we do anything, make sure the statuses are valid.
|
|
||||||
$rows = hesk_dbQuery('SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
|
|
||||||
while ($row = $rows->fetch_assoc())
|
|
||||||
{
|
|
||||||
if (!isset($_POST['s'.$row['ID'].'_delete']))
|
|
||||||
{
|
|
||||||
validateStatus($_POST['s'.$row['ID'].'_shortName'], $_POST['s'.$row['ID'].'_longName'], $_POST['s'.$row['ID'].'_textColor']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-- Validate the new one if at least one of the fields are used / checked
|
|
||||||
if ($_POST['sN_shortName'] != null || $_POST['sN_longName'] != null || $_POST['sN_textColor'] != null || isset($_POST['sN_isClosed']))
|
|
||||||
{
|
|
||||||
validateStatus($_POST['sN_shortName'], $_POST['sN_longName'], $_POST['sN_textColor']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$set=array();
|
$set=array();
|
||||||
|
|
||||||
/*** GENERAL ***/
|
/*** GENERAL ***/
|
||||||
@ -960,21 +944,3 @@ function hesk_formatUnits($size)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
} // End hesk_formatBytes()
|
} // End hesk_formatBytes()
|
||||||
|
|
||||||
function validateStatus($shortName, $longName, $textColor)
|
|
||||||
{
|
|
||||||
global $hesklang;
|
|
||||||
|
|
||||||
//-- Validation logic
|
|
||||||
if ($shortName == '')
|
|
||||||
{
|
|
||||||
hesk_process_messages($hesklang['shortNameRequired'], 'admin_settings.php');
|
|
||||||
} elseif ($longName == '')
|
|
||||||
{
|
|
||||||
hesk_process_messages($hesklang['longNameRequired'], 'admin_settings.php');
|
|
||||||
} elseif ($textColor == '')
|
|
||||||
{
|
|
||||||
hesk_process_messages($hesklang['textColorRequired'], 'admin_settings.php');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
@ -304,6 +304,22 @@ exit();
|
|||||||
function save() {
|
function save() {
|
||||||
global $hesklang, $hesk_settings;
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
//-- Before we do anything, make sure the statuses are valid.
|
||||||
|
$rows = hesk_dbQuery('SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'statuses`');
|
||||||
|
while ($row = $rows->fetch_assoc())
|
||||||
|
{
|
||||||
|
if (!isset($_POST['s'.$row['ID'].'_delete']))
|
||||||
|
{
|
||||||
|
validateStatus($_POST['s'.$row['ID'].'_key'], $_POST['s'.$row['ID'].'_textColor']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-- Validate the new one if at least one of the fields are used / checked
|
||||||
|
if ($_POST['sN_key'] != null || $_POST['sN_textColor'] != null || isset($_POST['sN_isClosed']))
|
||||||
|
{
|
||||||
|
validateStatus($_POST['sN_shortName'], $_POST['sN_textColor']);
|
||||||
|
}
|
||||||
|
|
||||||
hesk_dbConnect();
|
hesk_dbConnect();
|
||||||
$wasStatusDeleted = false;
|
$wasStatusDeleted = false;
|
||||||
//-- Get all the status IDs
|
//-- Get all the status IDs
|
||||||
@ -404,4 +420,18 @@ function save() {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
hesk_process_messages($hesklang['statuses_saved'],'manage_statuses.php','SUCCESS');
|
hesk_process_messages($hesklang['statuses_saved'],'manage_statuses.php','SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateStatus($key, $textColor)
|
||||||
|
{
|
||||||
|
global $hesklang;
|
||||||
|
|
||||||
|
//-- Validation logic
|
||||||
|
if ($key == '')
|
||||||
|
{
|
||||||
|
hesk_process_messages($hesklang['key_required'], 'manage_statuses.php');
|
||||||
|
} elseif ($textColor == '')
|
||||||
|
{
|
||||||
|
hesk_process_messages($hesklang['textColorRequired'], 'manage_statuses.php');
|
||||||
|
}
|
||||||
}
|
}
|
@ -35,6 +35,7 @@ $hesklang['email_template_not_saved'] = 'The email template <b>%s</b> was NOT sa
|
|||||||
$hesklang['language_key'] = 'Language Key';
|
$hesklang['language_key'] = 'Language Key';
|
||||||
$hesklang['language_key_description'] = 'This is the language file \'key\' that contains the text you want to display';
|
$hesklang['language_key_description'] = 'This is the language file \'key\' that contains the text you want to display';
|
||||||
$hesklang['can_man_ticket_statuses'] = 'Can manage ticket statuses';
|
$hesklang['can_man_ticket_statuses'] = 'Can manage ticket statuses';
|
||||||
|
$hesklang['key_required'] = 'Keys are required for all statuses';
|
||||||
|
|
||||||
// ADDED OR MODIFIED IN Mods for HESK 2.2.1
|
// ADDED OR MODIFIED IN Mods for HESK 2.2.1
|
||||||
$hesklang['popart_no_colon']='Top Knowledgebase Articles'; // same as $hesklang['popart'] but without a colon (:)
|
$hesklang['popart_no_colon']='Top Knowledgebase Articles'; // same as $hesklang['popart'] but without a colon (:)
|
||||||
@ -243,8 +244,6 @@ $hesklang['isStaffClosedOptionMsg'] = 'When a staff member clicks the "Close tic
|
|||||||
$hesklang['isStaffReopenedStatusMsg'] = 'When a staff member clicks the "Open ticket" link, change the status to';
|
$hesklang['isStaffReopenedStatusMsg'] = 'When a staff member clicks the "Open ticket" link, change the status to';
|
||||||
$hesklang['isDefaultStaffReplyStatusMsg'] = 'When a staff member replies to a ticket, change the status to';
|
$hesklang['isDefaultStaffReplyStatusMsg'] = 'When a staff member replies to a ticket, change the status to';
|
||||||
$hesklang['lockedTicketStatusMsg'] = 'When a ticket is locked, change the status to';
|
$hesklang['lockedTicketStatusMsg'] = 'When a ticket is locked, change the status to';
|
||||||
$hesklang['shortNameRequired'] = 'Short Name Key is required.';
|
|
||||||
$hesklang['longNameRequired'] = 'Long Name Key is required.';
|
|
||||||
$hesklang['textColorRequired'] = 'Text Color is required.';
|
$hesklang['textColorRequired'] = 'Text Color is required.';
|
||||||
$hesklang['addNew'] = 'Add New';
|
$hesklang['addNew'] = 'Add New';
|
||||||
$hesklang['close_action']='Close Ticket'; // Close ACTION
|
$hesklang['close_action']='Close Ticket'; // Close ACTION
|
||||||
|
Loading…
x
Reference in New Issue
Block a user