Menu

Customize User Portal

Melanie
2015-02-19
2015-11-06
  • Melanie

    Melanie - 2015-02-19

    Hi,

    I have a question regarding user portal. Our company doesn't want to have this click services and subservice category to create a ticket. Also, my opinion is the choice if the ticket will be critical or not should not be a choice of the user (in the end they will always say it's critical :)) They only want to have the last page of it: Inserting a Subject an a Textbody and it will create a unclassified ticket that we from IT will classify. Is there a possibility to do it this way?

    Cheers,

    Melanie

     
  • Melanie

    Melanie - 2015-02-27

    Hi there,

    I have raised this question to combodo and got this reply:


    Hello,

    The portal is a self contained application. Therefore, you can easily modify it and adapt it to your needs. For that purpose, you'll need to look at the <itop>/portal directory and mainly into the index.php file. Everything you need is in that file.</itop>

    Modifying the portal/index.php should not be too complex for a developper.

    Best regard


    Unfortunately I have no knowledge about php and need to find and test a little bit around. Hope I can figure it out where I need to make changes and what.
    Goal is to have still all services and subservices for classification active, but the user doesn't need to choose it in portal. Only IT can classify the tickets to whatever service or incident it is.

     
  • Marco Lima

    Marco Lima - 2015-03-01

    Melanie I was trying to this myself a while back, I will get back to you on Monday when I get to work.

     
  • Marco Lima

    Marco Lima - 2015-03-01

    Just thinking about it a bit you may have to pass "default" values even if you hide them from the user as I think the Services and Service Subcategory are both required values for the ticket life cycle. If they aren't then it's a simple case of omitting the field from the form.

     
  • Melanie

    Melanie - 2015-03-02

    Hey Marco,

    that would not be a problem to have a default value. I have already tried a default Service with one default subservice: I call it "General Ticket" and "General Subservice". If this would work somehow and that me and my colleague can classify it as something else later, then it's perfect :) and it fits the needs we have.

    Thanks,

    Melanie

     
  • Melanie

    Melanie - 2015-03-11

    We got it somehow.... My collegue has php knowledge :) I was also thinking that the change must be around line 220, but I didn't geht it:

    So that's the change for anyone who is interested in customizing the user portal:

    At first you will need to create a Service Family, Service and Subcatergory: I have called them: Family: General Request - Service: General Request - Service Subcategory: General Request Subcategory

    You need to find out now the ID of the Service... In our case it was ID 20

    The idea behind was, creating one Service that has only one subcategory, but still the ability to classify the ticket later to something else.

    Now you can make the changes in the /portal/index.php begins in our file at line 208

    <a href="#">
    function SelectServiceCategory($oP, $oUserOrg)
    {
        $aParameters = $oP->ReadAllParams(PORTAL_ALL_PARAMS.',template_id');
    
        $oSearch = DBObjectSearch::FromOQL(PORTAL_SERVICECATEGORY_QUERY);
        $oSearch->AllowAllData(); // In case the user has the rights on his org only
        $oSet = new CMDBObjectSet($oSearch, array(), array('org_id' => $oUserOrg->GetKey()));
        //if ($oSet->Count() == 1)
        //{
            $oService = $oSet->Fetch();
            $iSvcCategory = $oService->GetKey();
            // Only one Category, skip this step in the wizard
            //SelectServiceSubCategory($oP, $oUserOrg, $iSvcCategory);
            SelectServiceSubCategory($oP, $oUserOrg, 20);  // <==== This is where you         have to insert the ID of the Service
        /* <===== We don't need the else so comment this out
        }
         else
        {
            $oP->add("<div class=\"wizContainer\" id=\"form_select_service\">\n");
            $oP->WizardFormStart('request_wizard', 1);
    
            $oP->add("<h1 id=\"select_category\">".Dict::S('Portal:SelectService')."</h1>\n");
            $oP->add("<table>\n");
            while($oService = $oSet->Fetch())
            {
                $id = $oService->GetKey();
                $sChecked = "";
                if (isset($aParameters['service_id']) && ($id == $aParameters['service_id']))
                {
                    $sChecked = "checked";
                }
                $oP->p("<tr><td style=\"vertical-align:top\"><p><input name=\"attr_service_id\" $sChecked type=\"radio\" id=\"service_$id\" value=\"$id\"></p></td><td style=\"vertical-align:top\"><p><b><label for=\"service_$id\">".$oService->GetName()."</label></b></p>");
                $oP->p("<p>".$oService->GetAsHTML('description')."</p></td></tr>");     
            }
            $oP->add("</table>\n"); 
    
            $oP->DumpHiddenParams($aParameters, array('service_id'));
            $oP->add("<input type=\"hidden\" name=\"operation\" value=\"create_request\">");
            $oP->WizardFormButtons(BUTTON_NEXT | BUTTON_CANCEL); // NO back button since it's the first step of the Wizard
            $oP->WizardFormEnd();
            $oP->WizardCheckSelectionOnSubmit(Dict::S('Portal:PleaseSelectOneService'));
            $oP->add("</div>\n");
        }*/ <====== We don't need the else so comment this out till here
    
    </a>
    

    and a 2nd Part that is not completly needed begins at line 280:

    <a href="#">
    
    
    
    
    
    ///if ($oSet->Count() == 1)
        //{
            // Only one sub service, skip this step of the wizard
            $oSubService = $oSet->Fetch();
            $iSubSvdId = $oSubService->GetKey();
            SelectRequestTemplate($oP, $oUserOrg, $iSvcId, $iSubSvdId);
            //SelectRequestTemplate($oP, $oUserOrg, $iSvcId, 12);
        //}
        //else
        //{
        //  $oServiceCategory = MetaModel::GetObject('Service', $iSvcId, false, true /* allow all data*/);
        /*  if (is_object($oServiceCategory))
            {
                $oP->add("<div class=\"wizContainer\" id=\"form_select_servicesubcategory\">\n");
                $oP->add("<h1 id=\"select_subcategory\">".Dict::Format('Portal:SelectSubcategoryFrom_Service', $oServiceCategory->GetName())."</h1>\n");
                $oP->WizardFormStart('request_wizard', $iDefaultWizNext);
                $oP->add("<table>\n");
                while($oSubService = $oSet->Fetch())
                {
                    $id = $oSubService->GetKey();
                    $sChecked = "";
                    if ($id == $iDefaultSubSvcId)
                    {
                        $sChecked = "checked";
                    }
    
                    $oP->add("<tr>");
    
                    $oP->add("<td style=\"vertical-align:top\">");
                    $oP->add("<p><input name=\"attr_servicesubcategory_id\" $sChecked type=\"radio\" id=\"servicesubcategory_$id\" value=\"$id\"></p>");
                    $oP->add("</td>");
    
                    $oP->add("<td style=\"vertical-align:top\">");
                    $oP->add("<p><b><label for=\"servicesubcategory_$id\">".$oSubService->GetName()."</label></b></p>");
                    $oP->add("<p>".$oSubService->GetAsHTML('description')."</p>");
                    $oP->add("</td>");
                    $oP->add("</tr>");
                }
                $oP->add("</table>\n"); 
                $oP->DumpHiddenParams($aParameters, array('servicesubcategory_id'));
                $oP->add("<input type=\"hidden\" name=\"operation\" value=\"create_request\">");
                $oP->WizardFormButtons(BUTTON_BACK | BUTTON_NEXT | BUTTON_CANCEL); //Back button automatically discarded if on the first page
                $oP->WizardFormEnd();
                $oP->WizardCheckSelectionOnSubmit(Dict::S('Portal:PleaseSelectAServiceSubCategory'));
                $oP->add("</div>\n");
            }
            else
            {
                $oP->p("Error: Invalid Service: id = $iSvcId");
            }
        } */
    
    </a>
    

    It's easy if you see the changes....
    Sorry, I was too stupid to use the copy paste and formatting help :(

    Maybe it's helping others who have the same problem.

    Cheers,

    Mel

     

    Last edit: Melanie 2015-03-11
    • Marco Lima

      Marco Lima - 2015-03-11

      Melanie congratulations to you and your friend!

      You solved it rather elegantly and I must say in a much simpler manner than I would have approached it which was to literally remove the fields and force the values in the background.

      What you basically did was force the ServiceID you needed as the parameter and left the rest of the code pretty much alone and because that ID has only one Service Subcategory associated with it, it automatically selects it when the page loads.

      Good work :)

       
  • Melanie

    Melanie - 2015-03-12

    Thanks :) That's the difference if you have no glue of php or like my collegue who has a good knowledge.
    Next step will be to get rid of the "how urgent" the request is. But that is not "that urgent" :)

     
  • Hari Krishna

    Hari Krishna - 2015-03-27

    I am getting 500 server error when i add the above custom code to portal/index.php, one thing i am not sure, how can we find the index number of the service?

     
    • Al Mulaj

      Al Mulaj - 2015-11-06

      You have to put the text EXACTLY as written above. Don't forget that some lines out of the /.../ blocks are commented out singularly (with //).

      the index number can also be found in the itop.view_servicesubcategory on MySQL workbench.

      by the way, many thanks Melanie, helped me out a lot...

       

      Last edit: Al Mulaj 2015-11-06
  • Melanie

    Melanie - 2015-03-31

    That's easy.....

    Look in the HTML file of the portal page, where you can choose the services. You will find something inside like:

    <tr><td style="vertical-align:top"><p><input name="attr_service_id" type="radio" id="service_9" value="9"></p></td><td style="vertical-align:top"><p><b><label for="service_9">2.1 Microsoft Office / Outlook</label></b></p><p></p>
    

    The number behind value= is important, that's the number of the service id.
    I don't know if there is a difference in the files for the portal index, in case you have the itil version of itop installed. Maybe someone else can help you to find this out because I never had the complete itop for ITIL installed. We only need the small ticketsystem version without incident management :)

    Cheers Mel

     

    Last edit: Melanie 2015-03-31

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.