[ Index ]

PHP Cross Reference of Eventum

title

Body

[close]

/ -> close.php (source)

   1  <?php
   2  /* vim: set expandtab tabstop=4 shiftwidth=4 encoding=utf-8: */
   3  // +----------------------------------------------------------------------+
   4  // | Eventum - Issue Tracking System                                      |
   5  // +----------------------------------------------------------------------+
   6  // | Copyright (c) 2003, 2004, 2005, 2006, 2007 MySQL AB                  |
   7  // |                                                                      |
   8  // | This program is free software; you can redistribute it and/or modify |
   9  // | it under the terms of the GNU General Public License as published by |
  10  // | the Free Software Foundation; either version 2 of the License, or    |
  11  // | (at your option) any later version.                                  |
  12  // |                                                                      |
  13  // | This program is distributed in the hope that it will be useful,      |
  14  // | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
  15  // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |
  16  // | GNU General Public License for more details.                         |
  17  // |                                                                      |
  18  // | You should have received a copy of the GNU General Public License    |
  19  // | along with this program; if not, write to:                           |
  20  // |                                                                      |
  21  // | Free Software Foundation, Inc.                                       |
  22  // | 59 Temple Place - Suite 330                                          |
  23  // | Boston, MA 02111-1307, USA.                                          |
  24  // +----------------------------------------------------------------------+
  25  // | Authors: João Prado Maia <jpm@mysql.com>                             |
  26  // +----------------------------------------------------------------------+
  27  //
  28  // @(#) $Id: close.php 3383 2007-09-28 07:50:51Z glen $
  29  
  30  require_once(dirname(__FILE__) . "/init.php");
  31  require_once (APP_INC_PATH . "class.template.php");
  32  require_once (APP_INC_PATH . "class.auth.php");
  33  require_once (APP_INC_PATH . "class.issue.php");
  34  require_once (APP_INC_PATH . "class.misc.php");
  35  require_once (APP_INC_PATH . "class.resolution.php");
  36  require_once (APP_INC_PATH . "class.time_tracking.php");
  37  require_once (APP_INC_PATH . "class.status.php");
  38  require_once (APP_INC_PATH . "class.notification.php");
  39  require_once (APP_INC_PATH . "db_access.php");
  40  
  41  $tpl = new Template_API();
  42  $tpl->setTemplate("close.tpl.html");
  43  
  44  Auth::checkAuthentication(APP_COOKIE);
  45  
  46  $usr_id = Auth::getUserID();
  47  $prj_id = Auth::getCurrentProject();
  48  $issue_id = @$_POST["issue_id"] ? $_POST["issue_id"] : @$_GET["id"];
  49  $tpl->assign("extra_title", "Close Issue #$issue_id");
  50  
  51  if (!Issue::exists($issue_id, false)) {
  52      $tpl->assign("no_issue", true);
  53      $tpl->displayTemplate();
  54      exit;
  55  }
  56  
  57  $notification_list = Notification::getSubscribers($issue_id, 'closed');
  58  $tpl->assign("notification_list_all", $notification_list['all']);
  59  
  60  $notification_list_internal = Notification::getSubscribers($issue_id, 'closed', User::getRoleID("Standard User"));
  61  $tpl->assign("notification_list_internal", $notification_list_internal['all']);
  62  
  63  if (@$_REQUEST["cat"] == "close") {
  64      Custom_Field::updateValues();
  65      $res = Issue::close(Auth::getUserID(), $issue_id, $_REQUEST["send_notification"], $_REQUEST["resolution"], $_REQUEST["status"], $_REQUEST["reason"], @$_REQUEST['notification_list']);
  66  
  67      if (!empty($_POST['time_spent'])) {
  68          $_POST['summary'] = 'Time entry inserted when closing issue.';
  69          Time_Tracking::insertEntry();
  70      }
  71  
  72      if ((Customer::hasCustomerIntegration($prj_id)) && (Customer::hasPerIncidentContract($prj_id, Issue::getCustomerID($issue_id)))) {
  73          Customer::updateRedeemedIncidents($prj_id, $issue_id, @$_REQUEST['redeem']);
  74      }
  75  
  76      $tpl->assign("close_result", $res);
  77  }
  78  
  79  $tpl->assign(array(
  80      "statuses"      => Status::getClosedAssocList($prj_id),
  81      "resolutions"   => Resolution::getAssocList(),
  82      "time_categories"   => Time_Tracking::getAssocCategories(),
  83      "notify_list"       => Notification::getLastNotifiedAddresses($issue_id),
  84      "custom_fields"     => Custom_Field::getListByIssue($prj_id, $issue_id, $usr_id, 'close_form'),
  85      "issue_id"          => $issue_id,
  86  ));
  87  
  88  if ((Customer::hasCustomerIntegration($prj_id)) && (Customer::hasPerIncidentContract($prj_id, Issue::getCustomerID($issue_id)))) {
  89      $details = Issue::getDetails($issue_id);
  90      $tpl->assign(array(
  91              'redeemed'  =>  Customer::getRedeemedIncidentDetails($prj_id, $issue_id),
  92              'incident_details'  =>  $details['customer_info']['incident_details']
  93      ));
  94  }
  95  
  96  $usr_id = Auth::getUserID();
  97  $user_prefs = Prefs::get($usr_id);
  98  $tpl->assign("current_user_prefs", $user_prefs);
  99  
 100  $tpl->displayTemplate();


Generated: Wed Dec 19 21:21:33 2007 Cross-referenced by PHPXref 0.7