コード例 #1
0
 function Show($obj = '')
 {
     global $dcl_info, $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_LOOKUP, $this->mode == DCL_MODE_EDIT ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $Template = CreateTemplate(array('hForm' => 'htmlLookup.tpl'));
     $Template->set_var('VAL_FORMACTION', menuLink());
     $Template->set_var('BTN_SAVE', STR_CMMN_SAVE);
     $Template->set_var('BTN_RESET', STR_CMMN_RESET);
     $Template->set_var('CMB_ACTIVE', GetYesNoCombo($this->active, 'dcl_lookup_active', 0, false));
     $Template->set_var('VAL_NAME', htmlspecialchars($this->name));
     $Template->set_var('TXT_NAME', STR_LKP_NAME);
     $Template->set_var('TXT_ACTIVE', STR_LKP_ACTIVE);
     $Template->set_var('TXT_HIGHLIGHTEDNOTE', STR_CMMN_HIGHLIGHTEDNOTE);
     if ($this->mode == DCL_MODE_EDIT) {
         $Template->set_var('TXT_TITLE', STR_LKP_EDITTITLE);
         $hiddenvars = GetHiddenVar('menuAction', 'boLookup.dbmodify');
         $hiddenvars .= GetHiddenVar('dcl_lookup_id', $this->id);
     } else {
         $Template->set_var('TXT_TITLE', STR_LKP_ADDTITLE);
         $hiddenvars = GetHiddenVar('menuAction', 'boLookup.dbadd');
     }
     $Template->set_var('HIDDEN_VARS', $hiddenvars);
     $Template->pparse('out', 'hForm');
 }
コード例 #2
0
 function showForm($obj = '')
 {
     global $g_oSec;
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_FORMTEMPLATES, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $t = CreateSmarty();
     if ($isEdit) {
         $t->assign('VAL_MENUACTION', 'boChecklistTpl.dbmodify');
         $t->assign('CMB_ACTIVE', GetYesNoCombo($obj->dcl_chklst_tpl_active, 'dcl_chklst_tpl_active', 0, false));
         $t->assign('VAL_NAME', $obj->dcl_chklst_tpl_name);
         $t->assign('VAL_ID', $obj->dcl_chklst_tpl_id);
     } else {
         $t->assign('VAL_MENUACTION', 'boChecklistTpl.dbadd');
         $t->assign('CMB_ACTIVE', GetYesNoCombo('Y', 'dcl_chklst_tpl_active', 0, false));
     }
     SmartyDisplay($t, 'htmlChklstTplAdd.tpl');
 }
コード例 #3
0
 function ShowEntryForm($obj = '')
 {
     global $dcl_info, $g_oSec;
     commonHeader();
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_PRODUCT, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD, $isEdit ? (int) $obj->id : 0)) {
         return PrintPermissionDenied();
     }
     $t = CreateSmarty();
     if ($isEdit) {
         $t->assign('TXT_FUNCTION', STR_PROD_EDIT);
         $t->assign('menuAction', 'htmlProducts.submitModify');
         $t->assign('id', $obj->id);
     } else {
         $t->assign('TXT_FUNCTION', STR_PROD_ADD);
         $t->assign('menuAction', 'htmlProducts.submitAdd');
     }
     // Data
     $objHTMLPersonnel = CreateObject('dcl.htmlPersonnel');
     $objHA = CreateObject('dcl.htmlAttributesets');
     if ($isEdit) {
         $t->assign('CMB_ACTIVE', GetYesNoCombo($obj->active, 'active', 0, false));
         $t->assign('CMB_ISVERSIONED', GetYesNoCombo($obj->is_versioned, 'is_versioned', 0, false));
         $t->assign('CMB_ISPROJECTREQUIRED', GetYesNoCombo($obj->is_project_required, 'is_project_required', 0, false));
         $t->assign('CMB_ISPUBLIC', GetYesNoCombo($obj->is_public, 'is_public', 0, false));
         $t->assign('VAL_SHORT', $obj->short);
         $t->assign('VAL_NAME', $obj->name);
         $t->assign('CMB_REPORTTO', $objHTMLPersonnel->GetCombo($obj->reportto, 'reportto'));
         $t->assign('CMB_TICKETSTO', $objHTMLPersonnel->GetCombo($obj->ticketsto, 'ticketsto'));
         $t->assign('CMB_WOATTRIBUTESET', $objHA->GetCombo($obj->wosetid, 'wosetid'));
         $t->assign('CMB_TCKATTRIBUTESET', $objHA->GetCombo($obj->tcksetid, 'tcksetid'));
     } else {
         $t->assign('CMB_ACTIVE', GetYesNoCombo('Y', 'active', 0, false));
         $t->assign('CMB_ISVERSIONED', GetYesNoCombo('Y', 'is_versioned', 0, false));
         $t->assign('CMB_ISPROJECTREQUIRED', GetYesNoCombo('N', 'is_project_required', 0, false));
         $t->assign('CMB_ISPUBLIC', GetYesNoCombo('N', 'is_public', 0, false));
         $t->assign('CMB_REPORTTO', $objHTMLPersonnel->GetCombo($GLOBALS['DCLID'], 'reportto'));
         $t->assign('CMB_TICKETSTO', $objHTMLPersonnel->GetCombo($GLOBALS['DCLID'], 'ticketsto'));
         $t->assign('CMB_WOATTRIBUTESET', $objHA->GetCombo(0, 'wosetid'));
         $t->assign('CMB_TCKATTRIBUTESET', $objHA->GetCombo(0, 'tcksetid'));
     }
     SmartyDisplay($t, 'htmlProductsForm.tpl');
 }
コード例 #4
0
 function Show($oView = '')
 {
     global $dcl_info, $g_oSec, $g_oSession;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_SEARCH)) {
         return PrintPermissionDenied();
     }
     $bView = is_object($oView);
     $aProtectedFields = array('notes', 'dcl_hotlist.hotlist_tag', 'is_public', 'timecards.actionby', 'timecards.summary');
     $objJS = CreateObject('dcl.jsAttributesets');
     $objJS->bModules = true;
     $objJS->bStatusTypes = true;
     $objJS->bDepartments = !$g_oSec->IsPublicUser();
     $objJS->DisplayAttributeScript();
     $objPersonnel = CreateObject('dcl.htmlPersonnel');
     $objDepartment = CreateObject('dcl.htmlDepartments');
     $objProducts = CreateObject('dcl.htmlProducts');
     $objPriorities = CreateObject('dcl.htmlPriorities');
     $objSeverities = CreateObject('dcl.htmlSeverities');
     $objStatuses = CreateObject('dcl.htmlStatuses');
     $objProjects = CreateObject('dcl.htmlProjects');
     $objModules = CreateObject('dcl.htmlProductModules');
     $objType = CreateObject('dcl.htmlWorkOrderType');
     $oDBP = CreateObject('dcl.dbPersonnel');
     $oDBP->Load($GLOBALS['DCLID']);
     $t =& CreateSmarty();
     if ($bView) {
         $t->assign('VAL_REPORTTITLE', $oView->title);
     } else {
         $t->assign('VAL_REPORTTITLE', '');
     }
     $t->assign('VAL_DEPARTMENT', $oDBP->department);
     $t->assign('VAL_ID', $GLOBALS['DCLID']);
     $aDefault = array();
     $aDefault['product'] = array();
     $aDefault['priority'] = array();
     $aDefault['severity'] = array();
     $aDefault['dcl_wo_account.account_id'] = array();
     $aDefault['status'] = array();
     $aDefault['project'] = array();
     $aDefault['wo_type_id'] = array();
     $aDefault['statuses.dcl_status_type'] = array();
     $aDefault['department'] = array();
     $aDefault['personnel'] = array();
     $aDefault['is_public'] = array();
     $aDefault['entity_source_id'] = array();
     $aDefault['module_id'] = array();
     $sPersonnelKey = '';
     $sStatusKey = '';
     $sModuleKey = '';
     if ($bView) {
         foreach ($oView->filter as $field => $values) {
             if (substr($field, 1) == '.department') {
                 if ($field[0] == 'a') {
                     $t->assign('CHK_RESPONSIBLE', ' checked');
                 } else {
                     if ($field[0] == 'b') {
                         $t->assign('CHK_CREATEBY', ' checked');
                     } else {
                         if ($field[0] == 'c') {
                             $t->assign('CHK_CLOSEDBY', ' checked');
                         }
                     }
                 }
                 $field = 'department';
                 $sPersonnelKey = '';
             } else {
                 if ($field == 'responsible' || $field == 'createby' || $field == 'closedby') {
                     $t->assign('CHK_' . strtoupper($field), ' checked');
                     $field = 'personnel';
                     $sPersonnelKey = '';
                 } else {
                     if ($field == 'account') {
                         $field = 'dcl_wo_account.account_id';
                     } else {
                         if ($field == 'dcl_projects.projectid') {
                             $field = 'project';
                         }
                     }
                 }
             }
             if (array_key_exists($field, $aDefault)) {
                 $aDefault[$field] = $values;
             }
         }
         if (isset($aDefault['personnel']) && is_array($aDefault['personnel']) && count($aDefault['personnel']) > 0) {
             $sPersonnel = implode(',', $aDefault['personnel']);
             $oDBP->Query("select department, id from personnel where id in ({$sPersonnel})");
             while ($oDBP->next_record()) {
                 if (!in_array($oDBP->f(0), $aDefault['department'])) {
                     $aDefault['department'][] = $oDBP->f(0);
                 }
                 if ($sPersonnelKey != '') {
                     $sPersonnelKey .= ':';
                 }
                 $sPersonnelKey .= sprintf('%d,%d', $oDBP->f(0), $oDBP->f(1));
             }
         }
         if (isset($aDefault['status']) && is_array($aDefault['status']) && count($aDefault['status']) > 0) {
             $sStatus = implode(',', $aDefault['status']);
             $oDBP->Query("select dcl_status_type, id from statuses where id in ({$sStatus})");
             while ($oDBP->next_record()) {
                 if (!in_array($oDBP->f(0), $aDefault['statuses.dcl_status_type'])) {
                     $aDefault['statuses.dcl_status_type'][] = $oDBP->f(0);
                 }
                 if ($sStatusKey != '') {
                     $sStatusKey .= ':';
                 }
                 $sStatusKey .= sprintf('%d,%d', $oDBP->f(0), $oDBP->f(1));
             }
         }
         if (isset($aDefault['module_id']) && is_array($aDefault['module_id']) && count($aDefault['module_id']) > 0) {
             $sModule = implode(',', $aDefault['module_id']);
             $oDBP->Query("select product_id, product_module_id from dcl_product_module where product_module_id in ({$sModule})");
             while ($oDBP->next_record()) {
                 if (!in_array($oDBP->f(0), $aDefault['product'])) {
                     $aDefault['product'][] = $oDBP->f(0);
                 }
                 if ($sModuleKey != '') {
                     $sModuleKey .= ':';
                 }
                 $sModuleKey .= sprintf('%d,%d', $oDBP->f(0), $oDBP->f(1));
             }
         }
     } else {
         $aDefault['product'] = 0;
         $aDefault['priority'] = 0;
         $aDefault['severity'] = 0;
         $aDefault['dcl_wo_account.account_id'] = 0;
         $aDefault['status'] = 0;
         $aDefault['project'] = 0;
         $aDefault['wo_type_id'] = 0;
         $aDefault['entity_source_id'] = 0;
         $aDefault['is_public'] = 0;
         $aDefault['statuses.dcl_status_type'] = 1;
         $aDefault['department'] = array($oDBP->department);
         $aDefault['personnel'] = $GLOBALS['DCLID'];
         $sPersonnelKey = sprintf('%d,%d', $oDBP->department, $GLOBALS['DCLID']);
         $sStatusKey = '';
         $sModuleKey = '';
         if ($GLOBALS['g_oSec']->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ACTION)) {
             $t->assign('CHK_RESPONSIBLE', ' checked');
             $t->assign('CHK_CREATEBY', '');
             $t->assign('CHK_CLOSEDBY', '');
         } else {
             $t->assign('CHK_CREATEBY', ' checked');
             $t->assign('CHK_RESPONSIBLE', '');
             $t->assign('CHK_CLOSEDBY', '');
         }
     }
     $t->assign('VAL_DEPARTMENTS', $aDefault['department']);
     $t->assign('VAL_PERSONNEL', $aDefault['personnel']);
     $t->assign('VAL_WO_TYPE', $aDefault['wo_type_id']);
     $t->assign('VAL_PRODUCT', $aDefault['product']);
     $t->assign('VAL_MODULE', $aDefault['module_id']);
     $t->assign('VAL_PRIORITY', $aDefault['priority']);
     $t->assign('VAL_SEVERITY', $aDefault['severity']);
     $t->assign('VAL_SELECTPERSONNELKEY', $sPersonnelKey);
     $t->assign('VAL_SELECTSTATUSKEY', $sStatusKey);
     $t->assign('VAL_SELECTMODULEKEY', $sModuleKey);
     $t->assign('CMB_STATUSES', $objStatuses->GetCombo($aDefault['status'], 'status', 'name', 8));
     $t->assign('IS_PUBLIC', $g_oSec->IsPublicUser());
     if (!$g_oSec->IsPublicUser()) {
         $t->assign('CMB_PROJECTS', $objProjects->GetCombo($aDefault['project'], 'project', 'name', 8));
         $t->assign('CMB_PUBLIC', GetYesNoCombo($aDefault['is_public'], 'is_public', 2, false));
     }
     $oSelect =& CreateObject('dcl.htmlSelect');
     if ($g_oSec->IsOrgUser()) {
         $oSelect->SetOptionsFromDb('dcl_org', 'org_id', 'name', 'org_id IN (' . $g_oSession->Value('member_of_orgs') . ')', 'name');
     } else {
         $oSelect->SetOptionsFromDb('dcl_org', 'org_id', 'name', '', 'name');
     }
     $oSelect->iSize = 8;
     $oSelect->vDefault = $aDefault['dcl_wo_account.account_id'];
     $oSelect->sName = 'account';
     $t->assign('CMB_ACCOUNTS', $oSelect->GetHTML());
     $oSource = CreateObject('dcl.htmlEntitySource');
     $t->assign('CMB_SOURCE', $oSource->GetCombo($aDefault['entity_source_id'], 'entity_source_id', 8, false));
     // Empty status is for selecting status type, then filtering status if desired
     $oSelect->sName = 'status';
     $oSelect->iSize = 8;
     $t->assign('CMB_STATUSESEMPTY', $oSelect->GetHTML());
     // Status Types
     $oSelect->sName = 'dcl_status_type';
     $oSelect->iSize = 8;
     $oSelect->vDefault = $aDefault['statuses.dcl_status_type'];
     $oSelect->SetOptionsFromDb('dcl_status_type', 'dcl_status_type_id', 'dcl_status_type_name', '', 'dcl_status_type_id');
     $t->assign('CMB_STATUSTYPES', $oSelect->GetHTML());
     $t->assign('CHK_SUMMARY', '');
     $t->assign('CHK_NOTES', '');
     $t->assign('CHK_DESCRIPTION', '');
     $t->assign('VAL_SEARCHTEXT', '');
     if ($bView && count($oView->filterlike) > 0) {
         $searchText = '';
         foreach ($oView->filterlike as $field => $values) {
             if ($field == 'summary' || $field == 'notes' || $field == 'description') {
                 $t->assign('CHK_' . strtoupper($field), ' CHECKED');
                 $searchText = $values[0];
             }
         }
         $t->assign('VAL_SEARCHTEXT', $searchText);
     }
     if (isset($oView->filter['dcl_tag.tag_desc']) && is_array($oView->filter['dcl_tag.tag_desc']) && count($oView->filter['dcl_tag.tag_desc']) > 0) {
         $t->assign('VAL_TAGS', join(',', $oView->filter['dcl_tag.tag_desc']));
     }
     if (isset($oView->filter['dcl_hotlist.hotlist_tag']) && is_array($oView->filter['dcl_hotlist.hotlist_tag']) && count($oView->filter['dcl_hotlist.hotlist_tag']) > 0) {
         $t->assign('VAL_HOTLISTS', join(',', $oView->filter['dcl_hotlist.hotlist_tag']));
     }
     $aDateChecks = array('createdon', 'closedon', 'statuson', 'lastactionon', 'deadlineon', 'eststarton', 'estendon', 'starton');
     for ($i = 0; $i < count($aDateChecks); $i++) {
         $t->assign('CHK_' . strtoupper($aDateChecks[$i]), '');
     }
     if ($bView) {
         $t->assign('VAL_DATEFROM', '');
         $t->assign('VAL_DATETO', '');
         if (count($oView->filterdate) > 0) {
             $fromDate = '';
             $toDate = '';
             foreach ($oView->filterdate as $field => $values) {
                 $t->assign('CHK_' . strtoupper($field), ' CHECKED');
                 $fromDate = $values[0];
                 $toDate = $values[1];
             }
             $t->assign('VAL_DATEFROM', $fromDate);
             $t->assign('VAL_DATETO', $toDate);
         }
     } else {
         $aFewDaysAgo = mktime(0, 0, 0, date('m'), date('d') - 3, date('Y'));
         $t->assign('VAL_DATEFROM', date($dcl_info['DCL_DATE_FORMAT'], $aFewDaysAgo));
         $t->assign('VAL_DATETO', date($dcl_info['DCL_DATE_FORMAT']));
     }
     $aCols = array('jcn' => STR_WO_JCN, 'seq' => STR_WO_SEQ, 'dcl_wo_type.type_name' => STR_WO_TYPE, 'responsible.short' => STR_WO_RESPONSIBLE, 'products.name' => STR_WO_PRODUCT, 'statuses.name' => STR_WO_STATUS, 'summary' => STR_WO_SUMMARY, 'dcl_product_module.module_name' => STR_CMMN_MODULE, 'dcl_projects.name' => STR_WO_PROJECT, 'dcl_org.name' => STR_WO_ACCOUNT, 'count(*):dcl_org' => '# ' . STR_WO_ACCOUNT, 'dcl_tag.tag_desc' => STR_CMMN_TAGS, 'dcl_hotlist.hotlist_tag' => 'Hotlists', 'createby.short' => STR_WO_OPENBY, 'createdon' => STR_WO_OPENEDON, 'closedby.short' => STR_WO_CLOSEBY, 'closedon' => STR_WO_CLOSEDON, 'statuson' => STR_WO_STATUSON, 'lastactionon' => STR_WO_LASTACTION, 'deadlineon' => STR_WO_DEADLINE, 'eststarton' => STR_WO_ESTSTART, 'estendon' => STR_WO_ESTEND, 'starton' => STR_WO_START, 'esthours' => STR_WO_ESTHOURS, 'etchours' => STR_WO_ETCHOURS, 'totalhours' => STR_WO_ACTHOURS, 'priorities.name' => STR_WO_PRIORITY, 'severities.name' => STR_WO_SEVERITY, 'reported_version_id.product_version_text' => STR_WO_REVISION, 'targeted_version_id.product_version_text' => 'Target Version', 'fixed_version_id.product_version_text' => 'Fixed Version', 'dcl_contact.last_name' => 'Contact Last Name', 'dcl_contact.first_name' => 'Contact First Name', 'dcl_contact_phone.phone_number' => STR_WO_CONTACTPHONE, 'notes' => STR_WO_NOTES, 'description' => STR_WO_DESCRIPTION, 'dcl_status_type.dcl_status_type_name' => STR_CMMN_STATUSTYPE, 'dcl_entity_source.entity_source_name' => STR_CMMN_SOURCE, 'is_public' => STR_CMMN_PUBLIC, 'actionby.short' => 'Last Time Card By', 'timecards.summary' => 'Last Time Card Summary');
     if ($g_oSec->IsPublicUser()) {
         foreach ($aProtectedFields as $sField) {
             unset($aCols[$sField]);
         }
     }
     if ($bView) {
         $aShow = array();
         $aGroup = array();
         foreach ($oView->columns as $colName) {
             if ($colName == 'a.short') {
                 $colName = 'responsible.short';
             } else {
                 if ($colName == 'b.short') {
                     $colName = 'closedby.short';
                 } else {
                     if ($colName == 'c.short') {
                         $colName = 'createby.short';
                     } else {
                         if ($colName == 'g.short') {
                             $colName = 'actionby.short';
                         }
                     }
                 }
             }
             $aShow[$colName] = $aCols[$colName];
         }
         foreach ($oView->groups as $colName) {
             if ($colName == 'a.short') {
                 $colName = 'responsible.short';
             } else {
                 if ($colName == 'b.short') {
                     $colName = 'closedby.short';
                 } else {
                     if ($colName == 'c.short') {
                         $colName = 'createby.short';
                     } else {
                         if ($colName == 'g.short') {
                             $colName = 'actionby.short';
                         }
                     }
                 }
             }
             $aGroup[$colName] = $aCols[$colName];
         }
         if ($g_oSec->IsPublicUser()) {
             foreach ($aProtectedFields as $sField) {
                 if (isset($aShow[$sField])) {
                     unset($aShow[$sField]);
                 }
                 if (isset($aGroup[$sField])) {
                     unset($aGroup[$sField]);
                 }
             }
         }
     } else {
         $aShow = array('jcn' => STR_WO_JCN, 'seq' => STR_WO_SEQ, 'dcl_wo_type.type_name' => STR_WO_TYPE, 'responsible.short' => STR_WO_RESPONSIBLE, 'products.name' => STR_WO_PRODUCT, 'statuses.name' => STR_WO_STATUS, 'summary' => STR_WO_SUMMARY);
         $aGroup = array();
     }
     array_remove_keys($aCols, $aShow);
     array_remove_keys($aCols, $aGroup);
     $t->assign('VAL_COLS', $aCols);
     $t->assign('VAL_SHOW', $aShow);
     $t->assign('VAL_GROUP', $aGroup);
     if ($bView) {
         $aOrder = array();
         foreach ($oView->order as $val) {
             if ($val == 'priorities.weight') {
                 $sText = isset($aShow['priorities.name']) ? $aShow['priorities.name'] : $aCols['priorities.name'];
             } else {
                 if ($val == 'severities.weight') {
                     $sText = isset($aShow['severities.name']) ? $aShow['severities.name'] : $aCols['severities.name'];
                 } else {
                     if (isset($aShow[$val])) {
                         $sText = $aShow[$val];
                     } else {
                         if (isset($aCols[$val])) {
                             $sText = $aCols[$val];
                         }
                     }
                 }
             }
             array_push($aOrder, array($val => $sText));
         }
         $t->assign('VAL_SORT');
     }
     SmartyDisplay($t, 'htmlWorkOrderSearch.tpl');
 }
コード例 #5
0
 function ShowEntryForm($obj = '')
 {
     global $dcl_info, $g_oSec;
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDERTYPE, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $t = CreateSmarty();
     $t->assign('IS_EDIT', $isEdit);
     if ($isEdit) {
         if (($wo_type_id = DCL_Sanitize::ToInt($_REQUEST['wo_type_id'])) === null) {
             trigger_error('Data sanitize failed.');
             return;
         }
         $t->assign('VAL_WO_TYPE_ID', $wo_type_id);
     }
     $t->assign('URL_BACK', menuLink('', 'menuAction=htmlWorkOrderType.ShowAll'));
     // Data
     if ($isEdit) {
         $t->assign('CMB_ACTIVE', GetYesNoCombo($obj->active, 'active', 0, false));
         $t->assign('VAL_NAME', $obj->type_name);
     } else {
         $t->assign('CMB_ACTIVE', GetYesNoCombo('Y', 'active', 0, false));
         $t->assign('VAL_NAME', '');
     }
     SmartyDisplay($t, 'htmlWorkOrderTypeForm.tpl');
 }
コード例 #6
0
 function Show($oView = '')
 {
     global $dcl_info, $g_oSec, $g_oSession;
     commonHeader();
     $bView = is_object($oView);
     $objJS =& CreateObject('dcl.jsAttributesets');
     $objJS->bModules = true;
     $objJS->bStatusTypes = true;
     $objJS->bDepartments = !$g_oSec->IsPublicUser();
     $objJS->DisplayAttributeScript();
     $oSelect =& CreateObject('dcl.htmlSelect');
     $objPersonnel =& CreateObject('dcl.htmlPersonnel');
     $objProducts =& CreateObject('dcl.htmlProducts');
     $objPriorities =& CreateObject('dcl.htmlPriorities');
     $objSeverities =& CreateObject('dcl.htmlSeverities');
     $objStatuses =& CreateObject('dcl.htmlStatuses');
     $objDepartment =& CreateObject('dcl.htmlDepartments');
     $objModules =& CreateObject('dcl.htmlProductModules');
     $oDBP =& CreateObject('dcl.dbPersonnel');
     $oDBP->Load($GLOBALS['DCLID']);
     $t =& CreateSmarty();
     if ($bView) {
         $t->assign('VAL_REPORTTITLE', $oView->title);
     } else {
         $t->assign('VAL_REPORTTITLE', '');
     }
     $t->assign('VAL_DEPARTMENT', $oDBP->department);
     $t->assign('VAL_ID', $GLOBALS['DCLID']);
     $aDefault = array();
     $aDefault['product'] = array();
     $aDefault['module_id'] = array();
     $aDefault['priority'] = array();
     $aDefault['type'] = array();
     $aDefault['account'] = array();
     $aDefault['status'] = array();
     $aDefault['statuses.dcl_status_type'] = array();
     $aDefault['department'] = array();
     $aDefault['personnel'] = array();
     $aDefault['entity_source_id'] = array();
     $aDefault['is_public'] = array();
     $sPersonnelKey = '';
     $sStatusKey = '';
     $sModuleKey = '';
     if ($bView) {
         reset($oView->filter);
         while (list($field, $values) = each($oView->filter)) {
             if (substr($field, 1) == '.department') {
                 if ($field[0] == 'a') {
                     $t->assign('CHK_RESPONSIBLE', ' checked');
                 } else {
                     if ($field[0] == 'b') {
                         $t->assign('CHK_CREATEDBY', ' checked');
                     } else {
                         if ($field[0] == 'c') {
                             $t->assign('CHK_CLOSEDBY', ' checked');
                         }
                     }
                 }
                 $field = 'department';
                 $sPersonnelKey = '';
             } else {
                 if ($field == 'responsible' || $field == 'createdby' || $field == 'closedby') {
                     $t->assign('CHK_' . strtoupper($field), ' checked');
                     $field = 'personnel';
                     $sPersonnelKey = '';
                 }
             }
             if (array_key_exists($field, $aDefault)) {
                 $aDefault[$field] = $values;
             }
         }
         if (is_array($aDefault['personnel']) && count($aDefault['personnel']) > 0) {
             $sPersonnel = implode(',', $aDefault['personnel']);
             $oDBP->Query("select department, id from personnel where id in ({$sPersonnel})");
             while ($oDBP->next_record()) {
                 if (!in_array($oDBP->f(0), $aDefault['department'])) {
                     $aDefault['department'][] = $oDBP->f(0);
                 }
                 if ($sPersonnelKey != '') {
                     $sPersonnelKey .= ':';
                 }
                 $sPersonnelKey .= sprintf('%d,%d', $oDBP->f(0), $oDBP->f(1));
             }
         }
         if (is_array($aDefault['status']) && count($aDefault['status']) > 0) {
             $sStatus = implode(',', $aDefault['status']);
             $oDBP->Query("select dcl_status_type, id from statuses where id in ({$sStatus})");
             while ($oDBP->next_record()) {
                 if (!in_array($oDBP->f(0), $aDefault['statuses.dcl_status_type'])) {
                     $aDefault['statuses.dcl_status_type'][] = $oDBP->f(0);
                 }
                 if ($sStatusKey != '') {
                     $sStatusKey .= ':';
                 }
                 $sStatusKey .= sprintf('%d,%d', $oDBP->f(0), $oDBP->f(1));
             }
         }
         if (is_array($aDefault['module_id']) && count($aDefault['module_id']) > 0) {
             $sModule = implode(',', $aDefault['module_id']);
             $oDBP->Query("select product_id, product_module_id from dcl_product_module where product_module_id in ({$sModule})");
             while ($oDBP->next_record()) {
                 if (!in_array($oDBP->f(0), $aDefault['product'])) {
                     $aDefault['product'][] = $oDBP->f(0);
                 }
                 if ($sModuleKey != '') {
                     $sModuleKey .= ':';
                 }
                 $sModuleKey .= sprintf('%d,%d', $oDBP->f(0), $oDBP->f(1));
             }
         }
     } else {
         $aDefault['product'] = 0;
         $aDefault['priority'] = 0;
         $aDefault['type'] = 0;
         $aDefault['account'] = 0;
         $aDefault['status'] = 0;
         $aDefault['project'] = 0;
         $aDefault['entity_source_id'] = 0;
         $aDefault['statuses.dcl_status_type'] = 1;
         $aDefault['department'] = array($oDBP->department);
         $aDefault['personnel'] = $GLOBALS['DCLID'];
         $aDefault['is_public'] = '';
         $sPersonnelKey = sprintf('%d,%d', $oDBP->department, $GLOBALS['DCLID']);
         $sStatusKey = '';
         $sModuleKey = '';
         if ($g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_ACTION)) {
             $t->assign('CHK_RESPONSIBLE', ' checked');
             $t->assign('CHK_CREATEBY', '');
             $t->assign('CHK_CLOSEDBY', '');
         } else {
             $t->assign('CHK_CREATEBY', ' checked');
             $t->assign('CHK_RESPONSIBLE', '');
             $t->assign('CHK_CLOSEDBY', '');
         }
     }
     $t->assign('VAL_DEPARTMENTS', $aDefault['department']);
     $t->assign('VAL_PERSONNEL', $aDefault['personnel']);
     $t->assign('VAL_PRODUCT', $aDefault['product']);
     $t->assign('VAL_MODULE', $aDefault['module_id']);
     $t->assign('VAL_PRIORITY', $aDefault['priority']);
     $t->assign('VAL_TYPE', $aDefault['type']);
     $t->assign('VAL_SELECTPERSONNELKEY', $sPersonnelKey);
     $t->assign('VAL_SELECTSTATUSKEY', $sStatusKey);
     $t->assign('VAL_SELECTMODULEKEY', $sModuleKey);
     $t->assign('CMB_STATUS', $objStatuses->GetCombo($aDefault['status'], 'status', 'name', 8));
     $t->assign('IS_PUBLIC', $g_oSec->IsPublicUser());
     if (!$g_oSec->IsPublicUser()) {
         $t->assign('CMB_PUBLIC', GetYesNoCombo($aDefault['is_public'], 'is_public', 3));
     }
     if ($g_oSec->IsOrgUser()) {
         $oSelect->SetOptionsFromDb('dcl_org', 'org_id', 'name', 'org_id IN (' . $g_oSession->Value('member_of_orgs') . ')', 'name');
     } else {
         $oSelect->SetOptionsFromDb('dcl_org', 'org_id', 'name', '', 'name');
     }
     $oSelect->iSize = 8;
     $oSelect->vDefault = $aDefault['account'];
     $oSelect->sName = 'account';
     $t->assign('CMB_ACCOUNTS', $oSelect->GetHTML());
     $oSource = CreateObject('dcl.htmlEntitySource');
     $t->assign('CMB_SOURCE', $oSource->GetCombo($aDefault['entity_source_id'], 'entity_source_id', 8, false));
     // Modules only show for selected products
     $oSelect->aOptions = array();
     $oSelect->sName = 'module_id';
     $oSelect->iSize = 8;
     $t->assign('CMB_MODULES', $oSelect->GetHTML());
     // Empty status is for selecting status type, then filtering status if desired
     $oSelect->sName = 'status';
     $oSelect->iSize = 8;
     $t->assign('CMB_STATUSESEMPTY', $oSelect->GetHTML());
     // Status Types
     $oSelect->sName = 'dcl_status_type';
     $oSelect->iSize = 8;
     $oSelect->vDefault = $aDefault['statuses.dcl_status_type'];
     $oSelect->SetOptionsFromDb('dcl_status_type', 'dcl_status_type_id', 'dcl_status_type_name', '', 'dcl_status_type_id');
     $t->assign('CMB_STATUSTYPES', $oSelect->GetHTML());
     if ($g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_ACTION)) {
         $t->assign('CHK_SECLVLWO', ' CHECKED');
         $t->assign('CHK_NOSECLVLWO', '');
     } else {
         $t->assign('CHK_SECLVLWO', '');
         $t->assign('CHK_NOSECLVLWO', ' CHECKED');
     }
     $t->assign('VAL_SEARCHTEXT', '');
     if ($bView && count($oView->filterlike) > 0) {
         $searchText = '';
         foreach ($oView->filterlike as $field => $values) {
             $searchText = $values[0];
         }
         $t->assign('VAL_SEARCHTEXT', $searchText);
     }
     if (isset($oView->filter['dcl_tag.tag_desc']) && is_array($oView->filter['dcl_tag.tag_desc']) && count($oView->filter['dcl_tag.tag_desc']) > 0) {
         $t->assign('VAL_TAGS', join(',', $oView->filter['dcl_tag.tag_desc']));
     }
     $aDateChecks = array('createdon', 'closedon', 'statuson', 'lastactionon');
     for ($i = 0; $i < count($aDateChecks); $i++) {
         $t->assign('CHK_' . strtoupper($aDateChecks[$i]), '');
     }
     if ($bView) {
         $t->assign('VAL_DATEFROM', '');
         $t->assign('VAL_DATETO', '');
         if (count($oView->filterdate) > 0) {
             $fromDate = '';
             $toDate = '';
             reset($oView->filterdate);
             while (list($field, $values) = each($oView->filterdate)) {
                 $t->assign('CHK_' . strtoupper($field), ' CHECKED');
                 $fromDate = $values[0];
                 $toDate = $values[1];
             }
             $t->assign('VAL_DATEFROM', $fromDate);
             $t->assign('VAL_DATETO', $toDate);
         }
     } else {
         $aFewDaysAgo = mktime(0, 0, 0, date('m'), date('d') - 3, date('Y'));
         $t->assign('VAL_DATEFROM', date($dcl_info['DCL_DATE_FORMAT'], $aFewDaysAgo));
         $t->assign('VAL_DATETO', date($dcl_info['DCL_DATE_FORMAT']));
     }
     $aCols = array('ticketid' => STR_TCK_TICKET . '#', 'responsible.short' => STR_TCK_RESPONSIBLE, 'products.name' => STR_TCK_PRODUCT, 'dcl_org.name' => STR_TCK_ACCOUNT, 'statuses.name' => STR_TCK_STATUS, 'summary' => STR_TCK_SUMMARY, 'dcl_product_module.module_name' => STR_CMMN_MODULE, 'dcl_tag.tag_desc' => STR_CMMN_TAGS, 'version' => STR_TCK_VERSION, 'createdby.short' => STR_TCK_OPENEDBY, 'createdon' => STR_TCK_OPENEDON, 'closedby.short' => STR_TCK_CLOSEDBY, 'closedon' => STR_TCK_CLOSEDON, 'statuson' => STR_TCK_STATUSON, 'lastactionon' => STR_TCK_LASTACTIONON, 'priorities.name' => STR_TCK_PRIORITY, 'severities.name' => STR_TCK_TYPE, 'dcl_contact.last_name' => 'Contact Last Name', 'dcl_contact.first_name' => 'Contact First Name', 'dcl_contact_phone.phone_number' => STR_TCK_CONTACTPHONE, 'dcl_contact_email.email_addr' => STR_TCK_CONTACTEMAIL, 'issue' => STR_TCK_ISSUE, 'seconds' => STR_TCK_APPROXTIME, 'dcl_status_type.dcl_status_type_name' => STR_CMMN_STATUSTYPE, 'dcl_entity_source.entity_source_name' => 'Source', 'is_public' => 'Public');
     if ($bView) {
         $aShow = array();
         $aGroup = array();
         foreach ($oView->columns as $colName) {
             if ($colName == 'a.short') {
                 $colName = 'responsible.short';
             } else {
                 if ($colName == 'b.short') {
                     $colName = 'closedby.short';
                 } else {
                     if ($colName == 'c.short') {
                         $colName = 'createdby.short';
                     }
                 }
             }
             $aShow[$colName] = $aCols[$colName];
         }
         foreach ($oView->groups as $colName) {
             if ($colName == 'a.short') {
                 $colName = 'responsible.short';
             } else {
                 if ($colName == 'b.short') {
                     $colName = 'closedby.short';
                 } else {
                     if ($colName == 'c.short') {
                         $colName = 'createdby.short';
                     }
                 }
             }
             $aGroup[$colName] = $aCols[$colName];
         }
     } else {
         $aShow = array('ticketid' => STR_TCK_TICKET . '#', 'responsible.short' => STR_TCK_RESPONSIBLE, 'products.name' => STR_TCK_PRODUCT, 'dcl_org.name' => STR_TCK_ACCOUNT, 'statuses.name' => STR_TCK_STATUS, 'summary' => STR_TCK_SUMMARY);
         $aGroup = array();
     }
     array_remove_keys($aCols, $aShow);
     array_remove_keys($aCols, $aGroup);
     $t->assign('VAL_COLS', $aCols);
     $t->assign('VAL_SHOW', $aShow);
     $t->assign('VAL_GROUP', $aGroup);
     if ($bView) {
         $aOrder = array();
         foreach ($oView->order as $val) {
             if ($val == 'priorities.weight') {
                 $sText = $aShow['priorities.name'];
             } else {
                 if ($val == 'severities.weight') {
                     $sText = $aShow['severities.name'];
                 } else {
                     $sText = $aShow[$val];
                 }
             }
             array_push($aOrder, array($val => $sText));
         }
         $t->assign('VAL_SORT');
     }
     SmartyDisplay($t, 'htmlTicketSearch.tpl');
 }
コード例 #7
0
 function ShowEntryForm($obj = '')
 {
     global $dcl_info, $g_oSec;
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_STATUS, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $t = CreateSmarty();
     $oSelect = CreateObject('dcl.htmlSelect');
     $oSelect->SetOptionsFromDb('dcl_status_type', 'dcl_status_type_id', 'dcl_status_type_name', '', $order = 'dcl_status_type_id');
     $oSelect->vDefault = 0;
     $oSelect->sName = 'dcl_status_type';
     $oSelect->sZeroOption = STR_CMMN_SELECTONE;
     if ($isEdit) {
         $t->assign('TXT_FUNCTION', STR_STAT_EDIT);
         $t->assign('menuAction', 'boStatuses.dbmodify');
         $t->assign('id', $obj->id);
         $t->assign('CMB_ACTIVE', GetYesNoCombo($obj->active, 'active', 0, false));
         $t->assign('VAL_SHORT', $obj->short);
         $t->assign('VAL_NAME', $obj->name);
         $oSelect->vDefault = $obj->dcl_status_type;
     } else {
         $t->assign('TXT_FUNCTION', STR_STAT_ADD);
         $t->assign('menuAction', 'boStatuses.dbadd');
         $t->assign('CMB_ACTIVE', GetYesNoCombo('Y', 'active', 0, false));
     }
     $t->assign('CMB_TYPE', $oSelect->GetHtml());
     SmartyDisplay($t, 'htmlStatusesForm.tpl');
 }
コード例 #8
0
 function ShowEntryForm()
 {
     global $dcl_info, $g_oSec;
     if (!$g_oSec->HasPerm(DCL_ENTITY_SAVEDSEARCH, DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $Template = CreateTemplate(array('hForm' => 'htmlViewForm.tpl'));
     $Template->set_var('TXT_TITLE', STR_VW_ADDVIEW);
     $Template->set_var('TXT_PUBLIC', STR_VW_PUBLIC);
     $Template->set_var('TXT_NAME', STR_VW_NAME);
     $Template->set_var('BTN_SAVE', STR_CMMN_SAVE);
     $Template->set_var('BTN_RESET', STR_CMMN_RESET);
     $Template->set_var('TXT_HIGHLIGHTEDNOTE', STR_CMMN_HIGHLIGHTEDNOTE);
     $Template->set_var('VAL_FORMACTION', menuLink());
     $Template->set_var('BTN_CANCEL', STR_CMMN_CANCEL);
     $Template->set_var('VAL_DCLID', $GLOBALS['DCLID']);
     $Template->set_var('VAL_TABLENAME', $_REQUEST['vt']);
     // Add the URL pieces
     $viewUrl = '';
     $objView = CreateObject("dcl.boView");
     $o = CreateObject('dcl.dbPersonnel');
     while (list($key, $val) = each($objView->urlpieces)) {
         if (isset($_REQUEST[$val])) {
             $viewUrl .= sprintf('<input type="hidden" name="%s" value="%s">', $val, htmlspecialchars($o->GPCStripSlashes($_REQUEST[$val])));
         }
     }
     $Template->set_var('VAL_VIEWURL', $viewUrl);
     $Template->set_var('CMB_ISPUBLIC', GetYesNoCombo("N", "ispublic", 0, false));
     $Template->pparse('out', 'hForm');
 }
コード例 #9
0
 function ShowEntryForm($obj = '')
 {
     global $dcl_info, $g_oSec;
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_ATTRIBUTESETS, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     $t = CreateSmarty();
     if ($isEdit) {
         $t->assign('TXT_FUNCTION', STR_ATTR_EDITATTRIBUTESET);
         $t->assign('menuAction', 'boAttributesets.dbmodify');
         $t->assign('id', $obj->id);
         $t->assign('CMB_ACTIVE', GetYesNoCombo($obj->active, 'active', 0, false));
         $t->assign('VAL_SHORT', $obj->short);
         $t->assign('VAL_NAME', $obj->name);
     } else {
         $t->assign('TXT_FUNCTION', STR_ATTR_ADDATTRIBUTESET);
         $t->assign('menuAction', 'boAttributesets.dbadd');
         $t->assign('CMB_ACTIVE', GetYesNoCombo('Y', 'active', 0, false));
     }
     SmartyDisplay($t, 'htmlAttributesetsForm.tpl');
 }
コード例 #10
0
 function ShowEntryForm($obj = '')
 {
     global $dcl_info, $g_oSec;
     commonHeader();
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_SOURCE, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     if ($isEdit && ($id = DCL_Sanitize::ToInt($_REQUEST['entity_source_id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     $t = CreateSmarty();
     if ($isEdit) {
         $t->assign('TXT_FUNCTION', 'Edit Entity Source');
         $t->assign('menuAction', 'htmlEntitySource.submitModify');
         $t->assign('entity_source_id', $id);
         $t->assign('CMB_ACTIVE', GetYesNoCombo($obj->active, 'active', 0, false));
         $t->assign('VAL_NAME', $obj->entity_source_name);
     } else {
         $t->assign('TXT_FUNCTION', 'Add Entity Source');
         $t->assign('menuAction', 'htmlEntitySource.submitAdd');
         $t->assign('CMB_ACTIVE', GetYesNoCombo('Y', 'active', 0, false));
     }
     SmartyDisplay($t, 'htmlEntitySourceForm.tpl');
 }
コード例 #11
0
 function ShowEntryForm($obj = '')
 {
     global $dcl_info, $g_oSec;
     $isEdit = is_object($obj);
     if (!$g_oSec->HasPerm(DCL_ENTITY_PRODUCTMODULE, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD)) {
         return PrintPermissionDenied();
     }
     if ($isEdit) {
         if (($product_module_id = DCL_Sanitize::ToInt($_REQUEST['product_module_id'])) === null) {
             trigger_error('Data sanitize failed.');
             return;
         }
     } else {
         if (($product_id = DCL_Sanitize::ToInt($_REQUEST['product_id'])) === null) {
             trigger_error('Data sanitize failed.');
             return;
         }
     }
     $oProduct = CreateObject('dcl.dbProducts');
     $iProductID = $isEdit ? $obj->product_id : $product_id;
     if ($oProduct->Load($iProductID) == -1) {
         printf('Could not load product by id %d', $product_id);
         return;
     }
     $t = CreateSmarty();
     $t->assign('product_id', $iProductID);
     if ($isEdit) {
         $t->assign('TXT_FUNCTION', 'Edit Module for Product ' . $oProduct->name);
         $t->assign('menuAction', 'htmlProductModules.submitModify');
         $t->assign('product_module_id', $product_module_id);
         $t->assign('CMB_ACTIVE', GetYesNoCombo($obj->active, 'active', 0, false));
         $t->assign('VAL_NAME', $obj->module_name);
     } else {
         $t->assign('TXT_FUNCTION', 'Add Module for Product ' . $oProduct->name);
         $t->assign('menuAction', 'htmlProductModules.submitAdd');
         $t->assign('CMB_ACTIVE', GetYesNoCombo('Y', 'active', 0, false));
     }
     SmartyDisplay($t, 'htmlProductModulesForm.tpl');
 }