public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Resolution::create([]); } }
/** * Method used to send a diff-style notification email to the issue * subscribers about updates to its attributes. * * @access public * @param integer $issue_id The issue ID * @param array $old The old issue details * @param array $new The new issue details */ function notifyIssueUpdated($issue_id, $old, $new) { $diffs = array(); if (@$new["keep_assignments"] == "no") { if (empty($new['assignments'])) { $new['assignments'] = array(); } $assign_diff = Misc::arrayDiff($old['assigned_users'], $new['assignments']); if (count($assign_diff) > 0) { $diffs[] = '-Assignment List: ' . $old['assignments']; @($diffs[] = '+Assignment List: ' . implode(', ', User::getFullName($new['assignments']))); } } if (@$old['iss_expected_resolution_date'] != $new['expected_resolution_date']) { $diffs[] = '-Expected Resolution Date: ' . $old['iss_expected_resolution_date']; $diffs[] = '+Expected Resolution Date: ' . $new['expected_resolution_date']; } if ($old["iss_prc_id"] != $new["category"]) { $diffs[] = '-Category: ' . Category::getTitle($old["iss_prc_id"]); $diffs[] = '+Category: ' . Category::getTitle($new["category"]); } if (@$new["keep"] == "no" && $old["iss_pre_id"] != $new["release"]) { $diffs[] = '-Release: ' . Release::getTitle($old["iss_pre_id"]); $diffs[] = '+Release: ' . Release::getTitle($new["release"]); } if ($old["iss_pri_id"] != $new["priority"]) { $diffs[] = '-Priority: ' . Priority::getTitle($old["iss_pri_id"]); $diffs[] = '+Priority: ' . Priority::getTitle($new["priority"]); } if ($old["iss_sta_id"] != $new["status"]) { $diffs[] = '-Status: ' . Status::getStatusTitle($old["iss_sta_id"]); $diffs[] = '+Status: ' . Status::getStatusTitle($new["status"]); } if ($old["iss_res_id"] != $new["resolution"]) { $diffs[] = '-Resolution: ' . Resolution::getTitle($old["iss_res_id"]); $diffs[] = '+Resolution: ' . Resolution::getTitle($new["resolution"]); } if ($old["iss_dev_time"] != $new["estimated_dev_time"]) { $diffs[] = '-Estimated Dev. Time: ' . Misc::getFormattedTime($old["iss_dev_time"] * 60); $diffs[] = '+Estimated Dev. Time: ' . Misc::getFormattedTime($new["estimated_dev_time"] * 60); } if ($old["iss_summary"] != $new["summary"]) { $diffs[] = '-Summary: ' . $old['iss_summary']; $diffs[] = '+Summary: ' . $new['summary']; } if ($old["iss_description"] != $new["description"]) { // need real diff engine here include_once 'Text_Diff/Diff.php'; include_once 'Text_Diff/Diff/Renderer.php'; include_once 'Text_Diff/Diff/Renderer/unified.php'; $old['iss_description'] = explode("\n", $old['iss_description']); $new['description'] = explode("\n", $new['description']); $diff =& new Text_Diff($old["iss_description"], $new["description"]); $renderer =& new Text_Diff_Renderer_unified(); $desc_diff = explode("\n", trim($renderer->render($diff))); $diffs[] = 'Description:'; for ($i = 0; $i < count($desc_diff); $i++) { $diffs[] = $desc_diff[$i]; } } $emails = array(); $users = Notification::getUsersByIssue($issue_id, 'updated'); $user_emails = Project::getUserEmailAssocList(Issue::getProjectID($issue_id), 'active', User::getRoleID('Customer')); $user_emails = array_map('strtolower', $user_emails); for ($i = 0; $i < count($users); $i++) { if (empty($users[$i]["sub_usr_id"])) { $email = $users[$i]["sub_email"]; } else { $email = User::getFromHeader($users[$i]["sub_usr_id"]); } // now add it to the list of emails if (!empty($email) && !in_array($email, $emails)) { $emails[] = $email; } } $data = Notification::getIssueDetails($issue_id); $data['diffs'] = implode("\n", $diffs); $data['updated_by'] = User::getFullName(Auth::getUserID()); Notification::notifySubscribers($issue_id, $emails, 'updated', $data, 'Updated', FALSE); }
<?php $box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Choose Resolution No. :', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'width:100%; margin-top:1%;'))); ?> <br> <div class="span8"> <div class="wide form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); ?> <label>Resolution No.</label> <?php $this->widget('bootstrap.widgets.TbSelect2', array('model' => $model, 'attribute' => 'res_no', 'data' => CHtml::listData(Resolution::model()->findAll(), 'res_no', 'res_no'), 'options' => array('width' => '30%'))); ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Search')); ?> </div> <?php $this->endWidget(); ?> </div> <?php $this->endWidget(); ?>
/** * Remove the specified resolution from storage. * * @param int $id * @return Response */ public function destroy($id) { $resolution = Resolution::findOrFail($id); Resolution::destroy($id); return Redirect::to('enquiries/show/' . $resolution->enquiry->id); }
/** * Method used to get the details for a specific issue. * * @param integer $issue_id The issue ID * @param boolean $force_refresh If the cache should not be used. * @return array The details for the specified issue */ public static function getDetails($issue_id, $force_refresh = false) { static $returns; if (empty($issue_id)) { return ''; } if (!empty($returns[$issue_id]) && $force_refresh != true) { return $returns[$issue_id]; } $stmt = 'SELECT {{%issue}}.*, prj_title, prc_title, pre_title, pri_title, sev_title, sta_title, sta_abbreviation, sta_color status_color, sta_is_closed FROM ( {{%issue}}, {{%project}} ) LEFT JOIN {{%project_priority}} ON iss_pri_id=pri_id LEFT JOIN {{%project_severity}} ON iss_sev_id=sev_id LEFT JOIN {{%status}} ON iss_sta_id=sta_id LEFT JOIN {{%project_category}} ON iss_prc_id=prc_id LEFT JOIN {{%project_release}} ON iss_pre_id=pre_id WHERE iss_id=? AND iss_prj_id=prj_id'; try { $res = DB_Helper::getInstance()->getRow($stmt, array($issue_id)); } catch (DbException $e) { return ''; } if (empty($res)) { return ''; } $created_date_ts = Date_Helper::getUnixTimestamp($res['iss_created_date'], Date_Helper::getDefaultTimezone()); // get customer information, if any if (!empty($res['iss_customer_id']) && CRM::hasCustomerIntegration($res['iss_prj_id'])) { $crm = CRM::getInstance($res['iss_prj_id']); try { $customer = $crm->getCustomer($res['iss_customer_id']); $contract = $crm->getContract($res['iss_customer_contract_id']); $res['contact_local_time'] = Date_Helper::getFormattedDate(Date_Helper::getCurrentDateGMT(), $res['iss_contact_timezone']); $res['customer'] = $customer; $res['contract'] = $contract; $res['contact'] = $crm->getContact($res['iss_customer_contact_id']); // TODOCRM: Deal with incidents // $res['redeemed_incidents'] = Customer::getRedeemedIncidentDetails($res['iss_prj_id'], $res['iss_id']); $max_first_response_time = $contract->getMaximumFirstResponseTime($issue_id); $res['max_first_response_time'] = Misc::getFormattedTime($max_first_response_time / 60); if (empty($res['iss_first_response_date'])) { $first_response_deadline = $created_date_ts + $max_first_response_time; if (time() <= $first_response_deadline) { $res['max_first_response_time_left'] = Date_Helper::getFormattedDateDiff($first_response_deadline, time()); } else { $res['overdue_first_response_time'] = Date_Helper::getFormattedDateDiff(time(), $first_response_deadline); } } } catch (CRMException $e) { // TODOCRM: Log exception? } } $res['iss_original_description'] = $res['iss_description']; $res['iss_original_percent_complete'] = $res['iss_percent_complete']; $res['iss_description'] = nl2br(htmlspecialchars($res['iss_description'])); $res['iss_resolution'] = Resolution::getTitle($res['iss_res_id']); $res['iss_impact_analysis'] = nl2br(htmlspecialchars($res['iss_impact_analysis'])); $res['iss_created_date_ts'] = $created_date_ts; $res['assignments'] = @implode(', ', array_values(self::getAssignedUsers($res['iss_id']))); list($res['authorized_names'], $res['authorized_repliers']) = Authorized_Replier::getAuthorizedRepliers($res['iss_id']); $temp = self::getAssignedUsersStatus($res['iss_id']); $res['has_inactive_users'] = 0; $res['assigned_users'] = array(); $res['assigned_inactive_users'] = array(); foreach ($temp as $usr_id => $usr_status) { if (!User::isActiveStatus($usr_status)) { $res['assigned_inactive_users'][] = $usr_id; $res['has_inactive_users'] = 1; } else { $res['assigned_users'][] = $usr_id; } } if (@in_array(Auth::getUserID(), $res['assigned_users'])) { $res['is_current_user_assigned'] = 1; } else { $res['is_current_user_assigned'] = 0; } $res['associated_issues_details'] = self::getAssociatedIssuesDetails($res['iss_id']); $res['associated_issues'] = self::getAssociatedIssues($res['iss_id']); $res['reporter'] = User::getFullName($res['iss_usr_id']); if (empty($res['iss_updated_date'])) { $res['iss_updated_date'] = $res['iss_created_date']; } $res['estimated_formatted_time'] = Misc::getFormattedTime($res['iss_dev_time']); if (Release::isAssignable($res['iss_pre_id'])) { $release = Release::getDetails($res['iss_pre_id']); $res['pre_title'] = $release['pre_title']; $res['pre_status'] = $release['pre_status']; } // need to return the list of issues that are duplicates of this one $res['duplicates'] = self::getDuplicateList($res['iss_id']); $res['duplicates_details'] = self::getDuplicateDetailsList($res['iss_id']); // also get the issue title of the duplicated issue if (!empty($res['iss_duplicated_iss_id'])) { $res['duplicated_issue'] = self::getDuplicatedDetails($res['iss_duplicated_iss_id']); } // get group information if (!empty($res['iss_grp_id'])) { $res['group'] = Group::getDetails($res['iss_grp_id']); } // get quarantine issue $res['quarantine'] = self::getQuarantineInfo($res['iss_id']); $res['products'] = Product::getProductsByIssue($res['iss_id']); $returns[$issue_id] = $res; return $res; }
function getResolutionAssocList($p) { $res = Resolution::getAssocList(); return new XML_RPC_Response(XML_RPC_Encode($res)); }
// | | // | Free Software Foundation, Inc. | // | 51 Franklin Street, Suite 330 | // | Boston, MA 02110-1301, USA. | // +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ require_once dirname(__FILE__) . '/../../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('manage/resolution.tpl.html'); Auth::checkAuthentication(APP_COOKIE); $role_id = Auth::getCurrentRole(); if ($role_id < User::getRoleID('manager')) { Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR); $tpl->displayTemplate(); exit; } if (@$_POST['cat'] == 'new') { $res = Resolution::insert(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the issue resolution was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new issue resolution.'), Misc::MSG_INFO), -2 => array(ev_gettext('Please enter the title for this new issue resolution.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = Resolution::update(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the issue resolution was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the new issue resolution.'), Misc::MSG_INFO), -2 => array(ev_gettext('Please enter the title for this new issue resolution.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { Resolution::remove(); } if (@$_GET['cat'] == 'edit') { $tpl->assign('info', Resolution::getDetails($_GET['id'])); } $tpl->assign('list', Resolution::getList()); $tpl->displayTemplate();
/** * Method used to get the details for a specific issue. * * @access public * @param integer $issue_id The issue ID * @param boolean $force_refresh If the cache should not be used. * @return array The details for the specified issue */ function getDetails($issue_id, $force_refresh = false) { global $HTTP_SERVER_VARS; static $returns; $issue_id = Misc::escapeInteger($issue_id); if (empty($issue_id)) { return ''; } if (!empty($returns[$issue_id]) && $force_refresh != true) { return $returns[$issue_id]; } $stmt = "SELECT\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue.*,\n prj_title,\n prc_title,\n pre_title,\n pri_title,\n sta_title,\n sta_abbreviation,\n sta_color status_color,\n sta_is_closed,\n\t\t\t\t\tsup_id as last_sup_id,\n\t\t\t\t\tseb_body as last_seb_body,\n\t\t\t\t\tema_id,\n\t\t\t\t\ten_email as reporter_email\n FROM\n (\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project\n )\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_priority\n ON\n iss_pri_id=pri_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "status\n ON\n iss_sta_id=sta_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_category\n ON\n iss_prc_id=prc_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_release\n ON\n iss_pre_id=pre_id\n LEFT JOIN\n " . ETEL_USER_TABLE_NOSUB . "\n ON\n iss_usr_id=en_ID\n LEFT JOIN\n (\n\t\t\t\t\t\tSelect sup_id,sup_iss_id,seb_body\n\t\t\t\t\t\tfrom " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email\n\t\t\t\t\t\tleft join " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email_body on seb_sup_id = sup_id \n\t\t\t\t\t\twhere sup_iss_id = {$issue_id} order by sup_date desc\n\t\t\t\t\t) as sup\n ON\n sup_iss_id = iss_id\n LEFT JOIN\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_account\n ON\n ema_prj_id = iss_prj_id\n WHERE\n iss_id={$issue_id} AND\n iss_prj_id=prj_id"; $res = $GLOBALS["db_api"]->dbh->getRow($stmt, DB_FETCHMODE_ASSOC); if (PEAR::isError($res)) { Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__); return ""; } else { if (empty($res)) { return ""; } else { $created_date_ts = Date_API::getUnixTimestamp($res['iss_created_date'], Date_API::getDefaultTimezone()); // get customer information, if any if (!empty($res['iss_customer_id']) && Customer::hasCustomerIntegration($res['iss_prj_id'])) { $res['customer_business_hours'] = Customer::getBusinessHours($res['iss_prj_id'], $res['iss_customer_id']); $res['contact_local_time'] = Date_API::getFormattedDate(Date_API::getCurrentDateGMT(), $res['iss_contact_timezone']); $res['customer_info'] = Customer::getDetails($res['iss_prj_id'], $res['iss_customer_id']); $res['redeemed_incidents'] = Customer::getRedeemedIncidentDetails($res['iss_prj_id'], $res['iss_id']); $max_first_response_time = Customer::getMaximumFirstResponseTime($res['iss_prj_id'], $res['iss_customer_id']); $res['max_first_response_time'] = Misc::getFormattedTime($max_first_response_time / 60); if (empty($res['iss_first_response_date'])) { $first_response_deadline = $created_date_ts + $max_first_response_time; if (Date_API::getCurrentUnixTimestampGMT() <= $first_response_deadline) { $res['max_first_response_time_left'] = Date_API::getFormattedDateDiff($first_response_deadline, Date_API::getCurrentUnixTimestampGMT()); } else { $res['overdue_first_response_time'] = Date_API::getFormattedDateDiff(Date_API::getCurrentUnixTimestampGMT(), $first_response_deadline); } } } $res['iss_original_description'] = $res["iss_description"]; if (!strstr($HTTP_SERVER_VARS["PHP_SELF"], 'update.php')) { $res["iss_description"] = nl2br(htmlspecialchars($res["iss_description"])); $res["iss_resolution"] = Resolution::getTitle($res["iss_res_id"]); } $res["iss_impact_analysis"] = nl2br(htmlspecialchars($res["iss_impact_analysis"])); $res["iss_created_date"] = Date_API::getFormattedDate($res["iss_created_date"]); $res['iss_created_date_ts'] = $created_date_ts; $res["assignments"] = @implode(", ", array_values(Issue::getAssignedUsers($res["iss_id"]))); list($res['authorized_names'], $res['authorized_repliers']) = Authorized_Replier::getAuthorizedRepliers($res["iss_id"]); $temp = Issue::getAssignedUsersStatus($res["iss_id"]); $res["has_inactive_users"] = 0; $res["assigned_users"] = array(); $res["assigned_inactive_users"] = array(); foreach ($temp as $usr_id => $usr_status) { if (!User::isActiveStatus($usr_status)) { $res["assigned_inactive_users"][] = $usr_id; $res["has_inactive_users"] = 1; } else { $res["assigned_users"][] = $usr_id; } } if (@in_array(Auth::getUserID(), $res["assigned_users"])) { $res["is_current_user_assigned"] = 1; } else { $res["is_current_user_assigned"] = 0; } $res["associated_issues_details"] = Issue::getAssociatedIssuesDetails($res["iss_id"]); $res["associated_issues"] = Issue::getAssociatedIssues($res["iss_id"]); $res["reporter"] = User::getFullName($res["iss_usr_id"]); $res["email_list_details"] = Support::getFirstEmailer($issue_id); if (!$res["reporter"]) { $first_emailer = Support::getFirstEmailer($issue_id); $res["reporter"] = $first_emailer . " (No Account)"; $res["reporter_email"] = preg_replace('/.*<|>/', '', $first_emailer); } if (empty($res["iss_updated_date"])) { $res["iss_updated_date"] = 'not updated yet'; } else { $res["iss_updated_date"] = Date_API::getFormattedDate($res["iss_updated_date"]); } $res["estimated_formatted_time"] = Misc::getFormattedTime($res["iss_dev_time"]); if (Release::isAssignable($res["iss_pre_id"])) { $release = Release::getDetails($res["iss_pre_id"]); $res["pre_title"] = $release["pre_title"]; $res["pre_status"] = $release["pre_status"]; } // need to return the list of issues that are duplicates of this one $res["duplicates"] = Issue::getDuplicateList($res["iss_id"]); $res["duplicates_details"] = Issue::getDuplicateDetailsList($res["iss_id"]); // also get the issue title of the duplicated issue if (!empty($res['iss_duplicated_iss_id'])) { $res['duplicated_issue'] = Issue::getDuplicatedDetails($res['iss_duplicated_iss_id']); } // get group information if (!empty($res["iss_grp_id"])) { $res["group"] = Group::getDetails($res["iss_grp_id"]); } // get quarantine issue $res["quarantine"] = Issue::getQuarantineInfo($res["iss_id"]); $returns[$issue_id] = $res; return $res; } } }
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();
/** * Method used to send a diff-style notification email to the issue * subscribers about updates to its attributes. * * @param integer $issue_id The issue ID * @param array $old The old issue details * @param array $new The new issue details * @param array $updated_custom_fields An array of the custom fields that were changed. */ public static function notifyIssueUpdated($issue_id, $old, $new, $updated_custom_fields) { $prj_id = Issue::getProjectID($issue_id); $diffs = array(); if (@$new['keep_assignments'] == 'no') { if (empty($new['assignments'])) { $new['assignments'] = array(); } $assign_diff = Misc::arrayDiff($old['assigned_users'], $new['assignments']); if (count($assign_diff) > 0) { $diffs[] = '-' . ev_gettext('Assignment List') . ': ' . $old['assignments']; @($diffs[] = '+' . ev_gettext('Assignment List') . ': ' . implode(', ', User::getFullName($new['assignments']))); } } if (isset($new['expected_resolution_date']) && @$old['iss_expected_resolution_date'] != $new['expected_resolution_date']) { $diffs[] = '-' . ev_gettext('Expected Resolution Date') . ': ' . $old['iss_expected_resolution_date']; $diffs[] = '+' . ev_gettext('Expected Resolution Date') . ': ' . $new['expected_resolution_date']; } if (isset($new['category']) && $old['iss_prc_id'] != $new['category']) { $diffs[] = '-' . ev_gettext('Category') . ': ' . Category::getTitle($old['iss_prc_id']); $diffs[] = '+' . ev_gettext('Category') . ': ' . Category::getTitle($new['category']); } if (isset($new['release']) && $old['iss_pre_id'] != $new['release']) { $diffs[] = '-' . ev_gettext('Release') . ': ' . Release::getTitle($old['iss_pre_id']); $diffs[] = '+' . ev_gettext('Release') . ': ' . Release::getTitle($new['release']); } if (isset($new['priority']) && $old['iss_pri_id'] != $new['priority']) { $diffs[] = '-' . ev_gettext('Priority') . ': ' . Priority::getTitle($old['iss_pri_id']); $diffs[] = '+' . ev_gettext('Priority') . ': ' . Priority::getTitle($new['priority']); } if (isset($new['severity']) && $old['iss_sev_id'] != $new['severity']) { $diffs[] = '-' . ev_gettext('Severity') . ': ' . Severity::getTitle($old['iss_sev_id']); $diffs[] = '+' . ev_gettext('Severity') . ': ' . Severity::getTitle($new['severity']); } if (isset($new['status']) && $old['iss_sta_id'] != $new['status']) { $diffs[] = '-' . ev_gettext('Status') . ': ' . Status::getStatusTitle($old['iss_sta_id']); $diffs[] = '+' . ev_gettext('Status') . ': ' . Status::getStatusTitle($new['status']); } if (isset($new['resolution']) && $old['iss_res_id'] != $new['resolution']) { $diffs[] = '-' . ev_gettext('Resolution') . ': ' . Resolution::getTitle($old['iss_res_id']); $diffs[] = '+' . ev_gettext('Resolution') . ': ' . Resolution::getTitle($new['resolution']); } if (isset($new['estimated_dev_time']) && $old['iss_dev_time'] != $new['estimated_dev_time']) { $diffs[] = '-' . ev_gettext('Estimated Dev. Time') . ': ' . Misc::getFormattedTime($old['iss_dev_time'] * 60); $diffs[] = '+' . ev_gettext('Estimated Dev. Time') . ': ' . Misc::getFormattedTime($new['estimated_dev_time'] * 60); } if (isset($new['summary']) && $old['iss_summary'] != $new['summary']) { $diffs[] = '-' . ev_gettext('Summary') . ': ' . $old['iss_summary']; $diffs[] = '+' . ev_gettext('Summary') . ': ' . $new['summary']; } if (isset($new['percent_complete']) && $old['iss_original_percent_complete'] != $new['percent_complete']) { $diffs[] = '-' . ev_gettext('Percent complete') . ': ' . $old['iss_original_percent_complete']; $diffs[] = '+' . ev_gettext('Percent complete') . ': ' . $new['percent_complete']; } if (isset($new['description']) && $old['iss_description'] != $new['description']) { $old['iss_description'] = explode("\n", $old['iss_original_description']); $new['description'] = explode("\n", $new['description']); $diff = new Text_Diff($old['iss_description'], $new['description']); $renderer = new Text_Diff_Renderer_unified(); $desc_diff = explode("\n", trim($renderer->render($diff))); $diffs[] = 'Description:'; foreach ($desc_diff as $diff) { $diffs[] = $diff; } } $data = Issue::getDetails($issue_id); $data['diffs'] = implode("\n", $diffs); $data['updated_by'] = User::getFullName(Auth::getUserID()); $all_emails = array(); $role_emails = array(User::ROLE_VIEWER => array(), User::ROLE_REPORTER => array(), User::ROLE_CUSTOMER => array(), User::ROLE_USER => array(), User::ROLE_DEVELOPER => array(), User::ROLE_MANAGER => array(), User::ROLE_ADMINISTRATOR => array()); $users = self::getUsersByIssue($issue_id, 'updated'); foreach ($users as $user) { if (empty($user['sub_usr_id'])) { $email = $user['sub_email']; // non users are treated as "Viewers" for permission checks $role = User::ROLE_VIEWER; } else { $prefs = Prefs::get($user['sub_usr_id']); if (Auth::getUserID() == $user['sub_usr_id'] && (empty($prefs['receive_copy_of_own_action'][$prj_id]) || $prefs['receive_copy_of_own_action'][$prj_id] == false)) { continue; } $email = User::getFromHeader($user['sub_usr_id']); $role = $user['pru_role']; } // now add it to the list of emails if (!empty($email) && !in_array($email, $all_emails)) { $all_emails[] = $email; $role_emails[$role][] = $email; } } // get additional email addresses to notify $additional_emails = Workflow::getAdditionalEmailAddresses($prj_id, $issue_id, 'issue_updated', array('old' => $old, 'new' => $new)); $data['custom_field_diffs'] = implode("\n", Custom_Field::formatUpdatesToDiffs($updated_custom_fields, User::ROLE_VIEWER)); foreach ($additional_emails as $email) { if (!in_array($email, $all_emails)) { $role_emails[User::ROLE_VIEWER][] = $email; } } // send email to each role separately due to custom field restrictions foreach ($role_emails as $role => $emails) { if (count($emails) > 0) { $data['custom_field_diffs'] = implode("\n", Custom_Field::formatUpdatesToDiffs($updated_custom_fields, $role)); if (!empty($data['custom_field_diffs']) || !empty($data['diffs'])) { self::notifySubscribers($issue_id, $emails, 'updated', $data, ev_gettext('Updated'), false); } } } }
<?php /** * @copyright 2012 City of Bloomington, Indiana * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt * @author Cliff Ingham <*****@*****.**> */ require_once './config.inc'; // Clear out the lookup tables. We'll import everything from Mongo // The mysql.sql script preloads some generic values for these tables $zend_db->delete('resolutions'); $zend_db->delete('actions'); $result = $mongo->resolutions->find(); foreach ($result as $r) { $o = new Resolution(); $o->handleUpdate($r); $o->save(); echo "Resolution: {$o->getName()}\n"; } $result = $mongo->actions->find(); foreach ($result as $r) { $o = new Action(); $o->handleUpdate($r); $o->save(); echo "Action: {$o->getName()}\n"; } $result = $mongo->lookups->findOne(array('name' => 'contactMethods')); $methods = $result['items']; foreach ($methods as $m) { $o = new ContactMethod(); $o->setName($m);
if (@$HTTP_POST_VARS["cat"] == "update") { $res = Issue::update($HTTP_POST_VARS["issue_id"]); $tpl->assign("update_result", $res); if (Issue::hasDuplicates($HTTP_POST_VARS["issue_id"])) { $tpl->assign("has_duplicates", "yes"); } } $prj_id = Auth::getCurrentProject(); $setup = Setup::load(); $tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]); // if currently selected release is in the past, manually add it to list $releases = Release::getAssocList($prj_id); if ($details["iss_pre_id"] != 0 && empty($releases[$details["iss_pre_id"]])) { $releases = array($details["iss_pre_id"] => $details["pre_title"]) + $releases; } 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, false); } if (!empty($details['iss_sta_id']) && empty($statuses[$details['iss_sta_id']])) { $statuses[$details['iss_sta_id']] = Status::getStatusTitle($details['iss_sta_id']); } $tpl->assign(array("subscribers" => Notification::getSubscribers($issue_id), "categories" => Category::getAssocList($prj_id), "priorities" => Priority::getAssocList($prj_id), "status" => $statuses, "releases" => $releases, "resolutions" => Resolution::getAssocList(), "users" => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), "assoc_issues" => array_map("htmlspecialchars", array()), "one_week_ts" => time() + 7 * DAY, "allow_unassigned_issues" => @$setup["allow_unassigned_issues"], "groups" => Group::getAssocList($prj_id))); $cookie = Auth::getCookieInfo(APP_PROJECT_COOKIE); if (!empty($cookie['auto_switched_from'])) { $tpl->assign(array("project_auto_switched" => 1, "old_project" => Project::getName($cookie['auto_switched_from']))); } } $tpl->displayTemplate();
<?php /** * @copyright 2011 City of Bloomington, Indiana * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt * @author Cliff Ingham <*****@*****.**> */ include '../../../configuration.inc'; $resolutions = array('Resolved' => 'This ticket has been taken care of', 'Duplicate' => 'This ticket is a duplicate of another ticket', 'Bogus' => 'This ticket is not actually a problem or has already been taken care of'); foreach ($resolutions as $name => $description) { $resolution = new Resolution(); $resolution->setName($name); $resolution->setDescription($description); $resolution->save(); echo "{$resolution}\n"; } $actions = array(array('name' => 'open', 'description' => 'Opened by {actionPerson}', 'type' => 'system'), array('name' => 'assignment', 'description' => '{enteredByPerson} assigned this case to {actionPerson}', 'type' => 'system'), array('name' => 'close', 'description' => 'Closed by {actionPerson}', 'type' => 'system'), array('name' => 'referral', 'description' => '{enteredByPerson} referred this case to {actionPerson}', 'type' => 'system'), array('name' => 'Inspection', 'description' => '{actionPerson} inspected this Location', 'type' => 'department'), array('name' => 'Follow up', 'description' => '{actionPerson} followed up on this ticket', 'type' => 'department')); foreach ($actions as $a) { $action = new Action(); $action->setName($a['name']); $action->setDescription($a['description']); $action->setType($a['type']); $action->save(); echo "{$action->getName()}\n"; }
/* @var $this ResolutionController */ /* @var $model Resolution */ /* @var $form CActiveForm */ $box = $this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Advanced Search', 'headerIcon' => 'icon-th-list', 'htmlOptions' => array('class' => 'bootstrap-widget-table', 'style' => 'width:98%;'))); ?> <br> <div class="span8"> <div class="wide form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); CHtml::$afterRequiredLabel = ''; ?> <?php echo $form->dropDownListRow($model, 'res_no', CHtml::listData(Resolution::model()->findAll(), 'res_no', 'res_no'), array('class' => 'span3', 'empty' => 'Choose Resolution No.')); ?> <?php //echo $form->textFieldRow($model, 'res_no', array('class'=>'span4')); ?> <?php echo $form->textFieldRow($model, 'subj_matter', array('class' => 'span4')); ?> <?php echo $form->select2Row($model, 'author', array('asDropDownList' => true, 'data' => CHtml::listData(Officials::model()->findAll(''), 'off_id', 'Fullname'), 'multiple' => 'multiple', 'data-placeholder' => ' ------------ Select Author ------------', 'options' => array('width' => '40%'))); ?> <?php
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Resolution the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Resolution::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
// 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.user.php"; include_once APP_INC_PATH . "class.resolution.php"; include_once APP_INC_PATH . "db_access.php"; $tpl = new Template_API(); $tpl->setTemplate("manage/index.tpl.html"); Auth::checkAuthentication(APP_COOKIE); $tpl->assign("type", "resolution"); $role_id = Auth::getCurrentRole(); if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) { if ($role_id == User::getRoleID('administrator')) { $tpl->assign("show_setup_links", true); } if (@$HTTP_POST_VARS["cat"] == "new") { $tpl->assign("result", Resolution::insert()); } elseif (@$HTTP_POST_VARS["cat"] == "update") { $tpl->assign("result", Resolution::update()); } elseif (@$HTTP_POST_VARS["cat"] == "delete") { Resolution::remove(); } if (@$HTTP_GET_VARS["cat"] == "edit") { $tpl->assign("info", Resolution::getDetails($HTTP_GET_VARS["id"])); } $tpl->assign("list", Resolution::getList()); } else { $tpl->assign("show_not_allowed_msg", true); } $tpl->displayTemplate();
$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();
public function actionIndex() { $reso = new Resolution('searchIndex'); $reso->unsetAttributes(); // clear any default values if (isset($_GET['Resolution'])) { $reso->attributes = $_GET['Resolution']; } $ordi = new Ordinance('search'); $ordi->unsetAttributes(); // clear any default values if (isset($_GET['Ordinance'])) { $ordi->attributes = $_GET['Ordinance']; } $fquestion = new ForumQuestion('searchPosted'); $fquestion->unsetAttributes(); // clear any default values if (isset($_GET['ForumQuestion'])) { $model->attributes = $_GET['ForumQuestion']; } // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' $months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $jan = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-01%"'))); $feb = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-02%"'))); $mar = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-03%"'))); $apr = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-04%"'))); $may = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-05%"'))); $jun = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-06%"'))); $jul = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-07%"'))); $aug = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-08%"'))); $sep = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-09%"'))); $oct = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-10%"'))); $nov = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-11%"'))); $dec = count(Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-12%"'))); $months_data = array($jan, $feb, $mar, $apr, $may, $jun, $jul, $aug, $sep, $oct, $nov, $dec); $jan1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-01%"'))); $feb1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-02%"'))); $mar1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-03%"'))); $apr1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-04%"'))); $may1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-05%"'))); $jun1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-06%"'))); $jul1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-07%"'))); $aug1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-08%"'))); $sep1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-09%"'))); $oct1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-10%"'))); $nov1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-11%"'))); $dec1 = count(Ordinance::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-12%"'))); $months_dataOrd = array($jan1, $feb1, $mar1, $apr1, $may1, $jun1, $jul1, $aug1, $sep1, $oct1, $nov1, $dec1); $sql = 'select distinct substring(res_no,6,9) as reso from tbl_resolution order by date_passed asc'; $connection = Yii::app()->db; $command = $connection->createCommand($sql); $years = $command->queryAll(); $sql1 = 'select distinct substring(ord_no,6,9) as ordi from tbl_ordinance order by date_passed asc'; $connection1 = Yii::app()->db; $command1 = $connection->createCommand($sql1); $yearsOrd = $command1->queryAll(); $y = array(); foreach ($years as $value) { array_push($y, count(Resolution::model()->findAll(array('condition' => 'res_no like "%' . $value['reso'] . '"')))); } $yOrd = array(); foreach ($yearsOrd as $value) { array_push($yOrd, count(Ordinance::model()->findAll(array('condition' => 'ord_no like "%' . $value['ordi'] . '"')))); } if (!empty(User::model()->findByPK(Yii::app()->user->name)->emp_id)) { date_default_timezone_set("Asia/Manila"); $activity = new Activity(); $activity->act_desc = 'Return to Homepage'; $activity->act_datetime = date('Y-m-d G:i:s'); $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id; $activity->save(); } $this->render('index', array('months_dataOrd' => $months_dataOrd, 'months' => $months, 'months_data' => $months_data, 'years' => $years, 'yOrd' => $yOrd, 'years_data' => $y, 'reso' => $reso, 'ordi' => $ordi, 'fquestion' => $fquestion)); }
function Delete() { // Check the token if (!Kit::CheckToken()) { trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR); } $db =& $this->db; $user =& $this->user; $response = new ResponseManager(); $resolutionID = Kit::GetParam('resolutionid', _POST, _INT); // Remove the resolution $resObject = new Resolution($db); if (!$resObject->Delete($resolutionID)) { trigger_error($resObject->GetErrorMessage(), E_USER_ERROR); } $response->SetFormSubmitResponse('Resolution deleted'); $response->Respond(); }
public function resolution() { return $this->belongsTo(Resolution::getClass()); }
public function series($noMonth) { $officials = Officials::model()->findAll(array('condition' => 'now() >= start_date and now() <= end_date', 'order' => 'off_id asc')); $resolutions = Resolution::model()->findAll(array('condition' => 'date_passed like "' . date('Y') . '-' . $noMonth . '%"')); $series = array(); $off = array(); $off2 = array(); $x = 0; foreach ($officials as $v) { $off2[$v->off_id] = 0; $x++; } foreach ($officials as $val) { array_push($off, $val->off_id); } foreach ($resolutions as $reso) { $temp_reso = explode(',', $reso->author); foreach ($off as $val) { if (in_array($val, $temp_reso)) { $off2[$val]++; } } } foreach ($off2 as $values => $key) { $temp = array('name' => Officials::model()->findByPK($values)->Fullname, 'data' => array($key)); array_push($series, $temp); } return $series; }
public function getTitle($d) { $x = Referral::model()->findByAttributes(array('ctrl_no' => $d)); if (!empty($x->ref_id)) { if ($this->cat->cat_name == 'Provincial Ordinance') { $ord = CommMeetingOrdi::model()->findAll(array('condition' => 'ref_id=' . $x->ref_id, 'order' => 'date_meeting desc', 'limit' => 1)); $y = ''; foreach ($ord as $key) { $y = $key->meeting_ordi_id; } if (!empty(Ordinance::model()->findByAttributes(array('meeting_ordi_id' => $y))->ord_no)) { echo 'Ord No. ' . Ordinance::model()->findByAttributes(array('meeting_ordi_id' => $y))->ord_no; } else { echo 'None'; } } else { $reso = CommMeetingReso::model()->findAll(array('condition' => 'ref_id=' . $x->ref_id, 'order' => 'date_meeting desc', 'limit' => 1)); foreach ($reso as $key) { if (!empty($key->comm_report)) { if (!empty(Resolution::model()->findByAttributes(array('ctrl_no' => $d))->res_no)) { echo 'Res No. ' . Resolution::model()->findByAttributes(array('ctrl_no' => $d))->res_no; } else { echo 'None'; } } else { echo 'None'; } } } } else { if (!empty(Resolution::model()->findByAttributes(array('ctrl_no' => $d))->res_no)) { echo 'Res No. ' . Resolution::model()->findByAttributes(array('ctrl_no' => $d))->res_no; } else { echo 'None'; } } }
/** * @return array * @access public */ public function getResolutionAssocList() { $res = Resolution::getAssocList(); return $res; }
if (!isset($issue_fields_display['percent_complete']) || $issue_fields_display['percent_complete'] != false) { $columns[0][] = array('title' => ev_gettext('Percentage Complete'), 'data' => (empty($details['iss_percent_complete']) ? 0 : $details['iss_percent_complete']) . '%', 'field' => 'percentage_complete'); } $columns[0][] = array('title' => ev_gettext('Reporter'), 'field' => 'reporter'); $products = Product::getAssocList(false); if (count($products) > 0) { $columns[0][] = array('title' => ev_gettext('Product'), 'field' => 'product'); $columns[0][] = array('title' => ev_gettext('Product Version'), 'field' => 'product_version'); } $columns[0][] = array('title' => ev_gettext('Assignment'), 'data' => $details['assignments'], 'field' => 'assignment'); $columns[1][] = array('title' => ev_gettext('Notification List'), 'field' => 'notification_list'); $columns[1][] = array('title' => ev_gettext('Submitted Date'), 'data' => $details['iss_created_date']); $columns[1][] = array('title' => ev_gettext('Last Updated Date'), 'data' => $details['iss_updated_date']); $columns[1][] = array('title' => ev_gettext('Associated Issues'), 'field' => 'associated_issues'); if (!isset($issue_fields_display['expected_resolution']) || $issue_fields_display['expected_resolution'] != false) { $columns[1][] = array('title' => ev_gettext('Expected Resolution Date'), 'field' => 'expected_resolution'); } if (!isset($issue_fields_display['estimated_dev_time']) || $issue_fields_display['estimated_dev_time'] != false) { $columns[1][] = array('title' => ev_gettext('Estimated Dev. Time'), 'data' => $details['iss_dev_time'] . empty($details['iss_dev_time']) ? '' : ' hours', 'field' => 'estimated_dev_time'); } if ($role_id > User::getRoleID('Customer')) { $columns[1][] = array('title' => ev_gettext('Duplicates'), 'field' => 'duplicates', 'title_bgcolor' => APP_INTERNAL_COLOR); $columns[1][] = array('title' => ev_gettext('Authorized Repliers'), 'field' => 'authorized_repliers', 'title_bgcolor' => APP_INTERNAL_COLOR); } $groups = Group::getAssocList($prj_id); if ($role_id > User::getRoleID('Customer') && count($groups) > 0) { $columns[1][] = array('title' => ev_gettext('Group'), 'data' => isset($details['group']) ? $details['group']['grp_name'] : '', 'title_bgcolor' => APP_INTERNAL_COLOR); } $tpl->assign(array('subscribers' => Notification::getSubscribers($issue_id), 'categories' => $categories, 'priorities' => $priorities, 'severities' => $severities, 'status' => $statuses, 'releases' => $releases, 'resolutions' => Resolution::getAssocList(), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'one_week_ts' => time() + 7 * Date_Helper::DAY, 'groups' => Group::getAssocList($prj_id), 'current_year' => date('Y'), 'products' => Product::getList(false), 'grid' => $columns)); $tpl->assign('usr_role_id', User::getRoleByUser($usr_id, $prj_id)); $tpl->displayTemplate();
$data['longitude'] = $r['coordinates']['longitude']; } // Address Service Fields $af = array(); if (!empty($r['neighborhoodAssociation'])) { $af['neighborhoodAssociation'] = $r['neighborhoodAssociation']; } if (!empty($r['township'])) { $af['township'] = $r['township']; } if (count($af)) { $data['additionalFields'] = json_encode($af); } if (!empty($r['resolution'])) { try { $resolution = new Resolution($r['resolution']); $data['resolution_id'] = $resolution->getId(); } catch (Exception $e) { } // Just ignore bad Resolutions } try { $zend_db->insert('tickets', $data); } catch (Exception $e) { // Just log the problem tickets and move on // We'll need to check the log once we're done echo "Ticket save failed: {$e->getMessage()}\n"; fwrite($TICKET_FAILURE_LOG, $e->getMessage() . "\n"); fwrite($TICKET_FAILURE_LOG, print_r($data, true)); fwrite($TICKET_FAILURE_LOG, print_r($r, true)); continue;
/** * Method used to send a diff-style notification email to the issue * subscribers about updates to its attributes. * * @param integer $issue_id The issue ID * @param array $old The old issue details * @param array $new The new issue details */ public static function notifyIssueUpdated($issue_id, $old, $new) { $prj_id = Issue::getProjectID($issue_id); $diffs = array(); if (@$new['keep_assignments'] == 'no') { if (empty($new['assignments'])) { $new['assignments'] = array(); } $assign_diff = Misc::arrayDiff($old['assigned_users'], $new['assignments']); if (count($assign_diff) > 0) { $diffs[] = '-' . ev_gettext('Assignment List') . ': ' . $old['assignments']; @($diffs[] = '+' . ev_gettext('Assignment List') . ': ' . implode(', ', User::getFullName($new['assignments']))); } } if (isset($new['expected_resolution_date']) && @$old['iss_expected_resolution_date'] != $new['expected_resolution_date']) { $diffs[] = '-' . ev_gettext('Expected Resolution Date') . ': ' . $old['iss_expected_resolution_date']; $diffs[] = '+' . ev_gettext('Expected Resolution Date') . ': ' . $new['expected_resolution_date']; } if (isset($new['category']) && $old['iss_prc_id'] != $new['category']) { $diffs[] = '-' . ev_gettext('Category') . ': ' . Category::getTitle($old['iss_prc_id']); $diffs[] = '+' . ev_gettext('Category') . ': ' . Category::getTitle($new['category']); } if (isset($new['release']) && $old['iss_pre_id'] != $new['release']) { $diffs[] = '-' . ev_gettext('Release') . ': ' . Release::getTitle($old['iss_pre_id']); $diffs[] = '+' . ev_gettext('Release') . ': ' . Release::getTitle($new['release']); } if (isset($new['priority']) && $old['iss_pri_id'] != $new['priority']) { $diffs[] = '-' . ev_gettext('Priority') . ': ' . Priority::getTitle($old['iss_pri_id']); $diffs[] = '+' . ev_gettext('Priority') . ': ' . Priority::getTitle($new['priority']); } if (isset($new['severity']) && $old['iss_sev_id'] != $new['severity']) { $diffs[] = '-' . ev_gettext('Severity') . ': ' . Severity::getTitle($old['iss_sev_id']); $diffs[] = '+' . ev_gettext('Severity') . ': ' . Severity::getTitle($new['severity']); } if (isset($new['status']) && $old['iss_sta_id'] != $new['status']) { $diffs[] = '-' . ev_gettext('Status') . ': ' . Status::getStatusTitle($old['iss_sta_id']); $diffs[] = '+' . ev_gettext('Status') . ': ' . Status::getStatusTitle($new['status']); } if (isset($new['resolution']) && $old['iss_res_id'] != $new['resolution']) { $diffs[] = '-' . ev_gettext('Resolution') . ': ' . Resolution::getTitle($old['iss_res_id']); $diffs[] = '+' . ev_gettext('Resolution') . ': ' . Resolution::getTitle($new['resolution']); } if (isset($new['estimated_dev_time']) && $old['iss_dev_time'] != $new['estimated_dev_time']) { $diffs[] = '-' . ev_gettext('Estimated Dev. Time') . ': ' . Misc::getFormattedTime($old['iss_dev_time'] * 60); $diffs[] = '+' . ev_gettext('Estimated Dev. Time') . ': ' . Misc::getFormattedTime($new['estimated_dev_time'] * 60); } if (isset($new['summary']) && $old['iss_summary'] != $new['summary']) { $diffs[] = '-' . ev_gettext('Summary') . ': ' . $old['iss_summary']; $diffs[] = '+' . ev_gettext('Summary') . ': ' . $new['summary']; } if (isset($new['percent_complete']) && $old['iss_original_percent_complete'] != $new['percent_complete']) { $diffs[] = '-' . ev_gettext('Percent complete') . ': ' . $old['iss_original_percent_complete']; $diffs[] = '+' . ev_gettext('Percent complete') . ': ' . $new['percent_complete']; } if (isset($new['description']) && $old['iss_description'] != $new['description']) { $old['iss_description'] = explode("\n", $old['iss_original_description']); $new['description'] = explode("\n", $new['description']); $diff = new Text_Diff($old['iss_description'], $new['description']); $renderer = new Text_Diff_Renderer_unified(); $desc_diff = explode("\n", trim($renderer->render($diff))); $diffs[] = 'Description:'; foreach ($desc_diff as $diff) { $diffs[] = $diff; } } $emails = array(); $users = self::getUsersByIssue($issue_id, 'updated'); $user_emails = Project::getUserEmailAssocList(Issue::getProjectID($issue_id), 'active', User::getRoleID('Customer')); // FIXME: $user_emails unused $user_emails = array_map(function ($s) { return strtolower($s); }, $user_emails); foreach ($users as $user) { if (empty($user['sub_usr_id'])) { $email = $user['sub_email']; } else { $prefs = Prefs::get($user['sub_usr_id']); if (Auth::getUserID() == $user['sub_usr_id'] && (empty($prefs['receive_copy_of_own_action'][$prj_id]) || $prefs['receive_copy_of_own_action'][$prj_id] == false)) { continue; } $email = User::getFromHeader($user['sub_usr_id']); } // now add it to the list of emails if (!empty($email) && !in_array($email, $emails)) { $emails[] = $email; } } // get additional email addresses to notify $emails = array_merge($emails, Workflow::getAdditionalEmailAddresses($prj_id, $issue_id, 'issue_updated', array('old' => $old, 'new' => $new))); $data = Issue::getDetails($issue_id); $data['diffs'] = implode("\n", $diffs); $data['updated_by'] = User::getFullName(Auth::getUserID()); self::notifySubscribers($issue_id, $emails, 'updated', $data, ev_gettext('Updated'), false); }