#209 New statuses can be created to the xref table
This commit is contained in:
parent
15c2e7d983
commit
03718e2632
@ -18,9 +18,9 @@ hesk_checkPermission('can_man_ticket_statuses');
|
||||
define('WYSIWYG',1);
|
||||
|
||||
// Are we performing an action?
|
||||
if (isset($_POST['action'])) {
|
||||
if ($_POST['action'] == 'save') {
|
||||
save();
|
||||
if (isset($_POST['a'])) {
|
||||
if ($_POST['a'] == 'create') {
|
||||
createStatus();
|
||||
}
|
||||
}
|
||||
/* Print header */
|
||||
@ -327,7 +327,7 @@ function buildCreateModal() {
|
||||
<div class="modal fade" id="modal-status-new" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<form action="#" role="form" method="post" class="form-horizontal">
|
||||
<form action="manage_statuses.php" role="form" method="post" class="form-horizontal">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title"><?php echo $hesklang['create_new_status_title']; ?></h4>
|
||||
@ -339,12 +339,12 @@ function buildCreateModal() {
|
||||
<div class="footerWithBorder blankSpace"></div>
|
||||
<?php foreach ($languages as $language => $languageCode): ?>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" for="status_<?php echo $languageCode; ?>">
|
||||
<label class="col-sm-3 control-label" for="name[<?php echo $language; ?>]">
|
||||
<?php echo $language; ?>
|
||||
</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" placeholder="<?php echo htmlspecialchars($language); ?>"
|
||||
class="form-control">
|
||||
class="form-control" name="name[<?php echo $language; ?>]">
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
@ -396,6 +396,31 @@ function buildCreateModal() {
|
||||
<?php
|
||||
}
|
||||
|
||||
function createStatus() {
|
||||
global $hesklang, $hesk_settings;
|
||||
|
||||
hesk_dbConnect();
|
||||
|
||||
// Create the new status record
|
||||
$isClosed = hesk_POST('closed');
|
||||
$closable = hesk_POST('closable');
|
||||
$textColor = hesk_POST('text-color');
|
||||
$insert = "INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` (`Key`, `TextColor`, `IsClosed`, `Closable`)
|
||||
VALUES ('STORED IN XREF TABLE', '".hesk_dbEscape($textColor)."', ".intval($isClosed).", '".hesk_dbEscape($closable)."')";
|
||||
hesk_dbQuery($insert);
|
||||
|
||||
$newStatusId = hesk_dbInsertID();
|
||||
|
||||
// For each language, create a value in the xref table
|
||||
foreach (hesk_POST_array('name') as $language => $translation) {
|
||||
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` (`language`, `text`, `status_id`)
|
||||
VALUES ('".hesk_dbEscape($language)."', '".hesk_dbEscape($translation)."', ".intval($newStatusId).")");
|
||||
}
|
||||
|
||||
hesk_process_messages($hesklang['new_status_created'],'manage_statuses.php','SUCCESS');
|
||||
}
|
||||
|
||||
|
||||
function save() {
|
||||
global $hesklang, $hesk_settings;
|
||||
|
||||
|
@ -38,6 +38,7 @@ $hesklang['create_new_status_title'] = 'Create New Status';
|
||||
$hesklang['status_name_title'] = 'Status Name';
|
||||
$hesklang['properties'] = 'Properties';
|
||||
$hesklang['closable'] = 'Closable'; // Same as $hesklang['closable_question'], but without punctuation
|
||||
$hesklang['new_status_created'] = 'New status successfully created';
|
||||
|
||||
// ADDED OR MODIFIED IN Mods for HESK 2.3.0
|
||||
$hesklang['sm_icon'] = 'Icon';
|
||||
|
Loading…
x
Reference in New Issue
Block a user