7.11.4 - Error on Tasks subpanel on Opportunities

Hello

After upgrading to version 7.11.4, there is an error in Oppotunities detail view, when you have an open task. The tasks subpanel fails and you get a database failure error. See the log details in the end of this post (look at the last line).

Looking into the log, there is a field ‘taks.date_end’ in the query. But such a field doesn’t exist in Tasks table. It’s an error in the Tasks module, subpanel definition.

The quick & dirty fix is to enter MySQL and add date_end field to Tasks table. The right way is to change the subpanel definition in Tasks module. I didn’t have time to do so yet, but you guys should release a patch and fix that for the next version.

BTW, this kind of stupid bug is quite annoying. Don’t you guys test the thing before releasing?

Marcio


Log

Thu May 16 06:22:30 2019 [25746][ea8c85b6-8568-8950-b753-5b8053969e7d][FATAL] Error retrieving Opportunity list: Query Failed: (SELECT meetings.id , meetings.assigned_user_id , meetings.name , meetings.status , ’ ’ contact_name , ’ ’ contact_id , meetings.date_modified , meetings.date_entered , meetings.date_end as date_due , jt1.user_name assigned_user_name , jt1.created_by assigned_user_name_owner , ‘Users’ assigned_user_name_mod, 0 reply_to_status , ’ ’ contact_name_owner , ’ ’ contact_name_mod , meetings.parent_id , meetings.parent_type , ’ ’ filename , meetings.recurring_source , ’ ’ assigned_user_owner , ’ ’ assigned_user_mod , meetings.created_by , ‘meetings’ panel_name, NULL date_end, NULL category_id FROM meetings LEFT JOIN meetings_cstm ON meetings.id = meetings_cstm.id_c LEFT JOIN users jt1 ON meetings.assigned_user_id=jt1.id AND jt1.deleted=0

AND jt1.deleted=0 INNER JOIN opportunities meetings_rel ON meetings.parent_id=meetings_rel.id AND meetings_rel.deleted=0
AND meetings.parent_type = ‘Opportunities’
where ( meetings.parent_id=‘3ea8ec7f-3490-44e8-96ff-5b882afc7cd6’ AND (meetings.status=‘Held’ OR meetings.status=‘Not Held’)) AND meetings.deleted=0) UNION ALL ( SELECT tasks.id , tasks.assigned_user_id , tasks.name , tasks.status , LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,’’),’ ‘,IFNULL(contacts.last_name,’’)))) contact_name , tasks.contact_id , tasks.date_modified , tasks.date_entered , NULL date_due, jt1.user_name assigned_user_name , jt1.created_by assigned_user_name_owner , ‘Users’ assigned_user_name_mod, 0 reply_to_status , ’ ’ contact_name_owner , ’ ’ contact_name_mod , tasks.parent_id , tasks.parent_type , ’ ’ filename , NULL recurring_source, ’ ’ assigned_user_owner , ’ ’ assigned_user_mod , tasks.created_by , ‘tasks’ panel_name, tasks.date_end , NULL category_id FROM tasks LEFT JOIN contacts contacts ON tasks.contact_id=contacts.id AND contacts.deleted=0

AND contacts.deleted=0 LEFT JOIN users jt1 ON tasks.assigned_user_id=jt1.id AND jt1.deleted=0

AND jt1.deleted=0 INNER JOIN opportunities tasks_rel ON tasks.parent_id=tasks_rel.id AND tasks_rel.deleted=0
AND tasks.parent_type = ‘Opportunities’
where ( tasks.parent_id=‘3ea8ec7f-3490-44e8-96ff-5b882afc7cd6’ AND (tasks.status=‘Completed’ OR tasks.status=‘Deferred’)) AND tasks.deleted=0 ) UNION ALL ( SELECT calls.id , calls.assigned_user_id , calls.name , calls.status , ’ ’ contact_name , ’ ’ contact_id , calls.date_modified , calls.date_entered , calls.date_end as date_due , jt1.user_name assigned_user_name , jt1.created_by assigned_user_name_owner , ‘Users’ assigned_user_name_mod, 0 reply_to_status , ’ ’ contact_name_owner , ’ ’ contact_name_mod , calls.parent_id , calls.parent_type , ’ ’ filename , calls.recurring_source , ’ ’ assigned_user_owner , ’ ’ assigned_user_mod , calls.created_by , ‘calls’ panel_name, NULL date_end, NULL category_id FROM calls LEFT JOIN users jt1 ON calls.assigned_user_id=jt1.id AND jt1.deleted=0

AND jt1.deleted=0 INNER JOIN opportunities calls_rel ON calls.parent_id=calls_rel.id AND calls_rel.deleted=0
AND calls.parent_type = ‘Opportunities’
where ( calls.parent_id=‘3ea8ec7f-3490-44e8-96ff-5b882afc7cd6’ AND (calls.status=‘Held’ OR calls.status=‘Not Held’)) AND calls.deleted=0 ) UNION ALL ( SELECT notes.id , notes.assigned_user_id , notes.name , ’ ’ status , LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,’’),’ ‘,IFNULL(contacts.last_name,’’)))) contact_name , notes.contact_id , notes.date_modified , notes.date_entered , NULL date_due, jt1.user_name assigned_user_name , jt1.created_by assigned_user_name_owner , ‘Users’ assigned_user_name_mod, 0 reply_to_status , ’ ’ contact_name_owner , ’ ’ contact_name_mod , notes.parent_id , notes.parent_type , notes.filename , NULL recurring_source, ’ ’ assigned_user_owner , ’ ’ assigned_user_mod , notes.created_by , ‘notes’ panel_name, NULL date_end, NULL category_id FROM notes LEFT JOIN notes_cstm ON notes.id = notes_cstm.id_c LEFT JOIN contacts contacts ON notes.contact_id=contacts.id AND contacts.deleted=0

AND contacts.deleted=0 LEFT JOIN users jt1 ON notes.assigned_user_id=jt1.id AND jt1.deleted=0

AND jt1.deleted=0 INNER JOIN opportunities notes_rel ON notes.parent_id=notes_rel.id AND notes_rel.deleted=0
AND notes.parent_type = ‘Opportunities’
where ( notes.parent_id=‘3ea8ec7f-3490-44e8-96ff-5b882afc7cd6’) AND notes.deleted=0 ) UNION ALL ( SELECT emails.id , emails.assigned_user_id , emails.name , emails.status , ’ ’ contact_name , ’ ’ contact_id , emails.date_modified , emails.date_entered , NULL date_due, jt0.user_name assigned_user_name , jt0.created_by assigned_user_name_owner , ‘Users’ assigned_user_name_mod, emails.reply_to_status , ’ ’ contact_name_owner , ’ ’ contact_name_mod , emails.parent_id , emails.parent_type , ’ ’ filename , NULL recurring_source, ’ ’ assigned_user_owner , ’ ’ assigned_user_mod , emails.created_by , ‘emails’ panel_name, NULL date_end, emails.category_id FROM emails LEFT JOIN users jt0 ON emails.assigned_user_id=jt0.id AND jt0.deleted=0

AND jt0.deleted=0 INNER JOIN (
SELECT
eb.email_id,
‘direct’ source
FROM
emails_beans eb
WHERE
eb.bean_module = ‘Opportunities’
AND eb.bean_id = ‘3ea8ec7f-3490-44e8-96ff-5b882afc7cd6’
AND eb.deleted=0
UNION
SELECT DISTINCT
eear.email_id,
‘relate’ source
FROM
emails_email_addr_rel eear
INNER JOIN
email_addr_bean_rel eabr
ON
eabr.bean_id =‘3ea8ec7f-3490-44e8-96ff-5b882afc7cd6’
AND eabr.bean_module = ‘Opportunities’
AND eabr.email_address_id = eear.email_address_id
AND eabr.deleted=0
WHERE
eear.deleted=0
) email_ids ON emails.id=email_ids.email_id where ( emails.deleted=0 AND emails.assigned_user_id =‘ea8c85b6-8568-8950-b753-5b8053969e7d’ ) AND emails.deleted=0 ) ORDER BY date_entered desc LIMIT 0,10:
MySQL error 1054: Unknown column ‘tasks.date_end’ in ‘field list’

We’ve been writing tons of automated tests, haven’t you seen it on GitHub? But coverage is still not enough, this is a huge program. And testing everything manually would take a month.

Any way, I tried this on the online demo and I don’t get any error. Can you please check?

https://demo.suiteondemand.com (user:will, pass: will)

If you can get the error to happen there, please tell me the exact steps so I can’t reproduce it. Thanks

The only occurs in tasks created in the previous version (7.10.x). Tasks created after the update don’t show the error. I can’t say for sure if the problem is in the Activities subanel or in the History subpanel.

There is a related topic regarding this issue: https://suitecrm.com/suitecrm/forum/installation-upgrade-help/24551-database-failure-after-upgrading-to-version-7-11-4#82953

Rgds

Marcio

Can you have a look in the database and spot the difference between a pre-7.10.4 task that fails, and a new task that works well?

Diging down here… In modules/Tasks/metadata/subpanels file ForActivities.php, we have

‘date_due’ => array(
‘vname’ => ‘LBL_LIST_DUE_DATE’,
‘width’ => ‘10%’,
‘alias’ => ‘date_end’,
‘sort_by’ => ‘date_end’,

I believe it should be ‘date_due’, but may be in the weekend I test this out, because my instance is working ok after inserting a date_end column in the Tasks table.

Same issue happens to us. If necessary tell and I’ll post logs.

This change in the metadata has been going back and forth for a few releases; we fix in one place and it breaks in another. I think we need to go deeper and understand what is really wrong.

That’s why I was asking about the database - I would prefer a fix that gets the database right, not one that changes the metadata (since I am convinced that will break elsewhere).