function set_notification_body($xtpl, $task) { global $app_list_strings; global $timedate; $notifyUser = $task->current_notify_user; $prefDate = $notifyUser->getUserDateTimePreferences(); $xtpl->assign("TASK_SUBJECT", $task->name); //MFH #13507 $xtpl->assign("TASK_PRIORITY", isset($task->priority) ? $app_list_strings['task_priority_dom'][$task->priority] : ""); if (!empty($task->date_due)) { $duedate = $timedate->fromDb($task->date_due); $xtpl->assign("TASK_DUEDATE", $timedate->asUser($duedate, $notifyUser) . " " . TimeDate::userTimezoneSuffix($duedate, $notifyUser)); } else { $xtpl->assign("TASK_DUEDATE", ''); } $xtpl->assign("TASK_STATUS", isset($task->status) ? $app_list_strings['task_status_dom'][$task->status] : ""); $xtpl->assign("TASK_DESCRIPTION", $task->description); return $xtpl; }
function set_notification_body($xtpl, &$meeting) { global $sugar_config; global $app_list_strings; global $current_user; global $timedate; // cn: bug 9494 - passing a contact breaks this call $notifyUser = $meeting->current_notify_user->object_name == 'User' ? $meeting->current_notify_user : $current_user; // cn: bug 8078 - fixed call to $timedate if (strtolower(get_class($meeting->current_notify_user)) == 'contact') { $xtpl->assign("ACCEPT_URL", $sugar_config['site_url'] . '/index.php?entryPoint=acceptDecline&module=Meetings&contact_id=' . $meeting->current_notify_user->id . '&record=' . $meeting->id); } elseif (strtolower(get_class($meeting->current_notify_user)) == 'lead') { $xtpl->assign("ACCEPT_URL", $sugar_config['site_url'] . '/index.php?entryPoint=acceptDecline&module=Meetings&lead_id=' . $meeting->current_notify_user->id . '&record=' . $meeting->id); } else { $xtpl->assign("ACCEPT_URL", $sugar_config['site_url'] . '/index.php?entryPoint=acceptDecline&module=Meetings&user_id=' . $meeting->current_notify_user->id . '&record=' . $meeting->id); } $xtpl->assign("MEETING_TO", $meeting->current_notify_user->new_assigned_user_name); $xtpl->assign("MEETING_SUBJECT", trim($meeting->name)); $xtpl->assign("MEETING_STATUS", isset($meeting->status) ? $app_list_strings['meeting_status_dom'][$meeting->status] : ""); $typekey = strtolower($meeting->type); if (isset($meeting->type)) { if (!empty($app_list_strings['eapm_list'][$typekey])) { $typestring = $app_list_strings['eapm_list'][$typekey]; } else { $typestring = $app_list_strings['meeting_type_dom'][$meeting->type]; } } $xtpl->assign("MEETING_TYPE", isset($meeting->type) ? $typestring : ""); $startdate = $timedate->fromDb($meeting->date_start); $xtpl->assign("MEETING_STARTDATE", $timedate->asUser($startdate, $notifyUser) . " " . TimeDate::userTimezoneSuffix($startdate, $notifyUser)); $enddate = $timedate->fromDb($meeting->date_end); $xtpl->assign("MEETING_ENDDATE", $timedate->asUser($enddate, $notifyUser) . " " . TimeDate::userTimezoneSuffix($enddate, $notifyUser)); $xtpl->assign("MEETING_HOURS", $meeting->duration_hours); $xtpl->assign("MEETING_MINUTES", $meeting->duration_minutes); $xtpl->assign("MEETING_DESCRIPTION", $meeting->description); if (!empty($meeting->join_url)) { $xtpl->assign('MEETING_URL', $meeting->join_url); $xtpl->parse('Meeting.Meeting_External_API'); } return $xtpl; }
function set_notification_body($xtpl, $task) { global $app_list_strings; global $timedate; $task->custom_fields->retrieve(); $notifyUser = $task->current_notify_user; $prefDate = $notifyUser->getUserDateTimePreferences(); $xtpl->assign("TASK_SUBJECT", $task->name); //MFH #13507 $xtpl->assign("TASK_PRIORITY", isset($task->priority) ? $app_list_strings['task_priority_dom'][$task->priority] : ""); if (!empty($task->date_due)) { $duedate = $timedate->fromDb($task->date_due); $xtpl->assign("TASK_DUEDATE", $timedate->asUser($duedate, $notifyUser) . " " . TimeDate::userTimezoneSuffix($duedate, $notifyUser)); } else { $xtpl->assign("TASK_DUEDATE", ''); } $xtpl->assign("TASK_STATUS", isset($task->status) ? $app_list_strings['task_status_dom'][$task->status] : ""); $xtpl->assign("TASK_DESCRIPTION", $task->description); //Custom Additions $lcase = new aCase(); $lproject = new Project(); $lcase->retrieve($task->parent_id); $linkedprojects = $lcase->get_linked_beans('project', 'Project'); foreach ($linkedprojects as $curproj) { $lproject = $curproj; } $lproject->custom_fields->retrieve(); $xtpl->assign("TASK_PROJECT_NAME", isset($lproject->name) ? $lproject->name : ""); $xtpl->assign("TASK_PROJECT_FACILITY", isset($lproject->facility_c) ? $lproject->facility_c : ""); $xtpl->assign("TASK_JOBNUMBER", isset($task->jobnumber_c) ? $task->jobnumber_c : ""); $xtpl->assign("TASK_CASENUMBER", isset($lcase->case_number) ? $lcase->case_number : ""); $xtpl->assign("TASK_DEPARTMENT", isset($task->department_c) ? $app_list_strings['department_list'][$task->department_c] : ""); $xtpl->assign("TASK_TYPE", isset($task->type_c) ? $app_list_strings['Task_Type_list'][$task->type_c] : ""); $xtpl->assign("TASK_CONTACTNAME", isset($task->contactname_c) ? $task->contactname_c : ""); $xtpl->assign("TASK_CONTACTNUMBER", isset($task->contactnumber_c) ? $task->contactnumber_c : ""); $xtpl->assign("TASK_PARTSSPARESNEEDED", isset($task->partssparesneeded_c) ? $task->partssparesneeded_c : ""); $xtpl->assign("TASK_DOCKHELIPORTLOCATION", isset($task->dockheliportlocation_c) ? $task->dockheliportlocation_c : ""); $xtpl->assign("TASK_VESSELNAME", isset($task->vesselname_c) ? $task->vesselname_c : ""); $xtpl->assign("TASK_ACCOUNT", isset($task->account_c) ? $task->account_c : ""); $xtpl->assign("TASK_WORKLOG", isset($task->worklog_c) ? $task->worklog_c : ""); return $xtpl; }
/** * set reminder body * @param XTemplate $xtpl * @param SugarBean $bean * @param User $user * @return XTemplate */ protected function setReminderBody(XTemplate $xtpl, SugarBean $bean, User $user) { $object = strtoupper($bean->object_name); $xtpl->assign("{$object}_SUBJECT", $bean->name); $date = $GLOBALS['timedate']->fromUser($bean->date_start, $GLOBALS['current_user']); $xtpl->assign("{$object}_STARTDATE", $GLOBALS['timedate']->asUser($date, $user) . " " . TimeDate::userTimezoneSuffix($date, $user)); if (isset($bean->location)) { $xtpl->assign("{$object}_LOCATION", $bean->location); } $xtpl->assign("{$object}_CREATED_BY", $user->full_name); $xtpl->assign("{$object}_DESCRIPTION", $bean->description); return $xtpl; }
function set_notification_body($xtpl, &$oqc_task) { global $sugar_config; global $app_list_strings; global $current_user; global $timedate; $xtpl->assign("ACCEPT_URL", $sugar_config['site_url'] . '/index.php?entryPoint=acceptDecline&module=oqc_Task&user_id=' . $oqc_task->current_notify_user->id . '&record=' . $oqc_task->id); $xtpl->assign("TASK_ID", trim($oqc_task->svnumber)); $xtpl->assign("TASK_SUBJECT", trim($oqc_task->name)); $xtpl->assign("TASK_PRIORITY", isset($oqc_task->priority) ? $app_list_strings['oqc_task_priority_list'][$oqc_task->priority] : ""); $xtpl->assign("TASK_STATUS", isset($oqc_task->status) ? $app_list_strings['oqc_task_status_list'][$oqc_task->status] : ""); if (!empty($oqc_task->date_due)) { if (!preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$/', $oqc_task->date_due)) { // This appears to be formatted in user date/time $date_converted = $timedate->to_db($oqc_task->date_due); } else { $date_converted = $oqc_task->date_due; } $duedate = $timedate->fromDb($date_converted); } else { $duedate = $timedate->getNow(); } //$GLOBALS['log']->error("date due is ". var_export($oqc_task->date_due,true)); //$GLOBALS['log']->error("Timedate is ". var_export($duedate,true)); $xtpl->assign("TASK_DUEDATE", $timedate->asUser($duedate, $oqc_task->current_notify_user) . " " . TimeDate::userTimezoneSuffix($duedate, $oqc_task->current_notify_user)); $xtpl->assign("TASK_DESCRIPTION", $oqc_task->description); $task_type = $oqc_task->conjugate ? 'all participants' : 'one participant'; $xtpl->assign("TASK_TYPE", $task_type); return $xtpl; }