Re: svn commit: r690942 - in /ofbiz/trunk/applications/ecommerce: script/org/ofbiz/ecommerce/customer/CustomerEvents.xml webapp/ecommerce/WEB-INF/controller.xml

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

Re: svn commit: r690942 - in /ofbiz/trunk/applications/ecommerce: script/org/ofbiz/ecommerce/customer/CustomerEvents.xml webapp/ecommerce/WEB-INF/controller.xml

David E Jones

You could use the ProductStore setting that already exists (and has previously been used on the new customer screen) to
determine whether or not this is used.

-David

[hidden email] wrote:

> Author: mor
> Date: Mon Sep  1 04:44:10 2008
> New Revision: 690942
>
> URL: http://svn.apache.org/viewvc?rev=690942&view=rev
> Log:
> Added a new event that set userloginId from an email address. If user edit email address then set it as a new userLoginId and
> disabled date to far in the future for existing userLoginId.
> This is a new feature to new profile page.
>
> Thanks to Rishi Solanki for this work and Sumit Pandit and Mridul Pathak for review.
>
>
> Modified:
>     ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
>     ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
>
> Modified: ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml?rev=690942&r1=690941&r2=690942&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml (original)
> +++ ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml Mon Sep  1 04:44:10 2008
> @@ -1493,4 +1493,47 @@
>          <call-simple-method method-name="createUpdateEmailAddress"/>
>      </simple-method>
>  
> +    <simple-method method-name="setUserLoginFromEmail" short-description="Set userloginId from email. If user edit email address then set it as a new userLoginId and disabled date to far in the future for existing userLoginId">
> +        <if-compare field="parameters.userLoginId" operator="not-equals" value="userLogin.userLoginId">
> +            <set-service-fields service-name="updateUserLoginId" map-name="parameters" to-map-name="serviceContext"/>
> +            <set field="serviceContext.userLogin" from-field="userLogin"/>
> +            <call-service service-name="updateUserLoginId" in-map-name="serviceContext">
> +                <result-to-field result-name="newUserLogin"/>
> +            </call-service>
> +            <set-current-user-login value-name="newUserLogin"/>
> +            <call-bsh>
> +                <![CDATA[
> +                    org.ofbiz.webapp.control.LoginWorker.doBasicLogin(newUserLogin, request);
> +                    org.ofbiz.webapp.control.LoginWorker.autoLoginSet(request, response);
> +                ]]>
> +            </call-bsh>
> +            <!-- disabledDateTime/disableForYears set time until a user login remains disabled -->
> +            <if-not-empty field="parameters.disabledDateTime">
> +                <set field="disabledDateTime" from-field="parameters.disabledDateTime" type="Date"/>
> +            <else>
> +                <now-date-to-env env-name="nowTimeStamp"/>
> +                <if-not-empty field="parameters.disableForYear">
> +                    <set-calendar field="disabledDateTime" from-field="nowTimeStamp" years="${parameters.disableForYear}"/>
> +                <else>
> +                    <set-calendar field="disabledDateTime" from-field="nowTimeStamp" years="20"/>
> +                </else>
> +                </if-not-empty>
> +            </else>
> +            </if-not-empty>
> +            <set field="loggedInUser.disabledDateTime" from-field="disabledDateTime"/>
> +            <set field="loggedInUser.enabled" value="N"/>
> +            <store-value value-name="loggedInUser"/>
> +        </if-compare>
> +    </simple-method>
> +
> +    <simple-method method-name="updateProfileAndUserLoginFromEmail" short-description="Update a customer profile and userloginId from email">
> +        <set field="partyId" from-field="userLogin.partyId"/>
> +        <set field="parameters.userLoginId" from-field="parameters.emailAddress"/>
> +        <set field="loggedInUser" from-field="userLogin"/>
> +        <call-simple-method method-name="createUpdatePerson"/>
> +        <call-simple-method method-name="setUserLoginFromEmail"/>
> +        <call-simple-method method-name="createUpdateUserLogin"/>
> +        <call-simple-method method-name="createUpdateEmailAddress"/>
> +    </simple-method>
> +
>  </simple-methods>
> \ No newline at end of file
>
> Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=690942&r1=690941&r2=690942&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original)
> +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Mon Sep  1 04:44:10 2008
> @@ -1719,6 +1719,8 @@
>      <request-map uri="updateCustomerProfile">
>          <security https="true" auth="true"/>
>          <event type="simple" path="org/ofbiz/ecommerce/customer/CustomerEvents.xml" invoke="updateCustomerProfile"/>
> +        <!-- Use following event only if email address will be used as userLoginId. Updating email address will set it as new userLoginId and disable existing userLoginId -->
> +        <!--event type="simple" path="org/ofbiz/ecommerce/customer/CustomerEvents.xml" invoke="updateProfileAndUserLoginFromEmail"/-->
>          <response name="success" type="view" value="viewprofile"/>
>          <response name="error" type="view" value="EditProfile"/>
>      </request-map>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r690942 - in /ofbiz/trunk/applications/ecommerce: script/org/ofbiz/ecommerce/customer/CustomerEvents.xml webapp/ecommerce/WEB-INF/controller.xml

Vikas Mayur-2
Thanks David for review.
Done improvements in rev. 691119.

- Vikas

On Mon, Sep 1, 2008 at 7:01 PM, David E. Jones <[hidden email]>wrote:

>
> You could use the ProductStore setting that already exists (and has
> previously been used on the new customer screen) to determine whether or not
> this is used.
>
> -David
>
>
> [hidden email] wrote:
>
>> Author: mor
>> Date: Mon Sep  1 04:44:10 2008
>> New Revision: 690942
>>
>> URL: http://svn.apache.org/viewvc?rev=690942&view=rev
>> Log:
>> Added a new event that set userloginId from an email address. If user edit
>> email address then set it as a new userLoginId and disabled date to far in
>> the future for existing userLoginId.
>> This is a new feature to new profile page.
>>
>> Thanks to Rishi Solanki for this work and Sumit Pandit and Mridul Pathak
>> for review.
>>
>>
>> Modified:
>>
>>  ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
>>
>>  ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
>>
>> Modified:
>> ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml?rev=690942&r1=690941&r2=690942&view=diff
>>
>> ==============================================================================
>> ---
>> ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
>> (original)
>> +++
>> ofbiz/trunk/applications/ecommerce/script/org/ofbiz/ecommerce/customer/CustomerEvents.xml
>> Mon Sep  1 04:44:10 2008
>> @@ -1493,4 +1493,47 @@
>>         <call-simple-method method-name="createUpdateEmailAddress"/>
>>     </simple-method>
>>  +    <simple-method method-name="setUserLoginFromEmail"
>> short-description="Set userloginId from email. If user edit email address
>> then set it as a new userLoginId and disabled date to far in the future for
>> existing userLoginId">
>> +        <if-compare field="parameters.userLoginId" operator="not-equals"
>> value="userLogin.userLoginId">
>> +            <set-service-fields service-name="updateUserLoginId"
>> map-name="parameters" to-map-name="serviceContext"/>
>> +            <set field="serviceContext.userLogin"
>> from-field="userLogin"/>
>> +            <call-service service-name="updateUserLoginId"
>> in-map-name="serviceContext">
>> +                <result-to-field result-name="newUserLogin"/>
>> +            </call-service>
>> +            <set-current-user-login value-name="newUserLogin"/>
>> +            <call-bsh>
>> +                <![CDATA[
>> +
>>  org.ofbiz.webapp.control.LoginWorker.doBasicLogin(newUserLogin, request);
>> +
>>  org.ofbiz.webapp.control.LoginWorker.autoLoginSet(request, response);
>> +                ]]>
>> +            </call-bsh>
>> +            <!-- disabledDateTime/disableForYears set time until a user
>> login remains disabled -->
>> +            <if-not-empty field="parameters.disabledDateTime">
>> +                <set field="disabledDateTime"
>> from-field="parameters.disabledDateTime" type="Date"/>
>> +            <else>
>> +                <now-date-to-env env-name="nowTimeStamp"/>
>> +                <if-not-empty field="parameters.disableForYear">
>> +                    <set-calendar field="disabledDateTime"
>> from-field="nowTimeStamp" years="${parameters.disableForYear}"/>
>> +                <else>
>> +                    <set-calendar field="disabledDateTime"
>> from-field="nowTimeStamp" years="20"/>
>> +                </else>
>> +                </if-not-empty>
>> +            </else>
>> +            </if-not-empty>
>> +            <set field="loggedInUser.disabledDateTime"
>> from-field="disabledDateTime"/>
>> +            <set field="loggedInUser.enabled" value="N"/>
>> +            <store-value value-name="loggedInUser"/>
>> +        </if-compare>
>> +    </simple-method>
>> +
>> +    <simple-method method-name="updateProfileAndUserLoginFromEmail"
>> short-description="Update a customer profile and userloginId from email">
>> +        <set field="partyId" from-field="userLogin.partyId"/>
>> +        <set field="parameters.userLoginId"
>> from-field="parameters.emailAddress"/>
>> +        <set field="loggedInUser" from-field="userLogin"/>
>> +        <call-simple-method method-name="createUpdatePerson"/>
>> +        <call-simple-method method-name="setUserLoginFromEmail"/>
>> +        <call-simple-method method-name="createUpdateUserLogin"/>
>> +        <call-simple-method method-name="createUpdateEmailAddress"/>
>> +    </simple-method>
>> +
>>  </simple-methods>
>> \ No newline at end of file
>>
>> Modified:
>> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=690942&r1=690941&r2=690942&view=diff
>>
>> ==============================================================================
>> ---
>> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
>> (original)
>> +++
>> ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
>> Mon Sep  1 04:44:10 2008
>> @@ -1719,6 +1719,8 @@
>>     <request-map uri="updateCustomerProfile">
>>         <security https="true" auth="true"/>
>>         <event type="simple"
>> path="org/ofbiz/ecommerce/customer/CustomerEvents.xml"
>> invoke="updateCustomerProfile"/>
>> +        <!-- Use following event only if email address will be used as
>> userLoginId. Updating email address will set it as new userLoginId and
>> disable existing userLoginId -->
>> +        <!--event type="simple"
>> path="org/ofbiz/ecommerce/customer/CustomerEvents.xml"
>> invoke="updateProfileAndUserLoginFromEmail"/-->
>>         <response name="success" type="view" value="viewprofile"/>
>>         <response name="error" type="view" value="EditProfile"/>
>>     </request-map>
>>
>>
>>