I'm a bit lost here. Right above the part where I want to change the code, the variable 'record' gets used, for instance to create a link to the detail view:
And I see in the module that the record is the activity ID I'm looking for, but for some reason, it returns blank to me...
NOTE: The third line is just for testing now, to see if I can get the correct record ID to even show up.
Wait, I noticed something. It does show up, in the pop-up field. Just not in the event in the calendar itself. So I guess I have to change this in calendarview.tpl...
OK, I found out the following. Normally, the Calendar module would get all fields for the Calendar and run them through 'transferForAddIntoTitle()'. Since I don't do that, I just append the string, the 'fullcalendar' plugin doesn't know what I'm doing. I have to prepare my string somehow so that the plugin understands it. Here's what I have:
In 'Events.php'. Now I need to format this so the plugin understands it. The pop-up (when you click a calendar item) does work like I want it to.
PHP Code:
"<a target='_new' href='index.php?action=EditView&module=".$activitytypeid."&record=".$record."'>".$app['LNK_EDIT']."</a>";
PHP Code:
// Added by MajorLabel: Get the associated sales order id and create a link to that sales order
$getRelatedOrder = $adb->pquery('SELECT so_id FROM vtiger_soactivityrel WHERE activity_id=?',array($record));
$relatedOrder = $adb->query_result_rowdata($getRelatedOrder,0);
$title .= "<br><b>Order: </b>$record";
Wait, I noticed something. It does show up, in the pop-up field. Just not in the event in the calendar itself. So I guess I have to change this in calendarview.tpl...
OK, I found out the following. Normally, the Calendar module would get all fields for the Calendar and run them through 'transferForAddIntoTitle()'. Since I don't do that, I just append the string, the 'fullcalendar' plugin doesn't know what I'm doing. I have to prepare my string somehow so that the plugin understands it. Here's what I have:
PHP Code:
// Added by MajorLabel: Get the associated sales order id and create a link to that sales order
// Set up the query
$getRelatedOrder = $adb->pquery('SELECT so_id FROM vtiger_soactivityrel WHERE activity_id=?',array($record));
// Get the crmentity ID for the related sales order
$relatedOrder = $adb->query_result_rowdata($getRelatedOrder,0);
$relatedOrderID = $relatedOrder[so_id];
// Setup the query to get the sales order no and subject line
$getRelatedOrderDetails = $adb->pquery('SELECT subject, salesorder_no FROM vtiger_salesorder WHERE salesorderid=?',array($relatedOrder[so_id]));
// Create an array for this row
$relatedOrderDetails = $adb->query_result_rowdata($getRelatedOrderDetails,0);
$title .= "<br><b>Order: </b><a href='index.php?module=SalesOrder&parenttab=Sales&action=DetailView&record=$relatedOrderID'>$relatedOrderDetails[salesorder_no]: $relatedOrderDetails[subject]</a>";
// End addition by MajorLabel