function DisplayForm($obj = '')
 {
     global $dcl_info, $g_oSec;
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_FAQQUESTION, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $t =& CreateSmarty();
     $t->assign('IS_EDIT', $isEdit);
     if ($isEdit) {
         $t->assign('VAL_SEQ', $obj->seq);
         $t->assign('VAL_QUESTIONTEXT', $obj->questiontext);
         $t->assign('VAL_TOPICID', $obj->topicid);
         $t->assign('VAL_QUESTIONID', $obj->questionid);
     } else {
         if (($id = DCL_Sanitize::ToInt($_REQUEST['topicid'])) === null) {
             trigger_error('Data sanitize failed.');
             return;
         }
         $t->assign('VAL_SEQ', '');
         $t->assign('VAL_QUESTIONTEXT', '');
         $t->assign('VAL_TOPICID', $id);
     }
     SmartyDisplay($t, 'htmlFaqquestionsForm.tpl');
 }
 function show()
 {
     global $dcl_info, $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_ADMIN, DCL_PERM_MODIFY)) {
         return PrintPermissionDenied();
     }
     $objPersonnel = CreateObject('dcl.htmlPersonnel');
     $oDBPersonnel = CreateObject('dcl.dbPersonnel');
     if ($oDBPersonnel->Load($GLOBALS['DCLID']) == -1) {
         return;
     }
     $t =& CreateSmarty();
     $oSelect = CreateObject('dcl.htmlSelect');
     $t->assign('CMB_USERS', $objPersonnel->GetCombo(0, 'responsible', 'lastfirst', 0, false));
     $begindate = @DCL_Sanitize::ToDate($_REQUEST['begindate']);
     if ($begindate !== null) {
         $t->assign('VAL_BEGINDATE', $begindate);
     } else {
         $t->assign('VAL_BEGINDATE', '');
     }
     $enddate = @DCL_Sanitize::ToDate($_REQUEST['enddate']);
     if ($enddate !== null) {
         $t->assign('VAL_ENDDATE', $enddate);
     } else {
         $t->assign('VAL_ENDDATE', '');
     }
     SmartyDisplay($t, 'htmlSecAuditBrowse.tpl');
 }
 function _SetActionFormOptions()
 {
     global $g_oSec;
     $aLinks = array();
     if (($product_id = DCL_Sanitize::ToInt($_REQUEST['product_id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     if ($g_oSec->HasPerm(DCL_ENTITY_PRODUCTMODULE, DCL_PERM_ADD)) {
         $aLinks[STR_CMMN_NEW] = menuLink('', 'menuAction=htmlProductModules.add&product_id=' . $product_id);
     }
     if ($g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_VIEW)) {
         $aLinks['Detail'] = menuLink('', 'menuAction=boProducts.view&id=' . $product_id);
     }
     $this->_SetVar('hActionLinkSetLinks', '');
     $bFirst = true;
     foreach ($aLinks as $sText => $sLink) {
         if ($bFirst) {
             $bFirst = false;
         } else {
             $this->Template->parse('hActionLinkSetLinks', 'actionLinkSetSep', true);
         }
         $this->_SetVar('LNK_ACTIONVALUE', $sLink);
         $this->_SetVar('VAL_ACTIONVALUE', $sText);
         $this->Template->parse('hActionLinkSetLinks', 'actionLinkSetLink', true);
     }
     $this->Template->parse('hActionLinkSet', 'actionLinkSet');
     $this->Template->parse('hActions', 'actions');
 }
 function ShowPage($sPage)
 {
     global $g_oSec, $dcl_info;
     commonHeader();
     if (($productid = DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     if (!$g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_VIEW, $productid)) {
         return PrintPermissionDenied();
     }
     $this->oProduct =& CreateObject('dcl.dbProducts');
     if ($this->oProduct->Load($productid) == -1) {
         trigger_error('Could not find a product with an id of ' . $productid, E_USER_ERROR);
         return;
     }
     $this->oSmarty->assign('VAL_ID', $this->oProduct->id);
     $this->oSmarty->assign('VAL_NAME', $this->oProduct->name);
     $this->oSmarty->assign('PERM_VIEWWO', $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_VIEW));
     $this->oSmarty->assign('PERM_VIEWTCK', $g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_VIEW));
     $this->oSmarty->assign('PERM_WIKI', $dcl_info['DCL_WIKI_ENABLED'] == 'Y' && $g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_VIEWWIKI));
     $this->oSmarty->assign('PERM_EDIT', $g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_MODIFY));
     $this->oSmarty->assign('PERM_DELETE', $g_oSec->HasPerm(DCL_ENTITY_PRODUCT, DCL_PERM_DELETE));
     $this->oSmarty->assign('PERM_VERSIONS', $dcl_info['DCL_BUILD_MANAGER_ENABLED'] == 'Y' && $this->oProduct->is_versioned == 'Y');
     SmartyDisplay($this->oSmarty, $sPage);
 }
 function DisplayForm($obj = '')
 {
     global $dcl_info, $g_oSec;
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_FAQTOPIC, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $t =& CreateSmarty();
     $t->assign('IS_EDIT', $isEdit);
     if ($isEdit) {
         $t->assign('VAL_SEQ', $obj->seq);
         $t->assign('VAL_NAME', $obj->name);
         $t->assign('VAL_DESCRIPTION', $obj->description);
         $t->assign('VAL_FAQID', $obj->faqid);
         $t->assign('VAL_TOPICID', $obj->topicid);
     } else {
         if (($id = DCL_Sanitize::ToInt($_REQUEST['faqid'])) === null) {
             trigger_error('Data sanitize failed.');
             return;
         }
         $t->assign('TXT_TITLE', STR_FAQ_ADDFAQTOPIC);
         $t->assign('VAL_SEQ', '');
         $t->assign('VAL_NAME', '');
         $t->assign('VAL_DESCRIPTION', '');
         $t->assign('VAL_FAQID', $id);
     }
     SmartyDisplay($t, 'htmlFaqtopicsForm.tpl');
 }
 function ListVersions()
 {
     // FIXME: application/x-javascript for Opera
     header('Content-Type: application/json');
     $product_id = @DCL_Sanitize::ToInt($_REQUEST['product_id']);
     if ($product_id === null) {
         exit;
     }
     $oDB = CreateObject('dcl.dbProductVersion');
     $aOptions = $oDB->GetOptions('product_version_id', 'product_version_text', 'active', isset($_REQUEST['active']) && $_REQUEST['active'] == 'Y', '', "product_id={$product_id}");
     $bFirst = true;
     echo '{';
     echo '"totalRecords":', count($aOptions), ',';
     echo '"data":[';
     for ($i = 0; $i < count($aOptions); $i++) {
         if ($i > 0) {
             echo ',';
         }
         echo '{';
         echo '"id":', $aOptions[$i]['product_version_id'], ',';
         echo '"text":"', str_replace('"', '\\"', str_replace("\\", "\\\\", $aOptions[$i]['product_version_text'])), '"';
         echo '}';
     }
     echo ']}';
     exit;
 }
Ejemplo n.º 7
0
 function ListMainContacts($org_id)
 {
     if (($org_id = DCL_Sanitize::ToInt($org_id)) === null) {
         return;
     }
     $sSQL = "SELECT DISTINCT C.last_name, C.first_name, C.contact_id\n\t\t\t\tFROM dcl_contact C \n\t\t\t\t" . $this->JoinKeyword . " dcl_contact_type_xref CTX ON C.contact_id = CTX.contact_id \n\t\t\t\t" . $this->JoinKeyword . " dcl_contact_type CT ON CTX.contact_type_id = CT.contact_type_id\n\t\t\t\t" . $this->JoinKeyword . " dcl_org_contact OC ON C.contact_id = OC.contact_id \n\t\t\t\tWHERE OC.org_id = {$org_id}\n\t\t\t\tAND CT.contact_type_is_main = 'Y' \n\t\t\t\tORDER BY C.last_name, C.first_name, C.contact_id";
     $this->Query($sSQL);
 }
 function HasChecklists($id)
 {
     if (($id = DCL_Sanitize::ToInt($id)) == NULL) {
         trigger_error('Data sanitize failed.');
         return;
     }
     return $this->ExecuteScalar('select count(*) from dcl_chklst where dcl_chklst_tpl_id = ' . $id) > 0;
 }
 function submitModify()
 {
     global $g_oSession, $dcl_info, $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_PREFS, DCL_PERM_MODIFY)) {
         return PrintPermissionDenied();
     }
     $bHasChanges = false;
     $o = CreateObject('dcl.dbPreferences');
     $o->personnel_id = $GLOBALS['DCLID'];
     $o->preferences_data = $g_oSession->Value('dcl_preferences');
     if (!isset($o->preferences_data) || !is_array($o->preferences_data) || count($o->preferences_data) < 1) {
         $o->preferences_data = array('DCL_PREF_TEMPLATE_SET' => $dcl_info['DCL_DEF_TEMPLATE_SET'], 'DCL_PREF_LANGUAGE' => $dcl_info['DCL_DEFAULT_LANGUAGE'], 'DCL_PREF_NOTIFY_DEFAULT' => 'N', 'DCL_PREF_CREATED_WATCH_OPTION' => 4);
         $o->Add();
         $bHasChanges = true;
     }
     $sOldTpl = $o->preferences_data['DCL_PREF_TEMPLATE_SET'];
     foreach ($_REQUEST as $pref => $setting) {
         if (substr($pref, 0, 9) != 'DCL_PREF_') {
             continue;
         }
         if ($pref == 'DCL_PREF_NOTIFY_DEFAULT') {
             $setting = DCL_Sanitize::ToYN($_REQUEST['DCL_PREF_NOTIFY_DEFAULT']);
         }
         if ($o->Value($pref) != $setting) {
             $bHasChanges = true;
             $o->Register($pref, $setting);
         }
     }
     if (!isset($_REQUEST['DCL_PREF_NOTIFY_DEFAULT'])) {
         $bHasChanges = true;
         $o->Register('DCL_PREF_NOTIFY_DEFAULT', 'N');
     }
     if ($bHasChanges) {
         $o->Edit();
         $g_oSession->Register('dcl_preferences', $o->preferences_data);
         $g_oSession->Edit();
     }
     // Template change?
     $sNewTpl = $o->preferences_data['DCL_PREF_TEMPLATE_SET'];
     if ($sNewTpl != $sOldTpl) {
         // Do we need to break out of frames?
         $menuAction = 'menuAction=htmlPreferences.modify';
         $sNewIsFramed = file_exists(DCL_ROOT . 'templates/' . $sNewTpl . '/frameset.php');
         $sOldIsFramed = file_exists(DCL_ROOT . 'templates/' . $sOldTpl . '/frameset.php');
         if ($sOldIsFramed) {
             if ($sNewIsFramed) {
                 RefreshTop(menuLink(DCL_WWW_ROOT . 'templates/' . $sNewTpl . '/frameset.php', $menuAction));
             } else {
                 RefreshTop(menuLink('', $menuAction));
             }
         } else {
             if ($sNewIsFramed) {
                 RefreshTop(menuLink(DCL_WWW_ROOT . 'templates/' . $sNewTpl . '/frameset.php', $menuAction));
             }
         }
     }
     $this->modify();
 }
 function modify($aSource)
 {
     $aSource['active'] = @DCL_Sanitize::ToYN($aSource['active']);
     parent::modify($aSource);
     $oWSP = CreateObject('dcl.dbWorkspaceProduct');
     $oWSP->serialize($aSource['workspace_id'], $aSource['products'], false);
     $oWSU = CreateObject('dcl.dbWorkspaceUser');
     $oWSU->serialize($this->oDB->workspace_id, $aSource['users'], false);
 }
 function ListByOrg($org_id)
 {
     if (($org_id = DCL_Sanitize::ToInt($org_id)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     $sql = 'SELECT ' . $this->SelectAllColumns() . ' FROM ' . $this->TableName . ' WHERE org_id = ' . $org_id;
     return $this->Query($sql);
 }
 function HasSpecificRole($role_id)
 {
     // Checks the current user for specific role - should only be used by custom plugins
     if (($role_id = DCL_Sanitize::ToInt($role_id)) === null) {
         trigger_error('Data sanitize failed.');
         return false;
     }
     $oDB =& CreateObject('dcl.dbUserRole');
     return $oDB->HasSpecificRole($GLOBALS['DCLID'], $role_id);
 }
 function GetPrimaryPhone($iOrgID)
 {
     if (($iOrgID = DCL_Sanitize::ToInt($iOrgID)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     if ($this->Query("SELECT pt.phone_type_name, p.phone_number FROM dcl_org_phone p, dcl_phone_type pt WHERE p.phone_type_id = pt.phone_type_id AND p.org_id = {$iOrgID} AND preferred = 'Y'") != -1) {
         return $this->next_record();
     }
     return false;
 }
 function ListByContact($contact_id)
 {
     if (($contact_id = DCL_Sanitize::ToInt($contact_id)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     $sql = 'SELECT a.contact_addr_id, a.contact_id, a.addr_type_id, a.add1, a.add2, a.city, a.state, a.zip, a.country, a.preferred, t.addr_type_name';
     $sql .= ' FROM ' . $this->TableName . ' a, dcl_addr_type t WHERE a.contact_id = ' . $contact_id . ' AND t.addr_type_id = a.addr_type_id';
     $sql .= ' ORDER BY t.addr_type_name';
     return $this->Query($sql);
 }
 function ListByOrg($org_id)
 {
     if (($org_id = DCL_Sanitize::ToInt($org_id)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     $sql = 'SELECT p.id, op.org_id, p.name';
     $sql .= ' FROM dcl_org_product_xref op, products p WHERE op.org_id = ' . $org_id . ' AND p.id = op.product_id';
     $sql .= ' ORDER BY p.name';
     return $this->Query($sql);
 }
 function ListByContact($contact_id)
 {
     if (($contact_id = DCL_Sanitize::ToInt($contact_id)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     $sql = 'SELECT l.contact_license_id, l.contact_id, l.product_id, l.product_version, l.license_id, l.registered_on, l.expires_on, l.license_notes, p.name';
     $sql .= ' FROM ' . $this->TableName . ' l, products p WHERE l.contact_id = ' . $contact_id . ' AND p.id = l.product_id';
     $sql .= ' ORDER BY p.name, l.expires_on DESC, l.license_id';
     return $this->Query($sql);
 }
 function GetPrimaryEmail($iOrgID)
 {
     if (($iOrgID = DCL_Sanitize::ToInt($iOrgID)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     if ($this->Query("SELECT et.email_type_name, e.email_addr FROM dcl_org_email e, dcl_email_type et WHERE e.email_type_id = et.email_type_id AND e.org_id = {$iOrgID} AND e.preferred = 'Y'") != -1) {
         return $this->next_record();
     }
     return false;
 }
 function GetPrimaryUrl($contact_id)
 {
     if (($contact_id = DCL_Sanitize::ToInt($contact_id)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     if ($this->Query("SELECT ut.url_type_name, u.url_addr FROM dcl_contact_url u, dcl_url_type ut WHERE u.url_type_id = ut.url_type_id AND u.contact_id = {$contact_id} AND preferred = 'Y'") != -1) {
         return $this->next_record();
     }
     return false;
 }
 function ListByContact($contact_id)
 {
     if (($contact_id = DCL_Sanitize::ToInt($contact_id)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     $sql = 'SELECT u.contact_type_id, u.contact_id, t.contact_type_name';
     $sql .= ' FROM dcl_contact_type_xref u, dcl_contact_type t WHERE u.contact_id = ' . $contact_id . ' AND t.contact_type_id = u.contact_type_id';
     $sql .= ' ORDER BY t.contact_type_name';
     return $this->Query($sql);
 }
 function GetPrimaryEmailByUserID($iUserID)
 {
     if (($iUserID = DCL_Sanitize::ToInt($iUserID)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     if ($this->Query("SELECT et.email_type_name, e.email_addr FROM dcl_contact_email e, dcl_email_type et, personnel p WHERE p.contact_id = e.contact_id AND e.email_type_id = et.email_type_id AND p.id = {$iUserID} AND e.preferred = 'Y'") != -1) {
         return $this->next_record();
     }
     return false;
 }
 function ShowResults()
 {
     global $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_ADMIN, DCL_PERM_MODIFY)) {
         return PrintPermissionDenied();
     }
     $begindate = @DCL_Sanitize::ToDateTime($_REQUEST['begindate'] . ' 00:00:00.00');
     $enddate = @DCL_Sanitize::ToDateTime($_REQUEST['enddate'] . ' 23:59:59.99');
     $responsible = DCL_Sanitize::ToInt($_REQUEST['responsible']);
     if ($begindate === null || $enddate === null) {
         commonHeader();
         trigger_error(STR_SEC_DATEERR, E_USER_ERROR);
         $this->Show(false);
         return;
     }
     $objDBPer =& CreateObject('dcl.dbPersonnel');
     $objDBSA =& CreateObject('dcl.dbSecAudit');
     $objDB = new DCLDb();
     $sCols = 'SA.id, ' . $objDBSA->ConvertTimestamp('SA.actionon', 'actionon') . ', SA.actiontxt, SA.actionparam';
     $sCols .= ', ' . $objDBPer->SelectAllColumns('Pers.');
     $sQuery = "SELECT {$sCols}\n\t\t\tFROM {$objDBSA->TableName} SA INNER JOIN {$objDBPer->TableName} Pers on \n\t\t\tSA.id = pers.id \n\t\t\tWHERE SA.actionon BETWEEN " . $objDBSA->DisplayToSQL($begindate) . ' and ' . $objDBSA->DisplayToSQL($enddate);
     if ($responsible == 0) {
         $respname = STR_SEC_ALLUSERS;
     } else {
         $objDBPer->Load($responsible);
         $respname = $objDBPer->short;
         $sQuery .= ' AND SA.id=' . $responsible;
     }
     $sQuery .= ' ORDER BY SA.actionon';
     $reportAr = null;
     if ($objDB->Query($sQuery) != -1) {
         if ($objDB->next_record()) {
             $idx = -1;
             do {
                 $idx++;
                 $reportAr[$idx][] = $objDB->f('short');
                 $reportAr[$idx][] = $objDB->FormatTimeStampForDisplay($objDB->f('actionon'));
                 $reportAr[$idx][] = $objDB->f('actiontxt');
                 $reportAr[$idx][] = $objDB->f('actionparam');
             } while ($objDB->next_record());
         } else {
             trigger_error(STR_SEC_RPTNODATA, E_USER_ERROR);
             $this->Show(false);
             return;
         }
     }
     $obj =& CreateObject('dcl.htmlSecAudit');
     if (!$obj->Render($reportAr, $begindate, $enddate, $respname)) {
         trigger_error(STR_SEC_RPTERROR, E_USER_ERROR);
         $this->Show(false);
         return;
     }
 }
 function modify()
 {
     commonHeader();
     if (($id = DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     $oPersonnel =& CreateObject('dcl.dbPersonnel');
     if ($oPersonnel->Load($id) != -1) {
         $this->ShowEntryForm($oPersonnel);
     }
 }
 function LoadMapForType($setid, $typeid)
 {
     if (($setid = DCL_Sanitize::ToInt($setid)) == NULL || ($typeid = DCL_Sanitize::ToInt($typeid)) == NULL) {
         trigger_error('Data sanitize failed.');
         return;
     }
     $this->Clear();
     $sql = 'SELECT * FROM attributesetsmap WHERE setid=' . $setid . ' AND typeid=' . $typeid . ' ORDER BY weight';
     if (!$this->Query($sql)) {
         return -1;
     }
     return 1;
 }
 function updateOrgs($contact_id, &$aOrgID)
 {
     if (($contact_id = DCL_Sanitize::ToInt($contact_id)) === null) {
         return PrintPermissionDenied();
     }
     $aOrgID = DCL_Sanitize::ToIntArray($aOrgID);
     if ($aOrgID === null || count($aOrgID) == 0) {
         $aOrgID = array("-1");
     }
     $sOrgID = join(',', $aOrgID);
     $this->Execute("DELETE FROM dcl_org_contact WHERE contact_id = {$contact_id} AND org_id NOT IN ({$sOrgID})");
     $this->Execute("INSERT INTO dcl_org_contact (org_id, contact_id, created_on, created_by) SELECT org_id, {$contact_id}, " . $this->GetDateSQL() . ", " . $GLOBALS['DCLID'] . " FROM dcl_org WHERE org_id IN ({$sOrgID}) AND org_id NOT IN (SELECT org_id FROM dcl_org_contact WHERE contact_id = {$contact_id})");
 }
 function CloseAllIncompleteTasksForWorkOrder($wo_id, $seq)
 {
     global $DCLID;
     if (($wo_id = DCL_Sanitize::ToInt($wo_id)) === null || ($seq = DCL_Sanitize::ToInt($seq)) === null) {
         trigger_error('Data sanitize failed.', E_USER_ERROR);
         return;
     }
     if ($this->GetCountIncompleteTasksForWorkOrder($wo_id, $seq) > 0) {
         $this->Execute("UPDATE dcl_wo_task SET task_complete = 'Y', task_complete_by = {$DCLID}, task_complete_dt = " . $this->GetDateSQL() . " WHERE wo_id = {$wo_id} AND seq = {$seq} AND task_complete = 'N'");
         return true;
     }
     return false;
 }
 function GetPrimaryAddress($iOrgID)
 {
     if (($iOrgID = DCL_Sanitize::ToInt($iOrgID)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     $sql = 'SELECT a.org_addr_id, a.org_id, a.addr_type_id, a.add1, a.add2, a.city, a.state, a.zip, a.country, a.preferred, t.addr_type_name';
     $sql .= ' FROM ' . $this->TableName . ' a, dcl_addr_type t WHERE a.org_id = ' . $iOrgID . ' AND t.addr_type_id = a.addr_type_id';
     $sql .= " AND a.preferred = 'Y'";
     if ($this->Query($sql) != -1) {
         return $this->next_record();
     }
     return false;
 }
 function show()
 {
     global $dcl_info, $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_REPORT)) {
         return PrintPermissionDenied();
     }
     if (($type = DCL_Sanitize::ToInt($_REQUEST['type'])) === null || ($id = DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     $oSmarty =& CreateSmarty();
     $oAudit =& CreateObject('dcl.boAudit');
     switch ($type) {
         case DCL_ENTITY_WORKORDER:
             if (($id2 = DCL_Sanitize::ToInt($_REQUEST['id2'])) === null) {
                 trigger_error('Data sanitize failed.');
                 return;
             }
             $this->aAudit = $oAudit->LoadDiff('dbWorkorders', array('jcn' => $id, 'seq' => $id2));
             $oSmarty->assign('VAL_ID', sprintf('%d-%d', $id, $id2));
             $oSmarty->assign('VAL_SUMMARY', $this->oMeta->GetWorkOrder($id, $id2));
             $oSmarty->assign('LNK_BACK', menuLink('', "menuAction=boWorkorders.viewjcn&jcn={$id}&seq={$id2}"));
             $oAccount =& CreateObject('dcl.dbWorkOrderAccount');
             $this->aAuditAccount = $oAccount->AuditWorkOrderList($id, $id2);
             $oProject =& CreateObject('dcl.dbProjectmap');
             $this->aAuditProject = $oProject->AuditWorkOrderList($id, $id2);
             break;
         case DCL_ENTITY_PROJECT:
             $this->aAudit = $oAudit->LoadDiff('dbProjects', array('projectid' => $id));
             $oSmarty->assign('VAL_ID', $id);
             $oSmarty->assign('VAL_SUMMARY', $this->oMeta->GetProject($id));
             $oSmarty->assign('LNK_BACK', menuLink('', "menuAction=boProjects.viewproject&wostatus=0&project={$id}"));
             $oProject =& CreateObject('dcl.dbProjectmap');
             $this->aAuditWorkOrder = $oProject->AuditProjectList($id);
             break;
         case DCL_ENTITY_TICKET:
             $this->aAudit = $oAudit->LoadDiff('dbTickets', array('ticketid' => $id));
             $oSmarty->assign('VAL_ID', $id);
             $oSmarty->assign('VAL_SUMMARY', $this->oMeta->GetTicket($id));
             $oSmarty->assign('LNK_BACK', menuLink('', "menuAction=boTickets.view&ticketid={$id}"));
             break;
     }
     $this->prepareForDisplay();
     $oSmarty->assign_by_ref('VAL_AUDITTRAIL', $this->aAudit);
     $oSmarty->assign_by_ref('VAL_AUDITACCOUNT', $this->aAuditAccount);
     $oSmarty->assign_by_ref('VAL_AUDITPROJECT', $this->aAuditProject);
     $oSmarty->assign_by_ref('VAL_AUDITWORKORDER', $this->aAuditWorkOrder);
     SmartyDisplay($oSmarty, 'htmlAuditTrail.tpl');
 }
 function ShowView()
 {
     commonHeader();
     if (($id = DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     $oDB = CreateObject('dcl.dbViews');
     if ($oDB->Load($id) != -1) {
         $oView = CreateObject('dcl.boView');
         $oView->SetFromURLString($oDB->viewurl);
         $this->Show($oView);
     }
 }
 function GetFirstOrg($contact_id)
 {
     if (($contact_id = DCL_Sanitize::ToInt($contact_id)) === null) {
         trigger_error('Data sanitize failed.');
         return -1;
     }
     $aRetVal = array();
     $sSQL = 'SELECT O.org_id, O.name FROM dcl_org O ' . $this->JoinKeyword . " dcl_org_contact OC ON O.org_id = OC.org_id WHERE OC.contact_id = {$contact_id} ORDER BY O.name";
     if ($this->LimitQuery($sSQL, 0, 1) != -1) {
         if ($this->next_record()) {
             $aRetVal = $this->Record;
         }
     }
     return $aRetVal;
 }
 function modify()
 {
     global $dcl_info, $g_oSec;
     if (($id = DCL_Sanitize::ToInt($_REQUEST['dcl_chklst_tpl_id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     if (!$g_oSec->HasPerm(DCL_ENTITY_FORMTEMPLATES, DCL_PERM_MODIFY, $id)) {
         return PrintPermissionDenied();
     }
     $o = CreateObject('dcl.dbChklstTpl');
     if ($o->Load($id) == -1) {
         return;
     }
     $this->showForm($o);
 }