Ejemplo n.º 1
0
 /**
  * @param int $issue_id
  * @return struct
  * @access protected
  */
 public function getTimeTrackingCategories($issue_id)
 {
     $prj_id = Issue::getProjectID($issue_id);
     $res = Time_Tracking::getAssocCategories($prj_id);
     if (empty($res)) {
         throw new RemoteApiException('No time tracking categories could be found');
     }
     return $res;
 }
Ejemplo n.º 2
0
    if (!@empty($HTTP_POST_VARS['new_status'])) {
        $res = Issue::setStatus($issue_id, $HTTP_POST_VARS['new_status']);
        if ($res != -1) {
            $new_status = Status::getStatusTitle($HTTP_POST_VARS['new_status']);
            History::add($issue_id, $usr_id, History::getTypeID('status_changed'), "Status changed to '{$new_status}' by " . User::getFullName($usr_id));
        }
    }
    $res = Note::insert($usr_id, $issue_id);
    $tpl->assign("post_result", $res);
    // enter the time tracking entry about this phone support entry
    if (!empty($HTTP_POST_VARS['time_spent'])) {
        $HTTP_POST_VARS['issue_id'] = $issue_id;
        $HTTP_POST_VARS['category'] = $HTTP_POST_VARS['time_category'];
        $HTTP_POST_VARS['summary'] = 'Time entry inserted when sending an internal note.';
        Time_Tracking::insertEntry();
    }
} elseif (@$HTTP_GET_VARS["cat"] == "reply") {
    if (!@empty($HTTP_GET_VARS["id"])) {
        $note = Note::getDetails($HTTP_GET_VARS["id"]);
        $date = Misc::formatReplyDate($note["timestamp"]);
        $header = "\n\n\nOn {$date}, " . $note["not_from"] . " wrote:\n>\n";
        $note["not_body"] = $header . Misc::formatReply($note["not_note"]);
        $tpl->bulkAssign(array("note" => $note, "parent_note_id" => $HTTP_GET_VARS["id"]));
        $reply_subject = Mail_API::removeExcessRe($note['not_title']);
    }
}
if (empty($reply_subject)) {
    $reply_subject = 'Re: ' . $details['iss_summary'];
}
$tpl->assign(array('from' => User::getFromHeader($usr_id), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'current_user_prefs' => Prefs::get($usr_id), 'subscribers' => Notification::getSubscribers($issue_id, false, User::getRoleID("Standard User")), 'statuses' => Status::getAssocStatusList($prj_id, false), 'current_issue_status' => Issue::getStatusID($issue_id), 'time_categories' => Time_Tracking::getAssocCategories(), 'note_category_id' => Time_Tracking::getCategoryID('Note Discussion'), 'reply_subject' => $reply_subject));
$tpl->displayTemplate();
Ejemplo n.º 3
0
// |                                                                      |
// | Free Software Foundation, Inc.                                       |
// | 59 Temple Place - Suite 330                                          |
// | Boston, MA 02111-1307, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <*****@*****.**>                             |
// +----------------------------------------------------------------------+
//
// @(#) $Id$
//
include_once "config.inc.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.time_tracking.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("add_time_tracking.tpl.html");
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = @$HTTP_POST_VARS["issue_id"] ? $HTTP_POST_VARS["issue_id"] : $HTTP_GET_VARS["iss_id"];
if (!Issue::canAccess($issue_id, Auth::getUserID())) {
    $tpl = new Template_API();
    $tpl->setTemplate("permission_denied.tpl.html");
    $tpl->displayTemplate();
    exit;
}
if (@$HTTP_POST_VARS["cat"] == "add_time") {
    $res = Time_Tracking::insertEntry();
    $tpl->assign("time_add_result", $res);
}
$tpl->assign(array("issue_id" => $issue_id, "time_categories" => Time_Tracking::getAssocCategories(), "current_user_prefs" => Prefs::get(Auth::getUserID())));
$tpl->displayTemplate();
Ejemplo n.º 4
0
function getTimeTrackingCategories($p)
{
    $email = XML_RPC_decode($p->getParam(0));
    $password = XML_RPC_decode($p->getParam(1));
    $auth = authenticate($email, $password);
    if (is_object($auth)) {
        return $auth;
    }
    $res = Time_Tracking::getAssocCategories();
    if (empty($res)) {
        return new XML_RPC_Response(0, $XML_RPC_erruser + 1, "No time tracking categories could be found");
    } else {
        return new XML_RPC_Response(XML_RPC_Encode($res));
    }
}
Ejemplo n.º 5
0
// |                                                                      |
// | Free Software Foundation, Inc.                                       |
// | 51 Franklin Street, Suite 330                                        |
// | Boston, MA 02110-1301, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <*****@*****.**>                             |
// | Authors: Elan Ruusamäe <*****@*****.**>                               |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('add_time_tracking.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$issue_id = @$_POST['issue_id'] ? $_POST['issue_id'] : $_GET['iss_id'];
if (!Issue::canAccess($issue_id, Auth::getUserID()) || Auth::getCurrentRole() <= User::getRoleID('Customer')) {
    $tpl = new Template_Helper();
    $tpl->setTemplate('permission_denied.tpl.html');
    $tpl->displayTemplate();
    exit;
}
if (@$_POST['cat'] == 'add_time') {
    $date = (array) $_POST['date'];
    $ttc_id = (int) $_POST['category'];
    $iss_id = (int) $_POST['issue_id'];
    $time_spent = (int) $_POST['time_spent'];
    $summary = (string) $_POST['summary'];
    $res = Time_Tracking::addTimeEntry($iss_id, $ttc_id, $time_spent, $date, $summary);
    $tpl->assign('time_add_result', $res);
}
$prj_id = Auth::getCurrentProject();
$tpl->assign(array('issue_id' => $issue_id, 'time_categories' => Time_Tracking::getAssocCategories($prj_id), 'current_user_prefs' => Prefs::get(Auth::getUserID())));
$tpl->displayTemplate();
Ejemplo n.º 6
0
        $time_spent = (int) $_POST['time_spent'];
        $summary = 'Time entry inserted when closing issue.';
        Time_Tracking::addTimeEntry($iss_id, $ttc_id, $time_spent, $date, $summary);
    }
    if (CRM::hasCustomerIntegration($prj_id) && isset($details['contract'])) {
        $crm = CRM::getInstance($prj_id);
        $contract = $details['contract'];
        if ($contract->hasPerIncident()) {
            $contract->updateRedeemedIncidents($issue_id, @$_REQUEST['redeem']);
        }
    }
    $tpl->assign('close_result', $res);
    if ($res == 1) {
        Misc::setMessage(ev_gettext('Thank you, the issue was closed successfully'));
        Misc::displayNotifiedUsers(Notification::getLastNotifiedAddresses($issue_id));
        Auth::redirect(APP_RELATIVE_URL . 'view.php?id=' . $issue_id);
    }
}
$tpl->assign(array('statuses' => Status::getClosedAssocList($prj_id), 'resolutions' => Resolution::getAssocList(), 'time_categories' => Time_Tracking::getAssocCategories($prj_id), 'notify_list' => Notification::getLastNotifiedAddresses($issue_id), 'custom_fields' => Custom_Field::getListByIssue($prj_id, $issue_id, $usr_id, 'close_form'), 'issue_id' => $issue_id));
if (CRM::hasCustomerIntegration($prj_id) && isset($details['contract'])) {
    $crm = CRM::getInstance($prj_id);
    $contract = $details['contract'];
    if ($contract->hasPerIncident()) {
        $details = Issue::getDetails($issue_id);
        $tpl->assign(array('redeemed' => $contract->getRedeemedIncidentDetails($issue_id), 'incident_details' => $details['customer']['incident_details']));
    }
}
$usr_id = Auth::getUserID();
$user_prefs = Prefs::get($usr_id);
$tpl->assign('current_user_prefs', $user_prefs);
$tpl->displayTemplate();
Ejemplo n.º 7
0
                $show_category = 0;
            }
            $cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE);
            if (!empty($auto_switched_from)) {
                $tpl->assign(array("project_auto_switched" => 1, "old_project" => Project::getName($auto_switched_from)));
            }
            $setup = Setup::load();
            $tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]);
            $tpl->assign(array('next_issue' => @$sides['next'], 'previous_issue' => @$sides['previous'], 'subscribers' => Notification::getSubscribers($issue_id), 'custom_fields' => Custom_Field::getListByIssue($prj_id, $issue_id), 'files' => Attachment::getList($issue_id), 'emails' => Support::getEmailsByIssue($issue_id), 'zones' => Date_API::getTimezoneList(), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'ema_id' => Email_Account::getEmailAccount(), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'show_releases' => $show_releases, 'show_category' => $show_category, 'categories' => Category::getAssocList($prj_id), 'quarantine' => Issue::getQuarantineInfo($issue_id)));
            if ($role_id != User::getRoleID('customer')) {
                if (@$_REQUEST['show_all_drafts'] == 1) {
                    $show_all_drafts = true;
                } else {
                    $show_all_drafts = false;
                }
                if (Workflow::hasWorkflowIntegration($prj_id)) {
                    $statuses = Workflow::getAllowedStatuses($prj_id, $issue_id);
                    // if currently selected release is not on list, go ahead and add it.
                } else {
                    $statuses = Status::getAssocStatusList($prj_id);
                }
                if (!empty($details['iss_sta_id']) && empty($statuses[$details['iss_sta_id']])) {
                    $statuses[$details['iss_sta_id']] = Status::getStatusTitle($details['iss_sta_id']);
                }
                $time_entries = Time_Tracking::getListing($issue_id);
                $tpl->assign(array('notes' => Note::getListing($issue_id), 'is_user_assigned' => Issue::isAssignedToUser($issue_id, $usr_id), 'is_user_authorized' => Authorized_Replier::isUserAuthorizedReplier($issue_id, $usr_id), 'phone_entries' => Phone_Support::getListing($issue_id), 'phone_categories' => Phone_Support::getCategoryAssocList($prj_id), 'checkins' => SCM::getCheckinList($issue_id), 'time_categories' => Time_Tracking::getAssocCategories(), 'time_entries' => $time_entries['list'], 'total_time_spent' => $time_entries['total_time_spent'], 'impacts' => Impact_Analysis::getListing($issue_id), 'statuses' => $statuses, 'drafts' => Draft::getList($issue_id, $show_all_drafts), 'groups' => Group::getAssocList($prj_id)));
            }
        }
    }
}
$tpl->displayTemplate();
 /**
  * Returns information from time tracking module, split by category
  * 
  * @access  private
  * @return  array Array of counts.
  */
 function getTimeTracking()
 {
     $time = array();
     // get total stats
     $time[0] = $this->getIndividualTimeTracking();
     $time[0]["name"] = "Total";
     $this->time_tracking_categories[0] = "Total";
     // get categories
     $categories = Time_Tracking::getAssocCategories();
     foreach ($categories as $ttc_id => $category) {
         $individual = $this->getIndividualTimeTracking($ttc_id);
         if (count($individual) > 0) {
             $time[$ttc_id] = $individual;
             $time[$ttc_id]["name"] = $category;
             $this->time_tracking_categories[$ttc_id] = $category;
         }
     }
     return $time;
 }
Ejemplo n.º 9
0
include_once APP_INC_PATH . "class.notification.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("close.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$prj_id = Auth::getCurrentProject();
$issue_id = @$HTTP_POST_VARS["issue_id"] ? $HTTP_POST_VARS["issue_id"] : $HTTP_GET_VARS["id"];
$tpl->assign("extra_title", "Close Issue #{$issue_id}");
$notification_list = Notification::getSubscribers($issue_id, 'closed');
$tpl->assign("notification_list_all", $notification_list['all']);
$notification_list_internal = Notification::getSubscribers($issue_id, 'closed', User::getRoleID("standard User"));
$tpl->assign("notification_list_internal", $notification_list_internal['all']);
if (@$HTTP_POST_VARS["cat"] == "close") {
    $res = Issue::close(Auth::getUserID(), $HTTP_POST_VARS["issue_id"], $HTTP_POST_VARS["send_notification"], $HTTP_POST_VARS["resolution"], $HTTP_POST_VARS["status"], $HTTP_POST_VARS["reason"], @$_REQUEST['notification_list']);
    if (!empty($HTTP_POST_VARS['time_spent'])) {
        $HTTP_POST_VARS['summary'] = 'Time entry inserted when closing issue.';
        Time_Tracking::insertEntry();
    }
    if (Customer::hasCustomerIntegration($prj_id) && Customer::hasPerIncidentContract($prj_id, Issue::getCustomerID($issue_id))) {
        Customer::updateRedeemedIncidents($prj_id, $issue_id, @$_REQUEST['redeem']);
    }
    $tpl->assign("close_result", $res);
}
$tpl->assign("statuses", Status::getClosedAssocList($prj_id));
$tpl->assign("resolutions", Resolution::getAssocList());
$tpl->assign("time_categories", Time_Tracking::getAssocCategories());
if (Customer::hasCustomerIntegration($prj_id) && Customer::hasPerIncidentContract($prj_id, Issue::getCustomerID($issue_id))) {
    $details = Issue::getDetails($issue_id);
    $tpl->assign(array('redeemed' => Customer::getRedeemedIncidentDetails($prj_id, $issue_id), 'incident_details' => $details['customer_info']['incident_details']));
}
$tpl->displayTemplate();