Closes #39 - finished parent/child relationships
This commit is contained in:
parent
3151ece7df
commit
1855386878
@ -313,7 +313,7 @@ if ( ($can_reply || $can_edit) && isset($_POST['h']) && isset($_POST['m']) && is
|
|||||||
if (($can_reply || $can_edit) && isset($_POST['childTrackingId'])) {
|
if (($can_reply || $can_edit) && isset($_POST['childTrackingId'])) {
|
||||||
//-- Make sure this isn't the same ticket or one of its merged tickets.
|
//-- Make sure this isn't the same ticket or one of its merged tickets.
|
||||||
$mergedTickets = hesk_dbQuery('SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'tickets` WHERE `trackid` =
|
$mergedTickets = hesk_dbQuery('SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'tickets` WHERE `trackid` =
|
||||||
\''.hesk_dbEscape($trackingID).'\' AND `merged` LIKE \'#'.hesk_dbEscape($_POST['childTrackingId']).'\'');
|
\''.hesk_dbEscape($trackingID).'\' AND `merged` LIKE \'%#'.hesk_dbEscape($_POST['childTrackingId']).'#%\'');
|
||||||
if ($_POST['childTrackingId'] == $trackingID || $mergedTickets->num_rows > 0) {
|
if ($_POST['childTrackingId'] == $trackingID || $mergedTickets->num_rows > 0) {
|
||||||
hesk_process_messages($hesklang['child_is_itself'], 'admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999));
|
hesk_process_messages($hesklang['child_is_itself'], 'admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999));
|
||||||
}
|
}
|
||||||
@ -343,7 +343,16 @@ if (($can_reply || $can_edit) && isset($_POST['childTrackingId'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Delete child action */
|
/* Delete child action */
|
||||||
//TODO Populate this
|
if (($can_reply || $can_edit) && isset($_GET['deleteChild'])) {
|
||||||
|
//-- Delete the relationship
|
||||||
|
hesk_dbQuery('UPDATE `'.hesk_dbEscape($hesk_settings['db_pfix']).'tickets` SET `parent` = NULL WHERE `ID` = '.hesk_dbEscape($_GET['deleteChild']));
|
||||||
|
hesk_process_messages($hesklang['relationship_deleted'], 'admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999), 'SUCCESS');
|
||||||
|
|
||||||
|
} elseif (($can_reply || $can_edit) && isset($_GET['deleteParent'])) {
|
||||||
|
//-- Delete the relationship
|
||||||
|
hesk_dbQuery('UPDATE `'.hesk_dbEscape($hesk_settings['db_pfix']).'tickets` SET `parent` = NULL WHERE `ID` = '.hesk_dbEscape($ticket['id']));
|
||||||
|
hesk_process_messages($hesklang['relationship_deleted'], 'admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999), 'SUCCESS');
|
||||||
|
}
|
||||||
|
|
||||||
/* Delete attachment action */
|
/* Delete attachment action */
|
||||||
if (isset($_GET['delatt']) && hesk_token_check())
|
if (isset($_GET['delatt']) && hesk_token_check())
|
||||||
@ -543,7 +552,9 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
//-- Get the tracking ID of the parent
|
//-- Get the tracking ID of the parent
|
||||||
$parent = hesk_dbQuery('SELECT `trackid` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'tickets`
|
$parent = hesk_dbQuery('SELECT `trackid` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'tickets`
|
||||||
WHERE `ID` = '.hesk_dbEscape($ticket['parent']))->fetch_assoc();
|
WHERE `ID` = '.hesk_dbEscape($ticket['parent']))->fetch_assoc();
|
||||||
echo '<a href="admin_ticket.php?track='.$parent['trackid'].'&Refresh='.mt_rand(10000,99999).'">'.$parent['trackid'].'</a>';
|
echo '<a href="admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999).'&deleteParent=true">
|
||||||
|
<i class="fa fa-times-circle" data-toggle="tooltip" data-placement="top" title="'.$hesklang['delete_relationship'].'"></i></a>';
|
||||||
|
echo ' <a href="admin_ticket.php?track='.$parent['trackid'].'&Refresh='.mt_rand(10000,99999).'">'.$parent['trackid'].'</a>';
|
||||||
} else {
|
} else {
|
||||||
echo $hesklang['none'];
|
echo $hesklang['none'];
|
||||||
}
|
}
|
||||||
@ -554,11 +565,14 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
|||||||
<p><?php
|
<p><?php
|
||||||
//-- Check if any tickets have a parent set to this tracking ID
|
//-- Check if any tickets have a parent set to this tracking ID
|
||||||
$hasRows = false;
|
$hasRows = false;
|
||||||
$childrenRS = hesk_dbQuery('SELECT `trackid` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'tickets`
|
$childrenRS = hesk_dbQuery('SELECT * FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'tickets`
|
||||||
WHERE `parent` = '.hesk_dbEscape($ticket['id']));
|
WHERE `parent` = '.hesk_dbEscape($ticket['id']));
|
||||||
while ($row = $childrenRS->fetch_assoc()) {
|
while ($row = $childrenRS->fetch_assoc()) {
|
||||||
$hasRows = true;
|
$hasRows = true;
|
||||||
echo '<a href="admin_ticket.php?track='.$row['trackid'].'&Refresh='.mt_rand(10000,99999).'">'.$row['trackid'].'</a><br>';
|
echo '<a href="admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999).'&deleteChild='.$row['id'].'">
|
||||||
|
<i class="fa fa-times-circle" data-toggle="tooltip" data-placement="top" title="'.$hesklang['delete_relationship'].'"></i></a>';
|
||||||
|
echo ' <a href="admin_ticket.php?track='.$row['trackid'].'&Refresh='.mt_rand(10000,99999).'">'.$row['trackid'].'</a>';
|
||||||
|
echo '<br>';
|
||||||
}
|
}
|
||||||
if (!$hasRows) {
|
if (!$hasRows) {
|
||||||
echo $hesklang['none'];
|
echo $hesklang['none'];
|
||||||
|
@ -67,6 +67,8 @@ $hesklang['child_added'] = 'Successfully added <strong>%s</strong> as a child to
|
|||||||
$hesklang['is_child_already'] = '<strong>%s</strong> is already a child of this ticket.'; //%s: the child tracking ID
|
$hesklang['is_child_already'] = '<strong>%s</strong> is already a child of this ticket.'; //%s: the child tracking ID
|
||||||
$hesklang['child_does_not_exist'] = '<strong>%s</strong> is not a valid Tracking ID!'; //%s: the child tracking ID
|
$hesklang['child_does_not_exist'] = '<strong>%s</strong> is not a valid Tracking ID!'; //%s: the child tracking ID
|
||||||
$hesklang['child_is_itself'] = 'You cannot set a ticket as a child of itself.';
|
$hesklang['child_is_itself'] = 'You cannot set a ticket as a child of itself.';
|
||||||
|
$hesklang['delete_relationship'] = 'Delete Relationship';
|
||||||
|
$hesklang['relationship_deleted'] = 'Parent/Child relationship deleted.';
|
||||||
|
|
||||||
// ADDED OR MODIFIED IN NuMods 1.3.1
|
// ADDED OR MODIFIED IN NuMods 1.3.1
|
||||||
$hesklang['autorefresh'] = 'Autorefresh:';
|
$hesklang['autorefresh'] = 'Autorefresh:';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user