function smarty_function_dcl_calendar_init($params, &$smarty) { if (!isset($params['format'])) { if (!function_exists('GetJSDateFormat')) { $smarty->trigger_error('dcl_calendar_init: format parameter missing and GetJSDateFormat not defined'); return; } $params['format'] = GetJSDateFormat(); } $calDateFormat = str_replace('mm', '%m', $params['format']); $calDateFormat = str_replace('dd', '%d', $calDateFormat); $calDateFormat = str_replace('y', '%Y', $calDateFormat); ?> <link rel="stylesheet" type="text/css" media="all" href="calendar/calendar-system.css" title="system" /> <script type="text/javascript" src="calendar/calendar.js"></script> <script type="text/javascript" src="calendar/lang/calendar-en.js"></script> <script language="JavaScript"> function _dateSelected(cal, date) { cal.sel.value = date; if (cal.dateClicked) cal.callCloseHandler(); } function _closeHandler(cal) { cal.hide(); } function showCalendar(id) { var el = document.getElementById(id); if (_dynarch_popupCalendar != null) { _dynarch_popupCalendar.hide(); } else { var cal = new Calendar(false, null, _dateSelected, _closeHandler); cal.weekNumbers = false; _dynarch_popupCalendar = cal; cal.setRange(1900, 2070); cal.create(); } _dynarch_popupCalendar.setDateFormat('<?php echo $calDateFormat; ?> '); _dynarch_popupCalendar.parseDate(el.value); _dynarch_popupCalendar.sel = el; _dynarch_popupCalendar.showAtElement(el); return false; } </script> <?php }
function smarty_function_dcl_validator_init($params, &$smarty) { ?> <script language="JavaScript"> var calDateFormat = String("<?php echo GetJSDateFormat(); ?> ").replace("y", "yyyy"); </script> <script language="JavaScript" src="js/validator.js"></script> <?php }
function Show() { global $dcl_info, $g_oSec; commonHeader(); if (!$g_oSec->HasPerm(DCL_ENTITY_BUILDMANAGER, DCL_PERM_MODIFY)) { return PrintPermissionDenied(); } if (($product_id = DCL_Sanitize::ToInt($_REQUEST['product_id'])) === null) { return PrintPermissionDenied(); } if (($version_id = DCL_Sanitize::ToInt($_REQUEST['product_version_id'])) === null) { return PrintPermissionDenied(); } $oProduct = CreateObject('dcl.dbProducts'); $oProduct->Load($product_id); $oPV = CreateObject('dcl.dbProductVersion'); if ($oPV->Load(array('product_version_id' => $version_id)) == -1) { ShowError('Failed to load version ID ' . $version_id, 'Error'); return; } $this->oSmarty->assign('VAL_JSDATEFORMAT', GetJSDateFormat()); $this->oSmarty->assign('VAL_FORMACTION', menuLink()); if (isset($GLOBALS['add'])) { $this->oSmarty->assign('VAL_MENUACTION', 'boBuildManager.addRelease'); } else { $this->oSmarty->assign('VAL_MENUACTION', 'boBuildManager.modifyRelease'); } $this->oSmarty->assign('TXT_BM_ADD_RELEASE', STR_BM_MOD_RELEASE); $this->oSmarty->assign('TXT_BM_PRODUCT', STR_BM_PRODUCT); $this->oSmarty->assign('TXT_BM_RELEASE_ALIAS_TITLE', STR_BM_RELEASE_ALIAS_TITLE); $this->oSmarty->assign('TXT_BM_RELEASEDATE_DESC', STR_BM_RELEASEDATE_DESC); $this->oSmarty->assign('TXT_BM_RELEASEDATE', STR_BM_RELEASEDATE); $this->oSmarty->assign('VAL_PRODUCTNAME', $oProduct->name); $this->oSmarty->assign('VAL_PRODUCTID', $oProduct->id); $this->oSmarty->assign('VAL_VERSIONID', $version_id); $this->oSmarty->assign('VAL_VERSIONTEXT', $oPV->product_version_text); $this->oSmarty->assign('VAL_VERSIONDESCR', $oPV->product_version_descr); $this->oSmarty->assign('VAL_ACTIVE', $oPV->active); $this->oSmarty->assign('VAL_VERSIONACTUALDATE', $oPV->product_version_actual_date); $this->oSmarty->assign('VAL_VERSIONTARGETDATE', $oPV->product_version_target_date); $this->oSmarty->assign('date', $oPV->product_version_target_date); $this->oSmarty->assign('VAL_DATEELEMENT', 'product_version_target_date'); $this->oSmarty->assign('VAL_WHICH', $GLOBALS['which']); SmartyDisplay($this->oSmarty, 'htmlBuildManagerReleaseForm.tpl'); }
function ModifyReleaseInfo() { commonHeader(); global $dcl_info, $versionid, $g_oSec; if (!$g_oSec->HasPerm(DCL_ENTITY_BUILDMANAGER, DCL_PERM_MODIFY)) { return PrintPermissionDenied(); } includeCalendar(); $Template = CreateTemplate(array('hForm' => 'htmlBuildManagerRelease.tpl')); $oProduct = CreateObject('dcl.dbProducts'); $oProduct->Connect(); $oProduct->Load($_REQUEST['product_id']); $Template->set_var('COLOR_LIGHT', $dcl_info['DCL_COLOR_LIGHT']); $Template->set_var('VAL_FORMACTION', menuLink()); $Template->set_var('VAL_JSDATEFORMAT', GetJSDateFormat()); $Template->set_var('VAL_MENU', 'boBuildManager.modifySumbit'); $oPV = CreateObject('dcl.dbProductVersion'); if ($oPV->Load(array('product_version_id' => $versionid)) == -1) { ShowError('Failed to load version ID ' . $versionid, 'Error'); return; } $myDate = $oPV->product_version_target_date; $Template->set_var('TXT_BM_ADD_RELEASE', STR_BM_MOD_RELEASE); $Template->set_var('TXT_BM_PRODUCT', STR_BM_PRODUCT); $Template->set_var('TXT_BM_RELEASE_ALIAS_TITLE', STR_BM_RELEASE_ALIAS_TITLE); $Template->set_var('TXT_BM_RELEASE_ALIAS', '<input type="text" name="ReleaseAlias" size=10 value=' . $oPV->product_version_text . '>'); $Template->set_var('VAL_PRODUCTNAME', $oProduct->name); $Template->set_var('H_VERSIONID', $versionid); $Template->set_var('H_PRODUCTID', $oProduct->id); $Template->set_var('H_TARGETDATE', $oPV->product_version_target_date); $Template->set_var('VAL_VERSIONTEXT', $oPV->product_version_text); $Template->set_var('VAL_VERSIONDESCR', $oPV->product_version_descr); $Template->set_var('VAL_DATE', 'product_version_actual_date'); $Template->set_var('VAL_VERSIONTARGETDATE', $oPV->product_version_target_date); $Template->set_var('TXT_BM_RELEASEDATE_DESC', STR_BM_RELEASEDATE_DESC); $Template->set_var('TXT_BM_RELEASEDATE', STR_BM_RELEASEDATE); $Template->set_var('TXT_BM_RELEASEDATEFORM', '<input type="text" name="ReleaseDesc" size=50 value="' . $oPV->product_version_descr . '">'); $Template->set_var('date', $oPV->product_version_target_date); $Template->set_var('VAL_WHICH', $_REQUEST['which']); $Template->set_var('H_PRODUCTID', $oPV->product_id); $Template->set_var('BTN_SUBMIT', STR_BM_SUBMIT); $Template->pparse('out', 'hForm'); }
function IncludeCalendar() { if (defined('DCL_CALENDAR_INCLUDED')) { return; } define('DCL_CALENDAR_INCLUDED', 1); $t = CreateTemplate(array('hForm' => 'htmlCalendar.tpl')); $calDateFormat = str_replace('mm', '%m', GetJSDateFormat()); $calDateFormat = str_replace('dd', '%d', $calDateFormat); $calDateFormat = str_replace('y', '%Y', $calDateFormat); $t->set_var('VAL_JSDATEFORMAT', $calDateFormat); $t->pparse('out', 'hForm'); }
function Show($jcn = 0, $oSource = '') { global $dcl_info, $g_oSec, $dcl_preferences, $g_oSession; $isEdit = false; $isTicket = false; $isCopy = false; if (is_object($oSource)) { $isEdit = is_a($oSource, 'dbWorkorders') && $oSource->jcn > 0; $isTicket = !$isEdit && is_a($oSource, 'dbTickets'); $isCopy = !$isEdit && !$isTicket && is_a($oSource, 'dbWorkorders') && $oSource->jcn == 0; } if ($isEdit) { if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_MODIFY, $oSource->jcn, $oSource->seq)) { return PrintPermissionDenied(); } } else { if ($isTicket) { if (!$g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_COPYTOWO, $oSource->ticketid)) { return PrintPermissionDenied(); } } else { if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ADD)) { return PrintPermissionDenied(); } } } $objJS = CreateObject('dcl.jsAttributesets'); if (!$isEdit) { $objJS->bActiveOnly = true; } $objJS->bPriorities = true; $objJS->bSeverities = true; $objJS->bModules = true; $objJS->DisplayAttributeScript(); $title = ''; if ($isTicket) { $title = sprintf(STR_WO_TICKET, $oSource->ticketid); } elseif ($isEdit) { $title = sprintf(STR_WO_EDITWO, $oSource->jcn, $oSource->seq); } elseif ($isCopy) { $title = 'Copy Work Order'; if ($jcn > 0) { $title .= " as Sequence of {$jcn}"; } } elseif ($jcn == 0) { $title = STR_WO_ADDWO; } else { if ($jcn > 0) { $title = sprintf(STR_WO_ADDSEQJCN, $jcn); } else { $title = STR_WO_ADDSEQ; } } $this->oSmarty->assign('TXT_TITLE', $title); $this->oSmarty->assign('IS_EDIT', $isEdit); if ($isEdit) { $this->oSmarty->assign('VAL_MENUACTION', 'boWorkorders.dbmodifyjcn'); $this->oSmarty->assign('VAL_WOID', $oSource->jcn); $this->oSmarty->assign('VAL_SEQ', $oSource->seq); } else { $this->oSmarty->assign('VAL_MENUACTION', 'boWorkorders.dbnewjcn'); if ($isTicket) { $this->oSmarty->assign('VAL_TICKETID', $oSource->ticketid); } if ($jcn > 0) { $this->oSmarty->assign('VAL_WOID', $jcn); } } $this->oSmarty->assign('VAL_JSDATEFORMAT', GetJSDateFormat()); $this->oSmarty->assign('VAL_FORMACTION', menuLink()); $this->oSmarty->assign('VAL_MULTIORG', $dcl_info['DCL_WO_SECONDARY_ACCOUNTS_ENABLED'] == 'Y'); $this->oSmarty->assign('VAL_AUTODATE', $dcl_info['DCL_AUTO_DATE'] == 'Y'); $this->oSmarty->assign('PERM_ADDTASK', $g_oSec->HasPerm(DCL_ENTITY_PROJECT, DCL_PERM_ADDTASK, isset($_REQUEST['projectid']) ? (int) $_REQUEST['projectid'] : 0)); $this->oSmarty->assign('PERM_ACTION', $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ACTION)); $this->oSmarty->assign('PERM_ASSIGNWO', $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ASSIGN)); $this->oSmarty->assign('PERM_ATTACHFILE', $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ATTACHFILE) && $dcl_info['DCL_MAX_UPLOAD_FILE_SIZE'] > 0 && !$isEdit); $this->oSmarty->assign('VAL_MAXUPLOADFILESIZE', $dcl_info['DCL_MAX_UPLOAD_FILE_SIZE']); $this->oSmarty->assign('PERM_ISPUBLICUSER', $g_oSec->IsPublicUser()); $this->oSmarty->assign('VAL_NOTIFYDEFAULT', isset($dcl_preferences['DCL_PREF_NOTIFY_DEFAULT']) ? $dcl_preferences['DCL_PREF_NOTIFY_DEFAULT'] : 'N'); $oMeta =& CreateObject('dcl.DCL_MetadataDisplay'); if ($isEdit || $isTicket || $isCopy) { $oProduct =& CreateObject('dcl.dbProducts'); $oProduct->Query('SELECT wosetid FROM products WHERE id=' . ($isTicket ? $oSource->product : $oSource->product)); if ($oProduct->next_record()) { $this->oSmarty->assign('VAL_SETID', $oProduct->f(0)); } if ($isEdit || $isCopy) { $this->oSmarty->assign('VAL_SOURCE', $oSource->entity_source_id); $this->oSmarty->assign('VAL_PRODUCT', $oSource->product); $this->oSmarty->assign('VAL_MODULE', $oSource->module_id); $this->oSmarty->assign('VAL_TYPE', $oSource->wo_type_id); $this->oSmarty->assign('VAL_DEADLINEON', $oSource->deadlineon); $this->oSmarty->assign('VAL_ESTSTARTON', $oSource->eststarton); $this->oSmarty->assign('VAL_ESTENDON', $oSource->estendon); $this->oSmarty->assign('VAL_ESTHOURS', $oSource->esthours); $this->oSmarty->assign('VAL_SEVERITY', $oSource->severity); $this->oSmarty->assign('VAL_PRIORITY', $oSource->priority); $this->oSmarty->assign('VAL_CONTACTS', $oSource->contact_id); } else { $this->oSmarty->assign('VAL_SOURCE', $oSource->entity_source_id); $this->oSmarty->assign('VAL_PRODUCT', $oSource->product); $this->oSmarty->assign('VAL_MODULE', $oSource->module_id); $this->oSmarty->assign('VAL_TYPE', 0); $this->oSmarty->assign('VAL_SEVERITY', 0); $this->oSmarty->assign('VAL_PRIORITY', 0); $this->oSmarty->assign('VAL_CONTACTS', $oSource->contact_id); } $oTag =& CreateObject('dcl.dbEntityTag'); if ($isTicket) { $this->oSmarty->assign('VAL_TAGS', $oTag->getTagsForEntity(DCL_ENTITY_TICKET, $oSource->ticketid)); } else { $this->oSmarty->assign('VAL_TAGS', $oTag->getTagsForEntity(DCL_ENTITY_WORKORDER, $oSource->jcn, $oSource->seq)); } $oHotlist =& CreateObject('dcl.dbEntityHotlist'); if ($isTicket) { $this->oSmarty->assign('VAL_HOTLIST', $oHotlist->getTagsForEntity(DCL_ENTITY_TICKET, $oSource->ticketid)); } else { $this->oSmarty->assign('VAL_HOTLIST', $oHotlist->getTagsForEntity(DCL_ENTITY_WORKORDER, $oSource->jcn, $oSource->seq)); } } if (!$isEdit && !$isCopy) { if ($dcl_info['DCL_AUTO_DATE'] == 'Y') { $this->oSmarty->assign('VAL_DEADLINEON', date($dcl_info['DCL_DATE_FORMAT'])); $this->oSmarty->assign('VAL_ESTSTARTON', date($dcl_info['DCL_DATE_FORMAT'])); $this->oSmarty->assign('VAL_ESTENDON', date($dcl_info['DCL_DATE_FORMAT'])); } else { $this->oSmarty->assign('VAL_DEADLINEON', ''); $this->oSmarty->assign('VAL_ESTSTARTON', ''); $this->oSmarty->assign('VAL_ESTENDON', ''); } $this->oSmarty->assign('VAL_ESTHOURS', ''); // If not editing, display project options (if any) $objPM = CreateObject('dcl.dbProjectmap'); if ($jcn > 0 && $objPM->LoadByWO($jcn, 0) != -1 || $g_oSec->HasPerm(DCL_ENTITY_PROJECT, DCL_PERM_ADDTASK) && isset($_REQUEST['projectid'])) { $oProject = CreateObject('dcl.dbProjects'); if ($objPM->projectid > 0) { $oProject->Load($objPM->projectid); } else { $oProject->Load((int) $_REQUEST['projectid']); } $this->oSmarty->assign('VAL_PROJECT', $oProject->name); $this->oSmarty->assign('VAL_PROJECTS', (int) $_REQUEST['projectid']); $this->oSmarty->assign('TXT_WILLBEPARTOFPROJECT', sprintf(STR_WO_WILLBEPARTOFPROJECT, $oProject->name)); } } elseif ($isCopy) { $objPM = CreateObject('dcl.dbProjectmap'); $bAllSequencesInSameProject = $jcn > 0 && $objPM->LoadByWO($jcn, 0) != -1; if ($bAllSequencesInSameProject || $g_oSec->HasPerm(DCL_ENTITY_PROJECT, DCL_PERM_ADDTASK) && isset($_REQUEST['projectid'])) { $oProject = CreateObject('dcl.dbProjects'); if ($objPM->projectid > 0) { $oProject->Load($objPM->projectid); } else { $oProject->Load((int) $_REQUEST['projectid']); } $this->oSmarty->assign('VAL_PROJECT', $oProject->name); $this->oSmarty->assign('VAL_PROJECTS', (int) $_REQUEST['projectid']); if ($bAllSequencesInSameProject) { $this->oSmarty->assign('TXT_WILLBEPARTOFPROJECT', sprintf(STR_WO_WILLBEPARTOFPROJECT, $oProject->name)); } } } $this->oSmarty->assign('VAL_HIDEPROJECT', $isEdit); if ($isEdit || $isCopy) { $this->oSmarty->assign('VAL_REPORTED_VERSION', $oSource->reported_version_id); $this->oSmarty->assign('VAL_TARGETED_VERSION', $isCopy ? 0 : $oSource->targeted_version_id); $this->oSmarty->assign('VAL_FIXED_VERSION', $isCopy ? 0 : $oSource->fixed_version_id); $this->oSmarty->assign('VAL_SUMMARY', $oSource->summary); $this->oSmarty->assign('VAL_NOTES', $oSource->notes); $this->oSmarty->assign('VAL_DESCRIPTION', $oSource->description); $this->oSmarty->assign('VAL_ISPUBLIC', $oSource->is_public); $this->oSmarty->assign('VAL_RESPONSIBLE', $oSource->responsible); $this->oSmarty->assign('VAL_CONTACTID', $oSource->contact_id); if ($oSource->contact_id != '' && $oSource->contact_id > 0) { $aContact =& $oMeta->GetContact($oSource->contact_id); if (is_array($aContact) && count($aContact) > 1) { $this->oSmarty->assign('VAL_CONTACTNAME', $aContact['name']); } else { $this->oSmarty->assign('VAL_CONTACTNAME', 'Unknown'); } } if ($oSource->responsible == $GLOBALS['DCLID']) { $this->oSmarty->assign('VAL_RESPONSIBLENAME', $GLOBALS['DCLNAME']); } else { $oPersonnel =& CreateObject('dcl.dbPersonnel'); if ($oPersonnel->Load($oSource->responsible) == -1) { $this->oSmarty->assign('VAL_RESPONSIBLENAME', $oPersonnel->short); } else { $this->oSmarty->assign('VAL_RESPONSIBLENAME', 'Unknown'); } } } elseif ($isTicket) { $this->oSmarty->assign('VAL_REPORTED_VERSION', ''); $this->oSmarty->assign('VAL_SUMMARY', $oSource->summary); $this->oSmarty->assign('VAL_DESCRIPTION', $oSource->issue); $this->oSmarty->assign('VAL_CONTACTID', $oSource->contact_id); if ($oSource->contact_id != '' && $oSource->contact_id > 0) { $aContact =& $oMeta->GetContact($oSource->contact_id); if (is_array($aContact) && count($aContact) > 1) { $this->oSmarty->assign('VAL_CONTACTNAME', $aContact['name']); } else { $this->oSmarty->assign('VAL_CONTACTNAME', 'Unknown'); } } $notes = 'Copied from ticket dcl://tickets/' . $oSource->ticketid; $this->oSmarty->assign('VAL_NOTES', $notes); $this->oSmarty->assign('VAL_ISPUBLIC', $oSource->is_public); $this->oSmarty->assign('VAL_RESPONSIBLE', $GLOBALS['DCLID']); $this->oSmarty->assign('VAL_RESPONSIBLENAME', $GLOBALS['DCLNAME']); } else { $this->oSmarty->assign('VAL_REPORTED_VERSION', ''); $this->oSmarty->assign('VAL_CONTACTID', ''); $this->oSmarty->assign('VAL_SUMMARY', ''); $this->oSmarty->assign('VAL_NOTES', ''); $this->oSmarty->assign('VAL_DESCRIPTION', ''); $this->oSmarty->assign('VAL_ISPUBLIC', 'N'); $this->oSmarty->assign('VAL_RESPONSIBLE', $GLOBALS['DCLID']); $this->oSmarty->assign('VAL_RESPONSIBLENAME', $GLOBALS['DCLNAME']); if (($iContactID = @DCL_Sanitize::ToInt($_REQUEST['contact_id'])) !== null && $iContactID > 0) { $aContact =& $oMeta->GetContact($iContactID); if (is_array($aContact) && count($aContact) > 1) { $this->oSmarty->assign('VAL_CONTACTID', $iContactID); $this->oSmarty->assign('VAL_CONTACTNAME', $aContact['name']); } } } $sAssignedContactID = @$this->oSmarty->get_template_vars('VAL_CONTACTID'); if ($sAssignedContactID != '') { $oContact =& CreateObject('dcl.dbContact'); if ($oContact->Load(array('contact_id' => $sAssignedContactID)) != -1) { $this->oSmarty->assign('VAL_CONTACT', sprintf('%s, %s', $oContact->last_name, $oContact->first_name)); } } $aOrgID = array(); $aOrgName = array(); if ($isEdit || $isTicket || $isCopy) { $oOrgs =& CreateObject('dcl.boOrg'); if ($isEdit || $isCopy) { $oOrgs->ListSelectedByWorkOrder($oSource->jcn, $oSource->seq); } else { $oOrgs->ListSelectedByTicket($oSource->ticketid); } while ($oOrgs->oDB->next_record()) { $aOrgID[] = $oOrgs->oDB->f(0); $aOrgName[] = $oOrgs->oDB->f(1); } } else { $iOrgID = @DCL_Sanitize::ToInt($_REQUEST['org_id']); if ($iOrgID === null && $g_oSession->Value('member_of_orgs') != '') { $iOrgID = array_shift(split(',', $g_oSession->Value('member_of_orgs'))); } if ($iOrgID !== null && $iOrgID > 0) { $aOrg =& $oMeta->GetOrganization($iOrgID); if (is_array($aOrg) && count($aOrg) > 0) { $aOrgID[] = $iOrgID; $aOrgName[] = $aOrg['name']; } } } if (count($aOrgID) > 0) { $this->oSmarty->assign_by_ref('VAL_ORGID', $aOrgID); $this->oSmarty->assign_by_ref('VAL_ORGNAME', $aOrgName); } else { $this->oSmarty->assign('VAL_ORGID', ''); $this->oSmarty->assign('VAL_ORGNAME', ''); } SmartyDisplay($this->oSmarty, 'htmlWorkOrderForm.tpl'); }
function Show($obj = '') { global $dcl_info, $g_oSec, $dcl_preferences; $isEdit = is_object($obj); if (!$g_oSec->HasPerm(DCL_ENTITY_TICKET, $isEdit ? DCL_PERM_MODIFY : DCL_PERM_ADD, $isEdit ? $obj->ticketid : 0)) { return PrintPermissionDenied(); } $oSmarty =& CreateSmarty(); $objJS =& CreateObject('dcl.jsAttributesets'); if (!$isEdit) { $objJS->bActiveOnly = true; } $objJS->bPriorities = true; $objJS->bSeverities = true; $objJS->bModules = true; $objJS->forWhat = 'tck'; $objJS->DisplayAttributeScript(); $oSmarty->assign('VAL_FORMACTION', menuLink()); $oSmarty->assign('VAL_JSDATEFORMAT', GetJSDateFormat()); $oSmarty->assign('PERM_ACTION', $g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_ACTION)); $oSmarty->assign('PERM_ASSIGNWO', $g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_ASSIGN)); $oSmarty->assign('PERM_ATTACHFILE', $g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_ATTACHFILE) && $dcl_info['DCL_MAX_UPLOAD_FILE_SIZE'] > 0 && !$isEdit); $oSmarty->assign('PERM_ISPUBLIC', $g_oSec->IsPublicUser()); $oSmarty->assign('VAL_MAXUPLOADFILESIZE', $dcl_info['DCL_MAX_UPLOAD_FILE_SIZE']); $oSmarty->assign('VAL_ISEDIT', $isEdit); $oSmarty->assign('VAL_DCLID', $GLOBALS['DCLID']); $oSmarty->assign('VAL_NOTIFYDEFAULT', isset($dcl_preferences['DCL_PREF_NOTIFY_DEFAULT']) ? $dcl_preferences['DCL_PREF_NOTIFY_DEFAULT'] : 'N'); $oMeta =& CreateObject('dcl.DCL_MetadataDisplay'); if ($isEdit) { $oProduct =& CreateObject('dcl.dbProducts'); $oProduct->Query('SELECT tcksetid FROM products WHERE id=' . $obj->product); if ($oProduct->next_record()) { $oSmarty->assign('VAL_SETID', $oProduct->f(0)); } $oSmarty->assign('TXT_TITLE', sprintf(STR_TCK_EDITTITLE, $obj->ticketid)); $oSmarty->assign('VAL_ISPUBLIC', $obj->is_public); $oSmarty->assign('VAL_SOURCE', $obj->entity_source_id); $oSmarty->assign('VAL_PRODUCT', $obj->product); $oSmarty->assign('VAL_MODULE', $obj->module_id); $oSmarty->assign('VAL_PRIORITY', $obj->priority); $oSmarty->assign('VAL_TYPE', $obj->type); $oSmarty->assign('VAL_VERSION', $obj->version); $oSmarty->assign('VAL_SUMMARY', $obj->summary); $oSmarty->assign('VAL_ISSUE', $obj->issue); $oSmarty->assign('VAL_CONTACTID', $obj->contact_id); if ($obj->contact_id > 0) { $oContact =& CreateObject('dcl.dbContact'); if ($oContact->Load(array('contact_id' => $obj->contact_id)) != -1) { $oSmarty->assign('VAL_CONTACTNAME', sprintf('%s %s', $oContact->first_name, $oContact->last_name)); } } $oSmarty->assign('VAL_RESPONSIBLE', $obj->responsible); if ($obj->responsible == $GLOBALS['DCLID']) { $oSmarty->assign('VAL_RESPONSIBLENAME', $GLOBALS['DCLNAME']); } else { $oPersonnel =& CreateObject('dcl.dbPersonnel'); if ($oPersonnel->Load($obj->responsible) != -1) { $oSmarty->assign('VAL_RESPONSIBLENAME', $oPersonnel->short); } else { $oSmarty->assign('VAL_RESPONSIBLENAME', 'Unknown'); } } $oOrgs =& CreateObject('dcl.boOrg'); $oOrgs->ListSelectedByTicket($obj->ticketid); if ($oOrgs->oDB->next_record()) { $oSmarty->assign('VAL_ORGID', $oOrgs->oDB->f('org_id')); $oSmarty->assign('VAL_ORGNAME', $oOrgs->oDB->f('name')); } $oSmarty->assign('VAL_MENUACTION', 'boTickets.dbmodify'); $oSmarty->assign('VAL_TICKETID', $obj->ticketid); $oSmarty->assign('VAL_STATUS', $obj->status); $oTag =& CreateObject('dcl.dbEntityTag'); $oSmarty->assign('VAL_TAGS', $oTag->getTagsForEntity(DCL_ENTITY_TICKET, $obj->ticketid)); } else { $oSmarty->assign('TXT_TITLE', STR_TCK_ADDTITLE); $oSmarty->assign('VAL_ISPUBLIC', 'Y'); $oSmarty->assign('VAL_RESPONSIBLE', $GLOBALS['DCLID']); $oSmarty->assign('VAL_RESPONSIBLENAME', $GLOBALS['DCLNAME']); $oSmarty->assign('VAL_MENUACTION', 'boTickets.dbadd'); $oSmarty->assign('VAL_STARTEDON', date($dcl_info['DCL_TIMESTAMP_FORMAT'])); $oSmarty->assign('VAL_STATUS', $dcl_info['DCL_DEFAULT_TICKET_STATUS']); if (($iOrgID = @DCL_Sanitize::ToInt($_REQUEST['org_id'])) !== null && $iOrgID > 0) { $aOrg =& $oMeta->GetOrganization($iOrgID); if (is_array($aOrg) && count($aOrg) > 0) { $oSmarty->assign('VAL_ORGID', $iOrgID); $oSmarty->assign('VAL_ORGNAME', $aOrg['name']); } } if (($iContactID = @DCL_Sanitize::ToInt($_REQUEST['contact_id'])) !== null && $iContactID > 0) { $aContact =& $oMeta->GetContact($iContactID); if (is_array($aContact) && count($aContact) > 1) { $oSmarty->assign('VAL_CONTACTID', $iContactID); $oSmarty->assign('VAL_CONTACTNAME', $aContact['name']); } } } SmartyDisplay($oSmarty, 'htmlTicketForm.tpl'); }
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'); }