Commit e080cc5a authored by Jean-Paul Saman's avatar Jean-Paul Saman

Add loadConfig() function to load configuration.

parent b03f6a9e
...@@ -15,17 +15,7 @@ if (!canView('system')) { ...@@ -15,17 +15,7 @@ if (!canView('system')) {
@include_once( "./functions/admin_func.php" ); @include_once( "./functions/admin_func.php" );
$HELPDESK_CONFIG = array(); $HELPDESK_CONFIG = array();
$q = new w2p_Database_Query; $HELPDESK_CONFIG = loadConfiguration();
// Read values from table
$q->addQuery('*');
$q->addTable('helpdesk_config');
if (!$q->exec()) {
$AppUI->setMsg(db_error(), UI_MSG_ERROR);
}
while ($row = $q->fetchRow()) {
$HELPDESK_CONFIG[$row['helpdesk_config']] = $row['helpdesk_value'];
}
$q->clear();
// get a list of permitted companies // get a list of permitted companies
$company = new CCompany(); $company = new CCompany();
...@@ -221,7 +211,7 @@ $config_options = array( ...@@ -221,7 +211,7 @@ $config_options = array(
'buttons' => array (1 => $AppUI->_('Always'), 'buttons' => array (1 => $AppUI->_('Always'),
0 => $AppUI->_('Status change')) 0 => $AppUI->_('Status change'))
), ),
"notity_email_address" => array( "notify_email_address" => array(
"description" => $AppUI->_('New unassigned items notification address'), "description" => $AppUI->_('New unassigned items notification address'),
"value" => 'support@yourcompany.com', "value" => 'support@yourcompany.com',
'type' => 'text' 'type' => 'text'
......
...@@ -3,7 +3,26 @@ if (!defined('W2P_BASE_DIR')) { ...@@ -3,7 +3,26 @@ if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly'); die('You should not access this file directly');
} }
include_once 'config.php'; $HELDPDESK_CONFIG = loadConfig();
function loadConfig()
{
$config = array();
// Read values from table
$q = new w2p_Database_Query;
$q->addQuery('*');
$q->addTable('helpdesk_config');
if (!$q->exec()) {
$AppUI->setMsg(db_error(), UI_MSG_ERROR);
return null;
}
while ($row = $q->fetchRow()) {
$config[$row['helpdesk_config']] = $row['helpdesk_value'];
}
$q->clear();
return $config;
}
function getAllowedUsers($companyid=0,$activeOnly=0) function getAllowedUsers($companyid=0,$activeOnly=0)
{ {
......
...@@ -430,7 +430,7 @@ class CSetupHelpDesk extends w2p_System_Setup ...@@ -430,7 +430,7 @@ class CSetupHelpDesk extends w2p_System_Setup
$q->addInsert('helpdesk_value', '1'); $q->addInsert('helpdesk_value', '1');
$q->addInsert('helpdesk_config', 'task_requestor_notification'); $q->addInsert('helpdesk_config', 'task_requestor_notification');
$q->addInsert('helpdesk_value', '1'); $q->addInsert('helpdesk_value', '1');
$q->addInsert('helpdesk_config', 'notity_email_address'); $q->addInsert('helpdesk_config', 'notify_email_address');
$q->addInsert('helpdesk_value', 'support@yourcomapany.com'); $q->addInsert('helpdesk_value', 'support@yourcomapany.com');
$q->addInsert('helpdesk_config', 'email_subject'); $q->addInsert('helpdesk_config', 'email_subject');
$q->addInsert('helpdesk_value', 'Your Company registered your recent request'); $q->addInsert('helpdesk_value', 'Your Company registered your recent request');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment