Author: jaz
Date: Fri May 8 05:59:37 2009 New Revision: 772850 URL: http://svn.apache.org/viewvc?rev=772850&view=rev Log: since NEWSLETTER type marketing emails do not create unique communication events, added fields to keep track of party/message ID for these messages Modified: ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml ofbiz/trunk/applications/marketing/servicedef/secas.xml ofbiz/trunk/applications/marketing/servicedef/services.xml ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml Modified: ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml?rev=772850&r1=772849&r2=772850&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml Fri May 8 05:59:37 2009 @@ -191,6 +191,8 @@ <field name="contactListId" type="id-ne"></field> <field name="communicationEventId" type="id-ne"></field> <field name="contactMechId" type="id-ne"></field> + <field name="partyId" type="id"></field> + <field name="messageId" type="value"></field> <field name="statusId" type="id-ne"></field> <prim-key field="contactListId"/> <prim-key field="communicationEventId"/> @@ -204,9 +206,15 @@ <relation type="one" fk-name="CNCT_LST_CST_CM" rel-entity-name="ContactMech"> <key-map field-name="contactMechId"/> </relation> + <relation type="one" fk-name="CNCT_LST_CST_PT" rel-entity-name="Party"> + <key-map field-name="partyId"/> + </relation> <relation type="one" fk-name="CNCT_LST_CST_ST" rel-entity-name="StatusItem"> <key-map field-name="statusId"/> </relation> + <index name="CNTLSTCST_MSG_ID" unique="true"> + <index-field name="messageId"/> + </index> </entity> <entity entity-name="ContactListParty" package-name="org.ofbiz.marketing.contact" 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=772850&r1=772849&r2=772850&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 May 8 05:59:37 2009 @@ -127,6 +127,19 @@ </if> <check-errors/> + <!-- if fromDate is not found; look up the latest record --> + <if-empty field="parameters.fromDate"> + <entity-condition entity-name="ContactListPartyStatus" list="lookupList"> + <condition-list combine="and"> + <condition-expr field-name="contactListId" from-field="parameters.contactListId"/> + <condition-expr field-name="partyId" from-field="parameters.partyId"/> + </condition-list> + <order-by field-name="-statusDate"/> + </entity-condition> + <first-from-list entry="lastRecord" list="lookupList"/> + <set field="parameters.fromDate" from-field="lastRecord.fromDate"/> + </if-empty> + <entity-one entity-name="ContactList" value-field="contactList"/> <call-simple-method method-name="inlineCheckContactListMechType"/> <call-simple-method method-name="inlineCheckContactListStatusParameter"/> @@ -172,10 +185,10 @@ </if> <check-errors/> - <make-value entity-name="ContactListPartyStatus" value-field="newEntity"/> + <make-value entity-name="ContactListPartyStatus" value-field="newEntity"/> <set-pk-fields map="parameters" value-field="newEntity"/> <set-nonpk-fields map="parameters" value-field="newEntity"/> - + <now-timestamp field="newEntity.statusDate"/> <set from-field="userLogin.userLoginId" field="newEntity.setByUserLoginId"/> @@ -215,7 +228,8 @@ </then> </else-if> </if> - + + <log level="info" message="Wrote record : ${newEntity}"/> <create-value value-field="newEntity"/> </simple-method> @@ -281,4 +295,29 @@ </else> </if> </simple-method> + + <simple-method method-name="updateContactListCommStatus" short-description="Update ContactList Communication Status"> + <entity-one entity-name="ContactListCommStatus" value-field="lookedUpValue" auto-field-map="true"/> + <if-empty field="lookedUpValue"> + <make-value entity-name="ContactListCommStatus" value-field="lookedUpValue"/> + <set-pk-fields map="parameters" value-field="lookedUpValue"/> + <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> + <create-value value-field="lookedUpValue"/> + <else> + <set-nonpk-fields map="parameters" value-field="lookedUpValue"/> + <store-value value-field="lookedUpValue"/> + </else> + </if-empty> + </simple-method> + + <simple-method method-name="updateCommStatusFromCommEvent" short-description="Update ContactList Comm Status from CommunicationEvent"> + <entity-and list="clcs" entity-name="ContactListCommStatus"> + <field-map field-name="communicationEventId" from-field="parameters.communicationEventId"/> + </entity-and> + <iterate entry="commStatus" list="clcs"> + <set-service-fields service-name="updateContactListCommStatus" to-map="updateStatusCtx" map="commStatus"/> + <set field="updateStatusCtx.statusId" from-field="parameters.statusId"/> + <call-service service-name="updateContactListCommStatus" in-map-name="updateStatusCtx"/> + </iterate> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/marketing/servicedef/secas.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/servicedef/secas.xml?rev=772850&r1=772849&r2=772850&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/servicedef/secas.xml (original) +++ ofbiz/trunk/applications/marketing/servicedef/secas.xml Fri May 8 05:59:37 2009 @@ -27,7 +27,21 @@ <eca service="updatePartyEmailAddress" event="return"> <action service="updatePartyEmailContactListParty" mode="sync"/> </eca> - + + <!-- update contact list communication status --> + <eca service="updateCommunicationEvent" event="commit"> + <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/> + <action mode="sync" service="updateCommStatusFromCommEvent"/> + </eca> + + <!-- update contact list party for bounced messages --> + <eca service="updateContactListCommStatus" event="commit"> + <condition field-name="statusId" operator="equals" value="COM_BOUNCED"/> + <condition field-name="partyId" operator="is-not-empty"/> + <set field-name="statusId" value="CLPT_INVALID"/> + <action service="updateContactListParty" mode="sync"/> + </eca> + <!-- quick add functions which pass a contactListId as well --> <eca service="createLead" event="commit"> <condition field-name="contactListId" operator="is-not-empty"/> Modified: ofbiz/trunk/applications/marketing/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/servicedef/services.xml?rev=772850&r1=772849&r2=772850&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/servicedef/services.xml (original) +++ ofbiz/trunk/applications/marketing/servicedef/services.xml Fri May 8 05:59:37 2009 @@ -142,8 +142,9 @@ location="component://marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml" invoke="updateContactListParty" auth="true"> <description>Update Party to ContactList Join</description> <auto-attributes include="pk" mode="IN" optional="false"/> - <auto-attributes include="nonpk" mode="IN" optional="true"/> + <auto-attributes include="nonpk" mode="IN" optional="true"/> <attribute name="optInVerifyCode" type="String" mode="IN" optional="true"/> + <override name="fromDate" optional="true"/> </service> <service name="updatePartyEmailContactListParty" engine="simple" location="component://marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml" invoke="updatePartyEmailContactListParty" auth="true"> @@ -166,6 +167,7 @@ <exclude field-name="setByUserLoginId"/> </auto-attributes> <override name="statusId" optional="false"/> + <override name="fromDate" optional="true"/> </service> <service name="sendContactListPartyVerifyEmail" engine="simple" max-retry="3" location="component://marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml" invoke="sendContactListPartyVerifyEmail" auth="true"> @@ -173,7 +175,19 @@ <auto-attributes entity-name="ContactListParty" include="pk" mode="IN" optional="false"/> </service> - + <!-- ContactList Comm Status Services --> + <service name="updateContactListCommStatus" engine="simple" default-entity-name="ContactListCommStatus" + location="component://marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml" invoke="updateContactListCommStatus"> + <auto-attributes include="all" mode="IN" optional="false"/> + <override name="partyId" optional="true"/> + <override name="messageId" allow-html="any" optional="true"/> + </service> + <service name="updateCommStatusFromCommEvent" engine="simple" + location="component://marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml" invoke="updateCommStatusFromCommEvent"> + <attribute name="communicationEventId" type="String" mode="IN"/> + <attribute name="statusId" type="String" mode="IN"/> + </service> + <!-- TrackingCode Services --> <service name="createTrackingCode" default-entity-name="TrackingCode" engine="simple" location="component://marketing/script/org/ofbiz/marketing/tracking/TrackingCodeServices.xml" invoke="createTrackingCode" auth="true"> Modified: ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy?rev=772850&r1=772849&r2=772850&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy (original) +++ ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/actions/contact/GetContactListMarketingEmail.groovy Fri May 8 05:59:37 2009 @@ -28,7 +28,10 @@ if (!contactMechs || contactMechs.size() == 0) { contactMechs = ownerParty.getRelatedByAnd("PartyContactMechPurpose", [contactMechPurposeTypeId : "PRIMARY_EMAIL"]); } - context.marketingEmail = contactMechs.get(0); - //context.contactMechIdFrom = context.marketingEmail.contactMechId; + + if (contactMechs != null && contactMechs.size() > 0) { + context.marketingEmail = contactMechs.get(0); + //context.contactMechIdFrom = context.marketingEmail.contactMechId; + } } } Modified: ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml?rev=772850&r1=772849&r2=772850&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml (original) +++ ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml Fri May 8 05:59:37 2009 @@ -503,7 +503,7 @@ </sub-hyperlink> </display-entity> </field> - <field name="contactMechId"><display-entity entity-name="ContactMech" description="${infoString}"/></field> + <field name="contactMechId" title="${uiLabelMap.CommonEmailTo}"><display-entity entity-name="ContactMech" description="${infoString}"/></field> <field name="lastUpdatedStamp" title="${uiLabelMap.FormFieldTitle_lastModifiedDate}"><display/></field> <field name="statusId"><display-entity entity-name="StatusItem" description="${description}"/></field> </form> |
Free forum by Nabble | Edit this page |