Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions class.CloserPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
/**
* @file class.CloserPlugin.php :: Requires PHP5.6+
*
* @author Grizly <clonemeagain@gmail.com>
* @see https://github.com/clonemeagain/plugin-autocloser
* @author Blake Psychology Team
*/
foreach ([
'canned',
Expand Down Expand Up @@ -34,7 +33,7 @@ class CloserPlugin extends Plugin {
*
* @var boolean
*/
const DEBUG = FALSE;
const DEBUG = TRUE;

/**
* The name that appears in threads as: Closer Plugin.
Expand Down Expand Up @@ -301,6 +300,27 @@ private function find_ticket_ids(PluginConfig $config, $group_id) {
$ids[] = $i['ticket_id'];
}

// Customisation by Prism Cloud Inc
// Get all Ticket IDs that are answered but last customer reply is later
$answered_ticket_ids_sql = sprintf("
SELECT ticket_id
FROM %s WHERE updated < DATE_SUB(NOW(), INTERVAL %d DAY)
AND status_id=%d %s
AND isanswered = 1
ORDER BY ticket_id ASC
LIMIT %d", TICKET_TABLE, $age_days, $from_status, $whereFilter, $max);

if (self::DEBUG) {
error_log("Looking for tickets with query: $sql");
}

$answered_ticket_ids_r = db_query($answered_ticket_ids_sql);
// Fill an array with just the ID's of the tickets:
while ($i = db_fetch_array($answered_ticket_ids_r, MYSQLI_ASSOC)) {
$ids[] = $i['ticket_id'];
}


return $ids;
}

Expand Down