Party Main Role

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Party Main Role

Chris Snow-3
In the party find screen, there is a column to show the Party's Main Role.

Where is the party main role stored?

Many thanks in advance,

Chris
Reply | Threaded
Open this post in threaded view
|

Re: Party Main Role

Rishi Solanki
Hi,
It is coming from RoleType entity in the dropdown.
The Party main role as well as any other role is stored in PartyRole like ;
BUYER, SALES_REP, CUSTOMER etc.

Rishi Solanki
Enterprise Software Developer
HotWax Media Pvt. Ltd.


On Wed, Mar 24, 2010 at 4:53 PM, Christopher Snow <
[hidden email]> wrote:

> In the party find screen, there is a column to show the Party's Main Role.
>
> Where is the party main role stored?
>
> Many thanks in advance,
>
> Chris
>
Reply | Threaded
Open this post in threaded view
|

Re: Party Main Role

chris snow-2
Hi Rishi,  how is the main role differentiated from the other roles?

Many thanks,

Chris

On Wed, Mar 24, 2010 at 1:41 PM, Rishi Solanki <[hidden email]>wrote:

> Hi,
> It is coming from RoleType entity in the dropdown.
> The Party main role as well as any other role is stored in PartyRole like ;
> BUYER, SALES_REP, CUSTOMER etc.
>
> Rishi Solanki
> Enterprise Software Developer
> HotWax Media Pvt. Ltd.
>
>
> On Wed, Mar 24, 2010 at 4:53 PM, Christopher Snow <
> [hidden email]> wrote:
>
> > In the party find screen, there is a column to show the Party's Main
> Role.
> >
> > Where is the party main role stored?
> >
> > Many thanks in advance,
> >
> > Chris
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Party Main Role

Ashish Vijaywargiya
Here is the code from ftl file:

            <td>
              <#assign mainRole =
dispatcher.runSync("getPartyMainRole",
Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId",
partyRow.partyId, "userLogin", userLogin))/>
              ${mainRole.description?if_exists}
            </td>

Here is the code from service definition:
    <service name="getPartyMainRole" engine="simple"
            location="component://party/script/org/ofbiz/party/party/PartyServices.xml"
invoke="getPartyMainRole">
        <description>Get the main role of this party which is a child
of the MAIN_ROLE roletypeId</description>
        <attribute name="partyId" type="String" mode="IN" optional="false"/>
        <attribute name="roleTypeId" type="String" mode="OUT" optional="true"/>
        <attribute name="description" type="String" mode="OUT" optional="true"/>
    </service>

Here is the code from Mini Lang:
    <simple-method method-name="getPartyMainRole"
        short-description="Get the main role of this party which is a
child of the MAIN_ROLE roletypeId">
        <entity-and entity-name="PartyRole" list="partyRoles">
            <field-map field-name="partyId" from-field="parameters.partyId" />
        </entity-and>
        <!-- find the role in the list -->
        <clear-field field="mainRoleTypeId"/>
        <iterate entry="partyRole" list="partyRoles">
            <if-empty field="mainRoleTypeId">
                <entity-and entity-name="RoleTypeIn3Levels"
list="roleTypeIn3Levels">
                    <field-map field-name="topRoleTypeId" value="MAIN_ROLE" />
                    <field-map field-name="lowRoleTypeId"
from-field="partyRole.roleTypeId" />
                </entity-and>
                <if-not-empty field="roleTypeIn3Levels">
                    <set field="mainRoleTypeId"
from-field="partyRole.roleTypeId" />
                </if-not-empty>
            </if-empty>
        </iterate>
        <if-not-empty field="mainRoleTypeId">
            <field-to-result field="mainRoleTypeId" result-name="roleTypeId" />
            <entity-one entity-name="RoleType" value-field="roleType">
                <field-map field-name="roleTypeId"
from-field="mainRoleTypeId" />
            </entity-one>
            <field-to-result result-name="description"
field="roleType.description" />
        </if-not-empty>
    </simple-method>

Please let me me know if you need any help to understand the code.
In short refer RoleTypeIn3Levels entity. :-)

Thanks!

--
Ashish


On Wed, Mar 24, 2010 at 7:15 PM, chris snow <[hidden email]> wrote:

> Hi Rishi,  how is the main role differentiated from the other roles?
>
> Many thanks,
>
> Chris
>
> On Wed, Mar 24, 2010 at 1:41 PM, Rishi Solanki <[hidden email]>wrote:
>
>> Hi,
>> It is coming from RoleType entity in the dropdown.
>> The Party main role as well as any other role is stored in PartyRole like ;
>> BUYER, SALES_REP, CUSTOMER etc.
>>
>> Rishi Solanki
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>>
>>
>> On Wed, Mar 24, 2010 at 4:53 PM, Christopher Snow <
>> [hidden email]> wrote:
>>
>> > In the party find screen, there is a column to show the Party's Main
>> Role.
>> >
>> > Where is the party main role stored?
>> >
>> > Many thanks in advance,
>> >
>> > Chris
>> >
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Party Main Role

BJ Freeman
In reply to this post by Rishi Solanki
look at
    <simple-method method-name="getPartyMainRole"
under
party/scrips/org/ofbiz/party/party/partyservices.xml

=========================
BJ Freeman
http://bjfreeman.elance.com
Strategic Power Office with Supplier Automation <http://www.businessesnetwork.com/automation/viewforum.php?f=93>
Specialtymarket.com <http://www.specialtymarket.com/>

Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man
Linkedin
<http://www.linkedin.com/profile?viewProfile=&key=1237480&locale=en_US&trk=tab_pro>


chris snow sent the following on 3/24/2010 6:45 AM:

> Hi Rishi,  how is the main role differentiated from the other roles?
>
> Many thanks,
>
> Chris
>
> On Wed, Mar 24, 2010 at 1:41 PM, Rishi Solanki <[hidden email]>wrote:
>
>> Hi,
>> It is coming from RoleType entity in the dropdown.
>> The Party main role as well as any other role is stored in PartyRole like ;
>> BUYER, SALES_REP, CUSTOMER etc.
>>
>> Rishi Solanki
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>>
>>
>> On Wed, Mar 24, 2010 at 4:53 PM, Christopher Snow <
>> [hidden email]> wrote:
>>
>>> In the party find screen, there is a column to show the Party's Main
>> Role.
>>> Where is the party main role stored?
>>>
>>> Many thanks in advance,
>>>
>>> Chris
>>>
>


Reply | Threaded
Open this post in threaded view
|

Re: Party Main Role

Chris Snow-3
In reply to this post by Ashish Vijaywargiya
Hi Ashish,

That makes it easy to "get" the main party role.  How does one "set" the
main party role?

Many thanks,

Chris


Ashish Vijaywargiya wrote:

> Here is the code from ftl file:
>
>             <td>
>               <#assign mainRole =
> dispatcher.runSync("getPartyMainRole",
> Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId",
> partyRow.partyId, "userLogin", userLogin))/>
>               ${mainRole.description?if_exists}
>             </td>
>
> Here is the code from service definition:
>     <service name="getPartyMainRole" engine="simple"
>             location="component://party/script/org/ofbiz/party/party/PartyServices.xml"
> invoke="getPartyMainRole">
>         <description>Get the main role of this party which is a child
> of the MAIN_ROLE roletypeId</description>
>         <attribute name="partyId" type="String" mode="IN" optional="false"/>
>         <attribute name="roleTypeId" type="String" mode="OUT" optional="true"/>
>         <attribute name="description" type="String" mode="OUT" optional="true"/>
>     </service>
>
> Here is the code from Mini Lang:
>     <simple-method method-name="getPartyMainRole"
>         short-description="Get the main role of this party which is a
> child of the MAIN_ROLE roletypeId">
>         <entity-and entity-name="PartyRole" list="partyRoles">
>             <field-map field-name="partyId" from-field="parameters.partyId" />
>         </entity-and>
>         <!-- find the role in the list -->
>         <clear-field field="mainRoleTypeId"/>
>         <iterate entry="partyRole" list="partyRoles">
>             <if-empty field="mainRoleTypeId">
>                 <entity-and entity-name="RoleTypeIn3Levels"
> list="roleTypeIn3Levels">
>                     <field-map field-name="topRoleTypeId" value="MAIN_ROLE" />
>                     <field-map field-name="lowRoleTypeId"
> from-field="partyRole.roleTypeId" />
>                 </entity-and>
>                 <if-not-empty field="roleTypeIn3Levels">
>                     <set field="mainRoleTypeId"
> from-field="partyRole.roleTypeId" />
>                 </if-not-empty>
>             </if-empty>
>         </iterate>
>         <if-not-empty field="mainRoleTypeId">
>             <field-to-result field="mainRoleTypeId" result-name="roleTypeId" />
>             <entity-one entity-name="RoleType" value-field="roleType">
>                 <field-map field-name="roleTypeId"
> from-field="mainRoleTypeId" />
>             </entity-one>
>             <field-to-result result-name="description"
> field="roleType.description" />
>         </if-not-empty>
>     </simple-method>
>
> Please let me me know if you need any help to understand the code.
> In short refer RoleTypeIn3Levels entity. :-)
>
> Thanks!
>
> --
> Ashish
>
>
> On Wed, Mar 24, 2010 at 7:15 PM, chris snow <[hidden email]> wrote:
>  
>> Hi Rishi,  how is the main role differentiated from the other roles?
>>
>> Many thanks,
>>
>> Chris
>>
>> On Wed, Mar 24, 2010 at 1:41 PM, Rishi Solanki <[hidden email]>wrote:
>>
>>    
>>> Hi,
>>> It is coming from RoleType entity in the dropdown.
>>> The Party main role as well as any other role is stored in PartyRole like ;
>>> BUYER, SALES_REP, CUSTOMER etc.
>>>
>>> Rishi Solanki
>>> Enterprise Software Developer
>>> HotWax Media Pvt. Ltd.
>>>
>>>
>>> On Wed, Mar 24, 2010 at 4:53 PM, Christopher Snow <
>>> [hidden email]> wrote:
>>>
>>>      
>>>> In the party find screen, there is a column to show the Party's Main
>>>>        
>>> Role.
>>>      
>>>> Where is the party main role stored?
>>>>
>>>> Many thanks in advance,
>>>>
>>>> Chris
>>>>
>>>>        

Reply | Threaded
Open this post in threaded view
|

Re: Party Main Role

Ashish Vijaywargiya
AFAIK we don't have any GUI support for it.
You may need to play with Webtools to add supporting data.
Please refer commit done at r814287 for more details.

--
Ashish

On Wed, Mar 24, 2010 at 8:34 PM, Christopher Snow
<[hidden email]> wrote:

> Hi Ashish,
>
> That makes it easy to "get" the main party role.  How does one "set" the
> main party role?
>
> Many thanks,
>
> Chris
>
>
> Ashish Vijaywargiya wrote:
>>
>> Here is the code from ftl file:
>>
>>            <td>
>>              <#assign mainRole =
>> dispatcher.runSync("getPartyMainRole",
>> Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId",
>> partyRow.partyId, "userLogin", userLogin))/>
>>              ${mainRole.description?if_exists}
>>            </td>
>>
>> Here is the code from service definition:
>>    <service name="getPartyMainRole" engine="simple"
>>
>>  location="component://party/script/org/ofbiz/party/party/PartyServices.xml"
>> invoke="getPartyMainRole">
>>        <description>Get the main role of this party which is a child
>> of the MAIN_ROLE roletypeId</description>
>>        <attribute name="partyId" type="String" mode="IN"
>> optional="false"/>
>>        <attribute name="roleTypeId" type="String" mode="OUT"
>> optional="true"/>
>>        <attribute name="description" type="String" mode="OUT"
>> optional="true"/>
>>    </service>
>>
>> Here is the code from Mini Lang:
>>    <simple-method method-name="getPartyMainRole"
>>        short-description="Get the main role of this party which is a
>> child of the MAIN_ROLE roletypeId">
>>        <entity-and entity-name="PartyRole" list="partyRoles">
>>            <field-map field-name="partyId" from-field="parameters.partyId"
>> />
>>        </entity-and>
>>        <!-- find the role in the list -->
>>        <clear-field field="mainRoleTypeId"/>
>>        <iterate entry="partyRole" list="partyRoles">
>>            <if-empty field="mainRoleTypeId">
>>                <entity-and entity-name="RoleTypeIn3Levels"
>> list="roleTypeIn3Levels">
>>                    <field-map field-name="topRoleTypeId" value="MAIN_ROLE"
>> />
>>                    <field-map field-name="lowRoleTypeId"
>> from-field="partyRole.roleTypeId" />
>>                </entity-and>
>>                <if-not-empty field="roleTypeIn3Levels">
>>                    <set field="mainRoleTypeId"
>> from-field="partyRole.roleTypeId" />
>>                </if-not-empty>
>>            </if-empty>
>>        </iterate>
>>        <if-not-empty field="mainRoleTypeId">
>>            <field-to-result field="mainRoleTypeId"
>> result-name="roleTypeId" />
>>            <entity-one entity-name="RoleType" value-field="roleType">
>>                <field-map field-name="roleTypeId"
>> from-field="mainRoleTypeId" />
>>            </entity-one>
>>            <field-to-result result-name="description"
>> field="roleType.description" />
>>        </if-not-empty>
>>    </simple-method>
>>
>> Please let me me know if you need any help to understand the code.
>> In short refer RoleTypeIn3Levels entity. :-)
>>
>> Thanks!
>>
>> --
>> Ashish
>>
>>
>> On Wed, Mar 24, 2010 at 7:15 PM, chris snow <[hidden email]>
>> wrote:
>>
>>>
>>> Hi Rishi,  how is the main role differentiated from the other roles?
>>>
>>> Many thanks,
>>>
>>> Chris
>>>
>>> On Wed, Mar 24, 2010 at 1:41 PM, Rishi Solanki
>>> <[hidden email]>wrote:
>>>
>>>
>>>>
>>>> Hi,
>>>> It is coming from RoleType entity in the dropdown.
>>>> The Party main role as well as any other role is stored in PartyRole
>>>> like ;
>>>> BUYER, SALES_REP, CUSTOMER etc.
>>>>
>>>> Rishi Solanki
>>>> Enterprise Software Developer
>>>> HotWax Media Pvt. Ltd.
>>>>
>>>>
>>>> On Wed, Mar 24, 2010 at 4:53 PM, Christopher Snow <
>>>> [hidden email]> wrote:
>>>>
>>>>
>>>>>
>>>>> In the party find screen, there is a column to show the Party's Main
>>>>>
>>>>
>>>> Role.
>>>>
>>>>>
>>>>> Where is the party main role stored?
>>>>>
>>>>> Many thanks in advance,
>>>>>
>>>>> Chris
>>>>>
>>>>>
>
>