#209 Statuses can now be deleted
This commit is contained in:
parent
1a825b81af
commit
14ad6cd4f2
@ -18,12 +18,10 @@ hesk_checkPermission('can_man_ticket_statuses');
|
|||||||
define('WYSIWYG',1);
|
define('WYSIWYG',1);
|
||||||
|
|
||||||
// Are we performing an action?
|
// Are we performing an action?
|
||||||
if (isset($_POST['a'])) {
|
if (isset($_REQUEST['a'])) {
|
||||||
if ($_POST['a'] == 'create') {
|
if ($_POST['a'] == 'create') { createStatus(); }
|
||||||
createStatus();
|
elseif ($_POST['a'] == 'update') { updateStatus(); }
|
||||||
} elseif ($_POST['a'] == 'update') {
|
elseif ($_GET['a'] == 'delete') { deleteStatus(); }
|
||||||
updateStatus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -145,18 +143,22 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<!-- TODO Linkify These -->
|
|
||||||
<span data-toggle="modal" data-target="#modal-status-<?php echo $row['ID']; ?>" style="cursor: pointer;">
|
<span data-toggle="modal" data-target="#modal-status-<?php echo $row['ID']; ?>" style="cursor: pointer;">
|
||||||
<i class="fa fa-pencil icon-link" style="color: orange"
|
<i class="fa fa-pencil icon-link" style="color: orange"
|
||||||
data-toggle="tooltip" title="<?php echo $hesklang['edit']; ?>"></i>
|
data-toggle="tooltip" title="<?php echo $hesklang['edit']; ?>"></i>
|
||||||
</span>
|
</span>
|
||||||
<?php echoArrows($j, $numberOfStatuses); ?>
|
<?php echoArrows($j, $numberOfStatuses); ?>
|
||||||
<a href="#">
|
<span data-toggle="modal" data-target="#modal-status-delete-<?php echo $row['ID']; ?>" style="cursor: pointer;">
|
||||||
<i class="fa fa-times icon-link" style="color: red"
|
<i class="fa fa-times icon-link" style="color: red"
|
||||||
data-toggle="tooltip" title="<?php echo $hesklang['delete']; ?>"></i></a>
|
data-toggle="tooltip" title="<?php echo $hesklang['delete']; ?>"></i>
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php buildEditModal($row['ID']); $j++; endwhile; ?>
|
<?php
|
||||||
|
buildEditModal($row['ID']);
|
||||||
|
buildConfirmDeleteModal($row['ID']);
|
||||||
|
$j++;
|
||||||
|
endwhile; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -303,6 +305,39 @@ buildCreateModal();
|
|||||||
require_once(HESK_PATH . 'inc/footer.inc.php');
|
require_once(HESK_PATH . 'inc/footer.inc.php');
|
||||||
exit();
|
exit();
|
||||||
|
|
||||||
|
function buildConfirmDeleteModal($statusId) {
|
||||||
|
global $hesklang;
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="modal fade" id="modal-status-delete-<?php echo $statusId; ?>" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<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['confirm_delete_status_question']; ?></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<p><?php echo $hesklang['confirm_delete_status']; ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<input type="hidden" name="a" value="create">
|
||||||
|
<div class="btn-group">
|
||||||
|
<a href="manage_statuses.php?a=delete&id=<?php echo $statusId; ?>" class="btn btn-danger">
|
||||||
|
<?php echo $hesklang['delete']; ?>
|
||||||
|
</a>
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $hesklang['cancel']; ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
function echoArrows($index, $numberOfStatuses) {
|
function echoArrows($index, $numberOfStatuses) {
|
||||||
global $hesklang;
|
global $hesklang;
|
||||||
|
|
||||||
@ -573,6 +608,17 @@ function updateStatus() {
|
|||||||
hesk_process_messages($hesklang['ticket_status_updated'],'manage_statuses.php','SUCCESS');
|
hesk_process_messages($hesklang['ticket_status_updated'],'manage_statuses.php','SUCCESS');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteStatus() {
|
||||||
|
global $hesklang, $hesk_settings;
|
||||||
|
|
||||||
|
$statusId = hesk_GET('id');
|
||||||
|
|
||||||
|
hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."text_to_status_xref` WHERE `status_id` = ".intval($statusId));
|
||||||
|
hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."statuses` WHERE `ID` = ".intval($statusId));
|
||||||
|
|
||||||
|
hesk_process_messages($hesklang['ticket_status_deleted'],'manage_statuses.php','SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
global $hesklang, $hesk_settings;
|
global $hesklang, $hesk_settings;
|
||||||
|
@ -43,6 +43,9 @@ $hesklang['editing_status_x'] = 'Editing status <span style="color: %s; font-wei
|
|||||||
$hesklang['status_not_in_database'] = 'The status text for this language was not found in the database, so a suggested translation has been filled for you.
|
$hesklang['status_not_in_database'] = 'The status text for this language was not found in the database, so a suggested translation has been filled for you.
|
||||||
Please click "Save Changes" to save this translation to the database and to remove this warning.';
|
Please click "Save Changes" to save this translation to the database and to remove this warning.';
|
||||||
$hesklang['ticket_status_updated'] = 'Ticket status successfully updated!';
|
$hesklang['ticket_status_updated'] = 'Ticket status successfully updated!';
|
||||||
|
$hesklang['ticket_status_deleted'] = 'Ticket status deleted!';
|
||||||
|
$hesklang['confirm_delete_status_question'] = 'Delete status?';
|
||||||
|
$hesklang['confirm_delete_status'] = 'Are you sure you want to delete this status? This cannot be undone!';
|
||||||
|
|
||||||
// ADDED OR MODIFIED IN Mods for HESK 2.3.0
|
// ADDED OR MODIFIED IN Mods for HESK 2.3.0
|
||||||
$hesklang['sm_icon'] = 'Icon';
|
$hesklang['sm_icon'] = 'Icon';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user