Verified Commit f297d777 authored by Helmo's avatar Helmo
Browse files

Move back out of db class again

parent 0df596d8
Pipeline #11349 passed with stage
in 7 minutes and 33 seconds
......@@ -189,10 +189,6 @@ class db
return $sQuery;
}
function get_client_sql_concat_query() {
return "CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), IF(client.contact_firstname != '', CONCAT(client.contact_firstname, ' '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')')";
}
/**#@-*/
......@@ -354,7 +350,6 @@ class db
* @return array result row or NULL if none found
*/
public function queryOneRecord($sQuery = '') {
$sQuery = str_replace("{CLIENTNAMESQL}", $this->get_client_sql_concat_query(), $sQuery);
$aArgs = func_get_args();
if(!empty($aArgs)) {
......@@ -394,7 +389,6 @@ class db
* @return array all the rows in the result set
*/
public function queryAllRecords($sQuery = '') {
$sQuery = str_replace("{CLIENTNAMESQL}", $this->get_client_sql_concat_query(), $sQuery);
$aArgs = func_get_args();
$oResult = call_user_func_array(array(&$this, 'query'), $aArgs);
if(!$oResult) return array();
......
......@@ -640,6 +640,10 @@ class functions {
return $result;
}
// SQL query snippit for the client's company and username.
function get_client_sql_concat_query() {
return "CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')')";
}
}
?>
......@@ -94,6 +94,7 @@ class listform {
//$table_idx = $this->formDef['db_table_idx'];
//$querystring = str_replace("{RECORDID}",$record[$table_idx],$querystring);
$app->uses('tform');
$querystring = str_replace("{CLIENTNAMESQL}", $app->functions->get_client_sql_concat_query(), $querystring);
$querystring = str_replace("{AUTHSQL}", $app->tform->getAuthSQL('r'), $querystring);
$querystring = str_replace("{AUTHSQL-A}", $app->tform->getAuthSQL('r', 'a'), $querystring);
$querystring = str_replace("{AUTHSQL-B}", $app->tform->getAuthSQL('r', 'b'), $querystring);
......
......@@ -275,6 +275,7 @@ class tform_base {
$querystring = str_replace("{RECORDID}", $tmp_recordid, $querystring);
unset($tmp_recordid);
$querystring = str_replace("{CLIENTNAMESQL}", $app->functions->get_client_sql_concat_query(), $querystring);
$querystring = str_replace("{AUTHSQL}", $this->getAuthSQL('r'), $querystring);
$querystring = preg_replace_callback('@{AUTHSQL::(.+?)}@', create_function('$matches','global $app; $tmp = $app->tform->getAuthSQL("r", $matches[1]); return $tmp;'), $querystring);
......
......@@ -235,7 +235,7 @@ class page_action extends tform_actions {
if($app->auth->is_admin()) {
// Fill the client select field
$sql = "SELECT client.client_id, sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 AND client.limit_client != 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT client.client_id, sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 AND client.limit_client != 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
$client_select = "<option value='0'>- ".$app->tform->lng('none_txt')." -</option>";
......
......@@ -81,7 +81,7 @@ class page_action extends tform_actions {
if($_SESSION["s"]["user"]["typ"] == 'admin') {
// Getting Clients of the user
//$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
$client_select = '';
......@@ -98,11 +98,11 @@ class page_action extends tform_actions {
} else {
// Get the limits of the client
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, {CLIENTNAMESQL} as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->functions->htmlentities($client);
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
//die($sql);
$records = $app->db->queryAllRecords($sql, $client['client_id']);
$records = $app->functions->htmlentities($records);
......
......@@ -101,7 +101,7 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
$app->tpl->setVar("server_id", $server_id_option);
// load the list of clients
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
$client_select = '';
......@@ -120,11 +120,11 @@ if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSIO
// Get the limits of the client
$client_group_id = intval($_SESSION["s"]["user"]["default_group"]);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, {CLIENTNAMESQL} as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->functions->htmlentities($client);
// load the list of clients
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql, $client['client_id']);
$clients = $app->functions->htmlentities($clients);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']);
......
......@@ -83,7 +83,7 @@ class page_action extends tform_actions {
// If user is admin, we will allow him to select to whom this record belongs
if($_SESSION["s"]["user"]["typ"] == 'admin') {
// Getting Domains of the user
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
$client_select = '';
......@@ -100,11 +100,11 @@ class page_action extends tform_actions {
// Get the limits of the client
$client_group_id = intval($_SESSION["s"]["user"]["default_group"]);
$client = $app->db->queryOneRecord("SELECT client.client_id, sys_group.name, client.contact_name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, sys_group.name, client.contact_name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->functions->htmlentities($client);
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql, $client['client_id']);
$clients = $app->functions->htmlentities($clients);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']);
......
......@@ -105,7 +105,7 @@ class page_action extends tform_actions {
// If user is admin, we will allow him to select to whom this record belongs
if($_SESSION["s"]["user"]["typ"] == 'admin') {
// Getting Domains of the user
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
$client_select = '';
......@@ -122,11 +122,11 @@ class page_action extends tform_actions {
// Get the limits of the client
$client_group_id = intval($_SESSION["s"]["user"]["default_group"]);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, {CLIENTNAMESQL} as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->functions->htmlentities($client);
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql, $client['client_id']);
$clients = $app->functions->htmlentities($clients);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']);
......
......@@ -101,7 +101,7 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
if ($domains_settings['use_domain_module'] != 'y') {
// load the list of clients
$sql = "SELECT sys_group.groupid, sys_group.name,
{CLIENTNAMESQL} as contactname
" . $app->functions->get_client_sql_concat_query() . " as contactname
FROM sys_group, client
WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0
ORDER BY client.company_name, client.contact_name, sys_group.name";
......@@ -124,14 +124,14 @@ if ($_SESSION["s"]["user"]["typ"] != 'admin' && $app->auth->has_clients($_SESSIO
// Get the limits of the client
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, {CLIENTNAMESQL} AS contactname, sys_group.name
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, " . $app->functions->get_client_sql_concat_query() . " AS contactname, sys_group.name
FROM sys_group, client
WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->functions->htmlentities($client);
if ($domains_settings['use_domain_module'] != 'y') {
// load the list of clients
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} AS contactname
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " AS contactname
FROM sys_group, client
WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ?
ORDER BY client.company_name, client.contact_name, sys_group.name";
......
......@@ -76,14 +76,14 @@ class page_action extends tform_actions {
$settings = $app->getconf->get_global_config('domains');
if($_SESSION["s"]["user"]["typ"] == 'admin' && $settings['use_domain_module'] == 'y') {
$sql = "SELECT {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.groupid = ?";
$sql = "SELECT " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.groupid = ?";
$clients = $app->db->queryAllRecords($sql, $this->dataRecord['sys_groupid']);
$client_select = '<option value="dummy">' . $clients[0]['contactname'] . '</option>';
$app->tpl->setVar("client_group_name", $client_select);
}
elseif($_SESSION["s"]["user"]["typ"] == 'admin' && $settings['use_domain_module'] != 'y') {
// Getting Clients of the user
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
......@@ -102,7 +102,7 @@ class page_action extends tform_actions {
// Get the limits of the client
$client_group_id = $_SESSION["s"]["user"]["default_group"];
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.default_mailserver, {CLIENTNAMESQL} as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ? order by client.contact_name", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.default_mailserver, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ? order by client.contact_name", $client_group_id);
$client = $app->functions->htmlentities($client);
// Set the mailserver to the default server of the client
......@@ -112,7 +112,7 @@ class page_action extends tform_actions {
if ($settings['use_domain_module'] != 'y') {
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql, $client['client_id']);
$clients = $app->functions->htmlentities($clients);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']);
......
......@@ -72,7 +72,7 @@ class page_action extends tform_actions {
if($_SESSION["s"]["user"]["typ"] == 'admin') {
// Getting Clients of the user
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
$client_select = '';
......@@ -90,11 +90,11 @@ class page_action extends tform_actions {
// Get the limits of the client
$client_group_id = $_SESSION["s"]["user"]["default_group"];
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.default_mailserver, {CLIENTNAMESQL} as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ? order by contact_name", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.default_mailserver, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ? order by contact_name", $client_group_id);
$client = $app->functions->htmlentities($client);
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql, $client['client_id']);
$clients = $app->functions->htmlentities($clients);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']);
......
......@@ -105,7 +105,7 @@ class page_action extends tform_actions {
if($_SESSION["s"]["user"]["typ"] == 'admin' && $settings['use_domain_module'] != 'y') {
// Getting Clients of the user
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
......@@ -124,12 +124,12 @@ class page_action extends tform_actions {
// Get the limits of the client
$client_group_id = $_SESSION["s"]["user"]["default_group"];
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, {CLIENTNAMESQL} as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ? order by client.contact_name", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ? order by client.contact_name", $client_group_id);
$client = $app->functions->htmlentities($client);
if ($settings['use_domain_module'] != 'y') {
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql, $client['client_id']);
$clients = $app->functions->htmlentities($clients);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']);
......
......@@ -85,7 +85,7 @@ class page_action extends tform_actions {
$client = $app->db->queryOneRecord("SELECT client.company_name, client.contact_name, client.client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$records = $app->db->queryAllRecords($sql, $client['client_id']);
$records = $app->functions->htmlentities($records);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']);
......@@ -100,7 +100,7 @@ class page_action extends tform_actions {
$app->tpl->setVar("client_group_id", $client_select);
} elseif($_SESSION["s"]["user"]["typ"] == 'admin') {
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
$client_select = "<option value='0'></option>";
......
......@@ -279,12 +279,12 @@ class page_action extends tform_actions {
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
if($this->_vhostdomain_type == 'domain') {
$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_domain, client.web_servers, client.default_webserver, client.contact_name, {CLIENTNAMESQL} as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_domain, client.web_servers, client.default_webserver, client.contact_name, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$app->tpl->setVar('only_one_server', $only_one_server);
} elseif($this->_vhostdomain_type == 'subdomain') {
$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_subdomain, client.web_servers, client.default_webserver, client.contact_name, {CLIENTNAMESQL} as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_subdomain, client.web_servers, client.default_webserver, client.contact_name, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
} elseif($this->_vhostdomain_type == 'aliasdomain') {
$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_aliasdomain, client.web_servers, client.default_webserver, client.contact_name, {CLIENTNAMESQL} as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.limit_web_aliasdomain, client.web_servers, client.default_webserver, client.contact_name, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name, client." . implode(", client.", $read_limits) . " FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
}
$client = $app->functions->htmlentities($client);
......@@ -321,7 +321,7 @@ class page_action extends tform_actions {
if ($settings['use_domain_module'] != 'y') {
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$records = $app->db->queryAllRecords($sql, $client['client_id']);
$records = $app->functions->htmlentities($records);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']);
......@@ -539,7 +539,7 @@ class page_action extends tform_actions {
$this->dataRecord["sys_groupid"] = $tmp["sys_groupid"];
}
// Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
$client_select = "<option value='0'></option>";
......
......@@ -96,11 +96,11 @@ class page_action extends tform_actions {
//* Get the limits of the client
$client_group_id = $_SESSION["s"]["user"]["default_group"];
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.limit_openvz_vm_template_id, {CLIENTNAMESQL} as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->db->queryOneRecord("SELECT client.client_id, client.contact_name, client.limit_openvz_vm_template_id, " . $app->functions->get_client_sql_concat_query() . " as contactname, sys_group.name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
$client = $app->functions->htmlentities($client);
//* Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ? ORDER BY client.company_name, client.contact_name, sys_group.name";
$records = $app->db->queryAllRecords($sql, $client['client_id']);
$records = $app->functions->htmlentities($records);
$tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ?", $client['client_id']);
......@@ -133,7 +133,7 @@ class page_action extends tform_actions {
} else {
//* Fill the client select field
$sql = "SELECT sys_group.groupid, sys_group.name, {CLIENTNAMESQL} as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$sql = "SELECT sys_group.groupid, sys_group.name, " . $app->functions->get_client_sql_concat_query() . " as contactname FROM sys_group, client WHERE sys_group.client_id = client.client_id AND sys_group.client_id > 0 ORDER BY client.company_name, client.contact_name, sys_group.name";
$clients = $app->db->queryAllRecords($sql);
$clients = $app->functions->htmlentities($clients);
$client_select = "<option value='0'></option>";
......
Supports Markdown
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