11-19-2015, 11:19 PM
I ended up (for now) setteling for less functionality than I wanted. I will explain the process:
I had already created a new table called 'vtiger_soactivityrel', that has two columns: 'so_id' and 'activity_id'.
I created a new hidden input called "so_rel" in addEventUI.php, to contain this value. I modified 'SaveEvent.php' so it would save the relation between the activity and the sales order upon saving the event. I also modified 'Delete.php' so it would delete this relation on deleting the event.
I made some jQuery in addEventUI.php that filled my hidden input field "so_rel" with the salesorder crmentity ID (and I use that in my SaveEvent.php modification).
In Event.php, I made the following changes:
On line 338.
This appends my link to the title variable. It all works, but only in the white pop-up when you click an event. For some reason, apparantly the normal event layout treats the '$title' variable differently. I can't figure out why, but at least now you can link an event to a sales order, and open this sales order in detailview from the calendar in a new tab.
I had already created a new table called 'vtiger_soactivityrel', that has two columns: 'so_id' and 'activity_id'.
I created a new hidden input called "so_rel" in addEventUI.php, to contain this value. I modified 'SaveEvent.php' so it would save the relation between the activity and the sales order upon saving the event. I also modified 'Delete.php' so it would delete this relation on deleting the event.
I made some jQuery in addEventUI.php that filled my hidden input field "so_rel" with the salesorder crmentity ID (and I use that in my SaveEvent.php modification).
In Event.php, I made the following changes:
PHP Code:
// MajorLabel
$soActivityRelQuery = $adb->pquery("SELECT vtiger_salesorder.salesorderid, vtiger_salesorder.subject, vtiger_salesorder.salesorder_no FROM vtiger_soactivityrel RIGHT JOIN vtiger_salesorder ON vtiger_soactivityrel.so_id=vtiger_salesorder.salesorderid WHERE vtiger_soactivityrel.activity_id=?",array($record));
if ( ($adb->num_rows($soActivityRelQuery)) > 0 ) {
$RelatedSo = $adb->query_result_rowdata($soActivityRelQuery);
$title .= "<br><b>Order: </b><a target='_blank' href='index.php?module=SalesOrder&parenttab=Sales&action=DetailView&record=".$RelatedSo['salesorderid']."'>".$RelatedSo['salesorder_no'].": ".$RelatedSo['subject']."</a>";
}
// END MajorLabel
On line 338.
This appends my link to the title variable. It all works, but only in the white pop-up when you click an event. For some reason, apparantly the normal event layout treats the '$title' variable differently. I can't figure out why, but at least now you can link an event to a sales order, and open this sales order in detailview from the calendar in a new tab.