[OFBiz] SVN: r6965 - in trunk/specialized/opentravelsystem: . entitydef script/org/ofbiz/opentravelsystem servicedef src/org/ofbiz/opentravelsystem webapp/hotelbackend/screens webapp/hotelbackend/script

hansbak@svn.ofbiz.org hansbak at svn.ofbiz.org
Fri Mar 10 00:12:27 CST 2006


Author: hansbak
Date: 2006-03-10 00:11:45 -0600 (Fri, 10 Mar 2006)
New Revision: 6965

Modified:
   trunk/specialized/opentravelsystem/entitydef/entitygroup.xml
   trunk/specialized/opentravelsystem/entitydef/entitymodel.xml
   trunk/specialized/opentravelsystem/ofbiz-component.xml
   trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml
   trunk/specialized/opentravelsystem/servicedef/services.xml
   trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/FindServices.java
   trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java
   trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/PartyForms.xml
   trunk/specialized/opentravelsystem/webapp/hotelbackend/script/partyFinancialHistory.bsh
Log:
OTS: upgrade of party, bankstatementupload

Modified: trunk/specialized/opentravelsystem/entitydef/entitygroup.xml
===================================================================
--- trunk/specialized/opentravelsystem/entitydef/entitygroup.xml	2006-03-10 00:16:32 UTC (rev 6964)
+++ trunk/specialized/opentravelsystem/entitydef/entitygroup.xml	2006-03-10 06:11:45 UTC (rev 6965)
@@ -29,7 +29,7 @@
   <!-- ========================================================= -->
 <!--
  <entity-group group="org.ofbiz" entity="CustomerSummary" />
+-->
  <entity-group group="org.ofbiz" entity="PartyRelationshipAndPartyDetail" />
- -->
 </entitygroup>
 

Modified: trunk/specialized/opentravelsystem/entitydef/entitymodel.xml
===================================================================
--- trunk/specialized/opentravelsystem/entitydef/entitymodel.xml	2006-03-10 00:16:32 UTC (rev 6964)
+++ trunk/specialized/opentravelsystem/entitydef/entitymodel.xml	2006-03-10 06:11:45 UTC (rev 6965)
@@ -58,7 +58,7 @@
         <key-map field-name="orderId"/>
       </view-link>
     </view-entity>
-
+-->
   <view-entity entity-name="PartyRelationshipAndPartyDetail"
     package-name="org.ofbiz.opentravelsystem"
     title="Party Relationship and Party Detail (Person, PartyGroup, etc) View Entity">
@@ -88,9 +88,5 @@
       <key-map field-name="partyId"/>
     </view-link>
   </view-entity>
--->  
-
-
-
 </entitymodel>
 

Modified: trunk/specialized/opentravelsystem/ofbiz-component.xml
===================================================================
--- trunk/specialized/opentravelsystem/ofbiz-component.xml	2006-03-10 00:16:32 UTC (rev 6964)
+++ trunk/specialized/opentravelsystem/ofbiz-component.xml	2006-03-10 06:11:45 UTC (rev 6965)
@@ -39,7 +39,6 @@
     <!-- entity resources: model(s), eca(s), group, and data definitions. -->
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
     <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/>
-   
     <!-- data resources for initial data -->
     <entity-resource type="data" reader-name="seed" loader="main" location="data/BackendData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="webapp/hotelfrontend/data/HotelDemoStore.xml"/>

Modified: trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml
===================================================================
--- trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml	2006-03-10 00:16:32 UTC (rev 6964)
+++ trunk/specialized/opentravelsystem/script/org/ofbiz/opentravelsystem/PartyServices.xml	2006-03-10 06:11:45 UTC (rev 6965)
@@ -47,7 +47,7 @@
         <!-- partygroup -->
         <!-- create id using the invoice prefix -->
         <entity-one entity-name="PartyAcctgPreference" value-name="partyAcctgPreference" auto-field-map="false">
-            <field-map field-name="partyId" env-name="parameters.organizationPartyId"/>
+            <field-map field-name="partyId" env-name="parameters.userLogin.partyId"/>
         </entity-one>
         <set field="createPartyGroup.groupName" from-field="parameters.groupName"/>
         <sequenced-id-to-env sequence-name="${partyAcctgPreference.invoiceIdPrefix}Party" env-name="nextPartyId"/>
@@ -111,7 +111,7 @@
         <field-to-request field-name="partyId" request-name="partyId"/>
 
         <!-- party relationship -->
-        <set field="rel.partyIdFrom" from-field="organizationPartyId"/>
+        <set field="rel.partyIdFrom" from-field="parameters.userLogin.partyId"/>
         <set field="rel.partyIdTo" from-field="partyId"/>
         <set field="rel.partyRelationshipTypeId" from-field="parameters.partyRelationshipTypeId"/>
         <set field="rel.statusId" value="PARTYREL-ACTIVE"/>
@@ -121,8 +121,8 @@
     
     <simple-method method-name="updateParty" short-description="--Update an existingParty--">
         <check-permission permission="OPENTRAVELSYSTEM" action="_RW">
-            <alt-permission permission="${parameters.organizationPartyId}" action="_RW"/>
-            <fail-message message="Security Error: to update you need RW access to &quot;${parameters.organizationPartyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
+            <alt-permission permission="${parameters.userLogin.partyId}" action="_RW"/>
+            <fail-message message="Security Error: to update you need RW access to &quot;${parameters.userLogin.partyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
         </check-permission>        
         <check-errors/>
         
@@ -264,7 +264,7 @@
         
         <!-- party relationship -->
         <entity-and entity-name="PartyRelationship" list-name="partyRelationships">
-            <field-map field-name="partyIdFrom" value="${parameters.organizationPartyId}"/>
+            <field-map field-name="partyIdFrom" value="${parameters.userLogin.partyId}"/>
             <field-map field-name="partyIdTo" value="${parameters.partyId}"/>
         </entity-and>
         <first-from-list entry-name="partyRelationship" list-name="partyRelationships"/>
@@ -286,26 +286,12 @@
         
     </simple-method>
 
-    <simple-method method-name="getOrganizationParty" short-description="--retrieve Organization Party Information--">
+    <simple-method method-name="getParty" short-description="--retrieve Party Information--">
         <check-permission permission="OPENTRAVELSYSTEM" action="_R">
-            <alt-permission permission="${parameters.organizationPartyId}" action="_R"/>
-            <fail-message message="Security Error: to update you need R access to &quot;${parameters.organizationPartyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
+            <alt-permission permission="${parameters.userLogin.partyId}" action="_RW"/>
+            <fail-message message="Security Error: to read you need R access to &quot;${parameters.userLogin.partyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
         </check-permission>        
         <check-errors/>
-        <set field="org.organizationPartyId" value="parameters.organizationPartyId"/>        
-        <set field="org.partyId" value="parameters.organizationPartyId"/>        
-        <call-service service-name="otsGetParty" in-map-name="org">
-            <result-to-result/>
-        </call-service>
-        <field-to-result field-name="parameters.organizationPartyId" result-name="organizationPartyId"/>
-    </simple-method>
-    
-        <simple-method method-name="getParty" short-description="--retrieve Party Information--">
-        <check-permission permission="OPENTRAVELSYSTEM" action="_R">
-            <alt-permission permission="${parameters.organizationPartyId}" action="_R"/>
-            <fail-message message="Security Error: to update you need R access to &quot;${parameters.organizationPartyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
-        </check-permission>        
-        <check-errors/>
         
         <if-empty field-name="parameters.partyId">
             <return/>
@@ -313,7 +299,7 @@
 
         <!-- party relationship -->
         <entity-and entity-name="PartyRelationship" list-name="partyRelationships">
-            <field-map field-name="partyIdFrom" value="${parameters.organizationPartyId}"/>
+            <field-map field-name="partyIdFrom" value="${parameters.userLogin.partyId}"/>
             <field-map field-name="partyIdTo" value="${parameters.partyId}"/>
         </entity-and>
         <first-from-list entry-name="partyRelationship" list-name="partyRelationships"/>
@@ -334,7 +320,6 @@
         
         <!-- get the postal address defined as GENERAL LOCATION -->
         <set field="getKey.partyId" from-field="parameters.partyId"/>
-        <set field="getKey.organizationPartyId" from-field="parameters.organizationPartyId"/>
         <call-service service-name="otsGetPostalAddress" in-map-name="getKey">
             <result-to-result service-result-name="address1"  result-name="address1"/>
             <result-to-result service-result-name="address2" result-name="address2"/>
@@ -393,13 +378,13 @@
     
     <simple-method method-name="setStatusParty" short-description="--unDelete a Party--">
         <check-permission permission="OPENTRAVELSYSTEM" action="_RW">
-            <alt-permission permission="${parameters.organizationPartyId}" action="_RW"/>
-            <fail-message message="Security Error: to update you need RW access to &quot;${parameters.organizationPartyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
+            <alt-permission permission="${parameters.userLogin.partyId}" action="_RW"/>
+            <fail-message message="Security Error: to update you need RW access to &quot;${parameters.userLogin.partyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
         </check-permission>        
         <check-errors/>
         
         <entity-and entity-name="PartyRelationship" list-name="relations">
-            <field-map field-name="partyIdFrom" value="${parameters.organizationPartyId}"/>
+            <field-map field-name="partyIdFrom" value="${parameters.userLogin.partyId}"/>
             <field-map field-name="partyIdTo" value="${parameters.partyId}"/>
         </entity-and>
         <filter-list-by-date list-name="relations" to-list-name="selRelations"/>
@@ -413,20 +398,20 @@
     
     <simple-method method-name="createPartyRelationship" short-description="set the relationship between the party and the organizationParty">
         <check-permission permission="OPENTRAVELSYSTEM" action="_RW">
-            <alt-permission permission="${parameters.organizationPartyId}" action="_RW"/>
-            <fail-message message="Security Error: to update you need RW access to &quot;${parameters.organizationPartyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
+            <alt-permission permission="${parameters.userLogin.partyId}" action="_RW"/>
+            <fail-message message="Security Error: to update you need RW access to &quot;${parameters.userLogin.partyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
         </check-permission>        
         <check-errors/>
         
         <entity-and entity-name="PartyRelationship" list-name="relations">
-            <field-map field-name="partyIdFrom" value="${parameters.organizationPartyId}"/>
+            <field-map field-name="partyIdFrom" value="${parameters.userLogin.partyId}"/>
             <field-map field-name="partyIdTo" value="${parameters.partyId}"/>
         </entity-and>
         <filter-list-by-date list-name="relations" to-list-name="selRelations"/>
         <first-from-list entry-name="relation" list-name="selRelations"/>
         
         <if-empty field-name="relation">
-            <set field="rel.partyIdFrom" from-field="organizationPartyId"/>
+            <set field="rel.partyIdFrom" from-field="parameters.userLogin.partyId"/>
             <set field="rel.partyIdTo" from-field="partyId"/>
             <set field="rel.partyRelationshipTypeId" from-field="parameters.partyRelationshipTypeId"/>
             <set field="rel.statusId" value="PARTYREL-ACTIVE"/>
@@ -437,15 +422,15 @@
     
     <simple-method method-name="updatePostalAddress" short-description="--add/update a postal address for a party--">
         <check-permission permission="OPENTRAVELSYSTEM" action="_RW">
-            <alt-permission permission="${parameters.organizationPartyId}" action="_RW"/>
-            <fail-message message="Security Error: to update you need RW access to &quot;${parameters.organizationPartyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
+            <alt-permission permission="${parameters.userLogin.partyId}" action="_RW"/>
+            <fail-message message="Security Error: to update you need RW access to &quot;${parameters.userLogin.partyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
         </check-permission>        
         <check-errors/>
         
         <!-- check input -->        
         <if-empty field-name="parameters.countryGeoId"><!-- get countryGeoId from organizationparty if empty -->
             <entity-and entity-name="PartyAndPostalAddress" list-name="orgAddressesU">
-                <field-map field-name="partyId" value="${parameters.organizationPartyId}"/>
+                <field-map field-name="partyId" value="${parameters.userLogin.partyId}"/>
                 <field-map field-name="contactMechTypeId" value="POSTAL_ADDRESS"/>
             </entity-and>
             <filter-list-by-date list-name="orgAddressesU" to-list-name="orgAddresses"/>
@@ -467,7 +452,6 @@
         
         <!-- get the postal address defined as GENERAL LOCATION -->
         <set field="getKey.partyId" from-field="parameters.partyId"/>
-        <set field="getKey.organizationPartyId" from-field="parameters.organizationPartyId"/>
         <call-service service-name="otsGetPostalAddress" in-map-name="getKey">
             <result-to-field result-name="contactMechId" field-name="contactMechId"/><!-- required for update -->
             <result-to-field result-name="address1" field-name="postalAddress.address1"/>
@@ -512,8 +496,8 @@
     
     <simple-method method-name="getPostalAddress" short-description="--get postal address for a party--">
         <check-permission permission="OPENTRAVELSYSTEM" action="_R">
-            <alt-permission permission="${parameters.organizationPartyId}" action="_R"/>
-            <fail-message message="Security Error: to update you need R access to &quot;${parameters.organizationPartyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
+            <alt-permission permission="${parameters.userLogin.partyId}" action="_RW"/>
+            <fail-message message="Security Error: to update you need R access to &quot;${parameters.userLogin.partyId}&quot; in the &quot;OPENTRAVELSYSTEM&quot;"/>
         </check-permission>        
         <check-errors/>
         

Modified: trunk/specialized/opentravelsystem/servicedef/services.xml
===================================================================
--- trunk/specialized/opentravelsystem/servicedef/services.xml	2006-03-10 00:16:32 UTC (rev 6964)
+++ trunk/specialized/opentravelsystem/servicedef/services.xml	2006-03-10 06:11:45 UTC (rev 6965)
@@ -33,9 +33,8 @@
     <!-- party services to add, update and logically delete. -->
     <service name="otsAddParty" engine="simple" location="org/ofbiz/opentravelsystem/PartyServices.xml"
         invoke="addParty" auth="true">
-        <description>Add a new party to the system and the relationship to the organizationPartyId</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
-        <attribute name="partyId" type="String" mode="INOUT" optional="true"/>
+        <description>Add a new party to the system and the relationship to the logonnPartyId</description>
+        <attribute name="partyId" type="String" mode="OUT" optional="true"/>
         <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="false"/>
         <attribute name="groupName" type="String" mode="IN" optional="false"/>
         <attribute name="address1" type="String" mode="IN" optional="true"/>
@@ -52,7 +51,6 @@
     <service name="otsGetParty" engine="simple" location="org/ofbiz/opentravelsystem/PartyServices.xml"
         invoke="getParty" auth="true">
         <description>Retrieve the party information</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="partyId" type="String" mode="INOUT" optional="true"/>
         <attribute name="partyRelationshipTypeId" type="String" mode="OUT" optional="true"/>
         <attribute name="groupName" type="String" mode="OUT" optional="true"/>
@@ -69,8 +67,7 @@
     
     <service name="otsGetOrganizationParty" engine="simple" location="org/ofbiz/opentravelsystem/PartyServices.xml"
         invoke="getOrganizationParty" auth="true">
-        <description>Retrieve the organization party information</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
+        <description>Retrieve the organization party information (partyId from the loginId)</description>
         <attribute name="groupName" type="String" mode="IN" optional="true"/>
         <attribute name="address1" type="String" mode="IN" optional="true"/>
         <attribute name="address2" type="String" mode="IN" optional="true"/>
@@ -90,7 +87,6 @@
     <service name="otsUpdateParty" engine="simple"
         location="org/ofbiz/opentravelsystem/PartyServices.xml" invoke="updateParty" auth="true">
         <description>Modify the party information including the relationship to the organizationPartyId</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="partyId" type="String" mode="INOUT" optional="false"/>
         <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
         <attribute name="groupName" type="String" mode="IN" optional="true"/>
@@ -108,7 +104,6 @@
     <service name="otsUpdateOrganizationParty" engine="simple"
         location="org/ofbiz/opentravelsystem/PartyServices.xml" invoke="updateOrganizationParty" auth="true">
         <description>Modify the party organization information</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="groupName" type="String" mode="IN" optional="true"/>
         <attribute name="address1" type="String" mode="IN" optional="true"/>
         <attribute name="address2" type="String" mode="IN" optional="true"/>
@@ -127,7 +122,6 @@
     <service name="otsSetStatusParty" engine="simple"
         location="org/ofbiz/opentravelsystem/PartyServices.xml" invoke="setStatusParty" auth="true">
         <description>set the status of a party in thge relationship table</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="partyId" type="String" mode="IN" optional="false"/>
         <attribute name="statusId" type="String" mode="IN" optional="false"/>
     </service>
@@ -135,7 +129,6 @@
     <service name="otsCreatePartyRelationship" engine="simple"
         location="org/ofbiz/opentravelsystem/PartyServices.xml" invoke="createPartyRelationship" auth="true">
         <description>set the relationship between the party and the organizationParty</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="partyId" type="String" mode="IN" optional="false"/>
         <attribute name="partyRelationshipTypeId" type="String" mode="IN" optional="true"/>
     </service>
@@ -143,7 +136,6 @@
     <service name="otsUpdatePostalAddress" engine="simple"
         location="org/ofbiz/opentravelsystem/PartyServices.xml" invoke="updatePostalAddress" auth="true">
         <description>Add or Update a GeneralLocation postal address</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="partyId" type="String" mode="IN" optional="false"/>
         <attribute name="address1" type="String" mode="IN" optional="true"/>
         <attribute name="address2" type="String" mode="IN" optional="true"/>
@@ -155,7 +147,6 @@
     <service name="otsGetPostalAddress" engine="simple"
         location="org/ofbiz/opentravelsystem/PartyServices.xml" invoke="getPostalAddress" auth="true">
         <description>Get a GeneralLocation postal address</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="partyId" type="String" mode="IN" optional="false"/>
         <attribute name="contactMechId" type="String" mode="OUT" optional="true"/>
         <attribute name="address1" type="String" mode="OUT" optional="true"/>
@@ -168,7 +159,6 @@
     <service name="otsVatReport" engine="simple"
         location="org/ofbiz/opentravelsystem/ReportServices.xml" invoke="vatReport" auth="true">
         <description>Report on in/out going VAT for a certain time period</description>
-        <attribute name="organizationPartyId" type="String" mode="IN"/>
         <attribute name="year" type="String" mode="IN" optional="false"/>
         <attribute name="monthList" type="java.util.List" mode="OUT" optional="true"/>
     </service>
@@ -176,14 +166,12 @@
     <service name="otsOpenInvoiceReport" engine="simple"
         location="org/ofbiz/opentravelsystem/ReportServices.xml" invoke="openInvoiceReport" auth="true">
         <description>Report not completely applied invoices</description>
-        <attribute name="organizationPartyId" type="String" mode="IN"/>
         <attribute name="openInvoices" type="java.util.List" mode="OUT" optional="true"></attribute>
     </service>
     
     <service name="otsOpenPaymentReport" engine="simple"
         location="org/ofbiz/opentravelsystem/ReportServices.xml" invoke="openPaymentReport" auth="true">
         <description>Report not completely applied payments</description>
-        <attribute name="organizationPartyId" type="String" mode="IN"/>
         <attribute name="openPayments" type="java.util.List" mode="OUT" optional="true"></attribute>
     </service>
     
@@ -241,7 +229,6 @@
     <!-- UserLogin to SecurityGroup services -->
     <service name="otsAddUserLoginToSecurityGroup" engine="simple" location="org/ofbiz/opentravelsystem/GeneralServices.xml" invoke="addUserLoginToSecurityGroup" auth="true">
         <description>Add a UserLogin to a SecurityGroup</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="userLoginId" type="String" mode="IN" optional="false"/>
         <attribute name="groupId" type="String" mode="IN" optional="false"/>
         <attribute name="fromDate" type="Timestamp" mode="IN" optional="true"/>
@@ -249,7 +236,6 @@
     </service>
     <service name="otsUpdateUserLoginToSecurityGroup" engine="simple" location="org/ofbiz/opentravelsystem/GeneralServices.xml" invoke="updateUserLoginToSecurityGroup" auth="true">
         <description>Update a UserLogin to SecurityGroup Appl</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="userLoginId" type="String" mode="IN" optional="false"/>
         <attribute name="groupId" type="String" mode="IN" optional="false"/>
         <attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/>
@@ -258,7 +244,6 @@
     <service name="otsRemoveUserLoginFromSecurityGroup" engine="simple" 
         location="org/ofbiz/opentravelsystem/GeneralServices.xml" invoke="removeUserLoginFromSecurityGroup" auth="true">
         <description>Remove a UserLogin from a SecurityGroup</description>
-        <attribute name="organizationPartyId" type="String" mode="IN" optional="false"/>
         <attribute name="userLoginId" type="String" mode="IN" optional="false"/>
         <attribute name="groupId" type="String" mode="IN" optional="false"/>
         <attribute name="fromDate" type="Timestamp" mode="IN" optional="false"/>

Modified: trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/FindServices.java
===================================================================
--- trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/FindServices.java	2006-03-10 00:16:32 UTC (rev 6964)
+++ trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/FindServices.java	2006-03-10 06:11:45 UTC (rev 6965)
@@ -143,7 +143,7 @@
         		else if (entityName.equals("Payment")) {
         			extraCond = new EntityExpr("paymentId", EntityOperator.LIKE, companyPrefix); 
         		}
-        		else if (entityName.equals("Party") || entityName.equals("PartyNameView") ) {
+        		else if (entityName.equals("Party") || entityName.equals("PartyRelationshipAndPartyDetail") || entityName.equals("PartyNameView"))  {
         			extraCond = new EntityExpr("partyId", EntityOperator.LIKE, companyPrefix); 
         		}
         		else {

Modified: trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java
===================================================================
--- trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java	2006-03-10 00:16:32 UTC (rev 6964)
+++ trunk/specialized/opentravelsystem/src/org/ofbiz/opentravelsystem/mt940.java	2006-03-10 06:11:45 UTC (rev 6965)
@@ -97,8 +97,7 @@
 	static boolean debet; 					// if it was a debet (true) or credit (false) transaction
 	static String defaultCurrency = null;
 	static Map payment = null;		
-	static Map partyGroup = null;    				
-	static Map eftAccount = null;
+	static Map partyInfo = null;    				
 	// statistics
 	static int partiesCreated;
 	static int paymentsCreated;
@@ -164,12 +163,19 @@
 		
 		if (debug) Debug.logInfo("Start processing payments...", module);
 		while (getPayment(request) != null) {
+			// first check if the payment already exists
+			if (checkPayment() == true)	{
+				paymentAlreadyUploaded++;
+				if (debug) Debug.logInfo("Payment already exists...so not create again...",module);
+				continue;
+			}
+			
 			String otherParty = getParty();
 			// check to see if the parties where found, when not create
 			if (otherParty == null)	{ 
 				if (createParty() == null) 	
 					return "error"; // party creation error
-				otherParty = (String) partyGroup.get("partyId");
+				otherParty = (String) partyInfo.get("partyId");
 			}
 			if (debet  == false)	{
 				if (otherParty.equals(taxAuthPartyId) || accountPartyId.equals(taxAuthPartyId))
@@ -193,11 +199,7 @@
 			payment.put("paymentMethodTypeId","EFT_ACCOUNT");
 			// check if the payment was already uploaded.....
 			if (debug) Debug.logInfo("Creating payment with reference number: " + payment.get("paymentRefNum"),module);
-			if (checkPayment() == true)	{
-				paymentAlreadyUploaded++;
-				if (debug) Debug.logInfo("Payment already exists...so not create again...",module);
-			}
-			else if (!partyOnly)	{	// input parameter.....
+			if (!partyOnly)	{	// input parameter.....
 				// finally create payment record.
 				payment.put("userLogin",userLogin);
 				payment.put("locale", loc);
@@ -242,7 +244,7 @@
 	 * @return "error" when not ok...
 	 */
 	private static String createParty()	{
-		
+/*		
 		try {
 			results = dispatcher.runSync("createPartyGroup",partyGroup); 
 		} catch (GenericServiceException e1) {
@@ -298,10 +300,34 @@
 		} catch (GenericServiceException e1) {
 			Debug.logError(e1, "Error creating party relationship", module);
 		}
+*/
+		// create party
+		partyInfo.put("userLogin", userLogin);
+		partyInfo.put("partyRelationshipTypeId", "SUPPLIER_REL");
+		try {
+			results = dispatcher.runSync("otsAddParty", partyInfo);
+			partyInfo.put("partyId",results.get("partyId"));
+
+/*					UtilMisc.toMap(	
+							"userLogin", userLogin,
+							"partyRelationshipTypeId", partyRelationshipTypeId,
+							"groupName", partyGroup.get("partyId"),
+							"address1",
+							"address2",
+							"city",
+							"postalCode",
+							"countryGeoId",
+							"emailAddress",
+							"telephone",
+							"fax",
+							"accountNumber" */
+		} catch (GenericServiceException e1) {
+			Debug.logError(e1, "Error creating party relationship", module);
+		}
 		
-		Debug.logInfo("Party Created:" + partyGroup.get("partyId"), module);
+		Debug.logInfo("Party Created:" + partyInfo.get("partyId"), module);
 		partiesCreated++;
-		return (String) partyGroup.get("partyId");
+		return (String) partyInfo.get("partyId");
 	}
 	/**
 	 *    find parties by account number in the eftAccount table --> paymentMethod for the partyId
@@ -309,46 +335,28 @@
 	 * @return partyId if found, when not null
 	 */
 	private static String getParty()	{
-		if (debug) Debug.logInfo("eftAccount searching: accountNumber:" + eftAccount.get("accountNumber") + 
-				" Routing Number:" + eftAccount.get("routingNumber"), module);
+		if (debug) Debug.logInfo("eftAccount searching: accountNumber:" + partyInfo.get("accountNumber"), module);
 		
 		List eftAccounts = null; 
 		
-		if (UtilValidate.isNotEmpty((String) eftAccount.get("routingNumber")))	{ // only use if routing number available
-			try { 
-				eftAccounts = delegator.findByAnd("EftAccount", 
-						UtilMisc.toMap("accountNumber", eftAccount.get("accountNumber"), 
-								"routingNumber", eftAccount.get("routingNumber"))); 
-			}
-			catch (GenericEntityException e) {	
-				Debug.logError("Find account/routing Number exception:" + e.getMessage(), module); 
-			}
+		// try to find the account number
+		try { 
+			eftAccounts = delegator.findByAnd("EftAccount", 
+					UtilMisc.toMap("accountNumber", partyInfo.get("accountNumber"))); 
 		}
+		catch (GenericEntityException e) {	
+			Debug.logError("Find account number exception:" + e.getMessage(), module); 
+		}
 		
-		if (UtilValidate.isEmpty(eftAccounts))	{
-			if (debug) Debug.logInfo("Account: " + eftAccount.get("accountNumber") + 
-					" Routing number:" + eftAccount.get("routingNumber") + 
-					"  not specified or not found...try to find with account number only.", module);
-			
-			// try to find only with only the account number
-			try { 
-				eftAccounts = delegator.findByAnd("EftAccount", 
-						UtilMisc.toMap("accountNumber", eftAccount.get("accountNumber"))); 
-			}
-			catch (GenericEntityException e) {	
-				Debug.logError("Find account number exception:" + e.getMessage(), module); 
-			}
-			
-			
-			if(UtilValidate.isEmpty(eftAccounts))	{
-				if (debug) Debug.logInfo("Account: " + eftAccount.get("accountNumber") + " not found....", module);
-				return null;     		// account number not found.
-			}
+		
+		if(UtilValidate.isEmpty(eftAccounts))	{
+			if (debug) Debug.logInfo("Account: " + partyInfo.get("accountNumber") + " not found....", module);
+			return null;     		// account number not found.
 		}
 		
 		Iterator it = eftAccounts.iterator();
 		List paymentMethods = null;
-
+		
 		try { 
 			while (it.hasNext() && (paymentMethods == null || paymentMethods.size() == 0))	{
 				GenericValue eAccount = (GenericValue) it.next();
@@ -373,10 +381,7 @@
 	 */
 	private static String getFile(HttpServletRequest request)	{
 		try {
-			Locale locale = UtilHttp.getLocale(request);
-			LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher");
 			HttpSession session = request.getSession();
-			GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");
 			partiesCreated =  paymentsCreated = paymentAlreadyUploaded = 0;
 			start = end = lineNumber = 0;
 			
@@ -467,8 +472,7 @@
 		// structurees to create the records in the database (filled by the getPayment routine)
 		payment = new HashMap();
 		payment.put("paymentMethodTypeId","EFT_ACCOUNT");  // all payment are bank transfers....
-		partyGroup = new HashMap();
-		eftAccount = new HashMap();
+		partyInfo = new HashMap();
 		String fileLine = getLine(); // get first line of transaction
 		while (fileLine != null) {
 			//   		Debug.logInfo("Line: " + lineNumber + "  -->" + fileLine, module);
@@ -544,42 +548,49 @@
 					if (tagData.substring(0,4).compareTo("GIRO") == 0)	{ // GIRO number
 						x = 4; while (tagData.charAt(x) == ' ')  x++;	// find first nonblank character
 						int y = x; while (y< tagData.length() && tagData.charAt(y) != ' ')  y++;	// find end of account number
-						eftAccount.put("accountNumber","G".concat(tagData.substring(x,y)));
+						partyInfo.put("accountNumber","G".concat(tagData.substring(x,y)));
 						if (tagData.length() > y && tagData.charAt(y) == ' ')	// if blank name follows the account number
-							eftAccount.put("nameOnAccount", tagData.substring(y));
+							partyInfo.put("groupName", tagData.substring(y));
 						else // when not, name on next line
-							eftAccount.put("nameOnAccount", getLine());
-						partyGroup.put("groupName", eftAccount.get("nameOnAccount"));
+							partyInfo.put("groupName", getLine());
 					}
 					else if (tagData.charAt(0) == ' ') {	// normal bank account number start with blank
-						eftAccount.put("accountNumber",tagData.substring(1,3) + tagData.substring(4,6) + tagData.substring(7,9) + tagData.substring(10,13));
+						partyInfo.put("accountNumber",tagData.substring(1,3) + tagData.substring(4,6) + tagData.substring(7,9) + tagData.substring(10,13));
 						if (tagData.length() > 13 && tagData.charAt(13) == ' ')	// if blank name follows the account number
-							eftAccount.put("nameOnAccount", tagData.substring(14));
+							partyInfo.put("groupName", tagData.substring(14));
 						else // when not, name on next line
-							eftAccount.put("nameOnAccount", getLine());
-						partyGroup.put("groupName", eftAccount.get("nameOnAccount"));
+							partyInfo.put("groupName", getLine());
 					}
 					else if (tagData.substring(0,2).compareTo("EM") == 0)	{  // international payment
-						eftAccount.put("accountNumber", tagData.substring(2,15));
+						partyInfo.put("accountNumber", tagData.substring(2,15));
 						payment.put("comments",tagData.substring(15));
-						payment.put("comments",payment.get("comments") + getLine() + getLine());
-						eftAccount.put("nameOnAccount", getLine());
-						partyGroup.put("groupName", eftAccount.get("nameOnAccount"));
+						if((fileLine = getLine()) != null) {
+							payment.put("comments",payment.get("comments") + fileLine);
+							if((fileLine = getLine()) != null) {
+								payment.put("comments",payment.get("comments") + fileLine);
+							}
+						}
+						if (fileLine != null) {
+							if((fileLine=getLine()) != null) 
+								partyInfo.put("groupName", fileLine);
+							else
+								partyInfo.put("groupName", "International Payment");
+						}
+						else
+							partyInfo.put("groupName", "International Payment");
 					}
 					else if (tagData.substring(0,3).compareTo("BEA") == 0)	{  // paying with pincode
-						eftAccount.put("accountNumber", "BEA_Payment");
+						partyInfo.put("accountNumber", "BEA_Payment");
 						payment.put("comments",tagData.substring(18));
 						if((fileLine = getLine()) == null) return null;
 						x = 0; while (fileLine.charAt(x) != ',')  x++;	// find first comma 
-						eftAccount.put("nameOnAccount", "BEA Payments");
-						partyGroup.put("groupName", "BEA Payments");
-						payment.put("comments",payment.get("comments") + " - " + fileLine);
+						partyInfo.put("groupName", "BEA Payments");
+						payment.put("comments",payment.get("comments") + " - " + fileLine); 
 					}
 					else	{ // bank charges
 						payment.put("comments",tagData);
-						eftAccount.put("accountNumber", "ABNAMRO");
-						eftAccount.put("nameOnAccount", "ABN AMRO Bank");
-						partyGroup.put("groupName", eftAccount.get("nameOnAccount"));
+						partyInfo.put("accountNumber", "ABNAMRO");
+						partyInfo.put("groupName", "ABN AMRO Bank");
 					}
 					// read lines until the next 'tag' line and add to payment comments
 					while (localFile.charAt(start) != ':') // start is pointing at the first character of next  line
@@ -603,7 +614,7 @@
 	}
 	private static String getFileHeader(HttpServletRequest request) {
 		GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
-		eftAccount = (GenericValue) delegator.makeValue("EftAccount",null);
+		GenericValue eftAccount = (GenericValue) delegator.makeValue("EftAccount",null);
 		String fileLine = null; // get first line of transaction
 		lineNumber = end = start = seqNr =  0;
 		while (lineNumber < 7 && (fileLine = getLine()) != null) {
@@ -630,6 +641,8 @@
 					eftAccount.put("accountNumber", fileLine.substring(4));
 					accountNr = fileLine.substring(4);
 					lineNumber = end = start = 0;
+					partyInfo = new HashMap();
+					partyInfo.put("accountNumber",accountNr);
 					return "ok";
 				}
 			}

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/PartyForms.xml
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/PartyForms.xml	2006-03-10 00:16:32 UTC (rev 6964)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/screens/PartyForms.xml	2006-03-10 06:11:45 UTC (rev 6965)
@@ -10,9 +10,24 @@
         </actions>
         <!--field name="statusId"><hidden value="PARTYREL-ACTIVE"/></field-->
         <field name="hideSearch"><hidden value="Y"/></field>
-        <field name="partyIdTo" title="Party Id" ><text-find default-option="contains" ignore-case="true"/></field>
+        <field name="partyId" title="Party Id" ><text-find default-option="contains" ignore-case="true"/></field>
         <field name="groupName"><text-find default-option="contains" ignore-case="true"/></field>
         <field name="lastName" ><text-find default-option="contains" ignore-case="true"/></field>
+        <field name="partyRelationshipTypeId" title="Party Type">
+            <drop-down allow-empty="true">
+                <entity-options description="${partyRelationshipName}" entity-name="PartyRelationshipType">
+                    <entity-order-by field-name="partyRelationshipName"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field name="statusId">
+            <drop-down allow-empty="true">
+                <entity-options description="${description}" entity-name="StatusItem">
+                    <entity-constraint name="statusTypeId" value="PARTY-RELATION"/>
+                    <entity-order-by field-name="description"/>
+                </entity-options>
+            </drop-down>
+        </field>
         <field name="submitButton" title="${uiLabelMap.CommonLookup}" widget-style="smallSubmit">
             <submit button-type="button"/>
         </field>
@@ -23,23 +38,25 @@
         default-widget-style="tabletext" default-tooltip-style="tabletext"
         paginate-target="findParties" list-iterator-name="listIt" default-entity-name="PartyNameView">
         <actions>
-            <set field="parameters.partyIdFrom" from-field="parameters.organizationPartyId"/>
             <service service-name="performFind" result-map-name="result" result-map-list-iterator-name="listIt">
                 <field-map field-name="inputFields" env-name="parameters"/>
-                <field-map field-name="entityName" value="PartyNameView"/>
+                <field-map field-name="entityName" value="PartyRelationshipAndPartyDetail"/>
                 <field-map field-name="orderBy" value="partyId"/>
             </service>
         </actions>
+        <!--auto-fields-entity entity-name="PartyRelationshipAndPartyDetail" default-field-type="display"/-->
         <field name="partyId" widget-style="buttontext" >
             <hyperlink description="${partyId}" target="editParty?partyId=${partyId}"/>
         </field>
         <field name="partyTypeId"><display-entity entity-name="PartyType" description="${description}"/></field>
+        <field name="partyRelationshipTypeId" title="Rel.Type"><display-entity entity-name="PartyRelationshipType" description="${partyRelationshipName}"/></field>
         <field name="groupName" title="Name"><display description="${groupName} ${lastName} ${firstName} ${middleName}"/></field>
+        <field name="statusId"><display-entity entity-name="StatusItem" description="${description}"/></field>
         <field name="financialHistory" title=" " widget-style="buttontext" >
             <hyperlink description="Fin.Hist" target="partyFinancialHistory?partyId=${partyId}" target-window="new"/>
         </field>
         <field name="Disable" title=" " widget-style="buttontext">
-            <hyperlink description="Delete" target-type="plain" target="javascript:confirmActionLink('You want to delete this party?','deleteParty?organizationPartyId=${organizationPartyId}&amp;partyId=${partyId}&amp;statusId=PARTYREL-DELETED')"/>
+            <hyperlink description="Delete" target-type="plain" target="javascript:confirmActionLink('You want to delete this party?','deleteParty?partyId=${partyId}&amp;statusId=PARTYREL-DELETED')"/>
         </field>
     </form>
     
@@ -49,13 +66,11 @@
         <actions>
             <service service-name="otsGetParty" result-map-name="info">
                 <field-map field-name="partyId" value="${parameters.partyId}"/>
-                <field-map field-name="organizationPartyId" value="${organizationPartyId}"/>
             </service>
         </actions>
         <alt-target use-when="party==null||partyId==null" target="addParty"/>
         <auto-fields-service service-name="otsAddParty"/>
         <field name="partyId"><hidden value="${parameters.partyId}"/></field>
-        <field name="organizationPartyId"><hidden value="${organizationPartyId}"/></field>
         <field name="partyRelationshipTypeId" title="Party Type">
             <drop-down allow-empty="false">
                 <entity-options description="${partyRelationshipName}" entity-name="PartyRelationshipType">
@@ -84,12 +99,9 @@
         target="updateCompany" title="Edit Organization Party" default-map-name="info"
         default-title-style="tableheadtext" default-widget-style="inputBox" default-tooltip-style="tabletext">
         <actions>
-            <service service-name="otsGetOrganizationParty" result-map-name="info">
-                <field-map field-name="organizationPartyId" value="${organizationPartyId}"/>
-            </service>
+            <service service-name="otsGetOrganizationParty" result-map-name="info"/>
         </actions>
         <auto-fields-service service-name="otsUpdateOrganizationParty"/>
-        <field name="organizationPartyId"><hidden value="${organizationPartyId}"/></field>
         <field name="countryGeoId" title="Country">
             <drop-down allow-empty="true">
                 <entity-options description="${geoName}" entity-name="Geo" key-field-name="geoId">

Modified: trunk/specialized/opentravelsystem/webapp/hotelbackend/script/partyFinancialHistory.bsh
===================================================================
--- trunk/specialized/opentravelsystem/webapp/hotelbackend/script/partyFinancialHistory.bsh	2006-03-10 00:16:32 UTC (rev 6964)
+++ trunk/specialized/opentravelsystem/webapp/hotelbackend/script/partyFinancialHistory.bsh	2006-03-10 06:11:45 UTC (rev 6965)
@@ -154,11 +154,13 @@
 				historyItem.put("applied", applied.toString());
 				historyItem.put("paymentId", oldPaymentId);
 				payment = delegator.findByPrimaryKey("Payment",UtilMisc.toMap("paymentId",oldPaymentId));
+				if (payment != null) {
 					BigDecimal amount = payment.getBigDecimal("amount").setScale(2,BigDecimal.ROUND_HALF_UP);
 //					if (payment.getString("partyIdFrom").equals(organizationPartyId))	amount = amount.multiply(new BigDecimal("-1"));
 					historyItem.put("amount",amount.toString());
-				historyItem.put("effectiveDate",payment.getString("effectiveDate").substring(0,10));
-				historyList.add(historyItem);
+					historyItem.put("effectiveDate",payment.getString("effectiveDate").substring(0,10));
+					historyList.add(historyItem);
+				}
 			}
 		}
 	}
@@ -245,15 +247,17 @@
 		while (pa.hasNext())	{
 			GenericValue paymentApplication = pa.next();
 			GenericValue invoice = paymentApplication.getRelated("Invoice").get(0);
-			historyItem = new HashMap();
-			historyItem.put("paymentId",payment.getString("paymentId"));
-			historyItem.put("invoiceId",paymentApplication.getString("invoiceId"));
-			historyItem.put("invoiceItemSeqId",paymentApplication.getString("invoiceItemSeqId"));
-			historyItem.put("partyId",invoice.getString("partyId"));
-			historyItem.put("amount",amount.toString());
-			historyItem.put("applied",paymentApplication.getBigDecimal("amountApplied").setScale(2,BigDecimal.ROUND_HALF_UP).toString());
-			historyItem.put("effectiveDate",payment.getString("effectiveDate").substring(0,10));
-			historyList.add(historyItem);
+			if (!invoice.getString("partyId").equals(partyId)) {
+				historyItem = new HashMap();
+				historyItem.put("paymentId",payment.getString("paymentId"));
+				historyItem.put("invoiceId",paymentApplication.getString("invoiceId"));
+				historyItem.put("invoiceItemSeqId",paymentApplication.getString("invoiceItemSeqId"));
+				historyItem.put("partyId",invoice.getString("partyIdFrom"));
+				historyItem.put("amount",amount.toString());
+				historyItem.put("applied",paymentApplication.getBigDecimal("amountApplied").setScale(2,BigDecimal.ROUND_HALF_UP).toString());
+				historyItem.put("effectiveDate",payment.getString("effectiveDate").substring(0,10));
+				historyList.add(historyItem);
+			}
 		}
 	}
 	context.put("historyListPaymentsO",historyList);



More information about the Svn mailing list