Full Version: Calendar location field automatically links to google maps
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have altered the function 'transferForAddIntoTitle' in the CalendarUtils.php file a little:

PHP Code:
function transferForAddIntoTitle($type$row$CD) {
 if (
$CD["uitype"] == "66"
$Col_Field = array($CD["fieldname"]=> $row["parent_id"]);
$Col_Field = array($CD["fieldname"]=> $row[$CD["columnname"]]);

 if (
$CD["fieldname"] == "duration_hours"
$Col_Field["duration_minutes"] = $row["duration_minutes"];

 if (
$CD["fieldname"] == "contact_id") {
$Col_Field["contact_id"] = getAssignedContactsForEvent($row["crmid"]);
$CD["uitype"] = "1"  
$Cal_Data getDetailViewOutputHtml($CD["uitype"], $CD["fieldname"], $CD["fieldlabel"], $Col_Field"2"$calendar_tabid"Calendar");

 if (
$CD["uitype"] == "15")
$value getTranslatedString($Cal_Data[1],'Calendar');
$value $Cal_Data[1];
 if (
$CD["fieldname"] == "location" {
$value "<a href='".$row['location']."' target='_blank'>".$row['location']."</a>";
 if (
$type == "1")
'<br><b>'.$Cal_Data[0].'</b>: <span onmouseover="vtlib_listview.trigger(\'cell.onmouseover\', $(this))" onmouseout="vtlib_listview.trigger(\'cell.onmouseout\', $(this))">'.$value.'</span>';
// return '<table><tr><th>'.$Cal_Data[0].':</th><td onmouseover="vtlib_listview.trigger(\'cell.onmouseover\', $(this))" onmouseout="vtlib_listview.trigger(\'cell.onmouseout\', $(this))">'.$value.'</td></tr></table>';

Now, when you add a location the event will automatically create a link to google maps with that address or location pre-filled out.

If you adopt my account-selection autocomplete, the address for the appointment will automatically fill the location. To do so, change the 'select' in the autocomplete call to:

PHP Code:
         select: function( eventui) {
 // Add crmentity id to hidden input
 // Also update the activity name with the activity type and account name
 jQuery('input[name=subject]').val(jQuery('#activitytype option:selected').text() + " " ui.item.label);
 // Overwrite the input field with the account name in stead of the crmentity
 // Update the address automatically
 jQuery('input[name=location]').val(ui.item.street " ";
 return false;