Re: svn commit: r954583 - /ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.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: r954583 - /ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml

Adam Heath-2
[hidden email] wrote:

> Author: jleroux
> Date: Mon Jun 14 18:40:05 2010
> New Revision: 954583
>
> URL: http://svn.apache.org/viewvc?rev=954583&view=rev
> Log:
> Fix a bug that seems to have been introduced at r934389 for (https://issues.apache.org/jira/browse/OFBIZ-3703) - OFBIZ-3703
>
> This fix a bug in updatePartyContactMech. When you wanted to update only the extension of a phone number it did not get stored.
> I said "that seems to have been introduced" because it's working in stable demo.
>
> I also remove a useless couple of lines at the beginning of the updatePartyContactMech service.
>
> Finally I must say that I find very weird to have extension in PartyContactMech entity. It would be certainly more logical to have in TelecomNumber. Is it really used for anything else than phone number extension?

Several people could share a base TelecomNumber.

However, I agree, having it in PartyContactMech seems wrong.  Why not
have a TelecomNumberExtension contact mech, that extends TelecomNumber?


>
> Modified:
>     ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml
>
> Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml?rev=954583&r1=954582&r2=954583&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml (original)
> +++ ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml Mon Jun 14 18:40:05 2010
> @@ -71,11 +71,6 @@ under the License.
>      </simple-method>
>  
>      <simple-method method-name="updatePartyContactMech" short-description="Update a PartyContactMech">
> -        <make-value entity-name="PartyContactMech" value-field="newPartyContactMech"/>
> -        <if-empty field="parameters.partyId">
> -            <set field="parameters.partyId" from-field="userLogin.partyId"/>
> -        </if-empty>
> -
>          <!-- Find old value -->
>          <make-value entity-name="PartyContactMech" value-field="partyContactMechMap"/>
>          <set-pk-fields value-field="partyContactMechMap" map="parameters"/>
> @@ -85,11 +80,10 @@ under the License.
>          <if-empty field="partyContactMech">
>              <add-error><fail-property resource="PartyUiLabels" property="PartyCannotUpdateContactBecauseNotWithSpecifiedParty"/></add-error>
>          </if-empty>
> -
>          <check-errors/>
>  
>          <clone-value value-field="partyContactMech" new-value-field="newPartyContactMech"/>
> -
> +        
>          <!-- If we already have a new contactMechId don't update ContactMech -->
>          <if-empty field="parameters.newContactMechId">
>              <set-service-fields service-name="updateContactMech" map="parameters" to-map="updateContactMechMap"/>
> @@ -102,12 +96,11 @@ under the License.
>                  <log level="info" message="Using supplied new contact mech id: ${newPartyContactMech.contactMechId}"/>
>              </else>
>          </if-empty>
> -
> -        <set-nonpk-fields value-field="newPartyContactMech" map="parameters"/>
> -        <now-timestamp field="newPartyContactMech.fromDate"/>
> -        <now-timestamp field="partyContactMech.thruDate"/>
> -
> +        
>          <if-compare-field to-field="newPartyContactMech.contactMechId" field="parameters.contactMechId" operator="not-equals">
> +            <set-nonpk-fields value-field="newPartyContactMech" map="parameters"/>
> +            <now-timestamp field="newPartyContactMech.fromDate"/>
> +            <now-timestamp field="partyContactMech.thruDate"/>
>              <store-value value-field="partyContactMech"/>
>              <create-value value-field="newPartyContactMech"/>
>              <get-related value-field="partyContactMech" relation-name="PartyContactMechPurpose" list="partyContactMechPurposes"/>
> @@ -127,11 +120,21 @@ under the License.
>                      <create-value value-field="partyContactMechPurpose"/>
>                  </if-empty>
>              </iterate>
> +            <log level="info" message="Setting id to result: ${newPartyContactMech.contactMechId}"/>
> +            <field-to-result field="newPartyContactMech.contactMechId" result-name="contactMechId"/>
> +            <field-to-request field="newPartyContactMech.contactMechId" request-name="contactMechId"/>
> +            <else>
> +                <if-compare-field field="parameters.extension" operator="not-equals" to-field="partyContactMech.extension">
> +                    <set field="partyContactMech.extension" from-field="parameters.extension"/>
> +                    <set field="partyContactMech.thruDate" value=""/>
> +                    <store-value value-field="partyContactMech"/>
> +                </if-compare-field>
> +                <log level="info" message="Setting id to result: ${partyContactMech.contactMechId}"/>
> +                <field-to-result field="partyContactMech.contactMechId" result-name="contactMechId"/>
> +                <field-to-request field="partyContactMech.contactMechId" request-name="contactMechId"/>
> +            </else>
>          </if-compare-field>
>  
> -        <log level="info" message="Setting id to result: ${newPartyContactMech.contactMechId}"/>
> -        <field-to-result field="newPartyContactMech.contactMechId" result-name="contactMechId"/>
> -        <field-to-request field="newPartyContactMech.contactMechId" request-name="contactMechId"/>
>      </simple-method>
>  
>      <simple-method method-name="deletePartyContactMech" short-description="Delete a PartyContactMech">
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r954583 - /ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml

Jacques Le Roux
Administrator
From: "Adam Heath" <[hidden email]>

> [hidden email] wrote:
>> Author: jleroux
>> Date: Mon Jun 14 18:40:05 2010
>> New Revision: 954583
>>
>> URL: http://svn.apache.org/viewvc?rev=954583&view=rev
>> Log:
>> Fix a bug that seems to have been introduced at r934389 for (https://issues.apache.org/jira/browse/OFBIZ-3703) - OFBIZ-3703
>>
>> This fix a bug in updatePartyContactMech. When you wanted to update only the extension of a phone number it did not get stored.
>> I said "that seems to have been introduced" because it's working in stable demo.
>>
>> I also remove a useless couple of lines at the beginning of the updatePartyContactMech service.
>>
>> Finally I must say that I find very weird to have extension in PartyContactMech entity. It would be certainly more logical to
>> have in TelecomNumber. Is it really used for anything else than phone number extension?
>
> Several people could share a base TelecomNumber.

Yes, this might be the reason, though IMO it would not hurt to have a bit of redundancy there...

> However, I agree, having it in PartyContactMech seems wrong.  Why not
> have a TelecomNumberExtension contact mech, that extends TelecomNumber?

Yes maybe in some cases it could be helpful indeed, but I wonder it is worth the complexity. Don't we have already enough in phone
number area?

Jacques

>
>
>>
>> Modified:
>>     ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml
>>
>> Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml?rev=954583&r1=954582&r2=954583&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml (original)
>> +++ ofbiz/trunk/applications/party/script/org/ofbiz/party/contact/PartyContactMechServices.xml Mon Jun 14 18:40:05 2010
>> @@ -71,11 +71,6 @@ under the License.
>>      </simple-method>
>>
>>      <simple-method method-name="updatePartyContactMech" short-description="Update a PartyContactMech">
>> -        <make-value entity-name="PartyContactMech" value-field="newPartyContactMech"/>
>> -        <if-empty field="parameters.partyId">
>> -            <set field="parameters.partyId" from-field="userLogin.partyId"/>
>> -        </if-empty>
>> -
>>          <!-- Find old value -->
>>          <make-value entity-name="PartyContactMech" value-field="partyContactMechMap"/>
>>          <set-pk-fields value-field="partyContactMechMap" map="parameters"/>
>> @@ -85,11 +80,10 @@ under the License.
>>          <if-empty field="partyContactMech">
>>              <add-error><fail-property resource="PartyUiLabels"
>> property="PartyCannotUpdateContactBecauseNotWithSpecifiedParty"/></add-error>
>>          </if-empty>
>> -
>>          <check-errors/>
>>
>>          <clone-value value-field="partyContactMech" new-value-field="newPartyContactMech"/>
>> -
>> +
>>          <!-- If we already have a new contactMechId don't update ContactMech -->
>>          <if-empty field="parameters.newContactMechId">
>>              <set-service-fields service-name="updateContactMech" map="parameters" to-map="updateContactMechMap"/>
>> @@ -102,12 +96,11 @@ under the License.
>>                  <log level="info" message="Using supplied new contact mech id: ${newPartyContactMech.contactMechId}"/>
>>              </else>
>>          </if-empty>
>> -
>> -        <set-nonpk-fields value-field="newPartyContactMech" map="parameters"/>
>> -        <now-timestamp field="newPartyContactMech.fromDate"/>
>> -        <now-timestamp field="partyContactMech.thruDate"/>
>> -
>> +
>>          <if-compare-field to-field="newPartyContactMech.contactMechId" field="parameters.contactMechId" operator="not-equals">
>> +            <set-nonpk-fields value-field="newPartyContactMech" map="parameters"/>
>> +            <now-timestamp field="newPartyContactMech.fromDate"/>
>> +            <now-timestamp field="partyContactMech.thruDate"/>
>>              <store-value value-field="partyContactMech"/>
>>              <create-value value-field="newPartyContactMech"/>
>>              <get-related value-field="partyContactMech" relation-name="PartyContactMechPurpose"
>> list="partyContactMechPurposes"/>
>> @@ -127,11 +120,21 @@ under the License.
>>                      <create-value value-field="partyContactMechPurpose"/>
>>                  </if-empty>
>>              </iterate>
>> +            <log level="info" message="Setting id to result: ${newPartyContactMech.contactMechId}"/>
>> +            <field-to-result field="newPartyContactMech.contactMechId" result-name="contactMechId"/>
>> +            <field-to-request field="newPartyContactMech.contactMechId" request-name="contactMechId"/>
>> +            <else>
>> +                <if-compare-field field="parameters.extension" operator="not-equals" to-field="partyContactMech.extension">
>> +                    <set field="partyContactMech.extension" from-field="parameters.extension"/>
>> +                    <set field="partyContactMech.thruDate" value=""/>
>> +                    <store-value value-field="partyContactMech"/>
>> +                </if-compare-field>
>> +                <log level="info" message="Setting id to result: ${partyContactMech.contactMechId}"/>
>> +                <field-to-result field="partyContactMech.contactMechId" result-name="contactMechId"/>
>> +                <field-to-request field="partyContactMech.contactMechId" request-name="contactMechId"/>
>> +            </else>
>>          </if-compare-field>
>>
>> -        <log level="info" message="Setting id to result: ${newPartyContactMech.contactMechId}"/>
>> -        <field-to-result field="newPartyContactMech.contactMechId" result-name="contactMechId"/>
>> -        <field-to-request field="newPartyContactMech.contactMechId" request-name="contactMechId"/>
>>      </simple-method>
>>
>>      <simple-method method-name="deletePartyContactMech" short-description="Delete a PartyContactMech">
>>
>>
>