|
Author: jleroux
Date: Tue Dec 7 10:42:16 2010 New Revision: 1042964 URL: http://svn.apache.org/viewvc?rev=1042964&view=rev Log: Merges the trunk at r1042950 (some conflicts handled by hand) Added: ofbiz/branches/jquery/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy - copied unchanged from r1042956, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/ProductUomDropDownOnly.ftl - copied unchanged from r1042956, ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/ProductUomDropDownOnly.ftl Removed: ofbiz/branches/jquery/applications/product/webapp/facility/shipment/EditShipment.ftl Modified: ofbiz/branches/jquery/ (props changed) ofbiz/branches/jquery/applications/accounting/data/DemoAccountingUserData.xml ofbiz/branches/jquery/applications/accounting/data/DemoOrganizationData.xml ofbiz/branches/jquery/applications/accounting/servicedef/services_billing.xml ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java ofbiz/branches/jquery/applications/content/data/ContentPortletData.xml ofbiz/branches/jquery/applications/content/data/ExampleHelpData.xml ofbiz/branches/jquery/applications/content/data/MimeTypeData.xml ofbiz/branches/jquery/applications/content/data/UsersDemoData.xml ofbiz/branches/jquery/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java ofbiz/branches/jquery/applications/humanres/data/HumanResHelpData.xml ofbiz/branches/jquery/applications/marketing/data/sfaDemoData.xml ofbiz/branches/jquery/applications/order/data/OrderTypeData.xml ofbiz/branches/jquery/applications/order/entitydef/entitymodel.xml ofbiz/branches/jquery/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml (props changed) ofbiz/branches/jquery/applications/order/script/org/ofbiz/order/shoppinglist/ShoppingListServices.xml ofbiz/branches/jquery/applications/order/servicedef/orderProcessXPDL.xml ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java ofbiz/branches/jquery/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy ofbiz/branches/jquery/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy ofbiz/branches/jquery/applications/order/webapp/ordermgr/WEB-INF/controller.xml ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/compareproductslist.ftl ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/keywordsearch.ftl ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/productdetail.ftl ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/order/orderitems.ftl ofbiz/branches/jquery/applications/order/widget/ordermgr/OrderEntryCatalogScreens.xml ofbiz/branches/jquery/applications/party/data/PartyDemoData.xml ofbiz/branches/jquery/applications/party/data/PartyGeoPointData.xml ofbiz/branches/jquery/applications/party/entitydef/entitymodel_old.xml ofbiz/branches/jquery/applications/party/script/org/ofbiz/party/party/PartyServices.xml ofbiz/branches/jquery/applications/party/script/org/ofbiz/party/test/PartyContactMechTests.xml ofbiz/branches/jquery/applications/party/servicedef/services.xml ofbiz/branches/jquery/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy (props changed) ofbiz/branches/jquery/applications/party/webapp/partymgr/party/profileblocks/Content.ftl ofbiz/branches/jquery/applications/party/widget/partymgr/PartyVisitForms.xml ofbiz/branches/jquery/applications/product/config/ImageProperties.xml ofbiz/branches/jquery/applications/product/config/ProductEntityLabels.xml ofbiz/branches/jquery/applications/product/data/ProductTypeData.xml ofbiz/branches/jquery/applications/product/entitydef/entitymodel.xml ofbiz/branches/jquery/applications/product/script/org/ofbiz/product/price/PriceServices.xml ofbiz/branches/jquery/applications/product/script/org/ofbiz/product/product/ProductServices.xml ofbiz/branches/jquery/applications/product/script/org/ofbiz/product/test/InventoryTests.xml (props changed) ofbiz/branches/jquery/applications/product/servicedef/services.xml ofbiz/branches/jquery/applications/product/servicedef/services_pricepromo.xml ofbiz/branches/jquery/applications/product/src/org/ofbiz/product/image/ScaleImage.java ofbiz/branches/jquery/applications/product/src/org/ofbiz/product/price/PriceServices.java ofbiz/branches/jquery/applications/product/src/org/ofbiz/product/product/ProductServices.java ofbiz/branches/jquery/applications/product/src/org/ofbiz/product/product/ProductWorker.java ofbiz/branches/jquery/applications/product/webapp/catalog/promo/FindProductPromoCode.ftl ofbiz/branches/jquery/applications/product/webapp/catalog/reviews/pendingReviews.ftl ofbiz/branches/jquery/applications/product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy ofbiz/branches/jquery/applications/product/widget/catalog/FacilityForms.xml ofbiz/branches/jquery/applications/product/widget/catalog/ProductStoreForms.xml ofbiz/branches/jquery/applications/product/widget/facility/ShipmentForms.xml ofbiz/branches/jquery/applications/product/widget/facility/ShipmentScreens.xml ofbiz/branches/jquery/applications/workeffort/config/EventReminders.properties ofbiz/branches/jquery/applications/workeffort/data/WorkEffortSecurityData.xml ofbiz/branches/jquery/applications/workeffort/data/WorkEffortTypeData.xml ofbiz/branches/jquery/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java ofbiz/branches/jquery/debian/TODO ofbiz/branches/jquery/debian/ofbiz-framework.ofbiz.init ofbiz/branches/jquery/debian/override-data.xslt ofbiz/branches/jquery/framework/base/src/org/ofbiz/base/util/UtilIO.java ofbiz/branches/jquery/framework/common/config/general.properties ofbiz/branches/jquery/framework/common/data/UnitData.xml ofbiz/branches/jquery/framework/common/script/org/ofbiz/common/email/EmailServices.xml ofbiz/branches/jquery/framework/common/src/org/ofbiz/common/FindServices.java ofbiz/branches/jquery/framework/common/widget/HelpScreens.xml (props changed) ofbiz/branches/jquery/framework/entity/dtd/entitymodel.xsd ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java ofbiz/branches/jquery/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java ofbiz/branches/jquery/framework/example/data/ExampleHelpData.xml ofbiz/branches/jquery/framework/example/data/helpdata/HELP_EXAMPLE.xml ofbiz/branches/jquery/framework/example/data/helpdata/HELP_EXAMPLE_main.xml ofbiz/branches/jquery/framework/example/widget/example/BirtForms.xml ofbiz/branches/jquery/framework/example/widget/example/BirtScreens.xml ofbiz/branches/jquery/framework/images/webapp/images/ecommain.css ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java ofbiz/branches/jquery/framework/webtools/widget/CacheForms.xml ofbiz/branches/jquery/framework/webtools/widget/LabelManagerScreens.xml ofbiz/branches/jquery/framework/webtools/widget/Menus.xml ofbiz/branches/jquery/framework/webtools/widget/StatsForms.xml ofbiz/branches/jquery/macros.xml ofbiz/branches/jquery/specialpurpose/ebaystore/data/DemoEbayStoreData.xml ofbiz/branches/jquery/specialpurpose/ebaystore/lib/ (props changed) ofbiz/branches/jquery/specialpurpose/ecommerce/data/DemoMarketing.xml ofbiz/branches/jquery/specialpurpose/ecommerce/data/DemoOrderPeopleData.xml ofbiz/branches/jquery/specialpurpose/ecommerce/data/DemoProduct.xml ofbiz/branches/jquery/specialpurpose/ecommerce/data/DemoRentalProduct.xml ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/blog/blogs.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/catalog/choosecatalog.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/catalog/minilastviewedcategories.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/catalog/minilastviewedproducts.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/catalog/productdetail.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/catalog/sidedeepcategory.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/content/content_categories.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/content/factoids.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/content/minipoll.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/content/recentlyviewed.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/customer/miniSignUpForContactList.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/forum/forums.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/includes/language.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/widget/blog/BlogScreens.xml ofbiz/branches/jquery/specialpurpose/googlebase/data/DemoGoogleBaseData.xml ofbiz/branches/jquery/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/Facilities.groovy (props changed) ofbiz/branches/jquery/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductList.groovy (props changed) ofbiz/branches/jquery/specialpurpose/hhfacility/webapp/hhfacility/WEB-INF/actions/ProductStockTake.groovy (props changed) ofbiz/branches/jquery/specialpurpose/workflow/data/OrderProcessWorkflow.xml ofbiz/branches/jquery/themes/droppingcrumbs/data/DroppingCrumbsThemeData.xml Propchange: ofbiz/branches/jquery/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Dec 7 10:42:16 2010 @@ -1,3 +1,3 @@ /ofbiz/branches/addbirt:831210-885099,885686-886087 /ofbiz/branches/multitenant20100310:921280-927264 -/ofbiz/trunk:951708-1040441 +/ofbiz/trunk:951708-1042956 Modified: ofbiz/branches/jquery/applications/accounting/data/DemoAccountingUserData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/data/DemoAccountingUserData.xml?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/data/DemoAccountingUserData.xml (original) +++ ofbiz/branches/jquery/applications/accounting/data/DemoAccountingUserData.xml Tue Dec 7 10:42:16 2010 @@ -1,39 +1,39 @@ -<?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. ---> - -<entity-engine-xml> - <Party partyId="accountant_group" partyTypeId="PARTY_GROUP"/> - <PartyGroup partyId="accountant_group" groupName="Accountant Group"/> - <PartyRole partyId="accountant_group" roleTypeId="ORGANIZATION_ROLE"/> - <PartyRole partyId="accountant_group" roleTypeId="_NA_"/> - <PartyRelationship partyIdFrom="Company" partyIdTo="accountant_group" partyRelationshipTypeId="GROUP_ROLLUP" roleTypeIdFrom="_NA_" roleTypeIdTo="_NA_" fromDate="2001-01-01 12:00:00.0"/> - - <Party partyId="accountingadmin" partyTypeId="PERSON"/> - <Person partyId="accountingadmin" firstName="Accounting" lastName="Administrator"/> - <PartyRole partyId="accountingadmin" roleTypeId="ACCOUNTANT"/> - <PartyRole partyId="accountingadmin" roleTypeId="EMPLOYEE"/> - <PartyRole partyId="accountingadmin" roleTypeId="_NA_"/> - <UserLogin userLoginId="accountingadmin" currentPassword="{SHA}47ca69ebb4bdc9ae0adec130880165d2cc05db1a" partyId="accountingadmin" passwordHint=""/> - <UserLoginSecurityGroup groupId="ACCTG_FUNCTNL_ADMIN" userLoginId="accountingadmin" fromDate="2001-01-01 12:00:00.0"/> - - <PartyRelationship partyIdFrom="Company" partyIdTo="accountingadmin" partyRelationshipTypeId="EMPLOYMENT" roleTypeIdFrom="INTERNAL_ORGANIZATIO" roleTypeIdTo="EMPLOYEE" fromDate="2001-01-01 12:00:00.0"/> - <PartyRelationship partyIdFrom="accountant_group" partyIdTo="accountingadmin" partyRelationshipTypeId="GROUP_ROLLUP" roleTypeIdFrom="ORGANIZATION_ROLE" roleTypeIdTo="ACCOUNTANT" fromDate="2001-01-01 12:00:00.0"/> - -</entity-engine-xml> +<?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. +--> + +<entity-engine-xml> + <Party partyId="accountant_group" partyTypeId="PARTY_GROUP"/> + <PartyGroup partyId="accountant_group" groupName="Accountant Group"/> + <PartyRole partyId="accountant_group" roleTypeId="ORGANIZATION_ROLE"/> + <PartyRole partyId="accountant_group" roleTypeId="_NA_"/> + <PartyRelationship partyIdFrom="Company" partyIdTo="accountant_group" partyRelationshipTypeId="GROUP_ROLLUP" roleTypeIdFrom="_NA_" roleTypeIdTo="_NA_" fromDate="2001-01-01 12:00:00.0"/> + + <Party partyId="accountingadmin" partyTypeId="PERSON"/> + <Person partyId="accountingadmin" firstName="Accounting" lastName="Administrator"/> + <PartyRole partyId="accountingadmin" roleTypeId="ACCOUNTANT"/> + <PartyRole partyId="accountingadmin" roleTypeId="EMPLOYEE"/> + <PartyRole partyId="accountingadmin" roleTypeId="_NA_"/> + <UserLogin userLoginId="accountingadmin" currentPassword="{SHA}47ca69ebb4bdc9ae0adec130880165d2cc05db1a" partyId="accountingadmin" passwordHint=""/> + <UserLoginSecurityGroup groupId="ACCTG_FUNCTNL_ADMIN" userLoginId="accountingadmin" fromDate="2001-01-01 12:00:00.0"/> + + <PartyRelationship partyIdFrom="Company" partyIdTo="accountingadmin" partyRelationshipTypeId="EMPLOYMENT" roleTypeIdFrom="INTERNAL_ORGANIZATIO" roleTypeIdTo="EMPLOYEE" fromDate="2001-01-01 12:00:00.0"/> + <PartyRelationship partyIdFrom="accountant_group" partyIdTo="accountingadmin" partyRelationshipTypeId="GROUP_ROLLUP" roleTypeIdFrom="ORGANIZATION_ROLE" roleTypeIdTo="ACCOUNTANT" fromDate="2001-01-01 12:00:00.0"/> + +</entity-engine-xml> Modified: ofbiz/branches/jquery/applications/accounting/data/DemoOrganizationData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/data/DemoOrganizationData.xml?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/data/DemoOrganizationData.xml (original) +++ ofbiz/branches/jquery/applications/accounting/data/DemoOrganizationData.xml Tue Dec 7 10:42:16 2010 @@ -28,9 +28,12 @@ under the License. <ContactMech contactMechId="9000" contactMechTypeId="POSTAL_ADDRESS"/> <PartyContactMech partyId="Company" contactMechId="9000" fromDate="2000-01-01 00:00:00.000" allowSolicitation="Y"/> <PostalAddress contactMechId="9000" toName="Company XYZ" address1="2003 Open Blvd" city="Open City" postalCode="999999" countryGeoId="USA" stateProvinceGeoId="CA" geoPointId="9000"/> - <ContactMech contactMechId="Company" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> + <ContactMech contactMechId="Company" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> <PartyContactMech partyId="Company" contactMechId="Company" fromDate="2000-01-01 00:00:00.000" allowSolicitation="Y"/> <PartyContactMechPurpose contactMechPurposeTypeId="PRIMARY_EMAIL" partyId="Company" contactMechId="Company" fromDate="2003-01-01 00:00:00.000"/> + <ContactMech contactMechId="CompanySupport" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> + <PartyContactMech partyId="Company" contactMechId="CompanySupport" fromDate="2003-01-01 00:00:00.0" allowSolicitation="Y"/> + <PartyContactMechPurpose contactMechPurposeTypeId="SUPPORT_EMAIL" partyId="Company" contactMechId="CompanySupport" fromDate="2003-01-01 00:00:00.0"/> <PartyContactMechPurpose partyId="Company" contactMechId="9000" contactMechPurposeTypeId="BILLING_LOCATION" fromDate="2000-01-01 00:00:00.000"/> <PartyContactMechPurpose partyId="Company" contactMechId="9000" contactMechPurposeTypeId="GENERAL_LOCATION" fromDate="2000-01-01 00:00:00.000"/> <PartyContactMechPurpose partyId="Company" contactMechId="9000" contactMechPurposeTypeId="PAYMENT_LOCATION" fromDate="2000-01-01 00:00:00.000"/> Modified: ofbiz/branches/jquery/applications/accounting/servicedef/services_billing.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/servicedef/services_billing.xml?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/servicedef/services_billing.xml (original) +++ ofbiz/branches/jquery/applications/accounting/servicedef/services_billing.xml Tue Dec 7 10:42:16 2010 @@ -83,7 +83,7 @@ under the License. <permission-service service-name="acctgBillingAcctCheck" main-action="CREATE"/> <attribute name="billingAccountId" type="String" mode="IN" optional="false"/> <attribute name="termTypeId" type="String" mode="IN" optional="false"/> - <attribute name="termValue" type="Long" mode="IN" optional="false"/> + <attribute name="termValue" type="BigDecimal" mode="IN" optional="false"/> <attribute name="uomId" type="String" mode="IN" optional="true"/> <attribute name="billingAccountTermId" type="String" mode="OUT" optional="false"/> </service> @@ -94,7 +94,7 @@ under the License. <attribute name="billingAccountTermId" type="String" mode="IN" optional="false"/> <attribute name="billingAccountId" type="String" mode="IN" optional="true"/> <attribute name="termTypeId" type="String" mode="IN" optional="true"/> - <attribute name="termValue" type="Long" mode="IN" optional="true"/> + <attribute name="termValue" type="BigDecimal" mode="IN" optional="true"/> <attribute name="uomId" type="String" mode="IN" optional="true"/> </service> <service name="removeBillingAccountTerm" engine="simple" Modified: ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java (original) +++ ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java Tue Dec 7 10:42:16 2010 @@ -391,11 +391,38 @@ public class TaxAuthorityServices { // TODO: what to do if no TaxAuthorityGlAccount found? Use some default, or is that done elsewhere later on? } + GenericValue productPrice = null; + if (product != null && taxAuthPartyId != null && taxAuthGeoId != null) { + // find a ProductPrice for the productId and taxAuth* valxues, and see if it has a priceWithTax value + Map<String, String> priceFindMap = UtilMisc.toMap("productId", product.getString("productId"), + "taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, + "productPriceTypeId", "DEFAULT_PRICE", "productPricePurposeId", "PURCHASE"); + List<GenericValue> productPriceList = delegator.findByAnd("ProductPrice", priceFindMap, UtilMisc.toList("-fromDate")); + productPriceList = EntityUtil.filterByDate(productPriceList, true); + productPrice = (productPriceList != null && productPriceList.size() > 0) ? productPriceList.get(0): null; + //Debug.logInfo("=================== productId=" + product.getString("productId"), module); + //Debug.logInfo("=================== productPrice=" + productPrice, module); + + } + GenericValue taxAdjValue = delegator.makeValue("OrderAdjustment"); - taxAdjValue.set("taxAuthorityRateSeqId", taxAuthorityRateProduct.getString("taxAuthorityRateSeqId")); - taxAdjValue.set("amount", taxAmount); + + if (productPrice != null && "Y".equals(productPrice.getString("taxInPrice"))) { + // tax is in the price already, so we want the adjustment to be a VAT_TAX adjustment to be subtracted instead of a SALES_TAX adjustment to be added + taxAdjValue.set("orderAdjustmentTypeId", "VAT_TAX"); + + // the amount will be different because we want to figure out how much of the price was tax, and not how much tax needs to be added + // the formula is: taxAmount = priceWithTax - (priceWithTax/(1+taxPercentage/100)) + BigDecimal taxAmountIncluded = itemAmount.subtract(itemAmount.divide(BigDecimal.ONE.add(taxRate.divide(PERCENT_SCALE, 4, BigDecimal.ROUND_HALF_UP)), 3, BigDecimal.ROUND_HALF_UP)); + taxAdjValue.set("amountAlreadyIncluded", taxAmountIncluded); + taxAdjValue.set("amount", BigDecimal.ZERO); + } else { + taxAdjValue.set("orderAdjustmentTypeId", "SALES_TAX"); + taxAdjValue.set("amount", taxAmount); + } + taxAdjValue.set("sourcePercentage", taxRate); - taxAdjValue.set("orderAdjustmentTypeId", "SALES_TAX"); + taxAdjValue.set("taxAuthorityRateSeqId", taxAuthorityRateProduct.getString("taxAuthorityRateSeqId")); // the primary Geo should be the main jurisdiction that the tax is for, and the secondary would just be to define a parent or wrapping jurisdiction of the primary taxAdjValue.set("primaryGeoId", taxAuthGeoId); taxAdjValue.set("comments", taxAuthorityRateProduct.getString("description")); @@ -421,62 +448,50 @@ public class TaxAuthorityServices { } adjustments.add(taxAdjValue); - - // for VAT taxes if the calculated total item price plus calculated taxes is different from what would be - // expected based on the original entered price with taxes (if the price was entered this way), then create - // an adjustment that corrects for the difference, and this correction will be effectively subtracted from the - // price and not from the tax (the tax is meant to be calculated based on Tax Authority rules and so should - // not be shorted) - - // TODO get this to work with price rules changing the default price (right now only works where itemPrice==defaultPrice - // TODO (don't think this is needed, but just to keep it in mind): get this to work with multiple VAT tax authorities instead of just one (right now will get incorrect totals if there are multiple taxes included in the price) - // TODO add constraint to ProductPrice lookup by any productStoreGroupId associated with the current productStore - - //Debug.logInfo("=================== itemQuantity=" + itemQuantity, module); - //Debug.logInfo("=================== taxAuthPartyId=" + taxAuthPartyId, module); - //Debug.logInfo("=================== taxAuthGeoId=" + taxAuthGeoId, module); - if (product != null && itemQuantity != null && taxAuthPartyId != null && taxAuthGeoId != null) { - // find a ProductPrice for the productId and taxAuth* valxues, and see if it has a priceWithTax value - Map<String, String> priceFindMap = UtilMisc.toMap("productId", product.getString("productId"), - "taxAuthPartyId", taxAuthPartyId, "taxAuthGeoId", taxAuthGeoId, - "productPriceTypeId", "DEFAULT_PRICE", "productPricePurposeId", "PURCHASE"); - List<GenericValue> productPriceList = delegator.findByAnd("ProductPrice", priceFindMap, UtilMisc.toList("-fromDate")); - productPriceList = EntityUtil.filterByDate(productPriceList, true); - GenericValue productPrice = (productPriceList != null && productPriceList.size() > 0) ? productPriceList.get(0): null; - //Debug.logInfo("=================== productId=" + product.getString("productId"), module); - //Debug.logInfo("=================== productPrice=" + productPrice, module); + + if (productPrice != null && itemQuantity != null && + productPrice.getBigDecimal("priceWithTax") != null && + !"Y".equals(productPrice.getString("taxInPrice"))) { + BigDecimal priceWithTax = productPrice.getBigDecimal("priceWithTax"); + BigDecimal price = productPrice.getBigDecimal("price"); + BigDecimal baseSubtotal = price.multiply(itemQuantity); + BigDecimal baseTaxAmount = (baseSubtotal.multiply(taxRate)).divide(PERCENT_SCALE, salestaxCalcDecimals, salestaxRounding); + //Debug.logInfo("=================== priceWithTax=" + priceWithTax, module); + //Debug.logInfo("=================== enteredTotalPriceWithTax=" + enteredTotalPriceWithTax, module); + //Debug.logInfo("=================== calcedTotalPriceWithTax=" + calcedTotalPriceWithTax, module); + + // tax is not already in price so we want to add it in, but this is a VAT situation so adjust to make it as accurate as possible + + // for VAT taxes if the calculated total item price plus calculated taxes is different from what would be + // expected based on the original entered price with taxes (if the price was entered this way), then create + // an adjustment that corrects for the difference, and this correction will be effectively subtracted from the + // price and not from the tax (the tax is meant to be calculated based on Tax Authority rules and so should + // not be shorted) + + // TODO (don't think this is needed, but just to keep it in mind): get this to work with multiple VAT tax authorities instead of just one (right now will get incorrect totals if there are multiple taxes included in the price) + // TODO add constraint to ProductPrice lookup by any productStoreGroupId associated with the current productStore - if (productPrice != null && productPrice.getBigDecimal("priceWithTax") != null) { - BigDecimal priceWithTax = productPrice.getBigDecimal("priceWithTax"); - BigDecimal price = productPrice.getBigDecimal("price"); - BigDecimal baseSubtotal = price.multiply(itemQuantity); - BigDecimal baseTaxAmount = (baseSubtotal.multiply(taxRate)).divide(PERCENT_SCALE, salestaxCalcDecimals, salestaxRounding); - BigDecimal enteredTotalPriceWithTax = priceWithTax.multiply(itemQuantity); - BigDecimal calcedTotalPriceWithTax = (baseSubtotal).add(baseTaxAmount); - //Debug.logInfo("=================== priceWithTax=" + priceWithTax, module); - //Debug.logInfo("=================== enteredTotalPriceWithTax=" + enteredTotalPriceWithTax, module); - //Debug.logInfo("=================== calcedTotalPriceWithTax=" + calcedTotalPriceWithTax, module); + BigDecimal enteredTotalPriceWithTax = priceWithTax.multiply(itemQuantity); + BigDecimal calcedTotalPriceWithTax = (baseSubtotal).add(baseTaxAmount); + if (!enteredTotalPriceWithTax.equals(calcedTotalPriceWithTax)) { + // if the calced amount is higher than the entered amount we want the value to be negative + // to get it down to match the entered amount + // so, subtract the calced amount from the entered amount (ie: correction = entered - calced) + BigDecimal correctionAmount = enteredTotalPriceWithTax.subtract(calcedTotalPriceWithTax); + //Debug.logInfo("=================== correctionAmount=" + correctionAmount, module); - if (!enteredTotalPriceWithTax.equals(calcedTotalPriceWithTax)) { - // if the calced amount is higher than the entered amount we want the value to be negative - // to get it down to match the entered amount - // so, subtract the calced amount from the entered amount (ie: correction = entered - calced) - BigDecimal correctionAmount = enteredTotalPriceWithTax.subtract(calcedTotalPriceWithTax); - //Debug.logInfo("=================== correctionAmount=" + correctionAmount, module); - - GenericValue correctionAdjValue = delegator.makeValue("OrderAdjustment"); - correctionAdjValue.set("taxAuthorityRateSeqId", taxAuthorityRateProduct.getString("taxAuthorityRateSeqId")); - correctionAdjValue.set("amount", correctionAmount); - // don't set this, causes a doubling of the tax rate because calling code adds up all tax rates: correctionAdjValue.set("sourcePercentage", taxRate); - correctionAdjValue.set("orderAdjustmentTypeId", "VAT_PRICE_CORRECT"); - // the primary Geo should be the main jurisdiction that the tax is for, and the secondary would just be to define a parent or wrapping jurisdiction of the primary - correctionAdjValue.set("primaryGeoId", taxAuthGeoId); - correctionAdjValue.set("comments", taxAuthorityRateProduct.getString("description")); - if (taxAuthPartyId != null) correctionAdjValue.set("taxAuthPartyId", taxAuthPartyId); - if (taxAuthGlAccountId != null) correctionAdjValue.set("overrideGlAccountId", taxAuthGlAccountId); - if (taxAuthGeoId != null) correctionAdjValue.set("taxAuthGeoId", taxAuthGeoId); - adjustments.add(correctionAdjValue); - } + GenericValue correctionAdjValue = delegator.makeValue("OrderAdjustment"); + correctionAdjValue.set("taxAuthorityRateSeqId", taxAuthorityRateProduct.getString("taxAuthorityRateSeqId")); + correctionAdjValue.set("amount", correctionAmount); + // don't set this, causes a doubling of the tax rate because calling code adds up all tax rates: correctionAdjValue.set("sourcePercentage", taxRate); + correctionAdjValue.set("orderAdjustmentTypeId", "VAT_PRICE_CORRECT"); + // the primary Geo should be the main jurisdiction that the tax is for, and the secondary would just be to define a parent or wrapping jurisdiction of the primary + correctionAdjValue.set("primaryGeoId", taxAuthGeoId); + correctionAdjValue.set("comments", taxAuthorityRateProduct.getString("description")); + if (taxAuthPartyId != null) correctionAdjValue.set("taxAuthPartyId", taxAuthPartyId); + if (taxAuthGlAccountId != null) correctionAdjValue.set("overrideGlAccountId", taxAuthGlAccountId); + if (taxAuthGeoId != null) correctionAdjValue.set("taxAuthGeoId", taxAuthGeoId); + adjustments.add(correctionAdjValue); } } } Modified: ofbiz/branches/jquery/applications/content/data/ContentPortletData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/content/data/ContentPortletData.xml?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/content/data/ContentPortletData.xml (original) +++ ofbiz/branches/jquery/applications/content/data/ContentPortletData.xml Tue Dec 7 10:42:16 2010 @@ -1,28 +1,28 @@ -<?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. ---> -<entity-engine-xml> - <PortletCategory portletCategoryId="CONTENT" description="CMS Portlets"/> - - <PortalPortlet portalPortletId="showContent" - portletName="Show Content" description="Shows a content in a Portal page" - screenName="ShowContentPortlet" screenLocation="component://content/widget/content/ContentScreens.xml" - editFormName="EditShowContentPortlet" editFormLocation="component://content/widget/content/ContentForms.xml"/> - <PortletPortletCategory portalPortletId="showContent" portletCategoryId="CONTENT"/> +<?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. +--> +<entity-engine-xml> + <PortletCategory portletCategoryId="CONTENT" description="CMS Portlets"/> + + <PortalPortlet portalPortletId="showContent" + portletName="Show Content" description="Shows a content in a Portal page" + screenName="ShowContentPortlet" screenLocation="component://content/widget/content/ContentScreens.xml" + editFormName="EditShowContentPortlet" editFormLocation="component://content/widget/content/ContentForms.xml"/> + <PortletPortletCategory portalPortletId="showContent" portletCategoryId="CONTENT"/> </entity-engine-xml> Modified: ofbiz/branches/jquery/applications/content/data/ExampleHelpData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/content/data/ExampleHelpData.xml?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/content/data/ExampleHelpData.xml (original) +++ ofbiz/branches/jquery/applications/content/data/ExampleHelpData.xml Tue Dec 7 10:42:16 2010 @@ -1,38 +1,38 @@ -<?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. ---> -<entity-engine-xml> - <DataResource dataResourceId="HELP_EXAMPLE" localeString="en" dataResourceTypeId="OFBIZ_FILE" - objectInfo="framework/example/data/helpdata/HELP_EXAMPLE.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" - dataResourceName="Framework Example" mimeTypeId="text/xml" isPublic="Y" /> - <Content contentId="HELP_EXAMPLE" contentTypeId="DOCUMENT" contentName="Framework Example" templateDataResourceId="HELP_TEMPL" - dataResourceId="HELP_EXAMPLE" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> - <ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_EXAMPLE" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000"/> - - <DataResource dataResourceId="EXAMPLE_main" localeString="en" dataResourceTypeId="OFBIZ_FILE" - objectInfo="framework/example/data/helpdata/HELP_EXAMPLE_main.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Example help main page" mimeTypeId="text/xml" isPublic="Y" /> - <Content contentId="EXAMPLE_main" contentTypeId="DOCUMENT" contentName="Example main menu." templateDataResourceId="HELP_TEMPL" dataResourceId="EXAMPLE_main" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> - <ContentAssoc contentId="HELP_EXAMPLE" contentIdTo="EXAMPLE_main" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EXAMPLE_main"/> - - <DataResource dataResourceId="EXAMPLE_docbook" localeString="en" dataResourceTypeId="OFBIZ_FILE" - objectInfo="framework/example/data/helpdata/HELP_EXAMPLE_docbook.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Example docBook usage" mimeTypeId="text/xml" isPublic="Y" /> - <Content contentId="EXAMPLE_docbook" contentTypeId="DOCUMENT" contentName="Example Docbook usage" templateDataResourceId="HELP_TEMPL" dataResourceId="EXAMPLE_docbook" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> - <ContentAssoc contentId="HELP_EXAMPLE" contentIdTo="EXAMPLE_docbook" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EXAMPLE_docbook"/> - -</entity-engine-xml> +<?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. +--> +<entity-engine-xml> + <DataResource dataResourceId="HELP_EXAMPLE" localeString="en" dataResourceTypeId="OFBIZ_FILE" + objectInfo="framework/example/data/helpdata/HELP_EXAMPLE.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" + dataResourceName="Framework Example" mimeTypeId="text/xml" isPublic="Y" /> + <Content contentId="HELP_EXAMPLE" contentTypeId="DOCUMENT" contentName="Framework Example" templateDataResourceId="HELP_TEMPL" + dataResourceId="HELP_EXAMPLE" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> + <ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_EXAMPLE" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000"/> + + <DataResource dataResourceId="EXAMPLE_main" localeString="en" dataResourceTypeId="OFBIZ_FILE" + objectInfo="framework/example/data/helpdata/HELP_EXAMPLE_main.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Example help main page" mimeTypeId="text/xml" isPublic="Y" /> + <Content contentId="EXAMPLE_main" contentTypeId="DOCUMENT" contentName="Example main menu." templateDataResourceId="HELP_TEMPL" dataResourceId="EXAMPLE_main" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> + <ContentAssoc contentId="HELP_EXAMPLE" contentIdTo="EXAMPLE_main" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EXAMPLE_main"/> + + <DataResource dataResourceId="EXAMPLE_docbook" localeString="en" dataResourceTypeId="OFBIZ_FILE" + objectInfo="framework/example/data/helpdata/HELP_EXAMPLE_docbook.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Example docBook usage" mimeTypeId="text/xml" isPublic="Y" /> + <Content contentId="EXAMPLE_docbook" contentTypeId="DOCUMENT" contentName="Example Docbook usage" templateDataResourceId="HELP_TEMPL" dataResourceId="EXAMPLE_docbook" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> + <ContentAssoc contentId="HELP_EXAMPLE" contentIdTo="EXAMPLE_docbook" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum="000" mapKey="EXAMPLE_docbook"/> + +</entity-engine-xml> Modified: ofbiz/branches/jquery/applications/content/data/MimeTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/content/data/MimeTypeData.xml?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/content/data/MimeTypeData.xml (original) +++ ofbiz/branches/jquery/applications/content/data/MimeTypeData.xml Tue Dec 7 10:42:16 2010 @@ -1253,7 +1253,7 @@ under the License. [Van Nostern] Gene C. Van Nostern <[hidden email]>, February 1995. -[Yellow] Mr. Yellow <[hidden email]>, March 1998. +[Yellow] Mr. Yellow <[hidden email]>, March 1998. [Yoshitake] Jun Yoshitake, <[hidden email]>, February 1997. Modified: ofbiz/branches/jquery/applications/content/data/UsersDemoData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/content/data/UsersDemoData.xml?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/content/data/UsersDemoData.xml (original) +++ ofbiz/branches/jquery/applications/content/data/UsersDemoData.xml Tue Dec 7 10:42:16 2010 @@ -47,19 +47,19 @@ under the License. <PartyRole partyId="BLOG_EDITOR" roleTypeId="CONTENT_PUBLISHER"/> <PartyRole partyId="BLOG_EDITOR" roleTypeId="_NA_"/> - <ContactMech contactMechId="ADMIN_CONTACT" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> + <ContactMech contactMechId="ADMIN_CONTACT" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> <PartyContactMech partyId="BLOG_ADMIN" contactMechId="ADMIN_CONTACT" fromDate="2001-05-13 12:00:00.0"/> <PartyContactMechPurpose partyId="BLOG_ADMIN" contactMechId="ADMIN_CONTACT" contactMechPurposeTypeId="PRIMARY_EMAIL" fromDate="2001-05-13 12:00:00.0"/> - <ContactMech contactMechId="AUTHOR_CONTACT" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> + <ContactMech contactMechId="AUTHOR_CONTACT" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> <PartyContactMech partyId="BLOG_AUTHOR" contactMechId="AUTHOR_CONTACT" fromDate="2001-05-13 12:00:00.0"/> <PartyContactMechPurpose partyId="BLOG_AUTHOR" contactMechId="AUTHOR_CONTACT" contactMechPurposeTypeId="PRIMARY_EMAIL" fromDate="2001-05-13 12:00:00.0"/> - <ContactMech contactMechId="EDITOR_CONTACT" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> + <ContactMech contactMechId="EDITOR_CONTACT" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> <PartyContactMech partyId="BLOG_EDITOR" contactMechId="EDITOR_CONTACT" fromDate="2001-05-13 12:00:00.0"/> <PartyContactMechPurpose partyId="BLOG_EDITOR" contactMechId="EDITOR_CONTACT" contactMechPurposeTypeId="PRIMARY_EMAIL" fromDate="2001-05-13 12:00:00.0"/> - <ContactMech contactMechId="GUEST_CONTACT" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> + <ContactMech contactMechId="GUEST_CONTACT" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> <PartyContactMech partyId="BLOG_GUEST" contactMechId="GUEST_CONTACT" fromDate="2001-05-13 12:00:00.0"/> <PartyContactMechPurpose partyId="BLOG_GUEST" contactMechId="GUEST_CONTACT" contactMechPurposeTypeId="PRIMARY_EMAIL" fromDate="2001-05-13 12:00:00.0"/> </entity-engine-xml> Modified: ofbiz/branches/jquery/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java (original) +++ ofbiz/branches/jquery/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Tue Dec 7 10:42:16 2010 @@ -56,6 +56,7 @@ import org.ofbiz.base.util.FileUtil; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.base.util.UtilIO; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; @@ -149,7 +150,7 @@ public class DataResourceWorker impleme */ public static void getDataCategoryAncestry(Delegator delegator, String dataCategoryId, List<String> categoryTypeIds) throws GenericEntityException { categoryTypeIds.add(dataCategoryId); - GenericValue dataCategoryValue = delegator.findByPrimaryKey("DataCategory", UtilMisc.toMap("dataCategoryId", dataCategoryId)); + GenericValue dataCategoryValue = delegator.findOne("DataCategory", UtilMisc.toMap("dataCategoryId", dataCategoryId), false); if (dataCategoryValue == null) return; String parentCategoryId = (String) dataCategoryValue.get("parentCategoryId"); @@ -305,7 +306,7 @@ public class DataResourceWorker impleme String ownerContentId = (String) context.get("ownerContentId"); if (UtilValidate.isNotEmpty(ownerContentId)) { try { - GenericValue content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", ownerContentId)); + GenericValue content = delegator.findOne("Content", UtilMisc.toMap("contentId", ownerContentId), false); if (content != null) serviceInMap.put("currentContent", content); } catch (GenericEntityException e) { @@ -329,7 +330,7 @@ public class DataResourceWorker impleme public static byte[] acquireImage(Delegator delegator, String dataResourceId) throws GenericEntityException { byte[] b = null; - GenericValue dataResource = delegator.findByPrimaryKeyCache("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); + GenericValue dataResource = delegator.findOne("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId), true); if (dataResource == null) return b; @@ -340,7 +341,7 @@ public class DataResourceWorker impleme public static byte[] acquireImage(Delegator delegator, GenericValue dataResource) throws GenericEntityException { byte[] b = null; String dataResourceId = dataResource.getString("dataResourceId"); - GenericValue imageDataResource = delegator.findByPrimaryKey("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); + GenericValue imageDataResource = delegator.findOne("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), false); if (imageDataResource != null) { //b = (byte[]) imageDataResource.get("imageData"); b = imageDataResource.getBytes("imageData"); @@ -359,8 +360,8 @@ public class DataResourceWorker impleme if (UtilValidate.isNotEmpty(fileExtension)) { GenericValue ext = null; try { - ext = dataResource.getDelegator().findByPrimaryKey("FileExtension", - UtilMisc.toMap("fileExtensionId", fileExtension)); + ext = dataResource.getDelegator().findOne("FileExtension", + UtilMisc.toMap("fileExtensionId", fileExtension), false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -449,7 +450,7 @@ public class DataResourceWorker impleme mimeType = view.getString("drMimeTypeId"); //if (Debug.infoOn()) Debug.logInfo("getDataResourceMimeType, mimeType(2):" + mimeType, ""); if (UtilValidate.isEmpty(mimeType) && UtilValidate.isNotEmpty(dataResourceId)) { - GenericValue dataResource = delegator.findByPrimaryKeyCache("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); + GenericValue dataResource = delegator.findOne("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId), true); //if (Debug.infoOn()) Debug.logInfo("getDataResourceMimeType, dataResource(2):" + dataResource, ""); mimeType = dataResource.getString("mimeTypeId"); @@ -611,12 +612,7 @@ public class DataResourceWorker impleme } // get the data resource object - GenericValue dataResource = null; - if (cache) { - dataResource = delegator.findByPrimaryKeyCache("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } else { - dataResource = delegator.findByPrimaryKey("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } + GenericValue dataResource = delegator.findOne("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache); if (dataResource == null) { throw new GeneralException("No data resource object found for dataResourceId: [" + dataResourceId + "]"); @@ -658,7 +654,7 @@ public class DataResourceWorker impleme } else { String defaultVisualThemeId = UtilProperties.getPropertyValue("general", "VISUAL_THEME"); if (defaultVisualThemeId != null) { - GenericValue themeValue = delegator.findByPrimaryKeyCache("VisualThemeResource", UtilMisc.toMap("visualThemeId", defaultVisualThemeId, "resourceTypeEnumId", "VT_DOCBOOKSTYLESHEET", "sequenceId", "01")); + GenericValue themeValue = delegator.findOne("VisualThemeResource", UtilMisc.toMap("visualThemeId", defaultVisualThemeId, "resourceTypeEnumId", "VT_DOCBOOKSTYLESHEET", "sequenceId", "01"), true); sourceFileLocation = new File(System.getProperty("ofbiz.home") + "/themes" + themeValue.get("resourceValue")); UtilMisc.copyFile(sourceFileLocation,targetFileLocation); } @@ -778,12 +774,7 @@ public class DataResourceWorker impleme String text = dataResource.getString("objectInfo"); writeText(dataResource, text, templateContext, mimeTypeId, locale, out); } else if ("ELECTRONIC_TEXT".equals(dataResourceTypeId)) { - GenericValue electronicText; - if (cache) { - electronicText = delegator.findByPrimaryKeyCache("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId)); - } else { - electronicText = delegator.findByPrimaryKey("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId)); - } + GenericValue electronicText = delegator.findOne("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId), cache); String text = electronicText.getString("textData"); writeText(dataResource, text, templateContext, mimeTypeId, locale, out); @@ -856,7 +847,7 @@ public class DataResourceWorker impleme if ("text/html".equals(targetMimeTypeId)) { // get the default mime type template - GenericValue mimeTypeTemplate = delegator.findByPrimaryKeyCache("MimeTypeHtmlTemplate", UtilMisc.toMap("mimeTypeId", dataResourceMimeTypeId)); + GenericValue mimeTypeTemplate = delegator.findOne("MimeTypeHtmlTemplate", UtilMisc.toMap("mimeTypeId", dataResourceMimeTypeId), true); if (mimeTypeTemplate != null && mimeTypeTemplate.get("templateLocation") != null) { // prepare the context @@ -895,11 +886,8 @@ public class DataResourceWorker impleme if (!file.isAbsolute()) { throw new GeneralException("File (" + objectInfo + ") is not absolute"); } - int c; FileReader in = new FileReader(file); - while ((c = in.read()) != -1) { - out.append((char)c); - } + UtilIO.copy(in, true, out); } else if (dataResourceTypeId.equals("OFBIZ_FILE")) { String prefix = System.getProperty("ofbiz.home"); String sep = ""; @@ -907,10 +895,8 @@ public class DataResourceWorker impleme sep = "/"; } File file = FileUtil.getFile(prefix + sep + objectInfo); - int c; FileReader in = new FileReader(file); - while ((c = in.read()) != -1) - out.append((char)c); + UtilIO.copy(in, true, out); } else if (dataResourceTypeId.equals("CONTEXT_FILE")) { String prefix = rootDir; String sep = ""; @@ -918,7 +904,6 @@ public class DataResourceWorker impleme sep = "/"; } File file = FileUtil.getFile(prefix + sep + objectInfo); - int c; FileReader in = null; try { in = new FileReader(file); @@ -931,9 +916,7 @@ public class DataResourceWorker impleme } catch (Exception e) { Debug.logError(" in renderDataResourceAsHtml(CONTEXT_FILE), got exception:" + e.getMessage(), module); } - while ((c = in.read()) != -1) { - out.append((char)c); - } + UtilIO.copy(in, true, out); //out.flush(); } } @@ -970,12 +953,7 @@ public class DataResourceWorker impleme if ("SHORT_TEXT".equals(dataResourceTypeId) || "LINK".equals(dataResourceTypeId)) { text = dataResource.getString("objectInfo"); } else if ("ELECTRONIC_TEXT".equals(dataResourceTypeId)) { - GenericValue electronicText; - if (cache) { - electronicText = delegator.findByPrimaryKeyCache("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId)); - } else { - electronicText = delegator.findByPrimaryKey("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId)); - } + GenericValue electronicText = delegator.findOne("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId), cache); if (electronicText != null) { text = electronicText.getString("textData"); } @@ -992,38 +970,22 @@ public class DataResourceWorker impleme GenericValue valObj; if ("IMAGE_OBJECT".equals(dataResourceTypeId)) { - if (cache) { - valObj = delegator.findByPrimaryKeyCache("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } else { - valObj = delegator.findByPrimaryKey("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } + valObj = delegator.findOne("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache); if (valObj != null) { bytes = valObj.getBytes("imageData"); } } else if ("VIDEO_OBJECT".equals(dataResourceTypeId)) { - if (cache) { - valObj = delegator.findByPrimaryKeyCache("VideoDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } else { - valObj = delegator.findByPrimaryKey("VideoDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } + valObj = delegator.findOne("VideoDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache); if (valObj != null) { bytes = valObj.getBytes("videoData"); } } else if ("AUDIO_OBJECT".equals(dataResourceTypeId)) { - if (cache) { - valObj = delegator.findByPrimaryKeyCache("AudioDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } else { - valObj = delegator.findByPrimaryKey("AudioDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } + valObj = delegator.findOne("AudioDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache); if (valObj != null) { bytes = valObj.getBytes("audioData"); } } else if ("OTHER_OBJECT".equals(dataResourceTypeId)) { - if (cache) { - valObj = delegator.findByPrimaryKeyCache("OtherDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } else { - valObj = delegator.findByPrimaryKey("OtherDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - } + valObj = delegator.findOne("OtherDataResource", UtilMisc.toMap("dataResourceId", dataResourceId), cache); if (valObj != null) { bytes = valObj.getBytes("dataResourceContent"); } @@ -1071,7 +1033,7 @@ public class DataResourceWorker impleme // TODO: remove this method in favor of getDataResourceStream public static void streamDataResource(OutputStream os, Delegator delegator, String dataResourceId, String https, String webSiteId, Locale locale, String rootDir) throws IOException, GeneralException { try { - GenericValue dataResource = delegator.findByPrimaryKeyCache("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); + GenericValue dataResource = delegator.findOne("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId), true); if (dataResource == null) { throw new GeneralException("Error in streamDataResource: DataResource with ID [" + dataResourceId + "] was not found."); } @@ -1088,7 +1050,7 @@ public class DataResourceWorker impleme String text = dataResource.getString("objectInfo"); os.write(text.getBytes()); } else if (dataResourceTypeId.equals("ELECTRONIC_TEXT")) { - GenericValue electronicText = delegator.findByPrimaryKeyCache("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId)); + GenericValue electronicText = delegator.findOne("ElectronicText", UtilMisc.toMap("dataResourceId", dataResourceId), true); if (electronicText != null) { String text = electronicText.getString("textData"); if (text != null) os.write(text.getBytes()); @@ -1112,19 +1074,13 @@ public class DataResourceWorker impleme url = new URL(s2); } InputStream in = url.openStream(); - int c; - while ((c = in.read()) != -1) { - os.write(c); - } + UtilIO.copy(in, true, os, false); } else if (dataResourceTypeId.indexOf("_FILE") >= 0) { String objectInfo = dataResource.getString("objectInfo"); File inputFile = getContentFile(dataResourceTypeId, objectInfo, rootDir); //long fileSize = inputFile.length(); FileInputStream fis = new FileInputStream(inputFile); - int c; - while ((c = fis.read()) != -1) { - os.write(c); - } + UtilIO.copy(fis, true, os, false); } else { throw new GeneralException("The dataResourceTypeId [" + dataResourceTypeId + "] is not supported in streamDataResource"); } Modified: ofbiz/branches/jquery/applications/humanres/data/HumanResHelpData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/humanres/data/HumanResHelpData.xml?rev=1042964&r1=1042963&r2=1042964&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/humanres/data/HumanResHelpData.xml (original) +++ ofbiz/branches/jquery/applications/humanres/data/HumanResHelpData.xml Tue Dec 7 10:42:16 2010 @@ -1,39 +1,39 @@ -<?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. ---> -<entity-engine-xml> - <DataResource dataResourceId="HELP_HR" localeString="en" dataResourceTypeId="OFBIZ_FILE" - objectInfo="applications/humanres/data/helpdata/HELP_HR.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" - dataResourceName="Human Resources Overview" mimeTypeId="text/xml" isPublic="Y" /> - <Content contentId="HELP_HR" contentTypeId="DOCUMENT" contentName="Human Resources" templateDataResourceId="HELP_TEMPL" - dataResourceId="HELP_HR" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> - <ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_HR" contentAssocTypeId="TREE_CHILD" fromDate="2009-10-18 01:01:01" sequenceNum="000"/> - - <DataResource dataResourceId="HR_main" localeString="en" dataResourceTypeId="OFBIZ_FILE" - objectInfo="applications/humanres/data/helpdata/HELP_HR_main.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Human Resources Main Help" mimeTypeId="text/xml" isPublic="Y" /> - <Content contentId="HR_main" contentTypeId="DOCUMENT" contentName="Human Resources Main." templateDataResourceId="HELP_TEMPL" dataResourceId="HR_main" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> - <ContentAssoc contentId="HELP_HR" contentIdTo="HR_main" contentAssocTypeId="TREE_CHILD" fromDate="2009-10-18 01:01:01" sequenceNum="000" mapKey="HR_main"/> - - <!-- training --> - <DataResource dataResourceId="HR_training" localeString="en" dataResourceTypeId="OFBIZ_FILE" - objectInfo="applications/humanres/data/helpdata/HELP_HR_training.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Human Resources Training Help" mimeTypeId="text/xml" isPublic="Y" /> - <Content contentId="HR_training" contentTypeId="DOCUMENT" contentName="Training." templateDataResourceId="HELP_TEMPL" dataResourceId="HR_training" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> - <ContentAssoc contentId="HELP_HR" contentIdTo="HR_training" contentAssocTypeId="TREE_CHILD" fromDate="2009-10-18 01:01:01" sequenceNum="000" mapKey="HR_training"/> - -</entity-engine-xml> +<?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. +--> +<entity-engine-xml> + <DataResource dataResourceId="HELP_HR" localeString="en" dataResourceTypeId="OFBIZ_FILE" + objectInfo="applications/humanres/data/helpdata/HELP_HR.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" + dataResourceName="Human Resources Overview" mimeTypeId="text/xml" isPublic="Y" /> + <Content contentId="HELP_HR" contentTypeId="DOCUMENT" contentName="Human Resources" templateDataResourceId="HELP_TEMPL" + dataResourceId="HELP_HR" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> + <ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_HR" contentAssocTypeId="TREE_CHILD" fromDate="2009-10-18 01:01:01" sequenceNum="000"/> + + <DataResource dataResourceId="HR_main" localeString="en" dataResourceTypeId="OFBIZ_FILE" + objectInfo="applications/humanres/data/helpdata/HELP_HR_main.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Human Resources Main Help" mimeTypeId="text/xml" isPublic="Y" /> + <Content contentId="HR_main" contentTypeId="DOCUMENT" contentName="Human Resources Main." templateDataResourceId="HELP_TEMPL" dataResourceId="HR_main" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> + <ContentAssoc contentId="HELP_HR" contentIdTo="HR_main" contentAssocTypeId="TREE_CHILD" fromDate="2009-10-18 01:01:01" sequenceNum="000" mapKey="HR_main"/> + + <!-- training --> + <DataResource dataResourceId="HR_training" localeString="en" dataResourceTypeId="OFBIZ_FILE" + objectInfo="applications/humanres/data/helpdata/HELP_HR_training.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Human Resources Training Help" mimeTypeId="text/xml" isPublic="Y" /> + <Content contentId="HR_training" contentTypeId="DOCUMENT" contentName="Training." templateDataResourceId="HELP_TEMPL" dataResourceId="HR_training" statusId="CTNT_IN_PROGRESS" mimeTypeId="text/html"/> + <ContentAssoc contentId="HELP_HR" contentIdTo="HR_training" contentAssocTypeId="TREE_CHILD" fromDate="2009-10-18 01:01:01" sequenceNum="000" mapKey="HR_training"/> + +</entity-engine-xml> |
| Free forum by Nabble | Edit this page |
