AnsweredAssumed Answered

Error exporting after using Advanced Search with related module

Question asked by jlabuelo on Jul 7, 2017
Latest reply on Oct 3, 2017 by jlabuelo

Hello there

Sorry I am getting a strange error in a new SugarCRM relation I am creating between module A and module B. It is a One (A) to many (B) relationship. Everything works fine until I go to the B module Advanced Search view, and I select all the B records that are related to a "A" record.

Results are shown ok, however if I try to export them it happens to things

 

a) Exporting only the 20 records shown in the screen works fine.

b) But if I try to export the 80 records that the query returns I get this error message

Warning: Illegal string offset 'relationship' in /opt/sugarcrm/apps/sugarcrm/htdocs/include/SearchForm/SearchForm2.php on line 823
Error in the DB. Please check  sugarcrm.log.

 

In the sugarcrm.log file I can find the query that it is trying to run to obtain all the 80 records to export them, however there is a column name that does not exists and it is causing this error... but dont know how it has appeared in there...

 

Fri Jul  7 01:50:43 2017 [23077][1][FATAL] Error exportando OMS2B_PagoCuotas: <BR>. SELECT  oms2b_pagocuotas.* ,oms2b_pagocuotas_cstm.idxml_c,oms2b_pagocuotas_cstm.importe_c , LTRIM(RTRIM(CONCAT(IFNULL(jt0.first_name,''),' ',IFNULL(jt0.last_name,'')))) modified_by_name , jt0.created_by modified_by_name_owner  , 'Users' modified_by_name_mod , LTRIM(RTRIM(CONCAT(IFNULL(jt1.first_name,''),' ',IFNULL(jt1.last_name,'')))) created_by_name , jt1.created_by created_by_name_owner  , 'Users' created_by_name_mod , LTRIM(RTRIM(CONCAT(IFNULL(jt2.first_name,''),' ',IFNULL(jt2.last_name,'')))) assigned_user_name , jt2.created_by assigned_user_name_owner  , 'Users' assigned_user_name_mod , LTRIM(RTRIM(CONCAT(IFNULL(jt3.first_name,''),' ',IFNULL(jt3.last_name,'')))) contacts_oms2b_pagocuotas_1_name, jtl3.contacts_oms2b_pagocuotas_1contacts_ida contacts_oms2b_pagocuotas_1contacts_ida , jt4.name oms2b_facturacion_oms2b_pagocuotas_1_name, jtl4.oms2b_facturacion_oms2b_pagocuotas_1oms2b_facturacion_ida oms2b_facturacion_oms2b_pagocuotas_1oms2b_facturacion_ida FROM oms2b_pagocuotas  LEFT JOIN oms2b_pagocuotas_cstm ON oms2b_pagocuotas.id = oms2b_pagocuotas_cstm.id_c   LEFT JOIN  users jt0 ON oms2b_pagocuotas.modified_user_id=jt0.id AND jt0.deleted=0

 AND jt0.deleted=0  LEFT JOIN  users jt1 ON oms2b_pagocuotas.created_by=jt1.id AND jt1.deleted=0

 AND jt1.deleted=0  LEFT JOIN  users jt2 ON oms2b_pagocuotas.assigned_user_id=jt2.id AND jt2.deleted=0

 AND jt2.deleted=0  LEFT JOIN  contacts_oms2b_pagocuotas_1_c jtl3 ON oms2b_pagocuotas.id=jtl3.contacts_oms2b_pagocuotas_1oms2b_pagocuotas_idb AND jtl3.deleted=0

 LEFT JOIN  contacts jt3 ON jt3.id=jtl3.contacts_oms2b_pagocuotas_1contacts_ida AND jt3.deleted=0
 AND jt3.deleted=0  LEFT JOIN  oms2b_facturacion_oms2b_pagocuotas_1_c jtl4 ON oms2b_pagocuotas.id=jtl4.oms2b_facturacion_oms2b_pagocuotas_1oms2b_pagocuotas_idb AND jtl4.deleted=0

 LEFT JOIN  oms2b_facturacion jt4 ON jt4.id=jtl4.oms2b_facturacion_oms2b_pagocuotas_1oms2b_facturacion_ida AND jt4.deleted=0
 AND jt4.deleted=0 where ((join_oms2b_facturacion_oms2b_pagocuotas_1_name.name like 'Facturacion Amigos Jul 2017%')) AND oms2b_pagocuotas.deleted=0 Query Failed:  SELECT  oms2b_pagocuotas.* ,oms2b_pagocuotas_cstm.idxml_c,oms2b_pagocuotas_cstm.importe_c , LTRIM(RTRIM(CONCAT(IFNULL(jt0.first_name,''),' ',IFNULL(jt0.last_name,'')))) modified_by_name , jt0.created_by modified_by_name_owner  , 'Users' modified_by_name_mod , LTRIM(RTRIM(CONCAT(IFNULL(jt1.first_name,''),' ',IFNULL(jt1.last_name,'')))) created_by_name , jt1.created_by created_by_name_owner  , 'Users' created_by_name_mod , LTRIM(RTRIM(CONCAT(IFNULL(jt2.first_name,''),' ',IFNULL(jt2.last_name,'')))) assigned_user_name , jt2.created_by assigned_user_name_owner  , 'Users' assigned_user_name_mod , LTRIM(RTRIM(CONCAT(IFNULL(jt3.first_name,''),' ',IFNULL(jt3.last_name,'')))) contacts_oms2b_pagocuotas_1_name, jtl3.contacts_oms2b_pagocuotas_1contacts_ida contacts_oms2b_pagocuotas_1contacts_ida , jt4.name oms2b_facturacion_oms2b_pagocuotas_1_name, jtl4.oms2b_facturacion_oms2b_pagocuotas_1oms2b_facturacion_ida oms2b_facturacion_oms2b_pagocuotas_1oms2b_facturacion_ida FROM oms2b_pagocuotas  LEFT JOIN oms2b_pagocuotas_cstm ON oms2b_pagocuotas.id = oms2b_pagocuotas_cstm.id_c   LEFT JOIN  users jt0 ON oms2b_pagocuotas.modified_user_id=jt0.id AND jt0.deleted=0

 AND jt0.deleted=0  LEFT JOIN  users jt1 ON oms2b_pagocuotas.created_by=jt1.id AND jt1.deleted=0

 AND jt1.deleted=0  LEFT JOIN  users jt2 ON oms2b_pagocuotas.assigned_user_id=jt2.id AND jt2.deleted=0

 AND jt2.deleted=0  LEFT JOIN  contacts_oms2b_pagocuotas_1_c jtl3 ON oms2b_pagocuotas.id=jtl3.contacts_oms2b_pagocuotas_1oms2b_pagocuotas_idb AND jtl3.deleted=0

 LEFT JOIN  contacts jt3 ON jt3.id=jtl3.contacts_oms2b_pagocuotas_1contacts_ida AND jt3.deleted=0
 AND jt3.deleted=0  LEFT JOIN  oms2b_facturacion_oms2b_pagocuotas_1_c jtl4 ON oms2b_pagocuotas.id=jtl4.oms2b_facturacion_oms2b_pagocuotas_1oms2b_pagocuotas_idb AND jtl4.deleted=0

 LEFT JOIN  oms2b_facturacion jt4 ON jt4.id=jtl4.oms2b_facturacion_oms2b_pagocuotas_1oms2b_facturacion_ida AND jt4.deleted=0
 AND jt4.deleted=0 where ((join_oms2b_facturacion_oms2b_pagocuotas_1_name.name like 'Facturacion Amigos Jul 2017%')) AND oms2b_pagocuotas.deleted=0: MySQL error 1054: Unknown column 'join_oms2b_facturacion_oms2b_pagocuotas_1_name.name' in 'where clause'

I dont know why the column is called "join_oms2b_facturacion_oms2b_pagocuotas_1_name.name", when it should be onlye "oms2b_facturacion_oms2b_pagocuotas_1_name.name"

 

Any suggestions about how can I get this fixed??

Thanks a lot

We are using SugarCE 6.5 Community

Outcomes