function Search()
 {
     $this->Init();
     $aItems = $this->_aTypeInfo[$this->group][$this->sub];
     $objView = CreateObject('dcl.boView');
     $objView->style = 'report';
     $objView->title = 'Aggregate Search Results';
     $objView->table = $this->group;
     if ($this->group == 'workorders') {
         $objView->AddDef('order', '', array('priorities.weight', 'severities.weight', 'jcn', 'seq'));
     } else {
         if ($this->group == 'tickets') {
             $objView->AddDef('order', '', array('priorities.weight', 'severities.weight', 'ticketid'));
         }
     }
     $objView->AddDef('filter', 'statuses.dcl_status_type', $_REQUEST['col'] + 1);
     if ($this->group == 'workorders' && $this->sub == 'account') {
         $objView->AddDef('filter', 'dcl_wo_account.account_id', $_REQUEST['item']);
     } else {
         $objView->AddDef('filter', substr($aItems[2], 2), $_REQUEST['item']);
     }
     if (isset($_REQUEST['dateFrom']) && isset($_REQUEST['dateTo'])) {
         $field = $_REQUEST['col'] == 0 ? 'createdon' : 'closedon';
         $objView->AddDef('filterdate', $field, array(DCL_Sanitize::ToDate($_REQUEST['dateFrom']), DCL_Sanitize::ToDate($_REQUEST['dateTo'])));
     }
     if ($this->sub != 'product') {
         $objView->AddDef('groups', '', array('products.name'));
         if ($this->group == 'workorders') {
             $objView->AddDef('columns', '', array('jcn', 'seq', 'dcl_wo_type.type_name', 'responsible.short', 'statuses.name', 'eststarton', 'deadlineon', 'etchours', 'totalhours', 'summary'));
             $objView->AddDef('columnhdrs', '', array('', STR_WO_JCN, STR_WO_SEQ, STR_WO_TYPE, STR_WO_RESPONSIBLE, STR_WO_STATUS, STR_WO_ESTSTART, STR_WO_DEADLINE, STR_WO_ETCHOURS, STR_WO_ACTHOURS, STR_WO_SUMMARY));
         } else {
             $objView->AddDef('columns', '', array('ticketid', 'responsible.short', 'statuses.name', 'summary'));
             $objView->AddDef('columnhdrs', '', array('', STR_TCK_TICKET, STR_TCK_RESPONSIBLE, STR_WO_STATUS, STR_WO_SUMMARY));
         }
     } else {
         $objView->AddDef('groups', '', array('responsible.short'));
         if ($this->group == 'workorders') {
             $objView->AddDef('columns', '', array('jcn', 'seq', 'dcl_wo_type.type_name', 'products.name', 'statuses.name', 'eststarton', 'deadlineon', 'etchours', 'totalhours', 'summary'));
             $objView->AddDef('columnhdrs', '', array('', STR_WO_JCN, STR_WO_SEQ, STR_WO_TYPE, STR_WO_PRODUCT, STR_WO_STATUS, STR_WO_ESTSTART, STR_WO_DEADLINE, STR_WO_ETCHOURS, STR_WO_ACTHOURS, STR_WO_SUMMARY));
         } else {
             $objView->AddDef('columns', '', array('ticketid', 'responsible.short', 'statuses.name', 'products.name', 'summary'));
             $objView->AddDef('columnhdrs', '', array(STR_TCK_TICKETID, STR_TCK_RESPONSIBLE, STR_TCK_STATUS, STR_TCK_PRODUCT, STR_TCK_SUMMARY));
         }
     }
     $obj = CreateViewObject($this->group);
     $obj->Render($objView);
 }
 function viewTickets()
 {
     global $g_oSec;
     commonHeader();
     if (!$g_oSec->HasAnyPerm(array(DCL_ENTITY_TICKET => array($g_oSec->PermArray(DCL_PERM_VIEW), $g_oSec->PermArray(DCL_PERM_VIEWACCOUNT), $g_oSec->PermArray(DCL_PERM_VIEWSUBMITTED))))) {
         return PrintPermissionDenied();
     }
     if (($id = DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     $oMeta =& CreateObject('dcl.DCL_MetadataDisplay');
     $aContact = $oMeta->GetContact($id);
     $objView = CreateObject('dcl.boView');
     $objView->title = sprintf('%s Tickets', $aContact['name']);
     $objView->style = 'report';
     $objView->table = 'tickets';
     if ($g_oSec->IsPublicUser()) {
         $objView->AddDef('filter', 'is_public', "'Y'");
         $objView->AddDef('columns', '', array('ticketid', 'statuses.name', 'priorities.name', 'severities.name', 'summary'));
         $objView->AddDef('columnhdrs', '', array(STR_TCK_STATUS, STR_TCK_TICKET . '#', STR_TCK_STATUS, STR_TCK_PRIORITY, STR_TCK_TYPE, STR_TCK_SUMMARY));
     } else {
         $objView->AddDef('columns', '', array('ticketid', 'statuses.name', 'priorities.name', 'severities.name', 'responsible.short', 'summary'));
         $objView->AddDef('columnhdrs', '', array(STR_TCK_STATUS, STR_TCK_TICKET . '#', STR_TCK_STATUS, STR_TCK_PRIORITY, STR_TCK_TYPE, STR_TCK_RESPONSIBLE, STR_TCK_SUMMARY));
     }
     $objView->AddDef('filter', 'contact_id', $id);
     $objView->AddDef('filter', 'dcl_status_type.dcl_status_type_id', array(1, 3));
     $objView->AddDef('order', '', array('ticketid'));
     $objView->AddDef('groups', '', array('statuses.name'));
     $objHV = CreateViewObject($objView->table);
     $objHV->bShowPager = false;
     $objHV->Render($objView);
 }
 function page()
 {
     commonHeader();
     $objView = CreateObject('dcl.boView');
     $objView->SetFromURL();
     if ((isset($_REQUEST['btnNav']) || isset($_REQUEST['jumptopage'])) && isset($_REQUEST['startrow']) && isset($_REQUEST['numrows'])) {
         $startrow = @DCL_Sanitize::ToInt($_REQUEST['startrow']);
         $numrows = @DCL_Sanitize::ToInt($_REQUEST['numrows']);
         if ($startrow === null) {
             $startrow = 0;
         }
         if ($numrows === null) {
             $numrows = 25;
         }
         if ($_REQUEST['btnNav'] == '<<') {
             $objView->startrow = $startrow - $numrows;
         } else {
             if ($_REQUEST['btnNav'] == '>>') {
                 $objView->startrow = $startrow + $numrows;
             } else {
                 $iPage = @DCL_Sanitize::ToInt($_REQUEST['jumptopage']);
                 if ($iPage === null || $iPage < 1) {
                     $iPage = 1;
                 }
                 $objView->startrow = ($iPage - 1) * $numrows;
             }
         }
         if ($objView->startrow < 0) {
             $objView->startrow = 0;
         }
         $objView->numrows = $numrows;
     } else {
         $objView->numrows = 25;
         $objView->startrow = 0;
     }
     $objH =& CreateViewObject($objView->table);
     $objH->Render($objView);
 }
 function viewTickets()
 {
     commonHeader();
     if (($id = DCL_Sanitize::ToInt($_REQUEST['id'])) === null) {
         trigger_error('Data sanitize failed.');
         return;
     }
     $oMeta =& CreateObject('dcl.DCL_MetadataDisplay');
     $aOrg = $oMeta->GetOrganization($id);
     $objView = CreateObject('dcl.boView');
     $objView->title = sprintf('%s Tickets', $aOrg['name']);
     $objView->style = 'report';
     $objView->table = 'tickets';
     $objView->AddDef('columns', '', array('ticketid', 'statuses.name', 'priorities.name', 'severities.name', 'responsible.short', 'summary'));
     $objView->AddDef('columnhdrs', '', array(STR_TCK_STATUS, STR_TCK_TICKET . '#', STR_TCK_STATUS, STR_TCK_PRIORITY, STR_TCK_TYPE, STR_TCK_RESPONSIBLE, STR_TCK_SUMMARY));
     $objView->AddDef('filter', 'account', $id);
     $objView->AddDef('filter', 'dcl_status_type.dcl_status_type_id', array(1, 3));
     $objView->AddDef('order', '', array('ticketid'));
     $objView->AddDef('groups', '', array('statuses.name'));
     $objHV = CreateViewObject($objView->table);
     $objHV->bShowPager = false;
     $objHV->Render($objView);
 }
 function SearchFromStat()
 {
     global $dcl_domain_info, $dcl_domain;
     commonHeader();
     global $responsible, $product, $status, $begindate, $enddate;
     $obj = new dclDB();
     $objView = CreateObject('dcl.boView');
     $objView->table = 'tickets';
     $objView->style = 'report';
     $objView->title = STR_TCK_STATSEARCHRESULTS;
     $objView->AddDef('columns', '', array('ticketid', 'responsible.short', 'products.name', 'dcl_org.name', 'statuses.name', 'contact', 'contactphone'));
     $objView->AddDef('order', '', array('priorities.weight', 'severities.weight', 'ticketid'));
     if ($begindate != '' || $enddate != '') {
         $objView->AddDef('filter', 'statuses.dcl_status_type', '2');
         $objView->AddDef('filterdate', 'closedon', array($begindate, $enddate));
     } else {
         if ($status > 0) {
             $objView->AddDef('filter', 'status', $status);
         } else {
             $objView->AddDef('filternot', 'statuses.dcl_status_type', '2');
         }
     }
     if ($responsible > 0) {
         $objView->AddDef('filter', 'responsible', $responsible);
     }
     if ($product > 0) {
         $objView->AddDef('filter', 'product', $product);
     }
     $obj = CreateViewObject($objView->table);
     $obj->Render($objView);
 }
 function showmy($forField, $title, $noneMsg)
 {
     global $dcl_info, $g_oSec;
     $obj = CreateObject('dcl.dbTickets');
     $objView = CreateObject('dcl.boView');
     $objView->title = $title;
     $objView->style = 'report';
     $objView->table = 'tickets';
     $objView->AddDef('columns', '', array('ticketid', 'priorities.name', 'severities.name', 'responsible.short', 'dcl_tag.tag_desc', 'summary'));
     $objView->AddDef('columnhdrs', '', array(STR_TCK_TICKET, STR_TCK_PRIORITY, STR_TCK_TYPE, STR_TCK_RESPONSIBLE, STR_CMMN_TAGS, STR_TCK_SUMMARY));
     $objView->AddDef('filter', $forField, $GLOBALS['DCLID']);
     $objView->AddDef('filternot', 'statuses.dcl_status_type', '2');
     if ($forField == 'createdby') {
         $objView->AddDef('filternot', 'responsible', $GLOBALS['DCLID']);
     }
     $objView->AddDef('order', '', array('priorities.weight', 'severities.weight', 'ticketid'));
     $objHV = CreateViewObject($objView->table);
     $objHV->Render($objView);
 }
 function showmy($obj, $forField, $title, $noneMsg, $rowlimit)
 {
     global $dcl_info, $g_oSec;
     if (!is_object($obj)) {
         trigger_error('[htmlWorkorders::showmy] ' . STR_WO_OBJECTNOTPASSED);
         return;
     }
     $objView = CreateObject('dcl.boView');
     $objView->title = $title;
     $objView->style = 'report';
     if ($g_oSec->IsPublicUser()) {
         $objView->AddDef('columns', '', array('jcn', 'seq', 'dcl_wo_type.type_name', 'products.name', 'statuses.name', 'priorities.name', 'severities.name', 'dcl_tag.tag_desc', 'summary'));
         $objView->AddDef('order', '', array('priorities.weight', 'severities.weight', 'jcn', 'seq'));
         $objView->AddDef('columnhdrs', '', array(STR_WO_JCN, STR_WO_SEQ, STR_WO_TYPE, STR_WO_PRODUCT, STR_WO_STATUS, STR_WO_PRIORITY, STR_WO_SEVERITY, STR_CMMN_TAGS, STR_WO_SUMMARY));
     } else {
         $objView->AddDef('columns', '', array('jcn', 'seq', 'dcl_wo_type.type_name', 'products.name', 'statuses.name', 'priorities.name', 'severities.name', 'responsible.short', 'deadlineon', 'dcl_tag.tag_desc', 'summary'));
         $objView->AddDef('order', '', array('priorities.weight', 'severities.weight', 'deadlineon', 'eststarton', 'jcn', 'seq'));
         $objView->AddDef('columnhdrs', '', array(STR_WO_JCN, STR_WO_SEQ, STR_WO_TYPE, STR_WO_PRODUCT, STR_WO_STATUS, STR_WO_PRIORITY, STR_WO_SEVERITY, STR_WO_RESPONSIBLE, STR_WO_DEADLINE, STR_CMMN_TAGS, STR_WO_SUMMARY));
     }
     $objView->AddDef('filter', $forField, $GLOBALS['DCLID']);
     $objView->AddDef('filternot', 'statuses.dcl_status_type', '2');
     if ($forField == 'createby') {
         $objView->AddDef('filternot', 'responsible', $GLOBALS['DCLID']);
     }
     $objHV = CreateViewObject($objView->table);
     $objHV->Render($objView);
 }
 function SearchFromStat()
 {
     global $dcl_domain_info, $dcl_domain, $g_oSec;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     $responsible = DCL_Sanitize::ToInt($_REQUEST['responsible']);
     $product = DCL_Sanitize::ToInt($_REQUEST['product']);
     $status = DCL_Sanitize::ToInt($_REQUEST['status']);
     $begindate = DCL_Sanitize::ToDate($_REQUEST['begindate']);
     $enddate = DCL_Sanitize::ToDate($_REQUEST['enddate']);
     $obj = new dclDB();
     $objView = CreateObject('dcl.boView');
     $objView->style = 'report';
     $objView->title = STR_WOST_SEARCHRESULTS;
     $objView->AddDef('columns', '', array('jcn', 'seq', 'responsible.short', 'products.name', 'statuses.name', 'eststarton', 'deadlineon', 'etchours', 'totalhours', 'summary'));
     $objView->AddDef('columnhdrs', '', array(STR_WO_JCN, STR_WO_SEQ, STR_WO_RESPONSIBLE, STR_WO_PRODUCT, STR_WO_STATUS, STR_WO_ESTSTART, STR_WO_DEADLINE, STR_WO_ETCHOURS, STR_WO_ACTHOURS, STR_WO_SUMMARY));
     $objView->AddDef('order', '', array('priorities.weight', 'severities.weight', 'jcn', 'seq'));
     if ($begindate !== null || $enddate !== null) {
         $objView->AddDef('filter', 'statuses.dcl_status_type', '2');
         $objView->AddDef('filterdate', 'closedon', array($obj->DisplayToSQL($begindate), $obj->DisplayToSQL($enddate)));
     } else {
         if ($status !== null) {
             $objView->AddDef('filter', 'status', $status);
         } else {
             $objView->AddDef('filternot', 'statuses.dcl_status_type', '2');
         }
     }
     if ($responsible !== null) {
         $objView->AddDef('filter', 'responsible', $responsible);
     }
     if ($product !== null) {
         $objView->AddDef('filter', 'product', $product);
     }
     $obj = CreateViewObject($objView->table);
     $obj->Render($objView);
 }
 function _ShowProductItem()
 {
     $id = $this->id;
     if ($this->sView == 'modules') {
         $oModules = CreateObject('dcl.htmlProductModules');
         $_REQUEST['product_id'] = $id;
         $oModules->PrintAll();
     } else {
         if ($this->sView != 'summary') {
             // This shows the non-closed work orders/tickets grouped by status
             $objView = CreateObject('dcl.boView');
             if ($this->sView == 'workorders') {
                 $objView->title = sprintf(STR_PROD_WOTITLE, $this->oProduct->name);
                 $objView->style = 'report';
                 $objView->table = 'workorders';
                 $objView->AddDef('columns', '', array('jcn', 'seq', 'priorities.name', 'severities.name', 'responsible.short', 'deadlineon', 'summary'));
                 $objView->AddDef('columnhdrs', '', array(STR_WO_STATUS, STR_WO_JCN, STR_WO_SEQ, STR_WO_PRIORITY, STR_WO_SEVERITY, STR_WO_RESPONSIBLE, STR_WO_DEADLINE, STR_WO_SUMMARY));
                 $objView->AddDef('filter', 'product', $id);
                 $objView->AddDef('filternot', 'statuses.dcl_status_type', '2');
                 $objView->AddDef('order', '', array('jcn', 'seq'));
                 $objView->AddDef('groups', '', array('statuses.name'));
                 $objHV = CreateViewObject($objView->table);
             } elseif ($this->sView == 'release') {
                 $objView->title = sprintf(STR_PROD_RELEASEINFO, $this->oProduct->name);
                 $objView->style = 'report';
                 $objView->table = 'dcl_product_version';
                 $objView->AddDef('columns', '', array('product_version_id', 'product_version_text', 'active', 'product_version_descr', 'product_version_target_date', 'product_version_actual_date'));
                 $objView->AddDef('columnhdrs', '', array(STR_CMMN_ID, 'Version', STR_CMMN_ACTIVE, 'Version Description', 'Target Date', 'Actual Date'));
                 $objView->AddDef('filter', 'product_id', $id);
                 $objView->AddDef('order', '', array('product_version_target_date desc'));
                 $objHV = CreateObject('dcl.htmlBuildManagerVersionView');
                 $objHV->productid = $id;
             } elseif ($this->sView == 'build') {
                 $objView->title = sprintf(STR_PROD_BUILDINFO, $this->oProduct->name);
                 $objView->style = 'report';
                 $objView->table = 'dcl_product_version';
                 $objView->AddDef('columns', '', array('dcl_product_build.product_build_id', 'dcl_product_build.product_version_id', 'dcl_product_build.product_build_descr'));
                 $objView->AddDef('columnhdrs', '', array(STR_CMMN_ID, 'Version ID', 'Build Description'));
                 $objView->AddDef('filter', 'dcl_product_build.product_version_id', $this->iVersion);
                 //$objView->AddDef('order', '', array('product_version_target_date'));
                 $objHV = CreateObject('dcl.htmlBuildManagerBuildView');
                 $objHV->productid = $id;
                 $objHV->product_version_id = $this->iVersion;
             } else {
                 $objView->title = sprintf(STR_PROD_TICKETTITLE, $this->oProduct->name);
                 $objView->style = 'report';
                 $objView->table = 'tickets';
                 $objView->AddDef('columns', '', array('ticketid', 'priorities.name', 'severities.name', 'responsible.short', 'summary'));
                 $objView->AddDef('columnhdrs', '', array(STR_TCK_STATUS, STR_TCK_TICKET . '#', STR_TCK_PRIORITY, STR_TCK_TYPE, STR_TCK_RESPONSIBLE, STR_TCK_SUMMARY));
                 $objView->AddDef('filter', 'product', $id);
                 $objView->AddDef('filternot', 'statuses.dcl_status_type', '2');
                 $objView->AddDef('order', '', array('ticketid'));
                 $objView->AddDef('groups', '', array('statuses.name'));
                 $objHV = CreateViewObject($objView->table);
             }
             $objHV->Render($objView);
         }
     }
 }
 function searchTickets($searchText)
 {
     global $g_oSec;
     commonHeader();
     if ($g_oSec->IsPublicUser() && !$g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_SEARCH)) {
         ShowInfo('You must provide a ticket ID.', __FILE__, __LINE__, null);
         return;
     }
     $this->oView->title = STR_TCK_TICKETSEARCHRESULTS;
     $this->oView->table = 'tickets';
     $this->oView->AddDef('filterlike', 'issue', $searchText);
     $this->oView->AddDef('filterlike', 'summary', $searchText);
     if ($g_oSec->IsPublicUser()) {
         $this->oView->AddDef('filter', 'is_public', "'Y'");
         $this->oView->AddDef('filter', 'products.is_public', "'Y'");
     }
     if ($_REQUEST['which'] == 'opentickets') {
         $this->oView->AddDef('filternot', 'statuses.dcl_status_type', '2');
     }
     $this->oView->AddDef('columns', '', array('ticketid', 'responsible.short', 'products.name', 'dcl_org.name', 'statuses.name', 'dcl_contact.last_name', 'dcl_contact.first_name', 'dcl_contact_phone.phone_number', 'dcl_tag.tag_desc', 'summary'));
     $this->oView->AddDef('order', '', array('ticketid'));
     $this->oView->AddDef('columnhdrs', '', array(STR_TCK_TICKET, STR_TCK_RESPONSIBLE, STR_TCK_PRODUCT, STR_TCK_ACCOUNT, STR_TCK_STATUS, 'Last Name', 'First Name', STR_TCK_CONTACTPHONE, STR_CMMN_TAGS, STR_TCK_SUMMARY));
     $objHV = CreateViewObject($this->oView->table);
     $objHV->Render($this->oView);
 }