Author: hansbak
Date: Fri Jul 29 02:00:19 2011 New Revision: 1152073 URL: http://svn.apache.org/viewvc?rev=1152073&view=rev Log: (un)subscribe contactlist did not select active records only Modified: ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml ofbiz/trunk/applications/marketing/servicedef/services.xml ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactListUnsubscribeEmail.ftl ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/miniSignUpForContactList.ftl Modified: ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml?rev=1152073&r1=1152072&r2=1152073&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml (original) +++ ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml Fri Jul 29 02:00:19 2011 @@ -239,11 +239,40 @@ under the License. <set field="updateContactListPartyMap.baseLocation" from-field="parameters.baseLocation"/> <call-service service-name="updateContactListParty" in-map-name="updateContactListPartyMap"/> <else> - <add-error><fail-message message="The email address (${parameters.email}) does not have the Other Email Address as contact purpose."/></add-error> - <check-errors/> + <entity-and list="partyContactWithPurposes" entity-name="PartyContactWithPurpose"> + <field-map field-name="infoString" from-field="parameters.email"/> + <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/> + </entity-and> + <filter-list-by-date list="partyContactWithPurposes" from-field-name="contactFromDate" thru-field-name="contactThruDate"/> + <filter-list-by-date list="partyContactWithPurposes" from-field-name="purposeFromDate" thru-field-name="purposeThruDate"/> + <if-not-empty field="partyContactWithPurposes"> + <set field="updateContactListPartyMap.contactListId" from-field="parameters.contactListId"/> + <set field="updateContactListPartyMap.partyId" from-field="partyContactWithPurposes[0].partyId"/> + <set field="updateContactListPartyMap.preferredContactMechId" from-field="partyContactWithPurposes[0].contactMechId"/> + <set field="updateContactListPartyMap.statusId" value="CLPT_UNSUBS_PENDING"/> + <set field="updateContactListPartyMap.userLogin" from-field="userLogin"/> + <set field="updateContactListPartyMap.baseLocation" from-field="parameters.baseLocation"/> + <call-service service-name="updateContactListParty" in-map-name="updateContactListPartyMap"/> + <else> + <add-error><fail-message message="The email address (${parameters.email}) does not have the Other Email Address as contact purpose."/></add-error> + <check-errors/> + </else> + </if-not-empty> </else> </if-not-empty> </simple-method> + <simple-method method-name="unsubscribeContactListPartyContachMech" short-description="Find email by contactMechId then call unsubscribeContactListParty service"> + <entity-and list="partyContactWithPurposes" entity-name="PartyContactWithPurpose"> + <field-map field-name="contactMechId" from-field="parameters.preferredContactMechId"/> + <field-map field-name="partyId" from-field="parameters.partyId"/> + <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/> + </entity-and> + <first-from-list entry="partyContactWithPurpose" list="partyContactWithPurposes"/> + <set field="email" from-field="partyContactWithPurpose.infoString"/> + <set-service-fields service-name="unsubscribeContactListParty" to-map="unsubscribeContactListPartyCtx" map="parameters"/> + <set field="unsubscribeContactListPartyCtx.email" from-field="email"/> + <call-service service-name="unsubscribeContactListParty" in-map-name="unsubscribeContactListPartyCtx"/> + </simple-method> <simple-method method-name="updatePartyEmailContactListParty" short-description="Update ContactList Party Contact Mech"> <set field="lookupMap.preferredContactMechId" from-field="parameters.oldContactMechId"/> <find-by-and entity-name="ContactListParty" map="lookupMap" list="ContactListParties"/> Modified: ofbiz/trunk/applications/marketing/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/servicedef/services.xml?rev=1152073&r1=1152072&r2=1152073&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/servicedef/services.xml (original) +++ ofbiz/trunk/applications/marketing/servicedef/services.xml Fri Jul 29 02:00:19 2011 @@ -88,6 +88,14 @@ under the License. <attribute name="partyId" type="String" mode="IN" optional="true"/> <attribute name="baseLocation" type="String" mode="IN" optional="true"/> </service> + <service name="unsubscribeContactListPartyContachMech" engine="simple" + location="component://marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml" invoke="unsubscribeContactListPartyContachMech" auth="false"> + <description>Find email by contactMechId then call unsubscribeContactListParty service.</description> + <attribute name="contactListId" type="String" mode="IN" optional="false"/> + <attribute name="preferredContactMechId" type="String" mode="IN" optional="false"/> + <attribute name="partyId" type="String" mode="IN" optional="true"/> + <attribute name="baseLocation" type="String" mode="IN" optional="true"/> + </service> <!-- MarketingCampaignRole Services --> <service name="addRoleToMarketingCampaign" default-entity-name="MarketingCampaignRole" engine="simple" Modified: ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactListUnsubscribeEmail.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactListUnsubscribeEmail.ftl?rev=1152073&r1=1152072&r2=1152073&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactListUnsubscribeEmail.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactListUnsubscribeEmail.ftl Fri Jul 29 02:00:19 2011 @@ -21,11 +21,11 @@ under the License. <p class="tabletext">Hello ${partyName.firstName?if_exists} ${partyName.lastName?if_exists} ${partyName.groupName?if_exists}!</p> <p class="tabletext">Successfully unsubscribed from ${contactList.contactListName} contact list.</p> - <#assign verifyUrl = baseEcommerceSecureUrl +'updateContactListPartyNoUserLogin?contactListId='+contactListParty.contactListId+'&partyId='+contactListParty.partyId+'&fromDate='+contactListParty.fromDate+'&statusId=CLPT_SUBS_PENDING&optInVerifyCode='+contactListPartyStatus.optInVerifyCode+'&baseLocation='+baseLocation?if_exists> + <#--assign verifyUrl = baseEcommerceSecureUrl +'updateContactListPartyNoUserLogin?contactListId='+contactListParty.contactListId+'&partyId='+contactListParty.partyId+'&fromDate='+contactListParty.fromDate+'&statusId=CLPT_SUBS_PENDING&optInVerifyCode='+contactListPartyStatus.optInVerifyCode+'&baseLocation='+baseLocation?if_exists> <#if (contactListParty.preferredContactMechId)?exists> <#assign verifyUrl= verifyUrl+"&preferredContactMechId="+contactListParty.preferredContactMechId> </#if> - <a href="${verifyUrl}">If this was by mistake, click here subscribe again.</a> + <a href="${verifyUrl}">If this was by mistake, click here subscribe again.</a--> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=1152073&r1=1152072&r2=1152073&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Fri Jul 29 02:00:19 2011 @@ -1337,6 +1337,12 @@ under the License. <response name="success" type="view" value="main"/> <response name="error" type="view" value="main"/> </request-map> + <request-map uri="unsubscribeContactListPartyContachMech"> + <security https="false" auth="false"/> + <event type="service" invoke="unsubscribeContactListPartyContachMech"/> + <response name="success" type="view" value="main"/> + <response name="error" type="view" value="main"/> + </request-map> <request-map uri="contactListOptOut" track-serverhit="false" track-visit="false"> <security https="false" auth="false"/> <event type="service" invoke="updateContactListPartyNoUserLogin"/> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/miniSignUpForContactList.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/miniSignUpForContactList.ftl?rev=1152073&r1=1152072&r2=1152073&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/miniSignUpForContactList.ftl (original) +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/miniSignUpForContactList.ftl Fri Jul 29 02:00:19 2011 @@ -34,6 +34,12 @@ under the License. document.getElementById("statusId").value = "CLPT_UNSUBS_PENDING"; form.submit(); } + function unsubscribeByContactMech() { + var form = document.getElementById("signUpForContactListForm"); + form.action = "<@ofbizUrl>unsubscribeContactListPartyContachMech</@ofbizUrl>" + document.getElementById("statusId").value = "CLPT_UNSUBS_PENDING"; + form.submit(); + } </script> <div id="miniSignUpForContactList" class="screenlet"> @@ -67,7 +73,7 @@ under the License. </div> <div> <input type="submit" value="${uiLabelMap.EcommerceSubscribe}"/> - <input type="button" value="${uiLabelMap.EcommerceUnsubscribe}" onclick="javascript:unsubscribe();"/> + <input type="button" value="${uiLabelMap.EcommerceUnsubscribe}" onclick="javascript:unsubscribeByContactMech();"/> </div> </fieldset> </form> |
Free forum by Nabble | Edit this page |