Dear All,

I am migrating my SugarCRM from the release 5.0d to 5.1.0. I have started since yesterday and I have a big problem. The old custom relationship are not converted correctly, below you can find my relation (one case can have zero or one opportunity but an opportunity can have zero or more cases)

Layooutdefs.ext.php

$layout_defs['Opportunities']['subpanel_setup']['cases'] = array(
'order' => 200,
'module' => 'Cases',
'subpanel_name' => 'default',
'refresh_page' => 1,
'get_subpanel_data' => 'opportunity_c',
'title_key' => 'LBL_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton', 'mode'=>'MultiSelect')
),
);

vardefs.ext.php

$dictionary['Opportunity']['relationships']['opportunity_cases'] = array(
'lhs_module' => 'Opportunities',
'lhs_table' => 'opportunities',
'lhs_key' => 'id',
'rhs_module' => 'cases',
'rhs_table' => 'cases_cstm',
'rhs_key' => 'opportunity_id_c',
'relationship_type' => 'one-to-many'
);

$dictionary['Opportunity']['fields']['opportunity_c'] = array (
'name' => 'opportunity_c',
'type' => 'link',
'relationship' => 'opportunity_cases',
'source'=>'non-db',
'vname'=>'LBL_OPPORTUNITY',
);


This is the error in the opportunity detail view:

Error running count query for Opportunity List: Query Failed SELECT count(*) c FROM cases where ( cases_cstm.opportunity_id_c= '107320fe-a393-2370-56c5-488081933125') AND cases.deleted=0 )::MySQL error 1054: Unknown column 'cases_cstm.opportunity_id_c' in 'where clause'