Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix sql error: parent_type is ambiguous. #176

Open
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants

pokoli commented Jun 20, 2013

SugarCRM breaks while opening the detail view of any record if it has a parent_type field and its related with activities.
That's because parent_type is specified two times on the query, one without an alias. This patch adds the table alias to fix the problem.

Sergi Almacellas Abellana Fix sql error: parent_type is ambiguous.
SugarCRM breaks while opening the detail view of any record if it has a parent_type field and its related with activities.
That's because parent_type is specified two times on the query, one without an alias. This patch adds the table alias to fix the problem.
11c8fdb

@Sugared Sugared commented on the diff Aug 26, 2013

data/Relationships/One2MBeanRelationship.php
@@ -311,6 +311,7 @@ public function getSubpanelQuery($link, $params = array(), $return_array = false
if (!$linkIsLHS)
$startingTable = (empty($params['right_join_table_alias']) ? $this->def['rhs_table'] : $params['right_join_table_alias']);
$startingKey = $linkIsLHS ? $this->def['lhs_key'] : $this->def['rhs_key'];
+ $startingTable = $linkIsLHS ? $this->def['lhs_table'] : $this->def['rhs_table'];
@Sugared

Sugared Aug 26, 2013

Just wondering why is this change needed? I was able to make the use case work without this change. This change also means that lines 310 and 312 will always get overwritten by the new value.

@pokoli

pokoli Aug 26, 2013

This change is need to not borke the relations where they are defined in the other way arround.

Sugared commented Aug 26, 2013

Hi pokoli,

thanks for taking the time to issue this pull request. I was able to follow your steps and both reproduce and see your fix working. I just had a question about the first change in your pull request, which you can see inline.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment