// 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.custom_field.php"; include_once APP_INC_PATH . "class.project.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", "custom_fields"); $role_id = Auth::getCurrentRole(); if ($role_id == User::getRoleID('administrator')) { $tpl->assign("show_setup_links", true); if (@$HTTP_POST_VARS["cat"] == "new") { $tpl->assign("result", Custom_Field::insert()); } elseif (@$HTTP_POST_VARS["cat"] == "update") { $tpl->assign("result", Custom_Field::update()); } elseif (@$HTTP_POST_VARS["cat"] == "delete") { Custom_Field::remove(); } elseif (@$_REQUEST["cat"] == "change_rank") { Custom_Field::changeRank(); } if (@$HTTP_GET_VARS["cat"] == "edit") { $tpl->assign("info", Custom_Field::getDetails($HTTP_GET_VARS["id"])); } $excluded_roles = array(); if (!Customer::hasCustomerIntegration(Auth::getCurrentProject())) { $excluded_roles[] = "customer"; } $user_roles = User::getRoles($excluded_roles);
// +----------------------------------------------------------------------+ // | Authors: João Prado Maia <*****@*****.**> | // +----------------------------------------------------------------------+ require_once dirname(__FILE__) . '/../../init.php'; $tpl = new Template_Helper(); $tpl->setTemplate('manage/custom_fields.tpl.html'); Auth::checkAuthentication(APP_COOKIE); $role_id = Auth::getCurrentRole(); if ($role_id < User::getRoleID('administrator')) { Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR); $tpl->displayTemplate(); exit; } $tpl->assign('project_list', Project::getAll()); if (@$_POST['cat'] == 'new') { $res = Custom_Field::insert(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the custom field was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new custom field.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'update') { $res = Custom_Field::update(); Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the custom field was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the custom field information.'), Misc::MSG_ERROR))); } elseif (@$_POST['cat'] == 'delete') { $res = Custom_Field::remove(); Misc::mapMessages($res, array(true => array(ev_gettext('Thank you, the custom field was removed successfully.'), Misc::MSG_INFO), false => array(ev_gettext('An error occurred while trying to remove the custom field information.'), Misc::MSG_ERROR))); } elseif (@$_REQUEST['cat'] == 'change_rank') { Custom_Field::changeRank(); } if (@$_GET['cat'] == 'edit') { $tpl->assign('info', Custom_Field::getDetails($_GET['id'])); } $excluded_roles = array(); if (!CRM::hasCustomerIntegration(Auth::getCurrentProject())) {