Пример #1
0
 *
 * For the full copyright and license information,
 * please see the COPYING and AUTHORS files
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('reports/custom_fields.tpl.html');
Auth::checkAuthentication();
if (!Access::canAccessReports(Auth::getUserID())) {
    echo 'Invalid role';
    exit;
}
$prj_id = Auth::getCurrentProject();
// get list of fields and convert info useful arrays
$fields = Custom_Field::getListByProject($prj_id, '');
$custom_fields = array();
$options = array();
if (is_array($fields) && count($fields) > 0) {
    foreach ($fields as $field) {
        $custom_fields[$field['fld_id']] = $field['fld_title'];
        $options[$field['fld_id']] = Custom_Field::getOptions($field['fld_id']);
    }
} else {
    echo ev_gettext('No custom fields for this project');
    exit;
}
if (!empty($_REQUEST['start']['Year']) && !empty($_REQUEST['start']['Month']) && !empty($_REQUEST['start']['Day'])) {
    $start = implode('-', $_REQUEST['start']);
} else {
    $start = false;
/*
 * This file is part of the Eventum (Issue Tracking System) package.
 *
 * @copyright (c) Eventum Team
 * @license GNU General Public License, version 2 or later (GPL-2+)
 *
 * For the full copyright and license information,
 * please see the COPYING and AUTHORS files
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
Auth::checkAuthentication();
if (!empty($_REQUEST['iss_id'])) {
    $fields = Custom_Field::getListByIssue(Auth::getCurrentProject(), $_REQUEST['iss_id']);
} else {
    $fields = Custom_Field::getListByProject(Auth::getCurrentProject(), $_REQUEST['form_type']);
}
$data = array();
foreach ($fields as $field) {
    $backend = Custom_Field::getBackend($field['fld_id']);
    if (is_object($backend) && is_subclass_of($backend, 'Dynamic_Custom_Field_Backend')) {
        $field['structured_data'] = $backend->getStructuredData();
        $data[] = $field;
    }
}
header('Content-Type: text/javascript; charset=UTF-8');
$tpl = new Template_Helper();
$tpl->setTemplate('js/dynamic_custom_field.tpl.js');
$tpl->assign('fields', $data);
$tpl->displayTemplate();
Пример #3
0
        // need to show everything again
        $tpl->assign('error_msg', '1');
    }
} elseif (@$_GET['post_form'] == 'yes') {
    // only list those projects that are allowing anonymous reporting of new issues
    $projects = Project::getAnonymousList();
    if (empty($projects)) {
        $tpl->assign('no_projects', '1');
    } else {
        if (!in_array($_GET['project'], array_keys($projects))) {
            $tpl->assign('no_projects', '1');
        } else {
            // get list of custom fields for the selected project
            $options = Project::getAnonymousPostOptions($_GET['project']);
            if (@$options['show_custom_fields'] == 'yes') {
                $tpl->assign('custom_fields', Custom_Field::getListByProject($_GET['project'], 'anonymous_form'));
            }
            $tpl->assign('project_name', Project::getName($_GET['project']));
        }
    }
} else {
    // only list those projects that are allowing anonymous reporting of new issues
    $projects = Project::getAnonymousList();
    if (empty($projects)) {
        $tpl->assign('no_projects', '1');
    } else {
        if (count($projects) == 1) {
            $project_ids = array_keys($projects);
            Auth::redirect('post.php?post_form=yes&project=' . $project_ids[0]);
        } else {
            $tpl->assign('projects', $projects);
Пример #4
0
        if (count($item) == 1) {
            $email_details = Support::getEmailDetails(Email_Account::getAccountByEmail($item[0]), $item[0]);
            $tpl->assign(array('issue_summary' => $email_details['sup_subject'], 'issue_description' => $email_details['seb_body']));
            // also auto pre-fill the customer contact text fields
            if (CRM::hasCustomerIntegration($prj_id)) {
                $sender_email = Mail_Helper::getEmailAddress($email_details['sup_from']);
                try {
                    $contact = $crm->getContactByEmail($sender_email);
                    $tpl->assign('contact_details', $contact->getDetails());
                } catch (CRMException $e) {
                }
            }
        }
    }
}
$tpl->assign(array('cats' => Category::getAssocList($prj_id), 'priorities' => Priority::getAssocList($prj_id), 'severities' => Severity::getList($prj_id), 'users' => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), 'releases' => Release::getAssocList($prj_id), 'custom_fields' => Custom_Field::getListByProject($prj_id, 'report_form'), 'max_attachment_size' => Attachment::getMaxAttachmentSize(), 'max_attachment_bytes' => Attachment::getMaxAttachmentSize(true), 'field_display_settings' => Project::getFieldDisplaySettings($prj_id), 'groups' => Group::getAssocList($prj_id), 'products' => Product::getList(false)));
$prefs = Prefs::get($usr_id);
$tpl->assign('user_prefs', $prefs);
$tpl->assign('zones', Date_Helper::getTimezoneList());
if (Auth::getCurrentRole() == User::getRoleID('Customer')) {
    $crm = CRM::getInstance(Auth::getCurrentProject());
    $customer_contact_id = User::getCustomerContactID($usr_id);
    $contact = $crm->getContact($customer_contact_id);
    $customer_id = Auth::getCurrentCustomerID();
    $customer = $crm->getCustomer($customer_id);
    // TODOCRM: Pull contacts via ajax when user selects contract
    $tpl->assign(array('customer_id' => $customer_id, 'contact_id' => $customer_contact_id, 'customer' => $customer, 'contact' => $contact));
}
$clone_iss_id = isset($_GET['clone_iss_id']) ? (int) $_GET['clone_iss_id'] : null;
if ($clone_iss_id && Access::canCloneIssue($clone_iss_id, $usr_id)) {
    $tpl->assign(Issue::getCloneIssueTemplateVariables($clone_iss_id));
Пример #5
0
// customers should not be able to see this page
$role_id = Auth::getCurrentRole();
if ($role_id < User::getRoleID('Standard User')) {
    Auth::redirect(APP_RELATIVE_URL . "list.php");
}
$prj_id = Auth::getCurrentProject();
// generate options for assign list. If there are groups and user is above a customer, include groups
$groups = Group::getAssocList($prj_id);
$users = Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer'));
$assign_options = array("" => "Any", "-1" => "un-assigned", "-2" => "myself and un-assigned");
if (User::getGroupID(Auth::getUserID()) != '') {
    $assign_options['-3'] = 'myself and my group';
    $assign_options['-4'] = 'myself, un-assigned and my group';
}
if (count($groups) > 0 && $role_id > User::getRoleID("Customer")) {
    foreach ($groups as $grp_id => $grp_name) {
        $assign_options["grp:{$grp_id}"] = "Group: " . $grp_name;
    }
}
$assign_options += $users;
$tpl->assign(array("cats" => Category::getAssocList($prj_id), "priorities" => Priority::getList($prj_id), "status" => Status::getAssocStatusList($prj_id), "users" => $assign_options, "releases" => Release::getAssocList($prj_id, TRUE), "custom" => Filter::getListing($prj_id), "custom_fields" => Custom_Field::getListByProject($prj_id, ''), "reporters" => Project::getReporters($prj_id)));
if (!empty($HTTP_GET_VARS["custom_id"])) {
    $check_perm = true;
    if (Filter::isGlobal($HTTP_GET_VARS["custom_id"])) {
        if ($role_id >= User::getRoleID('Manager')) {
            $check_perm = false;
        }
    }
    $tpl->assign("options", Filter::getDetails($HTTP_GET_VARS["custom_id"], $check_perm));
}
$tpl->displayTemplate();
Пример #6
0
// generate options for assign list. If there are groups and user is above a customer, include groups
$groups = Group::getAssocList($prj_id);
$users = Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer'));
$assign_options = array('' => ev_gettext('Any'), '-1' => ev_gettext('un-assigned'), '-2' => ev_gettext('myself and un-assigned'));
if (Auth::isAnonUser()) {
    unset($assign_options['-2']);
} elseif (User::getGroupID(Auth::getUserID()) != '') {
    $assign_options['-3'] = ev_gettext('myself and my group');
    $assign_options['-4'] = ev_gettext('myself, un-assigned and my group');
}
if (count($groups) > 0 && $role_id > User::getRoleID('Customer')) {
    foreach ($groups as $grp_id => $grp_name) {
        $assign_options["grp:{$grp_id}"] = 'Group: ' . $grp_name;
    }
}
$assign_options += $users;
$tpl->assign(array('cats' => Category::getAssocList($prj_id), 'priorities' => Priority::getList($prj_id), 'severities' => Severity::getList($prj_id), 'status' => Status::getAssocStatusList($prj_id), 'users' => $assign_options, 'releases' => Release::getAssocList($prj_id, true), 'custom' => Filter::getListing($prj_id), 'custom_fields' => Custom_Field::getListByProject($prj_id, ''), 'reporters' => Project::getReporters($prj_id), 'products' => Product::getAssocList(false)));
if (!empty($_GET['custom_id'])) {
    $check_perm = true;
    if (Filter::isGlobal($_GET['custom_id'])) {
        if ($role_id >= User::getRoleID('Manager')) {
            $check_perm = false;
        }
    }
    $options = Filter::getDetails($_GET['custom_id'], $check_perm);
} else {
    $options = array();
    $options['cst_rows'] = APP_DEFAULT_PAGER_SIZE;
}
$tpl->assign('options', $options);
$tpl->displayTemplate();
Пример #7
0
        }
        // if we are dealing with just one message, use the subject line as the
        // summary for the issue, and the body as the description
        if (count($HTTP_GET_VARS["item"]) == 1) {
            $email_details = Support::getEmailDetails(Email_Account::getAccountByEmail($HTTP_GET_VARS["item"][0]), $HTTP_GET_VARS["item"][0]);
            $tpl->assign(array('issue_summary' => $email_details['sup_subject'], 'issue_description' => $email_details['message']));
            // also auto pre-fill the customer contact text fields
            if (Customer::hasCustomerIntegration($prj_id)) {
                $sender_email = Mail_API::getEmailAddress($email_details['sup_from']);
                list(, $contact_id) = Customer::getCustomerIDByEmails($prj_id, array($sender_email));
                if (!empty($contact_id)) {
                    $tpl->assign("contact_details", Customer::getContactDetails($prj_id, $contact_id));
                }
            }
        }
    }
}
$tpl->assign(array("cats" => Category::getAssocList($prj_id), "priorities" => Priority::getAssocList($prj_id), "users" => Project::getUserAssocList($prj_id, 'active', User::getRoleID('Customer')), "releases" => Release::getAssocList($prj_id), "custom_fields" => Custom_Field::getListByProject($prj_id, 'report_form'), "max_attachment_size" => Attachment::getMaxAttachmentSize(), "field_display_settings" => Project::getFieldDisplaySettings($prj_id), "groups" => Group::getAssocList($prj_id)));
$setup = Setup::load();
$tpl->assign("allow_unassigned_issues", @$setup["allow_unassigned_issues"]);
$prefs = Prefs::get($usr_id);
$tpl->assign("user_prefs", $prefs);
$tpl->assign("zones", Date_API::getTimezoneList());
if (User::getRole(Auth::getCurrentRole()) == "Customer") {
    $customer_contact_id = User::getCustomerContactID($usr_id);
    $tpl->assign("contact_details", Customer::getContactDetails($prj_id, $customer_contact_id));
    $customer_id = User::getCustomerID($usr_id);
    $tpl->assign("contacts", Customer::getContactEmailAssocList($prj_id, $customer_id));
    $tpl->assign(array("customer_id" => User::getCustomerID($usr_id), "contact_id" => User::getCustomerContactID($usr_id)));
}
$tpl->displayTemplate();
Пример #8
0
        // need to show everything again
        $tpl->assign("error_msg", "1");
    }
} elseif (@$HTTP_GET_VARS["post_form"] == "yes") {
    // only list those projects that are allowing anonymous reporting of new issues
    $projects = Project::getAnonymousList();
    if (empty($projects)) {
        $tpl->assign("no_projects", "1");
    } else {
        if (!in_array($HTTP_GET_VARS["project"], array_keys($projects))) {
            $tpl->assign("no_projects", "1");
        } else {
            // get list of custom fields for the selected project
            $options = Project::getAnonymousPostOptions($HTTP_GET_VARS["project"]);
            if (@$options["show_custom_fields"] == "yes") {
                $tpl->assign("custom_fields", Custom_Field::getListByProject($HTTP_GET_VARS["project"], 'anonymous_form'));
            }
            $tpl->assign("project_name", Project::getName($HTTP_GET_VARS["project"]));
        }
    }
} else {
    // only list those projects that are allowing anonymous reporting of new issues
    $projects = Project::getAnonymousList();
    if (empty($projects)) {
        $tpl->assign("no_projects", "1");
    } else {
        if (count($projects) == 1) {
            $project_ids = array_keys($projects);
            Auth::redirect('post.php?post_form=yes&project=' . $project_ids[0]);
        } else {
            $tpl->assign("projects", $projects);
Пример #9
0
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.report.php";
include_once APP_INC_PATH . "class.custom_field.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("reports/custom_fields.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
if (Auth::getCurrentRole() <= User::getRoleID("Customer")) {
    echo "Invalid role";
    exit;
}
$prj_id = Auth::getCurrentProject();
// get list of fields and convert info useful arrays
$fields = Custom_Field::getListByProject($prj_id, '', "combo");
$custom_fields = array();
$options = array();
if (is_array($fields) && count($fields) > 0) {
    foreach ($fields as $field) {
        $custom_fields[$field["fld_id"]] = $field["fld_title"];
        $options[$field["fld_id"]] = Custom_Field::getOptions($field["fld_id"]);
    }
} else {
    echo "No custom fields for this project";
    exit;
}
if (count(@$_GET['custom_field']) > 0) {
    $data = Report::getCustomFieldReport(@$HTTP_GET_VARS["custom_field"], @$HTTP_GET_VARS["custom_options"], @$HTTP_GET_VARS["group_by"], true);
}
$tpl->assign(array("custom_fields" => $custom_fields, "custom_field" => @$HTTP_GET_VARS["custom_field"], "options" => $options, "custom_options" => @$HTTP_GET_VARS["custom_options"], "group_by" => @$HTTP_GET_VARS["group_by"], "selected_options" => @$_REQUEST['custom_options'], "data" => @$data));