From ea61dbaa75e7480691e2eafc8a7c71c3d7aaf1b5 Mon Sep 17 00:00:00 2001 From: Herman van Rink <rink@initfour.nl> Date: Sun, 21 Jun 2020 22:32:43 +0200 Subject: [PATCH] Replace long sql snippit with {CLIENTNAMESQL}, batch 2 --- interface/web/client/list/client_template.list.php | 2 +- interface/web/client/list/domain.list.php | 2 +- interface/web/dns/list/dns_slave.list.php | 2 +- interface/web/mail/list/mail_domain.list.php | 2 +- interface/web/sites/list/database.list.php | 2 +- interface/web/sites/list/database_user.list.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/interface/web/client/list/client_template.list.php b/interface/web/client/list/client_template.list.php index a63776ff88..8a27e82a4b 100644 --- a/interface/web/client/list/client_template.list.php +++ b/interface/web/client/list/client_template.list.php @@ -52,7 +52,7 @@ if($_SESSION['s']['user']['typ'] == 'admin') { 'prefix' => '', 'suffix' => '', 'datasource' => array ( 'type' => 'SQL', - 'querystring' => "SELECT sys_group.groupid,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), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", + 'querystring' => "SELECT sys_group.groupid, {CLIENTNAMESQL} as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", 'keyfield'=> 'groupid', 'valuefield'=> 'name' ), diff --git a/interface/web/client/list/domain.list.php b/interface/web/client/list/domain.list.php index 8fc81eeef9..d05dc5b6ff 100644 --- a/interface/web/client/list/domain.list.php +++ b/interface/web/client/list/domain.list.php @@ -93,7 +93,7 @@ $liste["item"][] = array( 'field' => "sys_groupid", 'suffix' => "", 'datasource' => array ( 'type' => 'SQL', //'querystring' => 'SELECT a.groupid, a.name FROM sys_group a, domain b WHERE (a.groupid = b.sys_groupid) AND ({AUTHSQL-B}) ORDER BY name', - 'querystring' => "SELECT sys_group.groupid,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), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id AND {AUTHSQL} ORDER BY client.company_name, client.contact_name", + 'querystring' => "SELECT sys_group.groupid, {CLIENTNAMESQL} as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id AND {AUTHSQL} ORDER BY client.company_name, client.contact_name", 'keyfield'=> 'groupid', 'valuefield'=> 'name' ), diff --git a/interface/web/dns/list/dns_slave.list.php b/interface/web/dns/list/dns_slave.list.php index de0fd3a211..bd32b6a407 100644 --- a/interface/web/dns/list/dns_slave.list.php +++ b/interface/web/dns/list/dns_slave.list.php @@ -84,7 +84,7 @@ if($_SESSION['s']['user']['typ'] == 'admin') { 'suffix' => "", 'datasource' => array ( 'type' => 'SQL', //'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name', - 'querystring' => "SELECT sys_group.groupid,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), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", + 'querystring' => "SELECT sys_group.groupid, {CLIENTNAMESQL} as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", 'keyfield'=> 'groupid', 'valuefield'=> 'name' ), diff --git a/interface/web/mail/list/mail_domain.list.php b/interface/web/mail/list/mail_domain.list.php index 5304ab6226..e2a7b015c1 100644 --- a/interface/web/mail/list/mail_domain.list.php +++ b/interface/web/mail/list/mail_domain.list.php @@ -71,7 +71,7 @@ if($_SESSION['s']['user']['typ'] == 'admin') { 'suffix' => "", 'datasource' => array ( 'type' => 'SQL', //'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name', - 'querystring' => "SELECT sys_group.groupid,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), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", + 'querystring' => "SELECT sys_group.groupid, {CLIENTNAMESQL} as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", 'keyfield'=> 'groupid', 'valuefield'=> 'name' ), diff --git a/interface/web/sites/list/database.list.php b/interface/web/sites/list/database.list.php index 25e1b8de7f..6ecaa7e07e 100644 --- a/interface/web/sites/list/database.list.php +++ b/interface/web/sites/list/database.list.php @@ -92,7 +92,7 @@ if($_SESSION['s']['user']['typ'] == 'admin') { 'suffix' => "", 'datasource' => array ( 'type' => 'SQL', //'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name', - 'querystring' => "SELECT sys_group.groupid,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), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", + 'querystring' => "SELECT sys_group.groupid, {CLIENTNAMESQL} as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", 'keyfield'=> 'groupid', 'valuefield'=> 'name' ), diff --git a/interface/web/sites/list/database_user.list.php b/interface/web/sites/list/database_user.list.php index dd25d03349..f8935d33ec 100644 --- a/interface/web/sites/list/database_user.list.php +++ b/interface/web/sites/list/database_user.list.php @@ -61,7 +61,7 @@ if($_SESSION['s']['user']['typ'] == 'admin') { 'suffix' => "", 'datasource' => array ( 'type' => 'SQL', //'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name', - 'querystring' => "SELECT sys_group.groupid,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), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", + 'querystring' => "SELECT sys_group.groupid, {CLIENTNAMESQL} as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name", 'keyfield'=> 'groupid', 'valuefield'=> 'name' ), -- GitLab