Jump to content
  • 0

Unexpected error 'only one query allowed' during creation of custom report


Question

Posted

Hello,

I'm trying to create a custom report, but I receive error: "Only one query allowed, and it must be a SELECT query."
Problem occurs when I trying to add next string in my query:
 

	GROUP_CONCAT(CONCAT(`client_notes`.`title`, `client_notes`.`description`) SEPARATOR '; ') AS 'Notes'


Full text of my query:

SELECT 
	`users`.`date_added` AS 'Memeber Since',
	`clients`.`status` AS 'Client Status',
	`clients`.`id_value` AS 'CRM #',
	`contacts`.`first_name` AS 'First Name',
	`contacts`.`last_name` AS 'Last Name',
	`contacts`.`company` AS 'Company/Org.',
	`contacts`.`address1` AS 'Address',
	`contacts`.`city` AS 'City',
	`contacts`.`country` AS 'Country',
	`contacts`.`state` AS 'State/Province',
	`contacts`.`zip` AS 'Zip/Postal Code',
	`contacts`.`email` AS 'Email',
	GROUP_CONCAT(CONCAT(`client_notes`.`title`, `client_notes`.`description`) SEPARATOR '; ') AS 'Notes'
FROM 
	`clients`
	JOIN `users` ON (`users`.`id`=`clients`.`user_id`)
	LEFT JOIN `contacts` ON (`contacts`.`client_id`=`clients`.`id` AND `contacts`.`contact_type`='primary')
	LEFT JOIN `contact_numbers` ON (`contact_numbers`.`contact_id`=`contacts`.`id`)	
	LEFT JOIN `client_notes` ON (`client_notes`.`client_id`=`clients`.`id`)
GROUP BY `clients`.`id`

 

2 answers to this question

Recommended Posts

  • 0
Posted

Without looking at the code, my guess is that GROUP_CONCAT, CONCAT may not be explicitly allowed (Assuming we used a white list approach), which is the result of an attempt at preventing dangerous queries from running.

  • 0
Posted

Paul, in this case, please, change text of the error. Also, I will be very appreciate if you describe allowed and disallowed clauses in documentation(https://docs.blesta.com/display/user/Generating+Reports) more.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...