diff --git a/datamodels/1.x/itop-request-mgmt-1.0.0/main.itop-request-mgmt.php b/datamodels/1.x/itop-request-mgmt-1.0.0/main.itop-request-mgmt.php
index 59464a946..32b4ba1cb 100644
--- a/datamodels/1.x/itop-request-mgmt-1.0.0/main.itop-request-mgmt.php
+++ b/datamodels/1.x/itop-request-mgmt-1.0.0/main.itop-request-mgmt.php
@@ -33,4 +33,11 @@ define('PORTAL_REQUEST_FORM_ATTRIBUTES', 'title,description,impact,urgency,workg
define('PORTAL_ATTCODE_TYPE', ''); // optional if the type has to be set
define('PORTAL_SET_TYPE_FROM', ''); // The attribute to get the type from (Subcategory)
+define('PORTAL_TICKETS_LIST_ZLIST', 'finalclass,title,start_date,status,servicesubcategory_id,priority,caller_id');
+define('PORTAL_TICKETS_SEARCH_CRITERIA','ref,start_date,close_date,service_id,caller_id');
+define('PORTAL_TICKETS_CLOSED_ZLIST', 'title,start_date,close_date,servicesubcategory_id');
+// json encoded lists for the portal...
+define('PORTAL_TICKET_DETAILS_ZLIST', '{"col:left":["ref","caller_id","servicesubcategory_id","title","description","solution"],"col:right":["status","priority","start_date","resolution_date","last_update","agent_id"]}');
+
+
?>
diff --git a/datamodels/2.x/itop-request-mgmt-itil/main.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/main.itop-request-mgmt-itil.php
index 79a6b2449..b0e43da00 100755
--- a/datamodels/2.x/itop-request-mgmt-itil/main.itop-request-mgmt-itil.php
+++ b/datamodels/2.x/itop-request-mgmt-itil/main.itop-request-mgmt-itil.php
@@ -33,4 +33,9 @@ define('PORTAL_REQUEST_FORM_ATTRIBUTES', 'title,description,impact,urgency');
define('PORTAL_ATTCODE_TYPE', ''); // optional if the type has to be set
define('PORTAL_SET_TYPE_FROM', ''); // The attribute to get the type from (Subcategory)
+define('PORTAL_TICKETS_LIST_ZLIST', 'finalclass,title,start_date,status,servicesubcategory_id,priority,caller_id');
+define('PORTAL_TICKETS_SEARCH_CRITERIA','ref,start_date,close_date,service_id,caller_id');
+define('PORTAL_TICKETS_CLOSED_ZLIST', 'title,start_date,close_date,servicesubcategory_id');
+// json encoded lists for the portal...
+define('PORTAL_TICKET_DETAILS_ZLIST', '{"col:left":["ref","caller_id","servicesubcategory_id","title","description","solution"],"col:right":["status","priority","start_date","resolution_date","last_update","agent_id"]}');
?>
diff --git a/datamodels/2.x/itop-request-mgmt/main.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/main.itop-request-mgmt.php
index e1b0224c4..9e601dfdc 100755
--- a/datamodels/2.x/itop-request-mgmt/main.itop-request-mgmt.php
+++ b/datamodels/2.x/itop-request-mgmt/main.itop-request-mgmt.php
@@ -33,4 +33,9 @@ define('PORTAL_REQUEST_FORM_ATTRIBUTES', 'title,description,impact,urgency');
define('PORTAL_ATTCODE_TYPE', 'request_type'); // optional if the type has to be set
define('PORTAL_SET_TYPE_FROM', 'request_type'); // The attribute to get the type from (Subcategory)
+define('PORTAL_TICKETS_LIST_ZLIST', 'finalclass,title,start_date,status,servicesubcategory_id,priority,caller_id');
+define('PORTAL_TICKETS_SEARCH_CRITERIA','ref,start_date,close_date,service_id,caller_id');
+define('PORTAL_TICKETS_CLOSED_ZLIST', 'title,start_date,close_date,servicesubcategory_id');
+// json encoded lists for the portal...
+define('PORTAL_TICKET_DETAILS_ZLIST', '{"col:left":["ref","caller_id","servicesubcategory_id","title","description","solution"],"col:right":["status","priority","start_date","resolution_date","last_update","agent_id"]}');
?>
diff --git a/portal/index.php b/portal/index.php
index 925c48dca..8f559c643 100644
--- a/portal/index.php
+++ b/portal/index.php
@@ -84,33 +84,43 @@ function SelectServiceCategory($oP, $oUserOrg)
{
$aParameters = $oP->ReadAllParams(PORTAL_ALL_PARAMS);
- $oP->add("
\n");
+ }
}
/**
@@ -118,14 +128,23 @@ function SelectServiceCategory($oP, $oUserOrg)
* and based on the page's parameter 'service_id'
* @param WebPage $oP Web page for the form output
* @param Organization $oUserOrg The organization of the current user
+ * @param $iSvcId Id of the selected service in case of pass-through (when there is only one service)
* @return void
*/
-function SelectServiceSubCategory($oP, $oUserOrg)
+function SelectServiceSubCategory($oP, $oUserOrg, $iSvcId = null)
{
$aParameters = $oP->ReadAllParams(PORTAL_ALL_PARAMS);
-
- $iSvcId = $aParameters['service_id'];
+ $iWizardButtons = 0;
+ if ($iSvcId == null)
+ {
+ $iSvcId = $aParameters['service_id'];
+ }
+ else
+ {
+ $aParameters['service_id'] = $iSvcId;
+ $iWizardButtons = BUTTON_NEXT;
+ }
$iDefaultSubSvcId = isset($aParameters['servicesubcategory_id']) ? $aParameters['servicesubcategory_id'] : 0;
$iDefaultWizNext = 2;
@@ -133,45 +152,56 @@ function SelectServiceSubCategory($oP, $oUserOrg)
$oSearch = DBObjectSearch::FromOQL(PORTAL_SERVICE_SUBCATEGORY_QUERY);
$oSearch->AllowAllData(); // In case the user has the rights on his org only
$oSet = new CMDBObjectSet($oSearch, array(), array('svc_id' => $iSvcId, 'org_id' => $oUserOrg->GetKey()));
- $oServiceCategory = MetaModel::GetObject('Service', $iSvcId, false, true /* allow all data*/);
- if (is_object($oServiceCategory))
+ if ($oSet->Count() == 1)
{
- $oP->add("\n");
+ // Only one sub service, skip this step of the wizard
+ $oSubService = $oSet->Fetch();
+ $iSubSvdId = $oSubService->GetKey();
+ RequestCreationForm($oP, $oUserOrg, $iSvcId, $iSubSvdId);
}
else
{
- $oP->p("Error: Invalid Service: id = $iSvcId");
+ $oServiceCategory = MetaModel::GetObject('Service', $iSvcId, false, true /* allow all data*/);
+ if (is_object($oServiceCategory))
+ {
+ $oP->add("\n");
+ }
+ else
+ {
+ $oP->p("Error: Invalid Service: id = $iSvcId");
+ }
}
}
@@ -179,9 +209,11 @@ function SelectServiceSubCategory($oP, $oUserOrg)
* Displays the form for the final step of the UserRequest creation
* @param WebPage $oP The current web page for the form output
* @param Organization $oUserOrg The organization of the current user
+ * @param integer $iSvcId The identifier of the service (in cal of fall through, when there is only one service)
+ * @param integer $iSubSvcId The identifier of the sub-service (in cal of fall through, when there is only one sub-service)
* @return void
*/
-function RequestCreationForm($oP, $oUserOrg)
+function RequestCreationForm($oP, $oUserOrg, $iSvcId = null, $iSubSvcId = null)
{
$oP->add_script(
<<ReadAllParams(PORTAL_ALL_PARAMS);
-
+ if ($iSvcId != null)
+ {
+ $aParameters['service_id'] = $iSvcId;
+ }
+ if ($iSubSvcId != null)
+ {
+ $aParameters['servicesubcategory_id'] = $iSubSvcId;
+ }
+
// Example: $aList = array('title', 'description', 'impact', 'emergency');
$aList = explode(',', PORTAL_REQUEST_FORM_ATTRIBUTES);
@@ -418,7 +458,7 @@ function ListOpenRequests(WebPage $oP)
$oSearch->AddCondition('caller_id', $iUser);
}
$oSet = new CMDBObjectSet($oSearch, array(), array('org_id' => $oUserOrg->GetKey()));
- $aZList = array('finalclass', 'title', 'start_date', 'status', 'servicesubcategory_id', 'priority', 'caller_id');
+ $aZList = explode(',', PORTAL_TICKETS_LIST_ZLIST);
$oP->DisplaySet($oSet, $aZList, Dict::S('Portal:NoOpenRequest'));
}
@@ -439,7 +479,7 @@ function ListResolvedRequests(WebPage $oP)
$oSearch->AddCondition('caller_id', $iUser);
}
$oSet = new CMDBObjectSet($oSearch, array(), array('org_id' => $oUserOrg->GetKey()));
- $aZList = array('finalclass', 'title', 'start_date', 'status', 'servicesubcategory_id', 'priority', 'caller_id');
+ $aZList = explode(',', PORTAL_TICKETS_LIST_ZLIST);
$oP->DisplaySet($oSet, $aZList, Dict::S('Portal:NoOpenRequest'));
}
@@ -450,8 +490,8 @@ function ListResolvedRequests(WebPage $oP)
*/
function ListClosedTickets(WebPage $oP)
{
- $aAttSpecs = array('ref', 'start_date', 'close_date', 'service_id', 'caller_id');
- $aZList = array('title', 'start_date', 'close_date', 'servicesubcategory_id');
+ $aAttSpecs = explode(',', PORTAL_TICKETS_SEARCH_CRITERIA);
+ $aZList = explode(',', PORTAL_TICKETS_CLOSED_ZLIST);
$oP->DisplaySearchForm('UserRequest', $aAttSpecs, array('operation' => 'show_closed'), 'search_', false /* => not closed */);
@@ -503,7 +543,7 @@ function DisplayObject($oP, $oObj, $oUserOrg)
* @return void
*/
function ShowDetailsRequest(WebPage $oP, $oObj)
-{
+{
$sClass = get_class($oObj);
$bIsEscalateButton = false;
@@ -557,7 +597,8 @@ function ShowDetailsRequest(WebPage $oP, $oObj)
switch($sClass)
{
case 'UserRequest':
- $aAttList = array('col:left'=> array('ref','caller_id','servicesubcategory_id','title','description'),'col:right'=> array('status','priority','start_date','resolution_date','last_update','agent_id'));
+ $aAttList = json_decode(PORTAL_TICKET_DETAILS_ZLIST, true);
+
switch($oObj->GetState())
{
case 'closed':