I’ve found a problem, maybe a bug, when I tried to export an accounts list after applied a filter by campaign name. This is the way to reproduce the problem:
Add the field ‘campaign_name’ to the available fields on layaouts filter and list views using studio
Filter accounts by any campaign, filter works fine
Select all accounts after filter and export them using export on ‘bulk action’ menu
The page goes blank
As I see on suitecrm.log file, there are a problem with the SQL query:
Query Failed:
SELECT
accounts.*, email_addresses.email_address email_address, '' email_addresses_non_primary, accounts.name as account_name,
users.user_name as assigned_user_name ,accounts_cstm.jjwg_maps_lng_c,accounts_cstm.jjwg_maps_lat_c,accounts_cstm.jjwg_maps_geocode_status_c,accounts_cstm.jjwg_maps_address_c
FROM
accounts LEFT JOIN users
ON accounts.assigned_user_id=users.id
LEFT JOIN email_addr_bean_rel
on accounts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Accounts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1
LEFT JOIN email_addresses
on email_addresses.id = email_addr_bean_rel.email_address_id
LEFT JOIN accounts_cstm
ON accounts.id = accounts_cstm.id_c
where
((campaign_name like 'CAMPAIGN1%')) AND ( accounts.deleted IS NULL OR accounts.deleted=0 )
: MySQL error 1054: Unknown column 'campaign_name' in 'where clause'
Fri Jan 12 17:18:16 2018 [10499][d7feffe7-41cb-10c1-d063-5a37de0929cc][FATAL] Exception handling in /var/www/html/include/MVC/Controller/SugarController.php:402
Fri Jan 12 17:18:16 2018 [10499][d7feffe7-41cb-10c1-d063-5a37de0929cc][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.
Fri Jan 12 17:18:16 2018 [10499][d7feffe7-41cb-10c1-d063-5a37de0929cc][FATAL] backtrace:
#0 /var/www/html/include/database/DBManager.php(353): sugar_die('Database failur...')
#1 /var/www/html/include/database/DBManager.php(328): DBManager->registerError('Error exporting...', 'Error exporting...', true)
#2 /var/www/html/include/database/MysqliManager.php(160): DBManager->checkError('Error exporting...', true)
#3 /var/www/html/include/export_utils.php(172): MysqliManager->query('SELECT\n ...', true, 'Error exporting...')
#4 /var/www/html/export.php(67): export('Accounts')
#5 /var/www/html/include/MVC/Controller/SugarController.php(1014): require_once('/var/www/html/a...')
#6 /var/www/html/include/MVC/Controller/SugarController.php(465): SugarController->handleEntryPoint()
#7 /var/www/html/include/MVC/Controller/SugarController.php(373): SugarController->process()
#8 /var/www/html/include/MVC/SugarApplication.php(105): SugarController->execute()
#9 /var/www/html/index.php(52): SugarApplication->execute()
#10 {main}
There is clear that the where clause is trying to search all records where ‘campaign_name’ is like the desired Campaign Name, but the column campaign_name does not exist on accounts table or any other table on this query.
Have anyone done something like that or know how to solve this issue? maybe would be better to report it as a bug?
[Mon Jan 15 10:20:34.578925 2018] [:error] [pid 9557] [client 186.155.36.130:19278] PHP Notice: Only variables should be passed by reference in /var/www/html/include/export_utils.php on line 556, referer: https://mydomain.com/index.php?module=Accounts&action=index
When you do a Quick Repair and Rebuild, scroll down to the bottom and check if it gives you a button to sync vardefs with database. if it’s there, press it, then try again.
Sorry, I’ve already check at it, but in ‘accounts’ table there is only a field called ‘campaign_id’, and in ‘accounts_cstm’ there is no field similar to ‘campaign_name’.
It looks like the field is not correctly deployed by Studio, it seems incomplete.
Can you try more repairs from Admin / Repairs?
And perhaps try deleting the field and re-creating it? Of, course, you will lose any data you have there, but I suspect you don’t have any (if it’s not in the database…)
You might have to clear some left-overs from a previously failed deployment - some vardef file, or a row in table fields_meta_data
I have the same problem!. It seems to be a bug on PHP 7 using the “Select All” option using filter from related module. This doesn’t happen if I use instead the “Select this page” or if I select the rows one by one and then hit the Bulk action -> Export.