Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
With the suppression of all jar to download them form jcenter, the jpim.jar isn't present.

To resolve this issue we can convert the current use for import/export vcard by an other api ez-vcard (https://github.com/mangstadt/ez-vcard) under bsd licence and present on jcenter.

The refactoring raise some problem on existant code, we will try with Gil to improve the import/export to grow data conversion to functional framework.
Some improve on import :
 * check if more than one email is present before check the prefered else take the one
 * check if more than one phone is present before check the prefered else take the one
 * check if more than one address is present before check the prefered else take the one
 * When you load a party by vcard, initialize a reference by fn attribute on PartyIndentification to escape the second loading
Will need continue improve the import like correct Organization loading, update process, add service to detect already party present
I also improve the screen result to display all parties loaded by the import and all already present.
The solution isn't perfect but it's work and compile, first purpose to delete jpim.jar is done :)
Related issue OFBIZ-7961


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1756949 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
nmalin committed Aug 19, 2016
1 parent c670995 commit bddead2
Show file tree
Hide file tree
Showing 9 changed files with 277 additions and 181 deletions.
12 changes: 12 additions & 0 deletions applications/marketing/config/MarketingUiLabels.xml
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,10 @@
<value xml:lang="zh">雇员数量</value>
<value xml:lang="zh-TW">員工數量</value>
</property>
<property key="MarketingNoPartyLoad">
<value xml:lang="en">No party load</value>
<value xml:lang="fr">Aucun acteur chargé</value>
</property>
<property key="MarketingOrderAmount">
<value xml:lang="de">Auftragssumme</value>
<value xml:lang="en">Amount of Orders</value>
Expand Down Expand Up @@ -995,6 +999,14 @@
<value xml:lang="zh">上级攻势标识</value>
<value xml:lang="zh-TW">上級活動識別</value>
</property>
<property key="MarketingPartiesLoaded">
<value xml:lang="en">Parties Loaded</value>
<value xml:lang="fr">Acteurs chargés</value>
</property>
<property key="MarketingPartiesNoLoadedAlreadyExist">
<value xml:lang="en">Parties no loaded because they already exist on the system</value>
<value xml:lang="fr">Acteurs non chargés car déjà présent dans le système</value>
</property>
<property key="MarketingPartyStatusReport">
<value xml:lang="de">Statusbericht Akteur</value>
<value xml:lang="en">Party Status Report</value>
Expand Down
3 changes: 2 additions & 1 deletion applications/marketing/data/MarketingTypeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,6 @@ under the License.
<StatusValidChange statusId="LEAD_ASSIGNED" statusIdTo="PARTY_DISABLED" transitionName="Disabled"/>

<EnumerationType enumTypeId="SLSOPP_TYP_ENUM" description="Sales Opportunity Type"/>


<PartyIdentificationType description="VCard reference origin" partyIdentificationTypeId="VCARD_FN_ORIGIN" parentTypeId=""/>
</entity-engine-xml>
3 changes: 2 additions & 1 deletion applications/marketing/servicedef/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,11 @@ under the License.
<!-- VCard services -->
<service name="importVCard" engine="java" location="org.apache.ofbiz.sfa.vcard.VCard" invoke="importVCard" transaction-timeout="7200">
<attribute name="infile" type="java.nio.ByteBuffer" mode="IN" optional="false"/>
<attribute name="partyId" type="String" mode="OUT" optional="false"/>
<attribute name="partyType" type="String" mode="IN" optional="true"/>
<attribute name="serviceContext" type="Map" mode="IN" optional="true"/>
<attribute name="serviceName" type="String" mode="IN" optional="false"/>
<attribute name="partiesCreated" type="List" mode="OUT" optional="false"/>
<attribute name="partiesExist" type="List" mode="OUT" optional="true"/>
</service>
<service name="exportVCard" engine="java" location="org.apache.ofbiz.sfa.vcard.VCard" invoke="exportVCard">
<attribute name="partyId" type="String" mode="IN" optional="false"/>
Expand Down

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions applications/marketing/webapp/sfa/WEB-INF/controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ under the License.
<request-map uri="createLeadFromVCard">
<security https="true" auth="true"/>
<event type="service" invoke="importVCard"/>
<response name="success" type="request" value="viewprofile"/><!-- What would be the view in case a vCard has more than one contact -->
<response name="success" type="view" value="ViewPartiesCreatedByVCard"/>
<response name="error" type="view" value="NewLeadFromVCard"/>
</request-map>
<request-map uri="quickAddLead">
Expand Down Expand Up @@ -180,7 +180,7 @@ under the License.
<request-map uri="createContactFromVCard">
<security https="true" auth="true"/>
<event type="service" invoke="importVCard"/>
<response name="success" type="request" value="viewprofile"/><!-- What would be the view in case a vCard contains more than one contact -->
<response name="success" type="view" value="ViewPartiesCreatedByVCard"/>
<response name="error" type="view" value="NewContactFromVCard"/>
</request-map>
<request-map uri="createVCardFromContact">
Expand Down Expand Up @@ -276,6 +276,7 @@ under the License.
<!-- View Mappings -->
<view-map name="main" type="screen" page="component://marketing/widget/sfa/CommonScreens.xml#main"/>
<view-map name="viewprofile" type="screen" page="component://marketing/widget/sfa/CommonScreens.xml#ViewProfile"/>
<view-map name="ViewPartiesCreatedByVCard" type="screen" page="component://marketing/widget/sfa/CommonScreens.xml#ViewPartiesCreatedByVCard"/>

<view-map name="FindSalesOpportunity" type="screen" page="component://marketing/widget/sfa/OpportunityScreens.xml#FindSalesOpportunity"/>
<view-map name="ViewSalesOpportunity" type="screen" page="component://marketing/widget/sfa/OpportunityScreens.xml#ViewSalesOpportunity"/>
Expand Down
47 changes: 41 additions & 6 deletions applications/marketing/widget/sfa/CommonScreens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ under the License.
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="left-column">
<include-screen name="leftbar"/>
</decorator-section>
</decorator-section>
<decorator-section name="body">
<include-portal-page id="${parameters.portalPageId}"/>
</decorator-section>
Expand Down Expand Up @@ -96,7 +96,7 @@ under the License.
</decorator-section>
<decorator-section name="left-column">
<include-screen name="leftbar"/>
</decorator-section>
</decorator-section>
<decorator-section name="body">
<decorator-section-include name="body"/>
</decorator-section>
Expand Down Expand Up @@ -344,6 +344,41 @@ under the License.
</widgets>
</section>
</screen>
<screen name="ViewPartiesCreatedByVCard">
<section>
<widgets>
<decorator-screen name="CommonPartyDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<section>
<condition>
<or>
<not><if-empty field="parameters.partiesCreated"/></not>
<not><if-empty field="parameters.partiesExist"/></not>
</or>
</condition>
<actions>
<set field="partiesCreated" from-field="parameters.partiesCreated"/>
<set field="partiesExist" from-field="parameters.partiesExist"/>
</actions>
<widgets>
<screenlet title="${uiLabelMap.MarketingPartiesLoaded}">
<include-grid name="ViewPartiesCreatedByVCard" location="component://marketing/widget/sfa/forms/CommonForms.xml"/>
</screenlet>
<screenlet title="${uiLabelMap.MarketingPartiesNoLoadedAlreadyExist}">
<include-grid name="ViewPartiesExistInVCard" location="component://marketing/widget/sfa/forms/CommonForms.xml"/>
</screenlet>
</widgets>
<fail-widgets>
<container>
<label style="h3">${uiLabelMap.MarketingNoPartyLoad}</label>
</container>
</fail-widgets>
</section>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
<screen name="CommonCommunicationEventDecorator">
<section>
<actions>
Expand Down Expand Up @@ -381,7 +416,7 @@ under the License.
</decorator-section>
<decorator-section name="left-column">
<include-screen name="leftbar"/>
</decorator-section>
</decorator-section>
<decorator-section name="body">
<include-menu name="OpportunitySubTabBar" location="component://marketing/widget/sfa/SfaMenus.xml"/>
<decorator-section-include name="body"/>
Expand All @@ -401,7 +436,7 @@ under the License.
</decorator-section>
<decorator-section name="left-column">
<include-screen name="leftbar"/>
</decorator-section>
</decorator-section>
<decorator-section name="body">
<include-menu name="AccountSubTabBar" location="component://marketing/widget/sfa/SfaMenus.xml"/>
<decorator-section-include name="body"/>
Expand All @@ -419,7 +454,7 @@ under the License.
</decorator-section>
<decorator-section name="left-column">
<include-screen name="leftbar"/>
</decorator-section>
</decorator-section>
<decorator-section name="body">
<include-menu name="ContactSubTabBar" location="component://marketing/widget/sfa/SfaMenus.xml"/>
<decorator-section-include name="body"/>
Expand Down Expand Up @@ -463,7 +498,7 @@ under the License.
</decorator-section>
<decorator-section name="left-column">
<include-screen name="leftbar"/>
</decorator-section>
</decorator-section>
<decorator-section name="body">
<include-menu name="EventSubTabBar" location="component://marketing/widget/sfa/SfaMenus.xml"/>
<decorator-section-include name="body"/>
Expand Down
57 changes: 57 additions & 0 deletions applications/marketing/widget/sfa/forms/CommonForms.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">

<grid name="ViewPartiesCreatedByVCard" list-name="partiesCreated" header-row-style="header-row" default-table-style="basic-table">
<row-actions>
<entity-one entity-name="Party" value-field="party" use-cache="true"/>
<set field="partyName" value="${groovy:org.apache.ofbiz.party.party.PartyHelper.getPartyName(party, true)}"/>
<entity-and entity-name="PartyAndContactMech" list="emailAddresses">
<field-map field-name="partyId"/>
<field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/>
</entity-and>
<entity-and entity-name="PartyAndContactMech" list="telecomNumbers">
<field-map field-name="partyId"/>
<field-map field-name="contactMechTypeId" value="TELECOM_NUMBER"/>
</entity-and>
<set field="telecomNumber" from-field="telecomNumbers[0]" type="Object"/>
<entity-and entity-name="PartyAndContactMech" list="postalAddresses">
<field-map field-name="partyId"/>
<field-map field-name="contactMechTypeId" value="POSTAL_ADDRESS"/>
</entity-and>
<set field="postalAddress" from-field="postalAddresses[0]" type="Object"/>
</row-actions>
<field name="partyId" title="${uiLabelMap.PartyPartyId}">
<hyperlink target="viewprofile" description="${partyName} [${partyId}]" target-window="_blank">
<parameter param-name="partyId"/>
<parameter param-name="roleTypeId"/>
</hyperlink>
</field>
<field name="emailAddress"><display description="${emailAddresses[0].infoString}"/></field>
<field name="telecomNumber" title="${uiLabelMap.PartyPhoneNumber}">
<display description="${telecomNumber.tnCountryCode} ${telecomNumber.tnAreaCode} ${telecomNumber.tnContactNumber} ${telecomNumber.tnAskForName}"/>
</field>
<field name="city"><display description="${postalAddress.paCity}"/></field>
</grid>
<grid name="ViewPartiesExistInVCard" list-name="partiesExist" extends="ViewPartiesCreatedByVCard"/>

</forms>
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ configurations {
dependencies {
// general framework compile libs
compile 'apache-xerces:xercesImpl:2.9.1'
compile 'com.googlecode.ez-vcard:ez-vcard:0.9.10'
compile 'com.google.zxing:core:3.2.1'
compile 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.0'
compile 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20160628.1'
Expand Down Expand Up @@ -770,6 +771,7 @@ def createOfbizCommandTask(taskName, arguments, jvmArguments, isDebugMode) {
arguments.each { argument ->
args argument
}

}
}

Expand Down
Binary file removed framework/base/lib/jpim-0.1.jar
Binary file not shown.

0 comments on commit bddead2

Please sign in to comment.