You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Shiny Vijyaraghavan <sh...@gmail.com> on 2010/05/05 03:07:12 UTC

How to pass partyID to ListEmplLeaves form

Hi,

I am pretty new to Ofbiz. I am trying to create a "Total available leave"
function in OfBiz HR module. I would like to reuse the ListEmplLeaves form
to list out the current taken leaves of the employee. Sssuming I have the
partyId available, which I would take from the session, How do I pass the
partyID to the below?

*This is my screen:*
<screen name="TotalLeaveBalance">
        <section>
            <actions>
                <set field="titleProperty" value="HumanLeaveBalance"/>
                <set field="headerItem" value="Leave Balance"/>
                <set field="emplLeaveCtx" from-field="10010" type="Long"/>
               * <set field="partyId" value="10010" type="Long"/> <!-- I
have hardcoded the party ID for now.-->*
            </actions>
            <widgets>
                <decorator-screen name="main-decorator"
location="${parameters.mainDecoratorLocation}">
                 <decorator-section name="search-results">
                     <include-form name="ListEmplLeaves"
location="component://humanres/widget/forms/EmplLeaveForms.xml"/>
                 </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

*This is the already available for Form to list employee leaves in Ofbiz HR
module:*
 <form name="ListEmplLeaves" type="multi" use-row-submit="true"
separate-columns="true" target="updateEmplLeaveExt?partyId=${partyId}"
list-name="listIt" paginate-target="FindEmplLeaves"
        odd-row-style="alternate-row" header-row-style="header-row-2"
default-table-style="basic-table hover-bar">
        <actions>
            <service service-name="performFind" result-map="result"
result-map-list="listIt">
                <field-map field-name="inputFields"
from-field="parameters"/>
                <field-map field-name="entityName" value="EmplLeave"/>
                <field-map field-name="orderBy" value="fromDate"/>
            </service>
            <set field="insideEmployee"
from-field="parameters.insideEmployee"/>
        </actions>
        <alt-target use-when="insideEmployee==null"
target="updateEmplLeave"/>
        <auto-fields-service service-name="updateEmplLeave"/>
        <field name="partyId"><display/></field>
        <field name="leaveTypeId"><display/></field>
        <field name="fromDate"><display/></field>
        <field name="_rowSubmit" title="${uiLabelMap.CommonSelect}"><hidden
value="Y"/></field>
        <field name="submitButton" title="${uiLabelMap.CommonSubmit}"
widget-style="smallSubmit"><submit/></field>
    </form>

Thanks,
Shiny

Re: How to pass partyID to ListEmplLeaves form

Posted by Jacques Le Roux <ja...@les7arts.com>.
If you have it in the session you can use the from-scope field attribute, for session use user.

Jacques

From: "Shiny Vijyaraghavan" <sh...@gmail.com>
> Hi,
> 
> I am pretty new to Ofbiz. I am trying to create a "Total available leave"
> function in OfBiz HR module. I would like to reuse the ListEmplLeaves form
> to list out the current taken leaves of the employee. Sssuming I have the
> partyId available, which I would take from the session, How do I pass the
> partyID to the below?
> 
> *This is my screen:*
> <screen name="TotalLeaveBalance">
>        <section>
>            <actions>
>                <set field="titleProperty" value="HumanLeaveBalance"/>
>                <set field="headerItem" value="Leave Balance"/>
>                <set field="emplLeaveCtx" from-field="10010" type="Long"/>
>               * <set field="partyId" value="10010" type="Long"/> <!-- I
> have hardcoded the party ID for now.-->*
>            </actions>
>            <widgets>
>                <decorator-screen name="main-decorator"
> location="${parameters.mainDecoratorLocation}">
>                 <decorator-section name="search-results">
>                     <include-form name="ListEmplLeaves"
> location="component://humanres/widget/forms/EmplLeaveForms.xml"/>
>                 </decorator-section>
>                </decorator-screen>
>            </widgets>
>        </section>
>    </screen>
> 
> *This is the already available for Form to list employee leaves in Ofbiz HR
> module:*
> <form name="ListEmplLeaves" type="multi" use-row-submit="true"
> separate-columns="true" target="updateEmplLeaveExt?partyId=${partyId}"
> list-name="listIt" paginate-target="FindEmplLeaves"
>        odd-row-style="alternate-row" header-row-style="header-row-2"
> default-table-style="basic-table hover-bar">
>        <actions>
>            <service service-name="performFind" result-map="result"
> result-map-list="listIt">
>                <field-map field-name="inputFields"
> from-field="parameters"/>
>                <field-map field-name="entityName" value="EmplLeave"/>
>                <field-map field-name="orderBy" value="fromDate"/>
>            </service>
>            <set field="insideEmployee"
> from-field="parameters.insideEmployee"/>
>        </actions>
>        <alt-target use-when="insideEmployee==null"
> target="updateEmplLeave"/>
>        <auto-fields-service service-name="updateEmplLeave"/>
>        <field name="partyId"><display/></field>
>        <field name="leaveTypeId"><display/></field>
>        <field name="fromDate"><display/></field>
>        <field name="_rowSubmit" title="${uiLabelMap.CommonSelect}"><hidden
> value="Y"/></field>
>        <field name="submitButton" title="${uiLabelMap.CommonSubmit}"
> widget-style="smallSubmit"><submit/></field>
>    </form>
> 
> Thanks,
> Shiny
>