OK, it was an old 5.0.0i and is one of my first steps in sugar.
In include/Popups/PopupSmarty.php arround line 184 should be:
Code:
$associated_row_data = array();
foreach($this->data['data'] as $val){
$associated_row_data[$val['ID']] = $val;
} I put an sql-select into the foreach construct to get what i want and put the result to the associated_row_data array. So my code looks like
Code:
$associated_row_data = array();
foreach($this->data['data'] as $val){
$associated_row_data[$val['ID']] = $val;
$link_custom = mysql_connect($GLOBALS['sugar_config']['dbconfig']['db_host_name'], $GLOBALS['sugar_config']['dbconfig']['db_user_name'], $GLOBALS['sugar_config']['dbconfig']['db_password']);
$db_custom = mysql_select_db($GLOBALS['sugar_config']['dbconfig']['db_name'], $link_custom);
$sql_custom = "SELECT contacts.phone_work, contacts.phone_fax FROM contacts WHERE contacts.id ='" . $val['ID'] . "'";
$result_custom = mysql_query($sql_custom,$link_custom);
if (!$result) {
echo mysql_error();
}
$row_custom = mysql_fetch_assoc($result_custom);
if ($row_custom['phone_work']) {
$associated_row_data[$val['ID']]['PHONE_WORK'] = $row_custom['phone_work'];
} else {
$associated_row_data[$val['ID']]['PHONE_WORK'] = "";
}
if ($row_custom['phone_fax']) {
$associated_row_data[$val['ID']]['PHONE_FAX'] = $row_custom['phone_fax'];
} else {
$associated_row_data[$val['ID']]['PHONE_FAX'] = "";
}
mysql_close($link_custom);
} I know there are better ways to do sql querys in sugar, but like I say before this was one of my first steps in sugar.
Maybe there is a better way to solve this problem, but it is ok for me.
Bookmarks