close.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:3k
源码类别:

电子政务应用

开发平台:

Java

  1. <?php
  2. // +-------------------------------------------------------------+
  3. // | DeskPRO v [2.0.1 Production]
  4. // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
  5. // | Supplied by WTN-WDYL
  6. // | Nullified by WTN-WDYL
  7. // | Distribution via WebForum, ForumRU and associated file dumps
  8. // +-------------------------------------------------------------+
  9. // | DESKPRO IS NOT FREE SOFTWARE
  10. // +-------------------------------------------------------------+
  11. // | License ID : Full Enterprise License =) ...
  12. // | License Owner : WTN-WDYL Team
  13. // +-------------------------------------------------------------+
  14. // | $RCSfile: close.php,v $
  15. // | $Date: 2004/02/10 01:34:25 $
  16. // | $Revision: 1.15 $
  17. // +-------------------------------------------------------------+
  18. // | File Details:
  19. // | - Old ticket expiration (auto-close).
  20. // +-------------------------------------------------------------+
  21. error_reporting(E_ALL ^ E_NOTICE);
  22. cron_check();
  23. ############################### CLOSE USER AWAITING REPLY TICKETS ###############################
  24. if ($options['days_user_reply'] != "0" AND $options['days_user_reply'] != "") {
  25. $report .= "Auto-closed because last user response was more than $options[days_user_reply] days ago:nn";
  26. $expire_date = mktime() - ($options['days_user_reply'] * 60 * 60 * 24);
  27. $db->query("
  28. SELECT * FROM ticket 
  29. WHERE !awaiting_tech
  30. AND date_reply < '$expire_date' 
  31. AND is_open
  32. ");
  33. while ($ticket = $db->row_array()) {
  34. $user_details = $db2->query("SELECT * user WHERE id = '$ticket[userid]'");
  35. $db2->query("UPDATE ticket SET 
  36. is_open = '0', 
  37. awaiting_reply = '0' 
  38. WHERE id = '$ticket[id]'
  39. ");
  40. ticketlog($id, 'close');
  41. $report .= "Ticket $ticket[id] closedn";
  42. if ($options['notify_user'] == "1") {
  43. $user_details = update_user_details($user_details);
  44. eval(makeemaileval('body', 'BODY_question_closed', $subject));
  45. dp_mail($user_details['email'], $subject, $body);
  46. }
  47. }
  48. }
  49. ############################### CLOSE TECH AWAITING REPLY TICKETS ###############################
  50. if ($options['days_tech_reply'] != "0" AND $options['days_tech_reply'] != "") {
  51. $report .= "Auto-closed because last technician response was more thann$options[days_user_reply] days ago:nn";
  52. $expire_date = mktime() - ($options['days_tech_reply'] * 60 * 60 * 24);
  53. $db->query("
  54. SELECT * FROM ticket 
  55. WHERE awaiting_tech
  56. AND date_reply < '$expire_date'  
  57. AND is_open
  58. ");
  59. while ($ticket = $db->row_array()) {
  60. $user_details = $db2->query("SELECT * user WHERE id = '$ticket[userid]'");
  61. $db2->query("UPDATE ticket SET 
  62. is_open = '0', 
  63. awaiting_reply = '0' 
  64. WHERE id = '$ticket[id]'
  65. ");
  66. ticketlog($id, 'close');
  67. $report .= "Ticket $ticket[id] closedn";
  68. if ($options['notify_user'] == "1") {
  69. $user_details = update_user_details($user_details);
  70. eval(makeemaileval('body', 'BODY_question_closed', $subject));
  71. dp_mail($ticket['email'], $subject, $body);
  72. }
  73. }
  74. }
  75. //////////////////// PART 6: SEND EMAIL TO ADMIN ////////////////////
  76. if ($options['email_log'] AND $report) {
  77. dp_mail($options['email_log'], "$settings[site_name]Automatic Ticket Closure Report", $report, "From: $email_report");
  78. }