vtlib setRelatedList - improvement
setRelatedList() function into vtlib/Vtiger/Module.php should return <last insert id> (vtiger_relatedlists.relation_id) to set vtiger_relatedlists.relationtype correctly
vtlib/Vtiger/Module.php:86
function setRelatedList($moduleInstance, $label = '', $actions = false, $function_name = 'get_related_list', $fieldId = null) {
...
$adb->pquery("INSERT INTO vtiger_relatedlists(relation_id,tabid,related_tabid,name,sequence,label,presence,actions,relationfieldid) VALUES(?,?,?,?,?,?,?,?,?)",
Array($relation_id,$this->id,$moduleInstance->id,$function_name,$sequence,$label,$presence,$useactions_text,$fieldId));
self::log("Setting relation with $moduleInstance->name [$useactions_text] ... DONE");
return($adb->getLastInsertID('vtiger_relatedlists_seq'));
}
Alternatively add relationType parameter to setRelatedList() function
function setRelatedList($moduleInstance, $label = '', $actions = false, $function_name = 'get_related_list', $fieldId = null, $relationType = null) {
...
$adb->pquery("INSERT INTO vtiger_relatedlists(relation_id,tabid,related_tabid,name,sequence,label,presence,actions,relationfieldid,relationtype) VALUES(?,?,?,?,?,?,?,?,?,?)",
Array($relation_id,$this->id,$moduleInstance->id,$function_name,$sequence,$label,$presence,$useactions_text,$fieldId,$relationType));
self::log("Setting relation with $moduleInstance->name [$useactions_text] ... DONE");
}