3 Replies Latest reply: Jan 30, 2012 10:30 PM by Luke Marson RSS

Employee portrait issue in Orgchart 3.0 SP2

Emilio Ciotta
Currently Being Moderated

Hello again,

 

We have a issue in how to upload the employee portrait in OrgChart 3.0 SP2. Our customer doesn't have the portraits in SAP server. They have it in a folder on another server.

 

According with my basic research, Nakisa could support this situation. My question is How???

 

1.- In Application-wide Settings > General Settings, there are two fields:

.- Portraits Path

.- Portraits Image Extension

 

I guess that in portrait path, we must fill it with the path "folder" (//folder/). The employee portrait are saved using their PERNR, so, should we configure the Details panel? How?

Unfortunately, the files are saved only with the numeric part, I mean: 1234.jpg, instead of 00001234.jpg. Is there a problem?

 

2.- The SAP RFC SAP_EMPLOYEE_PICTURE, also should we configure it? or the POS_Portrait_3L.xsl template??

 

I really want to know the behavior.

 

Best regards

  • Re: Employee portrait issue in Orgchart 3.0 SP2
    Luke Marson
    Currently Being Moderated

    Hi Emilio,

     

    Sure, this is possible (even with the filename not having the leading zeros) and I have done it at a client before. If your application server is a Windows server then you can create a shared drive to the folder that contains the images. Then you can map this in the admin console (e.g. P:\ or P:\Photos\). In the details panel there should already be a section with the XSL so you need to make sure the field used is the Personnel number (PERNR?) and not the image url (URI).

     

    You will need to customize the XSL (or copy it and create a new version) in order to add some code to remove the leading zeros from the Personnel ID field value. This should work:

     

        <xsl:when test="starts-with(/cds/data/record/field[@name='PERNR'],'0')">
          <xsl:call-template name="removeLeadingZeros">
            <xsl:with-param name="originalString">
              <xsl:value-of select="substring-after((/cds/data/record/field[@name='PERNR'],'0' )"/>
            </xsl:with-param>
          </xsl:call-template>
        </xsl:when>

     

    Remember to change PERNR to the Personnel ID field if it is not PERNR.

     

    Finding the XSL template might be tricky, but the best place to start is by looking at SAPPositionDetailConfiguration.xml in the ..\AppResources\detailconfiguration folder in your build folder.

     

    Best regards,

     

    Luke

    • Re: Employee portrait issue in Orgchart 3.0 SP2
      Emilio Ciotta
      Currently Being Moderated

      Hello Luke, thanks for your reply

       

      In order to edit the XSL template, this was what I did:

       

      .- In my build folder (root/.system) I looked for the XML configuration file. Finally I found it and read it. I found a section into this tags: <presentation>EmployeePictureXSL</presentation>. I guess that the template is EmployeePictureXSL.. right?

       

      .-Well, with this informations, I found these files:

       

      \root\Templates

      \root\.system\application\Templates

      \root\.system\Admin_Config\__000__SAP_Live_GB\Picture (my build)

       

      Which one should we edit? (Guess "\root\.system\application\Templates")

       

      Thank and best regards

       

      Edited by: Emilio Ciotta on Jan 29, 2012 8:36 PM

      • Re: Employee portrait issue in Orgchart 3.0 SP2
        Luke Marson
        Currently Being Moderated

        Hi Emilio,

         

        I just checked and for the Live version the Position details panel uses the template SAPDirectEmployeePhotoXSL, found in ..\root\Templates_SAP. You should copy this file to ..\root\.system\Admin_config\<build>\.delta\root\Templates_SAP. If the root and/or Templates_SAP folder doesn't exist in the .delta folder then create it. Remember to use the same case for folders.

         

        Make the necessary changes in the file. Please note that my previous code was sample code. Below is some code that should work in the XSL file. Replace:

         

        <xsl:choose>
            <xsl:when test="string-length(normalize-space(string(/cds/data/record[1]/field[@name=$fieldname]))) >0">
                <img src="{/cds/data/record[1]/field[@name=$fieldname]}" class="PhotoSize" width="70" border="0" onerror="javascript:this.src='images/portraits/na.jpg'" />
              </xsl:when>
              <xsl:otherwise>
              <img src="images/portraits/na.gif" class="PhotoSize" width="70" border="0"/>
              </xsl:otherwise>
        </xsl:choose>

        With:

        <xsl:choose>
          <xsl:when test="string-length(normalize-space(string(/cds/data/record[1]/field[@name=$fieldname]))) > 0">
            <xsl:choose>
              <xsl:when test="starts-with(/cds/data/record/field[@name='PERNR'],'0')">
                <img src="{substring-after((/cds/data/record/field[@name='PERNR'],'0')}.jpg" class="PhotoSize" width="70" border="0" onerror="javascript:this.src='images/portraits/na.jpg'" />
              </xsl:when>
              <xsl:otherwise>
                <img src="{/cds/data/record[1]/field[@name='PERNR']}.jpg" class="PhotoSize" width="70" border="0" onerror="javascript:this.src='images/portraits/na.jpg'" />
              </xsl:otherwise>
            </xsl:choose>
          </xsl:when>
          <xsl:otherwise>
            <img src="images/portraits/na.gif" class="PhotoSize" width="70" border="0"/>
          </xsl:otherwise>
        </xsl:choose>

         

        Good luck!

         

        Luke

Actions