⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 escalate.php

📁 jsp程序开发系统
💻 PHP
字号:
<?php
// +-------------------------------------------------------------+
// | DeskPRO v [2.0.1 Production]
// | Copyright (C) 2001 - 2004 Headstart Solutions Limited
// | Supplied by WTN-WDYL
// | Nullified by WTN-WDYL
// | Distribution via WebForum, ForumRU and associated file dumps
// +-------------------------------------------------------------+
// | DESKPRO IS NOT FREE SOFTWARE
// +-------------------------------------------------------------+
// | License ID : Full Enterprise License =) ...
// | License Owner : WTN-WDYL Team
// +-------------------------------------------------------------+
// | $RCSfile: escalate.php,v $
// | $Date: 2004/02/10 01:34:25 $
// | $Revision: 1.7 $
// +-------------------------------------------------------------+
// | File Details:
// | - Ticket auto-escalation
// +-------------------------------------------------------------+

error_reporting(E_ALL ^ E_NOTICE);

cron_check();

//////////////////// RUN ESCALATIONS ////////////////////

$db->query("SELECT * FROM escalate");
while ($result = $db->row_array()) {

	if (!$result[dayswaiting] AND !$result[daysopen]) {
		// If it's a nonsensical escalation, don't continue
		continue;
	}

	// category change
	if ($result[category]) {
		$sql = " category = $result[category]";
		$i = 1;
	}

	// priority change
	if ($result[priority]) {
		$sql .= iff($i, ', ') . " priority = $result[priority]";
		$i = 1;
	}

	// tech owner
	if ($result[tech]) {
		$sql .= iff($i, ', ') . " tech = $result[tech]";
	}

	if ($sql) {

		if ($result[dayswaiting]) {
			$waiting_time = mktime() - (60 * 60 * 24 * $result[dayswaiting]);
		}
		if ($result[daysopen]) {
			$open_time = mktime() - (60 * 60 * 24 * $result[daysopen]);
		}

		if ($sql) {
			// First find all affected tickets
			$tickets = $db2->query_return_array("SELECT * FROM ticket WHERE
				" . iff($result[dayswaiting], " date_lastreply_tech > $waiting_time ") . "
				" . iff($result[daysopen], " date_opened > $open_time "));
			if ($db2->num_rows()) {
				// If there are tickets to escalate, log the changes and notify
				// technicians if needed.
				foreach ($tickets AS $ticket) {
					$userdata = $db2->query_return("SELECT * FROM tech WHERE id = '$ticket[tech]'");
					ticketlog($ticket[id], "escalate");

					if ($result[category]) {
						ticketlog($ticket[id], "category", $ticket[category], $result[category]);
					}

					if ($result[priority]) {
						ticketlog($ticket[id], "priority", $ticket[priority], $result[priority]);
					}

					if ($result[tech]) {
						ticketlog($ticket[id], "tech", $ticket[tech], $result[tech]);
						notify_technicians('assigned', $ticket, $userdata);
					}

				}

				$db2->query("
					UPDATE ticket SET $sql WHERE 
					" . iff($result[dayswaiting], " date_lastreply_tech > $waiting_time ") . "
					" . iff($result[daysopen], " date_opened > $open_time ") . "
				");
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -