function sendCustomerResponseEmail($oTicket) { global $dcl_info; if (!is_object($this->oDB) || $dcl_info['DCL_CQQ_PERCENT'] == 0) { return; } $oStatus =& CreateObject('dcl.dbStatuses'); if ($oStatus->GetStatusType($this->oDB->status) != 2) { return; } $oMeta =& CreateObject('dcl.DCL_MetadataDisplay'); $aContact = $oMeta->GetContact($oTicket->contact_id); if (!isset($aContact['email']) || trim($aContact['email']) == '') { return; } srand((double) microtime() * 1000000); $pct = rand(1, 100); if ($pct <= $dcl_info['DCL_CQQ_PERCENT']) { $t =& CreateSmarty(); $t->assign('VAL_TICKETID', $this->oDB->ticketid); $t->assign('VAL_CLOSEDON', date('n/j/Y')); $t->assign('contact', $aContact); $oMail =& CreateObject('dcl.boSMTP'); $oMail->isHtml = true; $oMail->to = $aContact['email']; $oMail->from = $dcl_info['DCL_CQQ_FROM']; $oMail->subject = $dcl_info['DCL_CQQ_SUBJECT']; $sProductTemplate = DCL_ROOT . 'templates/custom/cqq_' . $oTicket->product . '.tpl'; if (file_exists($sProductTemplate)) { $oMail->body = SmartyFetch($t, $sProductTemplate, 'custom'); } else { $oMail->body = SmartyFetch($t, $dcl_info['DCL_CQQ_TEMPLATE'], 'custom'); } $oMail->Send(); } }
function renderItems(&$aItems) { $aLinks = array(); $i = 0; foreach ($aItems as $aItem) { $aLinks[$i] = array(); if (substr($aItem[1], 0, 11) == 'javascript:') { $aLinks[$i]['onclick'] = $aItem[1]; } else { $aLinks[$i]['onclick'] = menuLink('', 'menuAction=' . $aItem[1]); } $aLinks[$i]['text'] = $aItem[0]; $aLinks[$i]['image'] = $aItem[2]; $i++; } $this->t->assign('VAL_NAVBOXITEMS', $aLinks); return SmartyFetch($this->t, 'navbar.tpl'); }
function GetTicketNotificationBody(&$obj, $bIsPublic) { global $dcl_info; $t =& CreateSmarty(); $t->assign_by_ref('obj', $obj); $objTR =& CreateObject('dcl.dbTicketresolutions'); $t->assign('VAL_RESOLUTIONS', $objTR->GetResolutionsArray($obj->ticketid, $bIsPublic)); if ($bIsPublic) { return SmartyFetch($t, $dcl_info['DCL_TCK_EMAIL_TEMPLATE_PUBLIC'], 'custom'); } return SmartyFetch($t, $dcl_info['DCL_TCK_EMAIL_TEMPLATE'], 'custom'); }
function GetTimeCards($jcn, $seq, $editID = 0, $forDelete = false) { global $dcl_info, $g_oSec; if (!$g_oSec->HasPerm(DCL_ENTITY_TIMECARD, DCL_PERM_VIEW, (int) $jcn, (int) $seq)) { return ''; } $retVal = ''; $objTimeCard = CreateObject('dcl.dbTimeCards'); if ($objTimeCard->GetTimeCards($jcn, $seq) != -1) { $objPersonnel = CreateObject('dcl.dbPersonnel'); $objStatus = CreateObject('dcl.dbStatuses'); $objAction = CreateObject('dcl.dbActions'); $oMeta =& CreateObject('dcl.DCL_MetadataDisplay'); $oSmarty =& CreateSmarty(); $oSmarty->assign('PERM_MODIFY', $g_oSec->HasPerm(DCL_ENTITY_TIMECARD, DCL_PERM_MODIFY)); $oSmarty->assign('PERM_DELETE', $g_oSec->HasPerm(DCL_ENTITY_TIMECARD, DCL_PERM_DELETE)); $oSmarty->assign('IS_DELETE', $forDelete); while ($objTimeCard->next_record()) { $objTimeCard->GetRow(); if (!$forDelete && $editID == $objTimeCard->id) { $retVal .= '<tr><th align="left" colspan="2">'; $oTCF = CreateObject('dcl.htmlTimeCardForm'); $retVal .= $oTCF->GetForm($objTimeCard->jcn, $objTimeCard->seq, $objTimeCard); $retVal .= '</th></tr>'; } else { $oSmarty->assign('VAL_ACTIONBY', $oMeta->GetPersonnel($objTimeCard->actionby)); $oSmarty->assign('VAL_ACTIONON', $objTimeCard->actionon); $oSmarty->assign('VAL_SUMMARY', $objTimeCard->summary); $oSmarty->assign('VAL_STATUS', $oMeta->GetStatus($objTimeCard->status)); $oSmarty->assign('VAL_REVISION', $objTimeCard->revision); $oSmarty->assign('VAL_ACTION', $oMeta->GetAction($objTimeCard->action)); $oSmarty->assign('VAL_HOURS', $objTimeCard->hours); $oSmarty->assign('VAL_DESCRIPTION', $objTimeCard->description); $oSmarty->assign('VAL_INPUTON', $objTimeCard->inputon); $oSmarty->assign('VAL_PUBLIC', $objTimeCard->is_public == 'Y' ? STR_CMMN_YES : STR_CMMN_NO); $oSmarty->assign('VAL_TIMECARDID', $objTimeCard->id); if ($objTimeCard->reassign_from_id > 0) { $oSmarty->assign('VAL_REASSIGNFROM', $oMeta->GetPersonnel($objTimeCard->reassign_from_id)); } else { $oSmarty->assign('VAL_REASSIGNFROM', ''); } if ($objTimeCard->reassign_to_id > 0) { $oSmarty->assign('VAL_REASSIGNTO', $oMeta->GetPersonnel($objTimeCard->reassign_to_id)); } else { $oSmarty->assign('VAL_REASSIGNTO', ''); } $retVal .= SmartyFetch($oSmarty, 'htmlTimeCardDetail.tpl'); } } } return $retVal; }
function GetForm($jcn, $seq, $obj = '', $selected = '') { global $dcl_info, $g_oSec, $dcl_preferences; $isBatch = is_array($selected) && count($selected) > 0; $isEdit = is_object($obj) && !$isBatch; // Don't allow batch updates for now... if ($isEdit && !$g_oSec->HasPerm(DCL_ENTITY_TIMECARD, DCL_PERM_MODIFY)) { return PrintPermissionDenied(); } else { if (!$isEdit && !$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ACTION)) { return PrintPermissionDenied(); } } $objStatuses =& CreateObject('dcl.htmlStatuses'); $objActions =& CreateObject('dcl.htmlActions'); $objPersonnel =& CreateObject('dcl.htmlPersonnel'); $oSmarty =& CreateSmarty(); $oSmarty->assign('IS_BATCH', $isBatch); $oSmarty->assign('IS_EDIT', $isEdit); $oSmarty->assign('VAL_JSDATEFORMAT', GetJSDateFormat()); $setid = 0; if ($isBatch) { $oView =& CreateObject('dcl.boView'); $oView->SetFromURL(); $oSmarty->assign('VAL_VIEWFORM', $oView->GetForm()); $oSmarty->assign('VAL_SELECTED', $selected); $oSmarty->assign('CMB_STATUS', $objStatuses->GetCombo(1, 'status', 'name', 0, true, $setid)); $oSmarty->assign('VAL_WOETCHOURS', '0'); $oSmarty->assign('VAL_UPDATEWOETCHOURS', 'false'); $oSmarty->assign('VAL_ENABLEPUBLIC', 'N'); } else { $oWO = CreateObject('dcl.dbWorkorders'); $oWO->Load($jcn, $seq); $oProduct = CreateObject('dcl.dbProducts'); $oProduct->Load($oWO->product); $setid = $oProduct->wosetid; $oSmarty->assign('VAL_PRODUCT', $oWO->product); $oSmarty->assign('VAL_WOETCHOURS', $oWO->etchours); $oSmarty->assign('VAL_UPDATEWOETCHOURS', 'true'); $oSmarty->assign('CMB_STATUS', $objStatuses->GetCombo($oWO->status, 'status', 'name', 0, true, $setid)); $oSmarty->assign('VAL_ISPUBLIC', $oWO->is_public); $oSmarty->assign('VAL_ENABLEPUBLIC', $oWO->is_public); $oSmarty->assign('VAL_ISVERSIONED', $oProduct->is_versioned == 'Y'); } if ($isEdit) { $oSmarty->assign('VAL_ID', $obj->id); $oSmarty->assign('VAL_ACTIONON', $obj->actionon); $oSmarty->assign('VAL_HOURS', $obj->hours); $oSmarty->assign('VAL_SUMMARY', $obj->summary); $oSmarty->assign('VAL_DESCRIPTION', $obj->description); $oSmarty->assign('VAL_ISPUBLIC', $obj->is_public); $oSmarty->assign('CMB_STATUS', $objStatuses->GetCombo($obj->status, 'status', 'name', 0, false, $setid)); $oSmarty->assign('CMB_ACTION', $objActions->GetCombo($obj->action, 'action', 'name', 0, false, $setid)); } else { $oSmarty->assign('VAL_ACTIONON', date($dcl_info['DCL_DATE_FORMAT'])); $oSmarty->assign('CMB_ACTION', $objActions->GetCombo(0, 'action', 'name', 0, true, $setid)); if ($g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ASSIGN)) { $oSmarty->assign('CMB_REASSIGN', $objPersonnel->GetCombo(0, 'reassign_to_id', 'lastfirst', 0, true, DCL_ENTITY_WORKORDER)); } } $oSmarty->assign('VAL_JCN', $jcn); $oSmarty->assign('VAL_SEQ', $seq); $oSmarty->assign('VAL_NOTIFYDEFAULT', isset($dcl_preferences['DCL_PREF_NOTIFY_DEFAULT']) ? $dcl_preferences['DCL_PREF_NOTIFY_DEFAULT'] : 'N'); $oSmarty->assign('PERM_REASSIGN', $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ASSIGN)); $oSmarty->assign('PERM_ADDTASK', $g_oSec->HasPerm(DCL_ENTITY_PROJECT, DCL_PERM_ADDTASK, isset($_REQUEST['projectid']) ? (int) $_REQUEST['projectid'] : 0)); $oSmarty->assign('PERM_ATTACHFILE', $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ATTACHFILE) && $dcl_info['DCL_MAX_UPLOAD_FILE_SIZE'] > 0); $oSmarty->assign('VAL_MAXUPLOADFILESIZE', $dcl_info['DCL_MAX_UPLOAD_FILE_SIZE']); $oSmarty->assign('VAL_MULTIORG', $dcl_info['DCL_WO_SECONDARY_ACCOUNTS_ENABLED'] == 'Y'); $oSmarty->assign('PERM_MODIFYWORKORDER', $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_MODIFY)); $oSmarty->assign('PERM_ISPUBLIC', $g_oSec->IsPublicUser()); if (!$isEdit && !$isBatch) { $aOrgID = array(); $aOrgName = array(); $objPM = CreateObject('dcl.dbProjectmap'); if ($objPM->LoadByWO($jcn, $seq) != -1) { $objDBPrj = CreateObject('dcl.dbProjects'); if ($objPM->projectid > 0) { $objDBPrj->Load($objPM->projectid); } $oSmarty->assign('VAL_PROJECT', $objDBPrj->name); $oSmarty->assign('VAL_PROJECTS', $objPM->projectid); } $oOrgs =& CreateObject('dcl.boOrg'); $oOrgs->ListSelectedByWorkOrder($jcn, $seq); while ($oOrgs->oDB->next_record()) { $aOrgID[] = $oOrgs->oDB->f(0); $aOrgName[] = $oOrgs->oDB->f(1); } $oTag =& CreateObject('dcl.dbEntityTag'); $oSmarty->assign('VAL_TAGS', $oTag->getTagsForEntity(DCL_ENTITY_WORKORDER, $jcn, $seq)); $oHotlist =& CreateObject('dcl.dbEntityHotlist'); $oSmarty->assign('VAL_HOTLISTS', $oHotlist->getTagsForEntity(DCL_ENTITY_WORKORDER, $jcn, $seq)); $oSmarty->assign_by_ref('VAL_ORGID', $aOrgID); $oSmarty->assign_by_ref('VAL_ORGNAME', $aOrgName); } if (isset($_REQUEST['return_to'])) { $oSmarty->assign('VAL_RETURNTO', $_REQUEST['return_to']); } if (isset($_REQUEST['project'])) { $oSmarty->assign('VAL_PROJECT', $_REQUEST['project']); } return SmartyFetch($oSmarty, 'htmlTimeCardForm.tpl'); }