57
57
$details = Issue::getDetails($issue_id);
58
58
if ($details == '') {
59
Misc::setMessage(ev_gettext('Error: The issue #%1$s could not be found.', $issue_id), Misc::MSG_ERROR);
60
$tpl->displayTemplate();
59
Misc::displayErrorMessage(ev_gettext('Error: The issue #%1$s could not be found.', $issue_id));
64
62
// TRANSLATORS: %1 = issue id
65
63
$tpl->assign("issue", $details);
66
$tpl->assign('customer_template_path', Customer::getTemplatePath($prj_id));
68
65
// in the case of a customer user, also need to check if that customer has access to this issue
69
if (($role_id == User::getRoleID('customer')) && ((empty($details)) || (User::getCustomerID($usr_id) != $details['iss_customer_id'])) ||
70
!Issue::canAccess($issue_id, $usr_id)) {
71
Misc::setMessage(ev_gettext('Sorry, you do not have the required privileges to view this issue.'), Misc::MSG_ERROR);
72
$tpl->displayTemplate();
66
if (!Issue::canAccess($issue_id, $usr_id)) {
67
Misc::displayErrorMessage(ev_gettext('Sorry, you do not have the required privileges to view this issue.'));
70
// if the issue has a different customer then the currently selected one, switch customers
71
if (Auth::getCurrentRole() == User::getRoleID("Customer") && Auth::getCurrentCustomerID() != $details['iss_customer_id']) {
72
Auth::setCurrentCustomerID($details['iss_customer_id']);
73
Misc::setMessage("Active customer changed to '" . $details['customer']->getName() . '"');
74
Auth::redirect(APP_RELATIVE_URL . "view.php?id=" . $issue_id);
75
77
$associated_projects = @array_keys(Project::getAssocList($usr_id));
76
78
if ((empty($details)) || ($details['iss_prj_id'] != $prj_id)) {
77
$tpl->assign('issue', '');
79
Misc::displayErrorMessage(ev_gettext(ev_gettext('Error: The issue #%1$s could not be found.', $issue_id)));
79
81
// now that we can access to the issue, add more verbose HTML <title>
80
82
// TRANSLATORS: Page HTML title: %1 = issue id, %2 = issue summary
83
85
// check if the requested issue is a part of one of the projects
84
86
// associated with this user
85
87
if (!@in_array($details['iss_prj_id'], $associated_projects)) {
86
$tpl->assign("auth_customer", 'denied');
88
Misc::displayErrorMessage(ev_gettext('Sorry, you do not have the required privileges to view this issue.'));
88
90
$options = Search::saveSearchParams();
89
91
$sides = Issue::getSides($issue_id, $options);