Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding a related sales order to the calendar event
#2
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:
PHP Code:
"<a target='_new' href='index.php?action=EditView&module=".$activitytypeid."&record=".$record."'>".$app['LNK_EDIT']."</a>"
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...
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:&nbsp;</b>$record"
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:

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:&nbsp;</b><a href='index.php?module=SalesOrder&parenttab=Sales&action=DetailView&record=$relatedOrderID'>$relatedOrderDetails[salesorder_no]$relatedOrderDetails[subject]</a>";
                    
// End addition by MajorLabel 
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.
Reply


Messages In This Thread
RE: Adding a related sales order to the calendar event - Guido1982 - 11-17-2015, 12:46 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)