Author: hansbak
Date: Thu May 14 04:50:22 2009 New Revision: 774632 URL: http://svn.apache.org/viewvc?rev=774632&view=rev Log: forward and reply fixes on commevent Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml ofbiz/trunk/applications/party/servicedef/services.xml ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml?rev=774632&r1=774631&r2=774632&view=diff ============================================================================== --- ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml (original) +++ ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml Thu May 14 04:50:22 2009 @@ -33,8 +33,20 @@ </simple-method> <simple-method method-name="createCommunicationEvent" short-description="Create a CommunicationEvent with or w/o permission check"> - <!-- create basic info for communication event --> - <make-value value-field="newEntity" entity-name="CommunicationEvent"/> + <!-- check for forward --> + <if-not-empty field="parameters.origCommEventId"> + <entity-one entity-name="CommunicationEvent" value-field="newEntity"> + <field-map field-name="communicationEventId" from-field="parameters.origCommEventId"/> + </entity-one> + <clear-field field="newEntity.communicationEventId"/> + <clear-field field="newEntity.partyIdFrom"/> + <clear-field field="newEntity.partyIdTo"/> + <set field="newEntity.subject" value="Forw: ${newEntity.subject}"/> + <else><!-- if not create empty one --> + <make-value value-field="newEntity" entity-name="CommunicationEvent"/> + </else> + </if-not-empty> + <set-nonpk-fields map="parameters" value-field="newEntity"/> <if-empty field="parameters.communicationEventId"> @@ -44,8 +56,8 @@ </else> </if-empty> <field-to-result field="newEntity.communicationEventId" result-name="communicationEventId"/> - - <!-- check for reply or forward --> + + <!-- check for reply --> <if-not-empty field="parameters.parentCommEventId"> <entity-one entity-name="CommunicationEvent" value-field="parentCommEvent"> <field-map field-name="communicationEventId" from-field="parameters.parentCommEventId"/> @@ -55,32 +67,34 @@ </entity-one> <if-compare-field field="parentCommEvent.partyIdFrom" operator="equals" to-field="parameters.partyIdTo"> - <!-- concider this as a reply --> <set field="newEntity.partyIdTo" from-field="parentCommEvent.partyIdFrom"/> </if-compare-field> + + <set field="newEntity.subject" value="RE: ${parentCommEvent.subject}"/> <set field="newEntity.content" value="${groovy: def localContent = parentCommEvent.content; - if (!localContent || localContent.indexOf("\n",0) == -1) return(""); + if (!localContent) return(""); resultLine = "\n\n\n" + (partyNameView.firstName!=null?partyNameView.firstName:"") + " " + (partyNameView.middleName!=null?partyNameView.middleName+" ":"") + " " - + (partyNameView.lastName!=null?partyNameView.lastName:" ") + + (partyNameView.lastName!=null?partyNameView.lastName:"") + + (partyNameView.groupName!=null?partyNameView.groupName:"") + " wrote:"; - resultLine += "\n\n\n\n\n -------------------------------------------------------------------- "; - resultLine += "\n> " + localContent.substring(0, localContent.indexOf("\n",0)); + resultLine += "\n -------------------------------------------------------------------- "; + resultLine += "\n> " + localContent.substring(0, localContent.indexOf("\n",0) == -1 ? localContent.length() : localContent.indexOf("\n",0)); startChar = localContent.indexOf("\n",0); while(startChar != -1 && (startChar = localContent.indexOf("\n",startChar) + 1) != 0) resultLine += "\n> " + localContent.substring(startChar, localContent.indexOf("\n",startChar)==-1 ? localContent.length() : localContent.indexOf("\n",startChar)); return(resultLine); }"/> - <!-- set rolestatus from original email to completed if logged-on userId can be found --> + <!-- set rolestatus from original email to completed --> <entity-and list="roles" entity-name="CommunicationEventRole"> - <field-map field-name="communicationEventId" from-field="parentCommEvent.parentCommEventId"/> + <field-map field-name="communicationEventId" from-field="parentCommEvent.communicationEventId"/> <field-map field-name="partyId" from-field="parentCommEvent.partyIdTo"/> </entity-and> <if-not-empty field="roles"> @@ -111,6 +125,16 @@ </if-not-empty> </if-empty> + <!-- if partyId provided but no contactMechIdTo get emailAddress --> + <if-not-empty field="parameters.partyIdTo"> + <if-empty field="parameters.contactMechIdTo"> + <set field="getEmail.partyId" from-field="parameters.partyIdTo"/> + <call-service service-name="getPartyEmail" in-map-name="getEmail"> + <result-to-field result-name="contacMechId" field="newEntity.ContactMechIdTo"/> + </call-service> + </if-empty> + </if-not-empty> + <now-timestamp field="newEntity.entryDate"/> <create-value value-field="newEntity"/> Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml?rev=774632&r1=774631&r2=774632&view=diff ============================================================================== --- ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml (original) +++ ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml Thu May 14 04:50:22 2009 @@ -658,17 +658,30 @@ </simple-method> <simple-method method-name="getPartyEmail" short-description="Get the email of the party"> - <set field="findMap.partyId" from-field="parameters.partyId"/> - <set field="findMap.contactMechTypeId" value="EMAIL_ADDRESS"/> - <find-by-and entity-name="PartyAndContactMech" map="findMap" list="emailAddressesAll"/> - <if-empty field="emailAddressesAll"> - <set field="findMap.contactMechTypeId" value="ELECTRONIC_ADDRESS"/> - <find-by-and entity-name="PartyAndContactMech" map="findMap" list="emailAddressesAll"/> + <!-- first try to find primary email Address when not found get other email --> + <entity-and entity-name="PartyContactMechPurpose" list="emailAddresses" filter-by-date="true"> + <field-map field-name="partyId" from-field="parameters.partyId"/> + <field-map field-name="contactMechPurposeTypeId" from-field="PRIMARY_EMAIL"/> + </entity-and> + <!-- any other email --> + <if-empty field="emailAddresses"> + <entity-and entity-name="PartyAndContactMech" list="emailAddresses" filter-by-date="true"> + <field-map field-name="partyId" from-field="parameters.partyId"/> + <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/> + </entity-and> + </if-empty> + <!-- any other electronic address --> + <if-empty field="emailAddresses"> + <entity-and entity-name="PartyAndContactMech" list="emailAddresses" filter-by-date="true"> + <field-map field-name="partyId" from-field="parameters.partyId"/> + <field-map field-name="contactMechTypeId" value="ELECTRONIC_ADDRESS"/> + </entity-and> </if-empty> - <now-date-to-env field="fromDate"/> - <filter-list-by-date list="emailAddressesAll" from-field-name="fromDate" to-list="emailAddresses"/> - <first-from-list entry="emailAddress" list="emailAddresses"/> - <field-to-result field="emailAddress.infoString" result-name="emailAddress"/> + <if-not-empty field="emailAddresses"> + <first-from-list entry="emailAddress" list="emailAddresses"/> + <field-to-result field="emailAddress.infoString" result-name="emailAddress"/> + <field-to-result field="emailAddress.contactMechId" result-name="contactMechId"/> + </if-not-empty> </simple-method> <simple-method method-name="getPartyTelephone" short-description="Get the telephone number of the party"> Modified: ofbiz/trunk/applications/party/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=774632&r1=774631&r2=774632&view=diff ============================================================================== --- ofbiz/trunk/applications/party/servicedef/services.xml (original) +++ ofbiz/trunk/applications/party/servicedef/services.xml Thu May 14 04:50:22 2009 @@ -922,6 +922,7 @@ <description>Get the main party Email address</description> <attribute name="partyId" type="String" mode="IN" optional="false"/> <attribute name="emailAddress" type="String" mode="OUT" optional="true"/> + <attribute name="contactMechId" type="String" mode="OUT" optional="true"/> </service> <service name="getPartyTelephone" engine="simple" Modified: ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml?rev=774632&r1=774631&r2=774632&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml Thu May 14 04:50:22 2009 @@ -172,6 +172,7 @@ </form> <form name="EditInternalNote" type="single" target="createCommunicationEvent" default-map-name="communicationEvent"> <actions> + <set field="nowDate" value="${bsh:org.ofbiz.base.util.UtilDateTime.nowDateString("yyyy-MM-dd HH:mm:ss.S")}" type="String"/> <script location="component://party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy"/> </actions> <alt-target use-when="communicationEvent!=null" target="updateCommunicationEvent"/> @@ -179,19 +180,20 @@ <field name="communicationEventTypeId"><hidden value="COMMENT_NOTE"/></field> <field name="parentCommEventId"><hidden value="${parameters.parentCommEventId}"/></field> <field name="statusId"><hidden value="COM_PENDING"/></field> + <field name="datetimeStarted"><hidden/></field> <field name="partyIdFrom"><hidden/></field> <field name="partyIdTo" title="${uiLabelMap.PartyPartyTo}"> <drop-down> <list-options list-name="recentParties" key-name="partyId" description="${firstName} ${middleName} ${lastName} ${groupName}"/> </drop-down> </field> - <field name="subject"><text size="60" default-value="${parameters.subject}"/></field> + <field name="subject"><text size="60"/></field> <field name="contentMimeTypeId"><hidden value="text/plain"/></field> - <field name="content" title="${uiLabelMap.CommonContent}"><textarea cols="60" rows="10" default-value="${parameters.content}"/></field> + <field name="content" title="${uiLabelMap.CommonContent}" encode-output="false"><textarea cols="72" rows="15" default-value="${parameters.content}"/></field> <field name="send" title=" " position="1" use-when="communicationEvent!=null"> <hyperlink also-hidden="true" target-type="plain" description="${uiLabelMap.CommonSend}" - target="javascript:(document.EditInternalNote.statusId.value='COM_COMPLETE'),(document.EditInternalNote.submit())"/> + target="javascript:(document.EditInternalNote.statusId.value='COM_COMPLETE'),(document.EditInternalNote.datetimeStarted.value='${nowDate}'),(document.EditInternalNote.submit())"/> </field> <field name="save" title=" " position="2" use-when="communicationEvent!=null"> <hyperlink also-hidden="true" target-type="plain" description="${uiLabelMap.CommonSave}" target="javascript:(document.EditInternalNote.submit())"/> Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml?rev=774632&r1=774631&r2=774632&view=diff ============================================================================== --- ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml (original) +++ ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml Thu May 14 04:50:22 2009 @@ -392,14 +392,14 @@ </condition> <link target="NewDraftCommunicationEvent"> <parameter param-name="communicationEventTypeId" from-field="communicationEvent.communicationEventTypeId"/> - <parameter param-name="parentCommEventId" from-field="parameters.communicationEventId"/> - <parameter param-name="partyIdFrom" from-field="partyId"/> + <parameter param-name="parentCommEventId" from-field="communicationEvent.communicationEventId"/> + <parameter param-name="partyIdFrom" from-field="parameters.partyId"/> <parameter param-name="my" value="My"/> <parameter param-name="statusId" value="COM_PENDING"/> <parameter param-name="partyIdTo" from-field="communicationEvent.partyIdFrom"/> </link> </menu-item> - <menu-item name="forward" title="${uiLabelMap.PartyForward}(${partyId})"> + <menu-item name="forward" title="${uiLabelMap.PartyForward}"> <condition> <and> <not><if-empty field="communicationEvent"/></not> @@ -410,8 +410,8 @@ </condition> <link target="NewDraftCommunicationEvent"> <parameter param-name="communicationEventTypeId" from-field="communicationEvent.communicationEventTypeId"/> - <parameter param-name="originalCommEventId" from-field="parameters.communicationEventId"/> - <parameter param-name="partyIdFrom" from-field="partyId"/> + <parameter param-name="origCommEventId" from-field="parameters.communicationEventId"/> + <parameter param-name="partyIdFrom" from-field="parameters.partyId"/> <parameter param-name="my" value="My"/> <parameter param-name="statusId" value="COM_PENDING"/> </link> |
Free forum by Nabble | Edit this page |