Author: jleroux
Date: Thu Nov 11 23:07:40 2010 New Revision: 1034192 URL: http://svn.apache.org/viewvc?rev=1034192&view=rev Log: Merges the trunk at r1034179. There were some small conflicts, notably in themes styles.css, though it's late, all seems ok. Added: ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java - copied unchanged from r1034179, ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java - copied unchanged from r1034179, ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java Removed: ofbiz/branches/jquery/applications/product/webapp/catalog/ChooseTopCategory.ftl ofbiz/branches/jquery/applications/product/webapp/catalog/catalog/ Modified: ofbiz/branches/jquery/ (props changed) ofbiz/branches/jquery/applications/accounting/config/AccountingUiLabels.xml ofbiz/branches/jquery/applications/accounting/entitydef/entitymodel.xml ofbiz/branches/jquery/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml ofbiz/branches/jquery/applications/accounting/servicedef/services_tax.xml ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java ofbiz/branches/jquery/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy ofbiz/branches/jquery/applications/accounting/widget/PaymentGatewayConfigForms.xml ofbiz/branches/jquery/applications/content/config/ContentUiLabels.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/src/org/ofbiz/order/order/OrderReadHelper.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/ShoppingCartServices.java ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickadd.ftl ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl ofbiz/branches/jquery/applications/order/widget/ordermgr/CommonScreens.xml ofbiz/branches/jquery/applications/order/widget/ordermgr/CustRequestForms.xml ofbiz/branches/jquery/applications/order/widget/ordermgr/CustRequestScreens.xml ofbiz/branches/jquery/applications/party/data/PartyTypeData.xml ofbiz/branches/jquery/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy (props changed) ofbiz/branches/jquery/applications/product/config/ProductEntityLabels.xml ofbiz/branches/jquery/applications/product/config/ProductUiLabels.xml ofbiz/branches/jquery/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml ofbiz/branches/jquery/applications/product/script/org/ofbiz/product/price/PriceServices.xml ofbiz/branches/jquery/applications/product/script/org/ofbiz/product/test/InventoryTests.xml (props changed) ofbiz/branches/jquery/applications/product/src/org/ofbiz/product/product/KeywordIndex.java ofbiz/branches/jquery/applications/product/webapp/catalog/WEB-INF/controller.xml ofbiz/branches/jquery/applications/product/widget/catalog/CatalogMenus.xml ofbiz/branches/jquery/applications/product/widget/catalog/CatalogScreens.xml ofbiz/branches/jquery/applications/product/widget/catalog/CategoryForms.xml ofbiz/branches/jquery/applications/product/widget/catalog/CommonScreens.xml ofbiz/branches/jquery/applications/product/widget/catalog/PriceScreens.xml ofbiz/branches/jquery/applications/product/widget/catalog/ProdCatalogForms.xml ofbiz/branches/jquery/applications/product/widget/catalog/ProductForms.xml ofbiz/branches/jquery/applications/product/widget/catalog/ProductScreens.xml ofbiz/branches/jquery/applications/product/widget/catalog/ProductStoreForms.xml ofbiz/branches/jquery/applications/product/widget/catalog/StoreScreens.xml ofbiz/branches/jquery/framework/birt/src/org/ofbiz/birt/BirtWorker.java ofbiz/branches/jquery/framework/birt/src/org/ofbiz/birt/email/BirtEmailServices.java ofbiz/branches/jquery/framework/birt/src/org/ofbiz/birt/report/servlet/BirtEngineServlet.java ofbiz/branches/jquery/framework/birt/src/org/ofbiz/birt/report/servlet/BirtViewerServlet.java ofbiz/branches/jquery/framework/birt/src/org/ofbiz/birt/webapp/view/BirtViewHandler.java ofbiz/branches/jquery/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java ofbiz/branches/jquery/framework/common/webcommon/login.ftl ofbiz/branches/jquery/framework/common/widget/HelpScreens.xml (props changed) ofbiz/branches/jquery/framework/entity/entitydef/entitymodel.xml ofbiz/branches/jquery/framework/images/webapp/images/ecommain.css ofbiz/branches/jquery/framework/images/webapp/images/selectall.js ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java ofbiz/branches/jquery/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java ofbiz/branches/jquery/framework/widget/templates/htmlFormMacroLibrary.ftl ofbiz/branches/jquery/specialpurpose/ebaystore/lib/ (props changed) ofbiz/branches/jquery/specialpurpose/ecommerce/config/EcommerceUiLabels.xml ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/catalog/advancedsearch.ftl ofbiz/branches/jquery/specialpurpose/ecommerce/webapp/ecommerce/order/checkoutpayment.ftl 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/projectmgr/config/ProjectMgrUiLabels.xml ofbiz/branches/jquery/specialpurpose/projectmgr/widget/CommonScreens.xml ofbiz/branches/jquery/specialpurpose/projectmgr/widget/CustRequestScreens.xml ofbiz/branches/jquery/specialpurpose/projectmgr/widget/ProjectMenus.xml ofbiz/branches/jquery/specialpurpose/projectmgr/widget/ProjectScreens.xml ofbiz/branches/jquery/themes/bizznesstime/webapp/bizznesstime/css/style.css ofbiz/branches/jquery/themes/bluelight/webapp/bluelight/style.css ofbiz/branches/jquery/themes/droppingcrumbs/webapp/droppingcrumbs/css/style.css ofbiz/branches/jquery/themes/flatgrey/webapp/flatgrey/maincss.css ofbiz/branches/jquery/themes/multiflex/webapp/multiflex/style.css ofbiz/branches/jquery/themes/tomahawk/webapp/tomahawk/css/style.css Propchange: ofbiz/branches/jquery/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Nov 11 23:07:40 2010 @@ -1,3 +1,3 @@ /ofbiz/branches/addbirt:831210-885099,885686-886087 /ofbiz/branches/multitenant20100310:921280-927264 -/ofbiz/trunk:951708-1030401 +/ofbiz/trunk:951708-1034179 Modified: ofbiz/branches/jquery/applications/accounting/config/AccountingUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/config/AccountingUiLabels.xml?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/config/AccountingUiLabels.xml (original) +++ ofbiz/branches/jquery/applications/accounting/config/AccountingUiLabels.xml Thu Nov 11 23:07:40 2010 @@ -1157,6 +1157,15 @@ <value xml:lang="hi_IN">ठधिà¤à¥à¤¤ Dot Net API सà¤à¤¸à¥à¤à¤°à¤£à¤</value> <value xml:lang="it">Versione API Authorize Dot Net</value> </property> + <property key="AccountingAuthorizeNetCpMarket"> + <value xml:lang="en">Card Present Market Type</value> + </property> + <property key="AccountingAuthorizeNetCpDevice"> + <value xml:lang="en">Card Present Device Type</value> + </property> + <property key="AccountingAuthorizeNetCpVersion"> + <value xml:lang="en">Card Present API Version</value> + </property> <property key="AccountingAuthorizeNetDelimiterChar"> <value xml:lang="en">Delimited Char</value> <value xml:lang="hi_IN">सà¥à¤®à¤¾à¤à¤à¤¿à¤¤ वरà¥à¤£</value> Modified: ofbiz/branches/jquery/applications/accounting/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/entitydef/entitymodel.xml?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/entitydef/entitymodel.xml (original) +++ ofbiz/branches/jquery/applications/accounting/entitydef/entitymodel.xml Thu Nov 11 23:07:40 2010 @@ -3254,6 +3254,9 @@ under the License. <field name="apiVersion" type="short-varchar"><description>Target Authorize Dot Net API version</description></field> <field name="delimitedData" type="short-varchar"><description>Delimited data (TRUE|FALSE)</description></field> <field name="delimiterChar" type="short-varchar"><description>Delimited Character - the delimiter to use in the response</description></field> + <field name="cpVersion" type="short-varchar"><description>Card Present Version</description></field> + <field name="cpMarketType" type="short-varchar"><description>Card Present Market Type</description></field> + <field name="cpDeviceType" type="short-varchar"><description>Card Present Device Type</description></field> <field name="method" type="short-varchar"><description>Method - CC for credit card processing</description></field> <field name="emailCustomer" type="short-varchar"><description>Email Customer? - if should send an email to the customer for each transaction (TRUE|FALSE)</description></field> <field name="emailMerchant" type="short-varchar"><description>Email Merchant? - if should send email to the merchant for each transaction (TRUE|FALSE)</description></field> Modified: ofbiz/branches/jquery/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml (original) +++ ofbiz/branches/jquery/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Thu Nov 11 23:07:40 2010 @@ -780,10 +780,11 @@ under the License. </else> </if-not-empty> <set field="itemAmount" from-field="totalAmount" type="BigDecimal"/> - <set field="itemPrice" from-field="invoiceItem.amount"/> + <set field="itemPrice" from-field="invoiceItem.amount" type="BigDecimal"/> <set field="addtaxMap.itemProductList[]" from-field="itemProduct"/> <set field="addtaxMap.itemAmountList[]" from-field="itemAmount" type="BigDecimal"/> - <set field="addtaxMap.itemPriceList[]" from-field="itemPrice"/> + <set field="addtaxMap.itemPriceList[]" from-field="itemPrice" type="BigDecimal"/> + <set field="addtaxMap.itemQuantityList[]" from-field="invoiceItem.quantity" type="BigDecimal"/> <set field="addtaxMap.itemShippingList[]" type="BigDecimal" value="0"/> </iterate> <set field="addtaxMap.orderShippingAmount" type="BigDecimal" value="0"/> Modified: ofbiz/branches/jquery/applications/accounting/servicedef/services_tax.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/servicedef/services_tax.xml?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/servicedef/services_tax.xml (original) +++ ofbiz/branches/jquery/applications/accounting/servicedef/services_tax.xml Thu Nov 11 23:07:40 2010 @@ -34,6 +34,7 @@ under the License. <attribute name="itemProductList" type="java.util.List" mode="IN" optional="false"><!-- List of GenericValues --></attribute> <attribute name="itemAmountList" type="java.util.List" mode="IN" optional="false"><!-- List of BigDecimals --></attribute> <attribute name="itemPriceList" type="java.util.List" mode="IN" optional="false"><!-- List of BigDecimals --></attribute> + <attribute name="itemQuantityList" type="java.util.List" mode="IN" optional="true"><!-- List of BigDecimals --></attribute> <attribute name="itemShippingList" type="java.util.List" mode="IN" optional="true"><!-- List of BigDecimals --></attribute> <attribute name="orderShippingAmount" type="BigDecimal" mode="IN" optional="true"/> <attribute name="orderPromotionsAmount" type="BigDecimal" mode="IN" optional="true"/> Modified: ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Thu Nov 11 23:07:40 2010 @@ -1496,6 +1496,7 @@ public class InvoiceServices { calcTaxContext.put("itemProductList", emptyList); calcTaxContext.put("itemAmountList", emptyList); calcTaxContext.put("itemPriceList", emptyList); + calcTaxContext.put("itemQuantityList", emptyList); calcTaxContext.put("itemShippingList", emptyList); Map<String, Object> calcTaxResult = null; 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=1034192&r1=1034191&r2=1034192&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 Thu Nov 11 23:07:40 2010 @@ -98,7 +98,7 @@ public class TaxAuthorityServices { throw new IllegalArgumentException("Could not find any Tax Authories for store with ID [" + productStoreId + "] for tax calculation; the store settings may need to be corrected."); } - List taxAdustmentList = getTaxAdjustments(delegator, product, productStore, null, billToPartyId, taxAuthoritySet, basePrice, amount, shippingPrice, ZERO_BASE); + List taxAdustmentList = getTaxAdjustments(delegator, product, productStore, null, billToPartyId, taxAuthoritySet, basePrice, quantity, amount, shippingPrice, ZERO_BASE); if (taxAdustmentList.size() == 0) { // this is something that happens every so often for different products and such, so don't blow up on it... Debug.logWarning("Could not find any Tax Authories Rate Rules for store with ID [" + productStoreId + "], productId [" + productId + "], basePrice [" + basePrice + "], amount [" + amount + "], for tax calculation; the store settings may need to be corrected.", module); @@ -108,11 +108,13 @@ public class TaxAuthorityServices { Iterator taxAdustmentIter = taxAdustmentList.iterator(); while (taxAdustmentIter.hasNext()) { GenericValue taxAdjustment = (GenericValue) taxAdustmentIter.next(); - taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage")); - BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount"); - taxTotal = taxTotal.add(adjAmount); - priceWithTax = priceWithTax.add(adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding)); - Debug.logInfo("For productId [" + productId + "] added [" + adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding) + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module); + if ("SALES_TAX".equals(taxAdjustment.getString("orderAdjustmentTypeId"))) { + taxPercentage = taxPercentage.add(taxAdjustment.getBigDecimal("sourcePercentage")); + BigDecimal adjAmount = taxAdjustment.getBigDecimal("amount"); + taxTotal = taxTotal.add(adjAmount); + priceWithTax = priceWithTax.add(adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding)); + Debug.logInfo("For productId [" + productId + "] added [" + adjAmount.divide(quantity,salestaxCalcDecimals,salestaxRounding) + "] of tax to price for geoId [" + taxAdjustment.getString("taxAuthGeoId") + "], new price is [" + priceWithTax + "]", module); + } } } } catch (GenericEntityException e) { @@ -141,6 +143,7 @@ public class TaxAuthorityServices { List itemProductList = (List) context.get("itemProductList"); List itemAmountList = (List) context.get("itemAmountList"); List itemPriceList = (List) context.get("itemPriceList"); + List itemQuantityList = (List) context.get("itemQuantityList"); List itemShippingList = (List) context.get("itemShippingList"); BigDecimal orderShippingAmount = (BigDecimal) context.get("orderShippingAmount"); BigDecimal orderPromotionsAmount = (BigDecimal) context.get("orderPromotionsAmount"); @@ -209,20 +212,21 @@ public class TaxAuthorityServices { GenericValue product = (GenericValue) itemProductList.get(i); BigDecimal itemAmount = (BigDecimal) itemAmountList.get(i); BigDecimal itemPrice = (BigDecimal) itemPriceList.get(i); + BigDecimal itemQuantity = itemQuantityList != null ? (BigDecimal) itemQuantityList.get(i) : null; BigDecimal shippingAmount = (BigDecimal) itemShippingList.get(i); List taxList = null; if (shippingAddress != null) { - taxList = getTaxAdjustments(delegator, product, productStore, payToPartyId, billToPartyId, taxAuthoritySet, itemPrice, itemAmount, shippingAmount, ZERO_BASE); + taxList = getTaxAdjustments(delegator, product, productStore, payToPartyId, billToPartyId, taxAuthoritySet, itemPrice, itemQuantity, itemAmount, shippingAmount, ZERO_BASE); } // this is an add and not an addAll because we want a List of Lists of GenericValues, one List of Adjustments per item itemAdjustments.add(taxList); } if (orderShippingAmount != null && orderShippingAmount.compareTo(BigDecimal.ZERO) > 0) { - List taxList = getTaxAdjustments(delegator, null, productStore, payToPartyId, billToPartyId, taxAuthoritySet, ZERO_BASE, ZERO_BASE, orderShippingAmount, ZERO_BASE); + List taxList = getTaxAdjustments(delegator, null, productStore, payToPartyId, billToPartyId, taxAuthoritySet, ZERO_BASE, ZERO_BASE, ZERO_BASE, orderShippingAmount, ZERO_BASE); orderAdjustments.addAll(taxList); } if (orderPromotionsAmount != null && orderPromotionsAmount.compareTo(BigDecimal.ZERO) != 0) { - List taxList = getTaxAdjustments(delegator, null, productStore, payToPartyId, billToPartyId, taxAuthoritySet, ZERO_BASE, ZERO_BASE, ZERO_BASE, orderPromotionsAmount); + List taxList = getTaxAdjustments(delegator, null, productStore, payToPartyId, billToPartyId, taxAuthoritySet, ZERO_BASE, ZERO_BASE, ZERO_BASE, ZERO_BASE, orderPromotionsAmount); orderAdjustments.addAll(taxList); } @@ -263,7 +267,10 @@ public class TaxAuthorityServices { //Debug.logInfo("Tax calc taxAuthoritySet after expand:" + taxAuthoritySet, module); } - private static List getTaxAdjustments(Delegator delegator, GenericValue product, GenericValue productStore, String payToPartyId, String billToPartyId, Set taxAuthoritySet, BigDecimal itemPrice, BigDecimal itemAmount, BigDecimal shippingAmount, BigDecimal orderPromotionsAmount) { + private static List getTaxAdjustments(Delegator delegator, GenericValue product, GenericValue productStore, + String payToPartyId, String billToPartyId, Set taxAuthoritySet, + BigDecimal itemPrice, BigDecimal itemQuantity, BigDecimal itemAmount, + BigDecimal shippingAmount, BigDecimal orderPromotionsAmount) { Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); List adjustments = FastList.newInstance(); @@ -384,17 +391,17 @@ public class TaxAuthorityServices { // TODO: what to do if no TaxAuthorityGlAccount found? Use some default, or is that done elsewhere later on? } - GenericValue adjValue = delegator.makeValue("OrderAdjustment"); - adjValue.set("taxAuthorityRateSeqId", taxAuthorityRateProduct.getString("taxAuthorityRateSeqId")); - adjValue.set("amount", taxAmount); - adjValue.set("sourcePercentage", taxRate); - adjValue.set("orderAdjustmentTypeId", "SALES_TAX"); + GenericValue taxAdjValue = delegator.makeValue("OrderAdjustment"); + taxAdjValue.set("taxAuthorityRateSeqId", taxAuthorityRateProduct.getString("taxAuthorityRateSeqId")); + taxAdjValue.set("amount", taxAmount); + taxAdjValue.set("sourcePercentage", taxRate); + taxAdjValue.set("orderAdjustmentTypeId", "SALES_TAX"); // 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 - adjValue.set("primaryGeoId", taxAuthGeoId); - adjValue.set("comments", taxAuthorityRateProduct.getString("description")); - if (taxAuthPartyId != null) adjValue.set("taxAuthPartyId", taxAuthPartyId); - if (taxAuthGlAccountId != null) adjValue.set("overrideGlAccountId", taxAuthGlAccountId); - if (taxAuthGeoId != null) adjValue.set("taxAuthGeoId", taxAuthGeoId); + taxAdjValue.set("primaryGeoId", taxAuthGeoId); + taxAdjValue.set("comments", taxAuthorityRateProduct.getString("description")); + if (taxAuthPartyId != null) taxAdjValue.set("taxAuthPartyId", taxAuthPartyId); + if (taxAuthGlAccountId != null) taxAdjValue.set("overrideGlAccountId", taxAuthGlAccountId); + if (taxAuthGeoId != null) taxAdjValue.set("taxAuthGeoId", taxAuthGeoId); // check to see if this party has a tax ID for this, and if the party is tax exempt in the primary (most-local) jurisdiction if (UtilValidate.isNotEmpty(billToPartyId) && UtilValidate.isNotEmpty(taxAuthGeoId)) { @@ -408,12 +415,70 @@ public class TaxAuthorityServices { GenericValue partyRelationship = (GenericValue) partyRelationshipIter.next(); billToPartyIdSet.add(partyRelationship.get("partyIdFrom")); } - handlePartyTaxExempt(adjValue, billToPartyIdSet, taxAuthGeoId, taxAuthPartyId, taxAmount, nowTimestamp, delegator); + handlePartyTaxExempt(taxAdjValue, billToPartyIdSet, taxAuthGeoId, taxAuthPartyId, taxAmount, nowTimestamp, delegator); } else { Debug.logInfo("NOTE: A tax calculation was done without a billToPartyId or taxAuthGeoId, so no tax exemptions or tax IDs considered; billToPartyId=[" + billToPartyId + "] taxAuthGeoId=[" + taxAuthGeoId + "]", module); } - adjustments.add(adjValue); + 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 && 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); + + 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); + } + } + } } } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up tax rates", module); Modified: ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java (original) +++ ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java Thu Nov 11 23:07:40 2010 @@ -304,21 +304,24 @@ public class AIMPaymentServices { Debug.logInfo("TEST Authorize.net request string " + request.toString(),module); Debug.logInfo("TEST Authorize.net properties string " + props.toString(),module); } + + // card present has a different layout from standard AIM; this determines how to parse the response + int apiType = props.get("cpMarketType") == null ? AuthorizeResponse.AIM_RESPONSE : AuthorizeResponse.CP_RESPONSE; + try { HttpClient httpClient = new HttpClient(url, request); String certificateAlias = props.getProperty("certificateAlias"); httpClient.setClientCertificateAlias(certificateAlias); String httpResponse = httpClient.post(); Debug.logInfo("transaction response: " + httpResponse,module); - AuthorizeResponse ar = new AuthorizeResponse(httpResponse); - String resp = ar.getResponseCode(); - if (resp.equals(AuthorizeResponse.APPROVED)) { + AuthorizeResponse ar = new AuthorizeResponse(httpResponse, apiType); + if (ar.isApproved()) { result.put("authResult", Boolean.TRUE); } else { result.put("authResult", Boolean.FALSE); - Debug.logInfo("responseCode: " + ar.getResponseField(AuthorizeResponse.RESPONSE_CODE),module); - Debug.logInfo("responseReason: " + ar.getResponseField(AuthorizeResponse.RESPONSE_REASON_CODE),module); - Debug.logInfo("reasonText: " + ar.getResponseField(AuthorizeResponse.RESPONSE_REASON_TEXT),module); + Debug.logInfo("responseCode: " + ar.getResponseCode(), module); + Debug.logInfo("responseReason: " + ar.getReasonCode(), module); + Debug.logInfo("reasonText: " + ar.getReasonText(), module); } result.put("httpResponse", httpResponse); result.put("authorizeResponse", ar); @@ -345,6 +348,9 @@ public class AIMPaymentServices { String ver = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "apiVersion", configStr, "payment.authorizedotnet.version"); String delimited = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "delimitedData", configStr, "payment.authorizedotnet.delimited"); String delimiter = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "delimiterChar", configStr, "payment.authorizedotnet.delimiter"); + String cpVersion = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "cpVersion", configStr, "payment.authorizedotnet.cpVersion"); + String cpMarketType = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "cpMarketType", configStr, "payment.authorizedotnet.cpMarketType"); + String cpDeviceType = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "cpDeviceType", configStr, "payment.authorizedotnet.cpDeviceType"); String method = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "method", configStr, "payment.authorizedotnet.method"); String emailCustomer = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "emailCustomer", configStr, "payment.authorizedotnet.emailcustomer"); String emailMerchant = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "emailMerchant", configStr, "payment.authorizedotnet.emailmerchant"); @@ -369,6 +375,10 @@ public class AIMPaymentServices { ver = "3.0"; } } + if (UtilValidate.isNotEmpty(cpMarketType) && UtilValidate.isEmpty(cpVersion)) { + cpVersion = "1.0"; + } + Properties props = new Properties(); props.put("url", url); props.put("certificateAlias", certificateAlias); @@ -376,6 +386,9 @@ public class AIMPaymentServices { props.put("delimited", delimited); props.put("delimiter", delimiter); props.put("method", method); + props.put("cpVersion", cpVersion); + props.put("cpMarketType", cpMarketType); + props.put("cpDeviceType", cpDeviceType); props.put("emailCustomer", emailCustomer); props.put("emailMerchant", emailMerchant); props.put("testReq", testReq); @@ -401,13 +414,48 @@ public class AIMPaymentServices { String trankey = props.getProperty("trankey"); if (UtilValidate.isNotEmpty(trankey)) { AIMRequest.put("x_Tran_Key", props.getProperty("trankey")); + } else { + // only send password if no tran key + AIMRequest.put("x_Password",props.getProperty("password")); + } + + // api version (non Card Present) + String apiVersion = props.getProperty("ver"); + if (UtilValidate.isNotEmpty(apiVersion)) { + AIMRequest.put("x_Version", props.getProperty("ver")); + } + + // CP version + String cpVersion = props.getProperty("cpver"); + if (UtilValidate.isNotEmpty(cpVersion)) { + AIMRequest.put("x_cpversion", cpVersion); + } + + // CP market type + String cpMarketType = props.getProperty("cpMarketType"); + if (UtilValidate.isNotEmpty(cpMarketType)) { + AIMRequest.put("x_market_type", cpMarketType); + + // CP test mode + if ("true".equalsIgnoreCase(props.getProperty("testReq"))) { + AIMRequest.put("x_test_request", props.getProperty("testReq")); + } } - AIMRequest.put("x_Password",props.getProperty("password")); - AIMRequest.put("x_Version", props.getProperty("ver")); + + // CP device typ + String cpDeviceType = props.getProperty("cpDeviceType"); + if (UtilValidate.isNotEmpty(cpDeviceType)) { + AIMRequest.put("x_device_type", cpDeviceType); + } } private static void buildGatewayResponeConfig(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) { - AIMRequest.put("x_Delim_Data", props.getProperty("delimited")); + if (AIMRequest.get("x_market_type") != null) { + // card present transaction + AIMRequest.put("x_response_format", "true".equalsIgnoreCase(props.getProperty("delimited")) ? "1" : "0"); + } else { + AIMRequest.put("x_Delim_Data", props.getProperty("delimited")); + } AIMRequest.put("x_Delim_Char", props.getProperty("delimiter")); } @@ -434,7 +482,7 @@ public class AIMPaymentServices { AIMRequest.put("x_Zip", UtilFormatOut.checkNull(address.getString("postalCode"))); AIMRequest.put("x_Country", UtilFormatOut.checkNull(address.getString("countryGeoId"))); } - } + } } else { Debug.logWarning("Payment preference " + opp + " is not a credit card", module); } @@ -489,6 +537,9 @@ public class AIMPaymentServices { if (UtilValidate.isNotEmpty(cardSecurityCode)) { AIMRequest.put("x_card_code", cardSecurityCode); } + if (AIMRequest.get("x_market_type") != null) { + AIMRequest.put("x_card_type", getCardType(UtilFormatOut.checkNull(cc.getString("cardType")))); + } } private static void buildCaptureTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) { @@ -506,6 +557,9 @@ public class AIMPaymentServices { AIMRequest.put("x_Exp_Date", expDate); AIMRequest.put("x_Trans_ID", at.get("referenceNum")); AIMRequest.put("x_Auth_Code", at.get("gatewayCode")); + if (AIMRequest.get("x_market_type") != null) { + AIMRequest.put("x_card_type", getCardType(UtilFormatOut.checkNull(cc.getString("cardType")))); + } } private static void buildRefundTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) { @@ -523,6 +577,9 @@ public class AIMPaymentServices { AIMRequest.put("x_Exp_Date", expDate); AIMRequest.put("x_Trans_ID", at.get("referenceNum")); AIMRequest.put("x_Auth_Code", at.get("gatewayCode")); + if (AIMRequest.get("x_market_type") != null) { + AIMRequest.put("x_card_type", getCardType(UtilFormatOut.checkNull(cc.getString("cardType")))); + } Debug.logInfo("buildCaptureTransaction. " + at.toString(), module); } @@ -550,11 +607,11 @@ public class AIMPaymentServices { results.put("authFlag", ar.getReasonCode()); results.put("authMessage", ar.getReasonText()); if (authResult.booleanValue()) { //passed - results.put("authCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE)); - results.put("authRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID)); - results.put("cvCode", ar.getResponseField(AuthorizeResponse.CID_RESPONSE_CODE)); - results.put("avsCode", ar.getResponseField(AuthorizeResponse.AVS_RESULT_CODE)); - results.put("processAmount", new BigDecimal(ar.getResponseField(AuthorizeResponse.AMOUNT))); + results.put("authCode", ar.getAuthorizationCode()); + results.put("authRefNum", ar.getTransactionId()); + results.put("cvCode", ar.getCvResult()); + results.put("avsCode", ar.getAvsResult()); + results.put("processAmount", ar.getAmount()); } else { results.put("authCode", ar.getResponseCode()); results.put("processAmount", BigDecimal.ZERO); @@ -569,10 +626,10 @@ public class AIMPaymentServices { results.put("captureResult", new Boolean(captureResult.booleanValue())); results.put("captureFlag", ar.getReasonCode()); results.put("captureMessage", ar.getReasonText()); - results.put("captureRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID)); + results.put("captureRefNum", ar.getTransactionId()); if (captureResult.booleanValue()) { //passed - results.put("captureCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE)); - results.put("captureAmount", new BigDecimal(ar.getResponseField(AuthorizeResponse.AMOUNT))); + results.put("captureCode", ar.getAuthorizationCode()); + results.put("captureAmount", ar.getAmount()); } else { results.put("captureAmount", BigDecimal.ZERO); } @@ -586,10 +643,10 @@ public class AIMPaymentServices { results.put("refundResult", new Boolean(captureResult.booleanValue())); results.put("refundFlag", ar.getReasonCode()); results.put("refundMessage", ar.getReasonText()); - results.put("refundRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID)); + results.put("refundRefNum", ar.getTransactionId()); if (captureResult.booleanValue()) { //passed - results.put("refundCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE)); - results.put("refundAmount", new BigDecimal(ar.getResponseField(AuthorizeResponse.AMOUNT))); + results.put("refundCode", ar.getAuthorizationCode()); + results.put("refundAmount", ar.getAmount()); } else { results.put("refundAmount", BigDecimal.ZERO); } @@ -604,10 +661,10 @@ public class AIMPaymentServices { results.put("releaseResult", new Boolean(captureResult.booleanValue())); results.put("releaseFlag", ar.getReasonCode()); results.put("releaseMessage", ar.getReasonText()); - results.put("releaseRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID)); + results.put("releaseRefNum", ar.getTransactionId()); if (captureResult.booleanValue()) { //passed - results.put("releaseCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE)); - results.put("releaseAmount", new BigDecimal(ar.getResponseField(AuthorizeResponse.AMOUNT))); + results.put("releaseCode", ar.getAuthorizationCode()); + results.put("releaseAmount", ar.getAmount()); } else { results.put("releaseAmount", BigDecimal.ZERO); } @@ -624,13 +681,13 @@ public class AIMPaymentServices { results.put("captureResult", new Boolean(authResult.booleanValue())); results.put("captureFlag", ar.getReasonCode()); results.put("captureMessage", ar.getReasonText()); - results.put("captureRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID)); + results.put("captureRefNum", ar.getTransactionId()); if (authResult.booleanValue()) { //passed - results.put("authCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE)); - results.put("authRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID)); - results.put("cvCode", ar.getResponseField(AuthorizeResponse.CID_RESPONSE_CODE)); - results.put("avsCode", ar.getResponseField(AuthorizeResponse.AVS_RESULT_CODE)); - results.put("processAmount", new BigDecimal(ar.getResponseField(AuthorizeResponse.AMOUNT))); + results.put("authCode", ar.getAuthorizationCode()); + results.put("authRefNum", ar.getTransactionId()); + results.put("cvCode", ar.getCvResult()); + results.put("avsCode", ar.getAvsResult()); + results.put("processAmount", ar.getAmount()); } else { results.put("authCode", ar.getResponseCode()); results.put("processAmount", BigDecimal.ZERO); @@ -662,4 +719,14 @@ public class AIMPaymentServices { } return returnValue; } + + private static String getCardType(String cardType) { + if ((cardType.equalsIgnoreCase("VISA"))) return "V"; + if ((cardType.equalsIgnoreCase("MASTERCARD"))) return "M"; + if (((cardType.equalsIgnoreCase("AMERICANEXPRESS")) || (cardType.equalsIgnoreCase("AMEX")))) return "A"; + if ((cardType.equalsIgnoreCase("DISCOVER"))) return "D"; + if ((cardType.equalsIgnoreCase("JCB"))) return "J"; + if (((cardType.equalsIgnoreCase("DINERSCLUB")))) return "C"; + return ""; + } } Modified: ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java (original) +++ ofbiz/branches/jquery/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java Thu Nov 11 23:07:40 2010 @@ -19,140 +19,114 @@ package org.ofbiz.accounting.thirdparty.authorizedotnet; +import java.math.BigDecimal; import java.util.*; import org.ofbiz.base.util.UtilValidate; public class AuthorizeResponse { - private String rawResp = null; private List<String> response = new ArrayList<String>(); - private String respCode = ""; - private String reasonCode = ""; - private String reasonText = ""; - private String version = "3.0"; - private int maxPos = 39; //maximum number of field positions in response. there are more, but currently none are used. - - //constant names for response fields - public static int RESPONSE_CODE = 1; - public static int RESPONSE_SUBCODE = 2; - public static int RESPONSE_REASON_CODE = 3; - public static int RESPONSE_REASON_TEXT = 4; - public static int APPROVAL_CODE = 5; - public static int AUTHORIZATION_CODE = 5; - public static int AVS_RESULT_CODE = 6; - public static int TRANSACTION_ID = 7; - - // 8 - 37 echoed from request - public static int INVOICE_NUMBER = 8; - public static int DESCRIPTION = 9; - public static int AMOUNT = 10; - public static int METHOD = 11; - public static int TRANSACTION_TYPE = 12; - public static int CUSTOMER_ID = 13; - public static int CARDHOLDER_FIRST_NAME = 14; - public static int CARDHOLDER_LAST_NAME = 15; - public static int COMPANY = 16; - public static int BILLING_ADDRESS = 17; - public static int CITY = 18; - public static int STATE = 19; - public static int ZIP = 20; - public static int COUNTRY = 21; - public static int PHONE = 22; - public static int FAX = 23; - public static int EMAIL = 24; - public static int SHIP_TO_FIRST_NAME = 25; - public static int SHIP_TO_LAST_NAME = 26; - public static int SHIP_TO_COMPANY = 27; - public static int SHIP_TO_ADDRESS = 28; - public static int SHIP_TO_CITY = 29; - public static int SHIP_TO_STATE = 30; - public static int SHIP_TO_ZIP = 31; - public static int SHIP_TO_COUNTRY = 32; - public static int TAX_AMOUNT = 33; - public static int DUTY_AMOUNT = 34; - public static int FREIGHT_AMOUNT = 35; - public static int TAX_EXEMPT_FLAG = 36; - public static int PO_NUMBER = 37; - public static int MD5_HASH = 38; - public static int CID_RESPONSE_CODE = 39; - //public static int CAVV_RESPONSE_CODE = 40; - - //some other constants - public static String APPROVED = "Approved"; - public static String DECLINED = "Declined"; - public static String ERROR = "Error"; - - - public AuthorizeResponse(String resp) { - this(resp, "|"); + private RespPositions pos; + private String rawResp; + + // response types + public static final int AIM_RESPONSE = 1; + public static final int CP_RESPONSE = 2; + + // status constants + public static final String APPROVED = "Approved"; + public static final String DECLINED = "Declined"; + public static final String ERROR = "Error"; + + // positions of the result + public static final String RESPONSE_CODE = "RESPONSE_CODE"; + public static final String REASON_CODE = "REASON_CODE"; + public static final String REASON_TEXT = "REASON_TEXT"; + public static final String AUTHORIZATION_CODE = "AUTHORIZATION_CODE"; + public static final String AVS_RESULT_CODE = "AVS_RESULT_CODE"; + public static final String CVV_RESULT_CODE = "CVV_RESULT_CODE"; + public static final String TRANSACTION_ID = "TRANSACTION_ID"; + public static final String AMOUNT = "AMOUNT"; + + // singletons + private static final AIMRespPositions aimPos = new AIMRespPositions(); + private static final CPRespPositions cpPos = new CPRespPositions(); + + public AuthorizeResponse(String resp, int responseType) { + this(resp, "|", responseType); } - public AuthorizeResponse(String resp, String delim) { + public AuthorizeResponse(String resp, String delim, int responseType) { this.rawResp = resp; this.response = splitResp(resp, delim); - setApproval(); - } - - private void setApproval() { - String rc = response.get(RESPONSE_CODE); - - if (rc.equals("1")) { - this.respCode = APPROVED; - } - - if (rc.equals("2")) { - this.respCode = DECLINED; + if (responseType == CP_RESPONSE) { + pos = cpPos; + } else { + pos = aimPos; } - - if (rc.equals("3")) { - this.respCode = ERROR; - } - - this.reasonCode = response.get(RESPONSE_REASON_CODE); - this.reasonText = response.get(RESPONSE_REASON_TEXT); - } - - public void setVersion(String version) - { - if (UtilValidate.isNotEmpty(version)) - { - if (version.equals("3.0") || version.equals("3.1")) - this.version = version; - } - + + public boolean isApproved() { + return pos.getApprovalString().equals(getResponseCode()); } - + + public String getTransactionId() { + return getResponseField(TRANSACTION_ID); + } + + public String getAuthorizationCode() { + return getResponseField(AUTHORIZATION_CODE); + } + public String getResponseCode() { - return this.respCode; + return getResponseField(RESPONSE_CODE); } public String getReasonCode() { - return this.reasonCode; + return getResponseField(REASON_CODE); } public String getReasonText() { - return this.reasonText; + return getResponseField(REASON_TEXT); } - - public String getResponseField(int posNum) { - - if (this.version.equals("3.0")) - { - if (posNum == CID_RESPONSE_CODE) - return "M"; + + public String getAvsResult() { + return getResponseField(AVS_RESULT_CODE); + } + + public String getCvResult() { + return getResponseField(CVV_RESULT_CODE); + } + + public BigDecimal getAmount() { + BigDecimal amount = BigDecimal.ZERO; + String amtStr = getResponseField(AMOUNT); + if (UtilValidate.isNotEmpty(amtStr) && !UtilValidate.isAlphabetic(amtStr)) { + amount = new BigDecimal(amtStr); } - if (posNum < 1 || posNum > maxPos) { - return "unknown_field"; - } - return response.get(posNum); + return amount; } - + public String getRawResponse() { return this.rawResp; } + private String getResponseField(String field) { + int position = pos.getPosition(field); + if (position == -1) + return null; + return getResponseField(position); + } + + private String getResponseField(int position) { + if (response.size() < position) { + return null; + } else { + return response.get(position); + } + } + private List<String> splitResp(String r, String delim) { int s1=0, s2=-1; List<String> out = new ArrayList<String>(40); @@ -179,5 +153,9 @@ public class AuthorizeResponse { public String toString() { return response.toString(); } - + + public static abstract class RespPositions { + public abstract int getPosition(String name); + public abstract String getApprovalString(); + } } Modified: ofbiz/branches/jquery/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy (original) +++ ofbiz/branches/jquery/applications/accounting/webapp/accounting/WEB-INF/actions/reports/IncomeStatement.groovy Thu Nov 11 23:07:40 2010 @@ -117,7 +117,7 @@ transactionTotals = []; balanceTotal = BigDecimal.ZERO; List contraRevenueAndExprs = FastList.newInstance(mainAndExprs); contraRevenueAndExprs.add(EntityCondition.makeCondition("glAccountClassId", EntityOperator.IN, contraRevenueAccountClassIds)); -transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(cogsExpenseAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); +transactionTotals = delegator.findList("AcctgTransEntrySums", EntityCondition.makeCondition(contraRevenueAndExprs, EntityOperator.AND), UtilMisc.toSet("glAccountId", "accountName", "accountCode", "debitCreditFlag", "amount"), UtilMisc.toList("glAccountId"), null, false); if (transactionTotals) { Map transactionTotalsMap = [:]; balanceTotalCredit = BigDecimal.ZERO; Modified: ofbiz/branches/jquery/applications/accounting/widget/PaymentGatewayConfigForms.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/accounting/widget/PaymentGatewayConfigForms.xml?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/accounting/widget/PaymentGatewayConfigForms.xml (original) +++ ofbiz/branches/jquery/applications/accounting/widget/PaymentGatewayConfigForms.xml Thu Nov 11 23:07:40 2010 @@ -158,13 +158,22 @@ under the License. <option key="TRUE" description="${uiLabelMap.CommonTrue}"/> <option key="FALSE" description="${uiLabelMap.CommonFalse}"/> </drop-down> - </field> + </field> <field name="relayResponse" title="${uiLabelMap.AccountingAuthorizeNetRelayResponse}"> <drop-down> <option key="TRUE" description="${uiLabelMap.CommonTrue}"/> <option key="FALSE" description="${uiLabelMap.CommonFalse}"/> </drop-down> </field> + <field name="cpVersion" title="${uiLabelMap.AccountingAuthorizeNetCpVersion}"> + <text size="10" maxlength="10"/> + </field> + <field name="cpMarketType" title="${uiLabelMap.AccountingAuthorizeNetCpMarket}"> + <text size="10" maxlength="10"/> + </field> + <field name="cpDeviceType" title="${uiLabelMap.AccountingAuthorizeNetCpDevice}"> + <text size="10" maxlength="10"/> + </field> <field name="tranKey" title="${uiLabelMap.AccountingAuthorizeNetTransKey}"> <text size="60" maxlength="60"/> </field> Modified: ofbiz/branches/jquery/applications/content/config/ContentUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/content/config/ContentUiLabels.xml?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/content/config/ContentUiLabels.xml (original) +++ ofbiz/branches/jquery/applications/content/config/ContentUiLabels.xml Thu Nov 11 23:07:40 2010 @@ -586,7 +586,7 @@ <value xml:lang="da">Opret ny blog</value> <value xml:lang="en">Create New Blog</value> <value xml:lang="fr">Créer un nouveau blog</value> - <value xml:lang="it">Creare nuovo Blog</value> + <value xml:lang="it">Nuovo blog</value> <value xml:lang="nl">Aanmaken nieuwe blog</value> <value xml:lang="zh">æ°å»ºå客</value> </property> @@ -1512,7 +1512,7 @@ <value xml:lang="en">Create Survey</value> <value xml:lang="es">Crear Encuesta</value> <value xml:lang="fr">Créer un sondage</value> - <value xml:lang="it">Creare sondaggio</value> + <value xml:lang="it">Nuovo sondaggio</value> <value xml:lang="ro">Creare Sondaj</value> <value xml:lang="th">สรà¹à¸²à¸à¸à¸²à¸£à¸ªà¸³à¸£à¸§à¸</value> <value xml:lang="zh">æ°å»ºè°æ¥</value> @@ -3855,7 +3855,7 @@ <value xml:lang="de">Neue Basis CompDoc Vorlage erstellen</value> <value xml:lang="en">Create New Root CompDoc Template</value> <value xml:lang="fr">Créer un nouveau modèle de racine de document composite</value> - <value xml:lang="it">Creare Nuovo Template Radice CompDoc</value> + <value xml:lang="it">Nuovo template radice CompDoc</value> <value xml:lang="th">สรà¹à¸²à¸à¸à¸µà¹à¸¡à¸²à¸à¸à¸ Template à¹à¸à¸à¸ªà¸²à¸£à¹à¸«à¸¡à¹</value> <value xml:lang="zh">å建æ°çæ ¹åæææ¡£ç模æ¿</value> </property> @@ -3866,7 +3866,7 @@ <value xml:lang="en">Create Survey</value> <value xml:lang="es">Crear Encuesta</value> <value xml:lang="fr">Créer un sondage</value> - <value xml:lang="it">Creare Sondaggio</value> + <value xml:lang="it">Nuovo sondaggio</value> <value xml:lang="nl">Aanmaken onderzoek</value> <value xml:lang="ro">Creare Sondaj</value> <value xml:lang="th">สรà¹à¸²à¸à¸à¸²à¸£à¸ªà¸³à¸£à¸§à¸</value> Modified: ofbiz/branches/jquery/applications/order/data/OrderTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/data/OrderTypeData.xml?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/data/OrderTypeData.xml (original) +++ ofbiz/branches/jquery/applications/order/data/OrderTypeData.xml Thu Nov 11 23:07:40 2010 @@ -42,6 +42,7 @@ under the License. <OrderAdjustmentType description="Fee" hasTable="N" orderAdjustmentTypeId="FEE" parentTypeId=""/> <OrderAdjustmentType description="Miscellaneous Charges" hasTable="N" orderAdjustmentTypeId="MISCELLANEOUS_CHARGE" parentTypeId=""/> <OrderAdjustmentType description="Sales Tax" hasTable="N" orderAdjustmentTypeId="SALES_TAX" parentTypeId=""/> + <OrderAdjustmentType description="VAT Price Correction" hasTable="N" orderAdjustmentTypeId="VAT_PRICE_CORRECT" parentTypeId=""/> <OrderAdjustmentType description="Shipping and Handling" hasTable="N" orderAdjustmentTypeId="SHIPPING_CHARGES" parentTypeId=""/> <OrderAdjustmentType description="Surcharge" hasTable="N" orderAdjustmentTypeId="SURCHARGE_ADJUSTMENT" parentTypeId=""/> <OrderAdjustmentType description="Additional Feature" hasTable="N" orderAdjustmentTypeId="ADDITIONAL_FEATURE" parentTypeId=""/> Modified: ofbiz/branches/jquery/applications/order/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/entitydef/entitymodel.xml?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/entitydef/entitymodel.xml (original) +++ ofbiz/branches/jquery/applications/order/entitydef/entitymodel.xml Thu Nov 11 23:07:40 2010 @@ -492,8 +492,8 @@ under the License. <field name="quantity" type="fixed-point" enable-audit-log="true"></field> <field name="cancelQuantity" type="fixed-point"></field> <field name="selectedAmount" type="fixed-point"></field> - <field name="unitPrice" type="currency-amount" enable-audit-log="true"></field> - <field name="unitListPrice" type="currency-amount"></field> + <field name="unitPrice" type="currency-precise" enable-audit-log="true"></field> + <field name="unitListPrice" type="currency-precise"></field> <field name="unitAverageCost" type="currency-amount"></field> <field name="unitRecurringPrice" type="currency-amount"></field> <field name="isModifiedPrice" type="indicator"></field> Propchange: ofbiz/branches/jquery/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Nov 11 23:07:40 2010 @@ -1,3 +1,3 @@ /ofbiz/branches/addbirt/specialpurpose/ecommerce/script/org/ofbiz/ecommerce/customer/CheckoutMapProcs.xml:831210-885099,885686-886087 /ofbiz/branches/multitenant20100310/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:921280-927264 -/ofbiz/trunk/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:951708-1030401 +/ofbiz/trunk/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:951708-1034179 Modified: ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Thu Nov 11 23:07:40 2010 @@ -2315,8 +2315,8 @@ public class OrderReadHelper { adjustments = EntityUtil.filterByAnd(adjustments, UtilMisc.toList(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.NOT_EQUAL, "SALES_TAX"))); BigDecimal total = getOrderItemsTotal(orderItems, adjustments); BigDecimal adj = getOrderAdjustmentsTotal(orderItems, adjustments); - total = total.add(taxGrandTotal).setScale(scale,rounding); - return total.add(adj).setScale(scale,rounding); + total = ((total.add(taxGrandTotal)).add(adj)).setScale(scale,rounding); + return total; } public static List<GenericValue> getOrderHeaderAdjustments(List<GenericValue> adjustments, String shipGroupSeqId) { @@ -2499,6 +2499,7 @@ public class OrderReadHelper { // subtotal also includes non tax and shipping adjustments; tax and shipping will be calculated using this adjusted value result = result.add(getOrderItemAdjustmentsTotal(orderItem, adjustments, true, false, false, forTax, forShipping)); + // Debug.logInfo("In getOrderItemSubTotal result=" + result + ", rounded result=" + result.setScale(scale, rounding), module); return result.setScale(scale, rounding); } @@ -2657,10 +2658,11 @@ public class OrderReadHelper { public static BigDecimal calcItemAdjustment(GenericValue itemAdjustment, BigDecimal quantity, BigDecimal unitPrice) { BigDecimal adjustment = ZERO; if (itemAdjustment.get("amount") != null) { - adjustment = adjustment.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")), itemAdjustment.getBigDecimal("amount"))); - } - else if (itemAdjustment.get("sourcePercentage") != null) { - adjustment = adjustment.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")), itemAdjustment.getBigDecimal("sourcePercentage").multiply(quantity).multiply(unitPrice).multiply(percentage))); + //shouldn't round amounts here, wait until item total is added up otherwise incremental errors are introduced, and there is code that calls this method that does that already: adjustment = adjustment.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")), itemAdjustment.getBigDecimal("amount"))); + adjustment = adjustment.add(itemAdjustment.getBigDecimal("amount")); + } else if (itemAdjustment.get("sourcePercentage") != null) { + // see comment above about rounding: adjustment = adjustment.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")), itemAdjustment.getBigDecimal("sourcePercentage").multiply(quantity).multiply(unitPrice).multiply(percentage))); + adjustment = adjustment.add(itemAdjustment.getBigDecimal("sourcePercentage").multiply(quantity).multiply(unitPrice).multiply(percentage)); } if (Debug.verboseOn()) Debug.logVerbose("calcItemAdjustment: " + itemAdjustment + ", quantity=" + quantity + ", unitPrice=" + unitPrice + ", adjustment=" + adjustment, module); return adjustment; Modified: ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Nov 11 23:07:40 2010 @@ -1473,6 +1473,7 @@ public class OrderServices { List amounts = new ArrayList(validOrderItems.size()); List shipAmts = new ArrayList(validOrderItems.size()); List itPrices = new ArrayList(validOrderItems.size()); + List itQuantities = new ArrayList(validOrderItems.size()); // adjustments and total List allAdjustments = orh.getAdjustments(); @@ -1494,6 +1495,7 @@ public class OrderServices { amounts.add(i, OrderReadHelper.getOrderItemSubTotal(orderItem, allAdjustments, true, false)); // get the item amount shipAmts.add(i, OrderReadHelper.getOrderItemAdjustmentsTotal(orderItem, allAdjustments, false, false, true)); // get the shipping amount itPrices.add(i, orderItem.getBigDecimal("unitPrice")); + itQuantities.add(i, orderItem.getBigDecimal("quantity")); } catch (GenericEntityException e) { Debug.logError(e, "Cannot read order item entity : " + orderItem, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderCannotReadTheOrderItemEntity",locale)); @@ -1535,7 +1537,7 @@ public class OrderServices { // prepare the service context Map serviceContext = UtilMisc.toMap("productStoreId", orh.getProductStoreId(), "itemProductList", products, "itemAmountList", amounts, - "itemShippingList", shipAmts, "itemPriceList", itPrices, "orderShippingAmount", orderShipping); + "itemShippingList", shipAmts, "itemPriceList", itPrices, "itemQuantityList", itQuantities, "orderShippingAmount", orderShipping); serviceContext.put("shippingAddress", shippingAddress); serviceContext.put("orderPromotionsAmount", orderPromotions); if (orh.getBillToParty() != null) serviceContext.put("billToPartyId", orh.getBillToParty().getString("partyId")); @@ -3786,6 +3788,7 @@ public class OrderServices { exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "PROMOTION_ADJUSTMENT")); exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "SHIPPING_CHARGES")); exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "SALES_TAX")); + exprs.add(EntityCondition.makeCondition("orderAdjustmentTypeId", EntityOperator.EQUALS, "VAT_PRICE_CORRECT")); adjExprs.add(EntityCondition.makeCondition(exprs, EntityOperator.OR)); EntityCondition cond = EntityCondition.makeCondition(adjExprs, EntityOperator.AND); delegator.removeByCondition("OrderAdjustment", cond); Modified: ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Nov 11 23:07:40 2010 @@ -794,6 +794,7 @@ public class CheckOutHelper { List<GenericValue> product = new ArrayList<GenericValue>(totalItems); List<BigDecimal> amount = new ArrayList<BigDecimal>(totalItems); List<BigDecimal> price = new ArrayList<BigDecimal>(totalItems); + List<BigDecimal> quantity = new ArrayList<BigDecimal>(totalItems); List<BigDecimal> shipAmt = new ArrayList<BigDecimal>(totalItems); // Debug.logInfo("====== makeTaxContext passed in shipAddress=" + shipAddress, module); @@ -809,6 +810,7 @@ public class CheckOutHelper { product.add(i, cartItem.getProduct()); amount.add(i, cartItem.getItemSubTotal(itemInfo.quantity)); price.add(i, cartItem.getBasePrice()); + quantity.add(i, cartItem.getQuantity()); shipAmt.add(i, BigDecimal.ZERO); // no per item shipping yet shoppingCartItemIndexMap.put(Integer.valueOf(i), cartItem); } @@ -862,6 +864,7 @@ public class CheckOutHelper { serviceContext.put("itemProductList", product); serviceContext.put("itemAmountList", amount); serviceContext.put("itemPriceList", price); + serviceContext.put("itemQuantityList", quantity); serviceContext.put("itemShippingList", shipAmt); serviceContext.put("orderShippingAmount", shipAmount); serviceContext.put("shippingAddress", shipAddress); Modified: ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Thu Nov 11 23:07:40 2010 @@ -2615,8 +2615,11 @@ public class ShoppingCart implements Ite /** Returns the total from the cart, including tax/shipping. */ public BigDecimal getGrandTotal() { // sales tax and shipping are not stored as adjustments but rather as part of the ship group - // Debug.logInfo("Subtotal:" + this.getSubTotal() + " Shipping:" + this.getTotalShipping() + "SalesTax: "+ this.getTotalSalesTax() + " others: " + this.getOrderOtherAdjustmentTotal(),module); - return this.getSubTotal().add(this.getTotalShipping()).add(this.getTotalSalesTax()).add(this.getOrderOtherAdjustmentTotal()); + // Debug.logInfo("Subtotal:" + this.getSubTotal() + " Shipping:" + this.getTotalShipping() + "SalesTax: "+ this.getTotalSalesTax() + " others: " + this.getOrderOtherAdjustmentTotal(), module); + BigDecimal grandTotal = this.getSubTotal().add(this.getTotalShipping()).add(this.getTotalSalesTax()).add(this.getOrderOtherAdjustmentTotal()); + // Debug.logInfo("Grand Total before rounding:" + grandTotal, module); + grandTotal = grandTotal.setScale(2, BigDecimal.ROUND_HALF_UP); + return grandTotal; } public BigDecimal getDisplaySubTotal() { Modified: ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Thu Nov 11 23:07:40 2010 @@ -1342,6 +1342,7 @@ public class ShoppingCartEvents { cart = (ShoppingCart) outMap.get("shoppingCart"); cart.removeAdjustmentByType("SALES_TAX"); + cart.removeAdjustmentByType("VAT_PRICE_CORRECT"); cart.removeAdjustmentByType("PROMOTION_ADJUSTMENT"); String shipGroupSeqId = null; long groupIndex = cart.getShipInfoSize(); Modified: ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original) +++ ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Thu Nov 11 23:07:40 2010 @@ -541,7 +541,8 @@ public class ShoppingCartServices { List<GenericValue> itemAdjustments = orh.getOrderItemAdjustments(item); if (itemAdjustments != null) { for(GenericValue itemAdjustment : itemAdjustments) { - if ("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId"))) { + if ("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")) || + "VAT_PRICE_CORRECT".equals(itemAdjustment.get("orderAdjustmentTypeId"))) { continue; } cartItem.addAdjustment(itemAdjustment); Modified: ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original) +++ ofbiz/branches/jquery/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Thu Nov 11 23:07:40 2010 @@ -1677,8 +1677,8 @@ public class ProductPromoWorker { BigDecimal quantityUsed = cartItem.getPromoQuantityCandidateUseActionAndAllConds(productPromoAction); BigDecimal ratioOfTotal = quantityUsed.multiply(cartItem.getBasePrice()).divide(totalAmount, generalRounding); BigDecimal weightedAmount = ratioOfTotal.multiply(discountAmountTotal); - // round the weightedAmount to 2 decimal places, ie a whole number of cents or 2 decimal place monetary units - weightedAmount = weightedAmount.setScale(2, BigDecimal.ROUND_HALF_UP); + // round the weightedAmount to 3 decimal places, we don't want an exact number cents/whatever because this will be added up as part of a subtotal which will be rounded to 2 decimal places + weightedAmount = weightedAmount.setScale(3, BigDecimal.ROUND_HALF_UP); discountAmount = discountAmount.subtract(weightedAmount); doOrderItemPromoAction(productPromoAction, cartItem, weightedAmount, "amount", delegator); } else { @@ -1713,7 +1713,8 @@ public class ProductPromoWorker { public static void doOrderItemPromoAction(GenericValue productPromoAction, ShoppingCartItem cartItem, BigDecimal amount, String amountField, Delegator delegator) { // round the amount before setting to make sure we don't get funny numbers in there - amount = amount.setScale(decimals, rounding); + // only round to 3 places, we need more specific amounts in adjustments so that they add up cleaner as part of the item subtotal, which will then be rounded + amount = amount.setScale(3, rounding); GenericValue orderAdjustment = delegator.makeValue("OrderAdjustment", UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT", amountField, amount, "productPromoId", productPromoAction.get("productPromoId"), Modified: ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickadd.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickadd.ftl?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickadd.ftl (original) +++ ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickadd.ftl Thu Nov 11 23:07:40 2010 @@ -60,20 +60,20 @@ under the License. <center> <form method="post" action="<@ofbizUrl>addtocartbulk</@ofbizUrl>" name="bulkaddform" style='margin: 0;'> <input type='hidden' name='category_id' value='${categoryId}' /> - <div align="right"> - <a href="javascript:document.bulkaddform.submit()" class="buttontext"><span style="white-space: nowrap;">${uiLabelMap.OrderAddAllToCart}</span></a> + <div class="quickaddall"> + <a href="javascript:document.bulkaddform.submit()" class="buttontext">${uiLabelMap.OrderAddAllToCart}</a> </div> - <table border='1' cellpadding='2' cellspacing='0'> + <div class="quickaddtable"> <#list productCategoryMembers as productCategoryMember> <#assign product = productCategoryMember.getRelatedOneCache("Product")> - <tr> + <p> ${setRequestAttribute("optProductId", productCategoryMember.productId)} ${screens.render(quickaddsummaryScreen)} - </tr> + </p> </#list> - </table> - <div align="right"> - <a href="javascript:document.bulkaddform.submit()" class="buttontext"><span style="white-space: nowrap;">${uiLabelMap.OrderAddAllToCart}</span></a> + </div> + <div class="quickaddall"> + <a href="javascript:document.bulkaddform.submit()" class="buttontext">${uiLabelMap.OrderAddAllToCart}</a> </div> </form> </center> @@ -87,3 +87,4 @@ under the License. </tr> </table> </#if> + Modified: ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl (original) +++ ofbiz/branches/jquery/applications/order/webapp/ordermgr/entry/catalog/quickaddsummary.ftl Thu Nov 11 23:07:40 2010 @@ -18,33 +18,35 @@ under the License. --> <#if product?exists> - <td valign="middle" width="5%"> + <span class="pid"> <div> <b>${product.productId}</b> </div> - </td> - <td valign="middle" width="90%"> - <a href="<@ofbizUrl>product?product_id=${product.productId}</@ofbizUrl>" class="buttontext">${productContentWrapper.get("PRODUCT_NAME")?if_exists}</a> - </td> - <td valign="middle" width="5%"> + </span> + <span class="name"> + <div> + <a href="<@ofbizUrl>product?product_id=${product.productId}</@ofbizUrl>" class="buttontext">${productContentWrapper.get("PRODUCT_NAME")?if_exists}</a> + </div> + </span> + <span class="listPrice"> <div> <#if price.listPrice?exists && price.price?exists && price.price?double < price.listPrice?double> - ${uiLabelMap.ProductListPrice}:<@ofbizCurrency amount=price.listPrice isoCode=price.currencyUsed/> + ${uiLabelMap.ProductListPrice}: <@ofbizCurrency amount=price.listPrice isoCode=price.currencyUsed/> <#else> </#if> </div> - </td> - <td align="right" valign="middle" width="5%"> - <#if totalPrice?exists> + </span> + <span class="totalPrice"> + <#if totalPrice?exists> <div>${uiLabelMap.ProductAggregatedPrice}: <span class='basePrice'><@ofbizCurrency amount=totalPrice isoCode=totalPrice.currencyUsed/></span></div> - <#else> - <div class="<#if price.isSale?exists && price.isSale>salePrice<#else>normalPrice</#if>"> - <b><@ofbizCurrency amount=price.price isoCode=price.currencyUsed/></b> - </div> - </#if> - </td> - <td align="right" valign="middle"> + <#else> + <div class="<#if price.isSale?exists && price.isSale>salePrice<#else>normalPrice</#if>"> + <b><@ofbizCurrency amount=price.price isoCode=price.currencyUsed/></b> + </div> + </#if> + </span> + <span class="qty"> <#-- check to see if introductionDate hasn't passed yet --> <#if product.introductionDate?exists && nowTimestamp.before(product.introductionDate)> <div style="color: red;">${uiLabelMap.ProductNotYetAvailable}</div> @@ -53,11 +55,15 @@ under the License. <div style="color: red;">${uiLabelMap.ProductNoLongerAvailable}</div> <#-- check to see if the product is a virtual product --> <#elseif product.isVirtual?default("N") == "Y"> - <a href="<@ofbizUrl>product?<#if categoryId?exists>category_id=${categoryId}&</#if>product_id=${product.productId}</@ofbizUrl>" class="buttontext">${uiLabelMap.OrderChooseVariations}...</a> + <div> + <a href="<@ofbizUrl>product?<#if categoryId?exists>category_id=${categoryId}&</#if>product_id=${product.productId}</@ofbizUrl>" class="buttontext">${uiLabelMap.OrderChooseVariations}...</a> + </div> <#else> - <input type="text" size="5" name="quantity_${product.productId}" value="" /> + <div> + <input type="text" size="5" name="quantity_${product.productId}" value="" /> + </div> </#if> - </td> + </span> <#else> <h1>${uiLabelMap.ProductErrorProductNotFound}.</h1> </#if> Modified: ofbiz/branches/jquery/applications/order/widget/ordermgr/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/applications/order/widget/ordermgr/CommonScreens.xml?rev=1034192&r1=1034191&r2=1034192&view=diff ============================================================================== --- ofbiz/branches/jquery/applications/order/widget/ordermgr/CommonScreens.xml (original) +++ ofbiz/branches/jquery/applications/order/widget/ordermgr/CommonScreens.xml Thu Nov 11 23:07:40 2010 @@ -62,7 +62,7 @@ under the License. </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> - <decorator-section name="body"> + <decorator-section name="pre-body"> <section> <condition> <not><if-empty field="custRequest"/></not> @@ -71,6 +71,8 @@ under the License. <include-menu name="RequestTabBar" location="component://order/widget/ordermgr/OrderMenus.xml"/> </widgets> </section> + </decorator-section> + <decorator-section name="body"> <include-menu name="RequestSubTabBar" location="component://order/widget/ordermgr/OrderMenus.xml"/> <container> <section> |
Free forum by Nabble | Edit this page |