Author Topic: MySQL Error while exporting companies. FO: 1.6.2  (Read 3726 times)

asystentka

  • Newbie
  • *
  • Posts: 1
    • View Profile
MySQL Error while exporting companies. FO: 1.6.2
« on: February 11, 2010, 01:05:22 pm »
Hello Everyone,

When I try to export companies or customers to .csv file I got this error:

<?php die(); ?>
Session "default" started at 2010-02-11T14:59:49+0000

#1 DEBUG: SQL ERROR: Query failed with message 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`archived_by_id` = 0 AND  `id` IN (SELECT `object_id` FROM `og_workspace_objects' at line 1' - SELECT * FROM `og_companies` WHERE `trashed_by_id` = 0 AND ( `id` IN (SELECT `object_id` FROM `og_workspace_objects` WHERE `object_manager` = 'Companies' AND `workspace_id` IN (SELECT `id` FROM `og_projects` WHERE (`p1` = 2 OR `p2` = 2 OR `p3` = 2 OR `p4` = 2 OR `p5` = 2 OR `p6` = 2 OR `p7` = 2 OR `p8` = 2 OR `p9` = 2 OR `p10` = 2) AND `id` IN (SELECT `og_project_users`.`project_id` FROM `og_project_users` WHERE ((`og_project_users`.`user_id` = '1') OR (`og_project_users`.`user_id` IN (SELECT `group_id` FROM `og_group_users` WHERE `og_group_users`.`user_id` = '1')))) AND `completed_on` = '0000-00-00 00:00:00')) `archived_by_id` = 0 AND  `id` IN (SELECT `object_id` FROM `og_workspace_objects` WHERE `object_manager` = 'Companies' AND `workspace_id` IN (SELECT `id` FROM `og_projects` WHERE (`p1` = 2 OR `p2` = 2 OR `p3` = 2 OR `p4` = 2 OR `p5` = 2 OR `p6` = 2 OR `p7` = 2 OR `p8` = 2 OR `p9` = 2 OR `p10` = 2) AND `id` IN (SELECT `og_project_users`.`project_id` FROM `og_project_users` WHERE ((`og_project_users`.`user_id` = '1') OR (`og_project_users`.`user_id` IN (SELECT `group_id` FROM `og_group_users` WHERE `og_group_users`.`user_id` = '1')))) AND `completed_on` = '0000-00-00 00:00:00')) ) 
Time since start: 0.36444711685181 seconds
-------------------------------------------------------------------------------

I have:
Feng Office Ver.: 1.6.2 (there was the same error in 1.6.1)
MYSQL Version : 5.0.45
PHP Version : 5.2.11

Could anyone help me with this problem, please? :'(

Greetings,

Asys

DougLucas

  • Guest
Re: MySQL Error while exporting companies. FO: 1.6.2
« Reply #1 on: February 14, 2010, 02:29:40 am »
I would love to see help on this question.

virtualweb

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: MySQL Error while exporting companies. FO: 1.6.2
« Reply #2 on: March 23, 2010, 07:20:52 am »
I figured out what the problem is.

in File /application/controllers/ContactController.class.php at Line 1700 the Code

$conditions .= "`archived_by_id` = 0" . ($conditions ? " AND $conditions" : "");
should be
$conditions .= "AND `archived_by_id` = 0" . ($conditions ? " AND $conditions" : "");

Then Export is working but i have no idea if this fix opens errors at other places. I think it shouldn't because we are in the function export_to_csv_file() and this function should only be used on Export.