User login : system does not have related Party
-----------------------------------------------

                 Key: OFBIZ-4231
                 URL: https://issues.apache.org/jira/browse/OFBIZ-4231
             Project: OFBiz
          Issue Type: Bug
    Affects Versions: Release Branch 10.04
         Environment: Data scope: SEED
            Reporter: Sergei


I faced a problem, which will appear for the seed db initialization (not 
demo)!!! 
I have setup email sending for order confirmation, the each new email has  the 
attachment in PDF. During the mail sending chain of services are called (via 
callback events) and in the end of the chain these services are called:

    <!-- dataresource role ecas -->
    <eca service="createDataResourceRole" event="invoke">
        <action service="ensurePartyRole" mode="sync" run-as-user="system"/>
    </eca>

    <service name="ensurePartyRole" engine="simple"
            
location="component://party/script/org/ofbiz/party/party/PartySimpleMethods.xml"
 invoke="ensureNaPartyRole" auth="false">
        <description>Ensure that the party is in the specified 
role.</description>
        <attribute name="partyId" type="String" mode="IN" optional="true"/>
        <attribute name="roleTypeId" type="String" mode="IN" optional="false"/>
    </service>

as you can see these services are called by "system" UserLogin.
ensurePartyRole - throws an exception, because of partyId = null. I researched 
db model, and found that the UserLogin "system" exists, but without a party. 
However, these methods are called after the mail was sent, but the overall 
transaction is rollbacked, so the next retries fire the same problems, as 
result we have 3 retries and 3 mails in the mailbox.
To fix this problem, I have created the "system" party and associated it with 
the UserLogin (I got it from the Demo data):

    <!-- Party for System UserLogin Account - just in case logic depends on it 
-->
    <Party partyId="system" partyTypeId="PERSON"/>
    <Person partyId="system" firstName="System" lastName="Account"/>
    <!-- various automated processes will cause it to be put in this role 
anyway -->
    <PartyRole partyId="system" roleTypeId="PACKER"/>
    <UserLogin userLoginId="system" partyId="system"/>



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to