|
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=1059306&r1=1059305&r2=1059306&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Sat Jan 15 11:54:04 2011 @@ -113,6 +113,7 @@ public class InvoiceServices { public static Map<String, Object> createInvoiceForOrderAllItems(DispatchContext dctx, Map<String, Object> context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); + Locale locale = (Locale) context.get("locale"); try { List<GenericValue> orderItems = delegator.findByAnd("OrderItem", UtilMisc.toMap("orderId", (String) context.get("orderId"))); if (orderItems.size() > 0) { @@ -129,13 +130,15 @@ public class InvoiceServices { return result; } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource,"AccountingEntityDataProblemCreatingInvoiceFromOrderItems",UtilMisc.toMap("reason",e.toString()),(Locale) context.get("locale")); - Debug.logError (e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError (e, "Entity/data problem creating invoice from order items: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingEntityDataProblemCreatingInvoiceFromOrderItems", + UtilMisc.toMap("reason", e.toString()), locale)); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource,"AccountingEntityDataProblemCreatingInvoiceFromOrderItems",UtilMisc.toMap("reason",e.toString()),(Locale) context.get("locale")); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError (e, "Entity/data problem creating invoice from order items: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingEntityDataProblemCreatingInvoiceFromOrderItems", + UtilMisc.toMap("reason", e.toString()), locale)); } } @@ -147,7 +150,8 @@ public class InvoiceServices { Locale locale = (Locale) context.get("locale"); if (DECIMALS == -1 || ROUNDING == -1) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingAritmeticPropertiesNotConfigured",locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingAritmeticPropertiesNotConfigured", locale)); } String orderId = (String) context.get("orderId"); @@ -156,13 +160,15 @@ public class InvoiceServices { if (UtilValidate.isEmpty(billItems)) { Debug.logVerbose("No order items to invoice; not creating invoice; returning success", module); - return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource,"AccountingNoOrderItemsToInvoice",locale)); + return ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, + "AccountingNoOrderItemsToInvoice", locale)); } try { GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); if (orderHeader == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingNoOrderHeader",locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingNoOrderHeader", locale)); } // figure out the invoice type @@ -236,7 +242,8 @@ public class InvoiceServices { // store the invoice first Map<String, Object> createInvoiceResult = dispatcher.runSync("createInvoice", createInvoiceContext); if (ServiceUtil.isError(createInvoiceResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceFromOrder",locale), null, null, createInvoiceResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, createInvoiceResult); } // call service, not direct entity op: delegator.create(invoice); @@ -253,7 +260,8 @@ public class InvoiceServices { createInvoiceRoleContext.put("roleTypeId", orderRole.getString("roleTypeId")); Map<String, Object> createInvoiceRoleResult = dispatcher.runSync("createInvoiceRole", createInvoiceRoleContext); if (ServiceUtil.isError(createInvoiceRoleResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceFromOrder",locale), null, null, createInvoiceRoleResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, createInvoiceRoleResult); } } @@ -283,7 +291,8 @@ public class InvoiceServices { "roleTypeId", "BILL_TO_CUSTOMER", "userLogin", userLogin); Map<String, Object> createInvoiceRoleResult = dispatcher.runSync("createInvoiceRole", createInvoiceRoleContext); if (ServiceUtil.isError(createInvoiceRoleResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceRoleFromOrder",locale), null, null, createInvoiceRoleResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceRoleFromOrder", locale), null, null, createInvoiceRoleResult); } } } @@ -294,7 +303,8 @@ public class InvoiceServices { "contactMechPurposeTypeId", "BILLING_LOCATION", "userLogin", userLogin); Map<String, Object> createBillToContactMechResult = dispatcher.runSync("createInvoiceContactMech", createBillToContactMechContext); if (ServiceUtil.isError(createBillToContactMechResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceContactMechFromOrder",locale), null, null, createBillToContactMechResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceContactMechFromOrder", locale), null, null, createBillToContactMechResult); } } } else { @@ -305,7 +315,8 @@ public class InvoiceServices { "contactMechPurposeTypeId", "BILLING_LOCATION", "userLogin", userLogin); Map<String, Object> createBillToContactMechResult = dispatcher.runSync("createInvoiceContactMech", createBillToContactMechContext); if (ServiceUtil.isError(createBillToContactMechResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceContactMechFromOrder",locale), null, null, createBillToContactMechResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceContactMechFromOrder", locale), null, null, createBillToContactMechResult); } } } else { @@ -337,7 +348,8 @@ public class InvoiceServices { "contactMechPurposeTypeId", "PAYMENT_LOCATION", "userLogin", userLogin); Map<String, Object> createPayToContactMechResult = dispatcher.runSync("createInvoiceContactMech", createPayToContactMechContext); if (ServiceUtil.isError(createPayToContactMechResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceContactMechFromOrder",locale), null, null, createPayToContactMechResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceContactMechFromOrder", locale), null, null, createPayToContactMechResult); } } @@ -366,7 +378,8 @@ public class InvoiceServices { orderItem = shipmentReceipt.getRelatedOne("OrderItem"); } else if ((orderItem == null) && (itemIssuance == null) && (shipmentReceipt == null)) { Debug.logError("Cannot create invoice when orderItem, itemIssuance, and shipmentReceipt are all null", module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingIllegalValuesPassedToCreateInvoiceService",locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingIllegalValuesPassedToCreateInvoiceService", locale)); } GenericValue product = null; if (orderItem.get("productId") != null) { @@ -427,7 +440,8 @@ public class InvoiceServices { Map<String, Object> createInvoiceItemResult = dispatcher.runSync("createInvoiceItem", createInvoiceItemContext); if (ServiceUtil.isError(createInvoiceItemResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceItemFromOrder",locale), null, null, createInvoiceItemResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceItemFromOrder", locale), null, null, createInvoiceItemResult); } // this item total @@ -460,7 +474,8 @@ public class InvoiceServices { Map<String, Object> createOrderItemBillingResult = dispatcher.runSync("createOrderItemBilling", createOrderItemBillingContext); if (ServiceUtil.isError(createOrderItemBillingResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingOrderItemBillingFromOrder",locale), null, null, createOrderItemBillingResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingOrderItemBillingFromOrder", locale), null, null, createOrderItemBillingResult); } if ("ItemIssuance".equals(currentValue.getEntityName())) { @@ -493,9 +508,9 @@ public class InvoiceServices { Map<String, Object> checkResult = dispatcher.runSync("calculateInvoicedAdjustmentTotal", UtilMisc.toMap("orderAdjustment", adj)); adjAlreadyInvoicedAmount = (BigDecimal) checkResult.get("invoicedTotal"); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Accounting trouble calling calculateInvoicedAdjustmentTotal service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale)); } // If the absolute invoiced amount >= the abs of the adjustment amount, the full amount has already been invoiced, @@ -574,7 +589,8 @@ public class InvoiceServices { Map<String, Object> createInvoiceItemAdjResult = dispatcher.runSync("createInvoiceItem", createInvoiceItemAdjContext); if (ServiceUtil.isError(createInvoiceItemAdjResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceItemFromOrder",locale), null, null, createInvoiceItemAdjResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceItemFromOrder", locale), null, null, createInvoiceItemAdjResult); } // Create the OrderAdjustmentBilling record @@ -587,7 +603,8 @@ public class InvoiceServices { Map<String, Object> createOrderAdjustmentBillingResult = dispatcher.runSync("createOrderAdjustmentBilling", createOrderAdjustmentBillingContext); if (ServiceUtil.isError(createOrderAdjustmentBillingResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingOrderAdjustmentBillingFromOrder",locale), null, null, createOrderAdjustmentBillingContext); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingOrderAdjustmentBillingFromOrder", locale), null, null, createOrderAdjustmentBillingContext); } // this adjustment amount @@ -625,9 +642,9 @@ public class InvoiceServices { Map<String, Object> checkResult = dispatcher.runSync("calculateInvoicedAdjustmentTotal", UtilMisc.toMap("orderAdjustment", adj)); adjAlreadyInvoicedAmount = ((BigDecimal) checkResult.get("invoicedTotal")).setScale(invoiceTypeDecimals, ROUNDING); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Accounting trouble calling calculateInvoicedAdjustmentTotal service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale)); } // If the absolute invoiced amount >= the abs of the adjustment amount, the full amount has already been invoiced, @@ -748,7 +765,8 @@ public class InvoiceServices { appl.put("userLogin", userLogin); Map<String, Object> createPayApplResult = dispatcher.runSync("createPaymentApplication", appl); if (ServiceUtil.isError(createPayApplResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceFromOrder",locale), null, null, createPayApplResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, createPayApplResult); } } } @@ -759,7 +777,8 @@ public class InvoiceServices { String nextStatusId = "PURCHASE_INVOICE".equals(invoiceType) ? "INVOICE_IN_PROCESS" : "INVOICE_READY"; Map<String, Object> setInvoiceStatusResult = dispatcher.runSync("setInvoiceStatus", UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "statusId", nextStatusId, "userLogin", userLogin)); if (ServiceUtil.isError(setInvoiceStatusResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceFromOrder",locale), null, null, setInvoiceStatusResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, setInvoiceStatusResult); } } @@ -768,13 +787,15 @@ public class InvoiceServices { resp.put("invoiceTypeId", invoiceType); return resp; } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingEntityDataProblemCreatingInvoiceFromOrderItems", UtilMisc.toMap("reason", e.toString()), locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Entity/data problem creating invoice from order items: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingEntityDataProblemCreatingInvoiceFromOrderItems", + UtilMisc.toMap("reason", e.toString()), locale)); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingServiceOtherProblemCreatingInvoiceFromOrderItems", UtilMisc.toMap("reason", e.toString()), locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Service/other problem creating invoice from order items: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingServiceOtherProblemCreatingInvoiceFromOrderItems", + UtilMisc.toMap("reason", e.toString()), locale)); } } @@ -792,7 +813,8 @@ public class InvoiceServices { BigDecimal amountTotal = InvoiceWorker.getInvoiceTotal(delegator, salesInvoiceId); if (amountTotal.signum() == 0) { Debug.logWarning("Invoice [" + salesInvoiceId + "] has an amount total of [" + amountTotal + "], so no commission invoice will be created", module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingInvoiceCommissionZeroInvoiceAmount",locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingInvoiceCommissionZeroInvoiceAmount", locale)); } BigDecimal appliedFraction = amountTotal.divide(amountTotal, 12, ROUNDING); GenericValue invoice = null; @@ -811,7 +833,8 @@ public class InvoiceServices { if (UtilValidate.isEmpty(salesRepPartyIds)) { salesRepPartyIds = EntityUtil.getFieldListFromEntityList(delegator.findList("InvoiceRole", EntityCondition.makeCondition(invoiceRoleConds, EntityOperator.AND), null, null, null, false), "partyId", true); if (UtilValidate.isEmpty(salesRepPartyIds)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"No party found with role sales representative for sales invoice "+ salesInvoiceId,locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "No party found with role sales representative for sales invoice "+ salesInvoiceId, locale)); } } else { List<String> salesInvoiceRolePartyIds = EntityUtil.getFieldListFromEntityList(delegator.findList("InvoiceRole", EntityCondition.makeCondition(invoiceRoleConds, EntityOperator.AND), null, null, null, false), "partyId", true); @@ -825,7 +848,8 @@ public class InvoiceServices { isReturn = true; } else if (!"SALES_INVOICE".equals(invoiceTypeId)) { Debug.logWarning("This type of invoice has no commission; returning success", module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingInvoiceCommissionInvalid",locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingInvoiceCommissionInvalid", locale)); } invoiceItems = delegator.findList("InvoiceItem", EntityCondition.makeCondition("invoiceId", EntityOperator.EQUALS, salesInvoiceId), null, null, null, false); } catch (GenericEntityException e) { @@ -913,7 +937,8 @@ public class InvoiceServices { try { createInvoiceResult = dispatcher.runSync("createInvoice", createInvoiceMap); } catch (GenericServiceException e) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingInvoiceCommissionError",locale), null, null, createInvoiceResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingInvoiceCommissionError", locale), null, null, createInvoiceResult); } String invoiceId = (String) createInvoiceResult.get("invoiceId"); // create the bill-from (or pay-to) contact mech as the primary PAYMENT_LOCATION of the party from the store @@ -984,20 +1009,24 @@ public class InvoiceServices { return ServiceUtil.returnError(e.getMessage()); } if (ServiceUtil.isError(resMap)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingInvoiceCommissionErrorItem",locale), null, null, resMap); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingInvoiceCommissionErrorItem", locale), null, null, resMap); } } // store value objects try { delegator.storeAll(toStore); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource,"AccountingInvoiceCommissionEntityDataProblem",UtilMisc.toMap("reason",e.toString()),locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Entity/data problem creating commission invoice: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingInvoiceCommissionEntityDataProblem", + UtilMisc.toMap("reason", e.toString()), locale)); } invoicesCreated.add(UtilMisc.toMap("commissionInvoiceId",invoiceId, "salesRepresentative ",partyIdBillFrom)); } - Map<String, Object> result = ServiceUtil.returnSuccess("Created Commission invoices for each commission receiving parties " + invoicesCreated); + Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, + "AccountingCommissionInvoicesCreated", + UtilMisc.toMap("invoicesCreated", invoicesCreated), locale)); Debug.logInfo("Created Commission invoices for each commission receiving parties " + invoicesCreated, module); result.put("invoicesCreated", invoicesCreated); return result; @@ -1014,13 +1043,15 @@ public class InvoiceServices { for (String invoiceId : invoicesCreated) { Map<String, Object> setInvoiceStatusResult = dispatcher.runSync("setInvoiceStatus", UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "statusId", nextStatusId, "userLogin", userLogin)); if (ServiceUtil.isError(setInvoiceStatusResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingInvoiceCommissionError",locale), null, null, setInvoiceStatusResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingInvoiceCommissionError", locale), null, null, setInvoiceStatusResult); } } } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource,"AccountingInvoiceCommissionEntityDataProblem",UtilMisc.toMap("reason",e.toString()),locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Entity/data problem creating commission invoice: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingInvoiceCommissionError", + UtilMisc.toMap("reason", e.toString()), locale)); } return ServiceUtil.returnSuccess(); } @@ -1038,7 +1069,9 @@ public class InvoiceServices { invoicesCreated = UtilGenerics.checkList(result.get("invoicesCreated")); } catch (GenericServiceException e) { Debug.logError(e, "Trouble calling createInvoicesFromShipment service; invoice not created for shipment [" + shipmentId + "]", module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingTroubleCallingCreateInvoicesFromShipmentService",UtilMisc.toMap("shipmentId",shipmentId),locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCreateInvoicesFromShipmentService", + UtilMisc.toMap("shipmentId", shipmentId), locale)); } Map<String, Object> response = ServiceUtil.returnSuccess(); response.put("invoicesCreated", invoicesCreated); @@ -1061,9 +1094,10 @@ public class InvoiceServices { try { shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleGettingShipmentEntity", UtilMisc.toMap("shipmentId",shipmentId), locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble getting Shipment entity for shipment " + shipmentId, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleGettingShipmentEntity", + UtilMisc.toMap("shipmentId", shipmentId), locale)); } List<GenericValue> itemIssuances = FastList.newInstance(); try { @@ -1072,9 +1106,9 @@ public class InvoiceServices { Set<String> fieldsToSelect = UtilMisc.toSet("orderId", "shipmentId"); itemIssuances = delegator.findList("ItemIssuance", EntityCondition.makeCondition("shipmentId", shipmentId), fieldsToSelect, UtilMisc.toList("orderId"), findOptions, false); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemGettingItemsFromShipments", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Problem getting issued items from shipments", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemGettingItemsFromShipments", locale)); } if (itemIssuances.size() == 0) { Debug.logInfo("No items issued for shipments", module); @@ -1094,9 +1128,10 @@ public class InvoiceServices { try { orderItemBillings = delegator.findByAnd("OrderItemBilling", billFields); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemLookingUpOrderItemBilling", UtilMisc.toMap("billFields", billFields), locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Problem looking up OrderItemBilling records for " + billFields, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemLookingUpOrderItemBilling", + UtilMisc.toMap("billFields", billFields), locale)); } // if none found, the order does not have any invoice if (orderItemBillings.size() != 0) { @@ -1130,7 +1165,8 @@ public class InvoiceServices { return ServiceUtil.returnError(e.getMessage()); } if (ServiceUtil.isError(setInvoiceStatusResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceFromOrder",locale), null, null, setInvoiceStatusResult); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceFromOrder", locale), null, null, setInvoiceStatusResult); } } return ServiceUtil.returnSuccess(); @@ -1147,9 +1183,10 @@ public class InvoiceServices { try { serviceResult = dispatcher.runSync("createInvoicesFromShipments", serviceContext); } catch (GenericServiceException e) { - String errorMessage = UtilProperties.getMessage(resource, "AccountingTroubleCallingCreateInvoicesFromShipmentService", UtilMisc.toMap("shipmentId", shipmentId), locale); - Debug.logError(e, errorMessage, module); - return ServiceUtil.returnError(errorMessage); + Debug.logError(e, "Trouble calling createInvoicesFromShipment service; invoice not created for shipment " + shipmentId, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCreateInvoicesFromShipmentService", + UtilMisc.toMap("shipmentId", shipmentId), locale)); } return serviceResult; @@ -1181,12 +1218,16 @@ public class InvoiceServices { salesShipmentFound = true; } if (purchaseShipmentFound && salesShipmentFound && dropShipmentFound) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingShipmentsOfDifferentTypes",UtilMisc.toMap("tmpShipmentId",tmpShipmentId,"shipmentTypeId",shipment.getString("shipmentTypeId")),locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingShipmentsOfDifferentTypes", + UtilMisc.toMap("tmpShipmentId", tmpShipmentId, "shipmentTypeId", shipment.getString("shipmentTypeId")), + locale)); } } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleGettingShipmentEntity",UtilMisc.toMap("tmpShipmentId",tmpShipmentId), locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble getting Shipment entity for shipment " + tmpShipmentId, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleGettingShipmentEntity", + UtilMisc.toMap("tmpShipmentId", tmpShipmentId), locale)); } } EntityCondition shipmentIdsCond = EntityCondition.makeCondition("shipmentId", EntityOperator.IN, shipmentIds); @@ -1233,9 +1274,9 @@ public class InvoiceServices { items = delegator.findList("ItemIssuance", shipmentIdsCond, null, UtilMisc.toList("shipmentId"), null, false); } } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemGettingItemsFromShipments", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Problem getting issued items from shipments", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemGettingItemsFromShipments", locale)); } if (items.size() == 0) { Debug.logInfo("No items issued for shipments", module); @@ -1273,9 +1314,10 @@ public class InvoiceServices { try { itemBillings = delegator.findList("OrderItemBillingAndInvoiceAndItem", EntityCondition.makeCondition(billFields, EntityOperator.AND), null, null, null, false); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemLookingUpOrderItemBilling",UtilMisc.toMap("billFields",billFields), locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Problem looking up OrderItemBilling records for " + billFields, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemLookingUpOrderItemBilling", + UtilMisc.toMap("billFields", billFields), locale)); } // if none found, then okay to bill @@ -1335,9 +1377,10 @@ public class InvoiceServices { } billed = delegator.findList("OrderItemBillingAndInvoiceAndItem", EntityCondition.makeCondition(lookup, EntityOperator.AND), null, null, null, false); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemGettingOrderItemOrderItemBilling",UtilMisc.toMap("lookup",lookup), locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Problem getting OrderItem/OrderItemBilling records " + lookup, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemGettingOrderItemOrderItemBilling", + UtilMisc.toMap("lookup", lookup), locale)); } @@ -1427,9 +1470,9 @@ public class InvoiceServices { } } } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingCreateInvoicesFromShipmentsService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble calling createInvoicesFromShipments service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCreateInvoicesFromShipmentsService", locale)); } // Total the additional shipping charges for the shipments @@ -1467,9 +1510,9 @@ public class InvoiceServices { Map<String, Object> createOrderAdjustmentResult = dispatcher.runSync("createOrderAdjustment", createOrderAdjustmentContext); shippingOrderAdjustmentId = (String) createOrderAdjustmentResult.get("orderAdjustmentId"); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingCreateOrderAdjustmentService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble calling createOrderAdjustment service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCreateOrderAdjustmentService", locale)); } // Obtain a list of OrderAdjustments due to tax on the shipping charges, if any @@ -1479,9 +1522,9 @@ public class InvoiceServices { try { destinationContactMech = shipment.getRelatedOne("DestinationPostalAddress"); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingCreateInvoicesFromShipmentService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble calling createInvoicesFromShipment service; invoice not created for shipment " + shipmentId, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCreateInvoicesFromShipmentService", locale)); } List<Object> emptyList = FastList.newInstance(); @@ -1503,9 +1546,9 @@ public class InvoiceServices { try { calcTaxResult = dispatcher.runSync("calcTax", calcTaxContext); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingCalcTaxService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble calling calcTaxService", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCalcTaxService", locale)); } List<GenericValue> orderAdjustments = UtilGenerics.checkList(calcTaxResult.get("orderAdjustments")); @@ -1522,9 +1565,10 @@ public class InvoiceServices { try { delegator.storeAll(orderAdjustments); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemStoringOrderAdjustments", UtilMisc.toMap("orderAdjustments", orderAdjustments), locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Problem storing OrderAdjustments: " + orderAdjustments, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemStoringOrderAdjustments", + UtilMisc.toMap("orderAdjustments", orderAdjustments), locale)); } } @@ -1533,9 +1577,9 @@ public class InvoiceServices { try { orderPaymentPreferences = delegator.findByAnd("OrderPaymentPreference", UtilMisc.toMap("orderId", orderId, "paymentMethodTypeId", "CREDIT_CARD")); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemGettingOrderPaymentPreferences", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Problem getting OrderPaymentPreference records", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemGettingOrderPaymentPreferences", locale)); } // Use the first credit card we find, for the sake of simplicity @@ -1564,9 +1608,9 @@ public class InvoiceServices { try { prefReleaseResult = dispatcher.runSync("releaseOrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreference.getString("orderPaymentPreferenceId"), "userLogin", context.get("userLogin"))); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble calling releaseOrderPaymentPreference service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale)); } if (ServiceUtil.isError(prefReleaseResult) || ServiceUtil.isFailure(prefReleaseResult)) { String errMsg = ServiceUtil.getErrorMessage(prefReleaseResult); @@ -1585,9 +1629,9 @@ public class InvoiceServices { Map<String, Object> result = dispatcher.runSync("createOrderPaymentPreference", serviceContext); orderPaymentPreferenceId = (String) result.get("orderPaymentPreferenceId"); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingCreateOrderPaymentPreferenceService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble calling createOrderPaymentPreference service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCreateOrderPaymentPreferenceService", locale)); } // Attempt to authorize the new orderPaymentPreference @@ -1596,9 +1640,9 @@ public class InvoiceServices { // Use an overrideAmount because the maxAmount wasn't set on the OrderPaymentPreference authResult = dispatcher.runSync("authOrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId, "overrideAmount", totalNewAuthAmount, "userLogin", context.get("userLogin"))); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingAuthOrderPaymentPreferenceService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble calling authOrderPaymentPreference service", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingAuthOrderPaymentPreferenceService", locale)); } // If the authorization fails, create the invoice anyway, but make a note of it @@ -1622,8 +1666,8 @@ public class InvoiceServices { try { shipmentItemBillings = delegator.findByAnd("ShipmentItemBilling", UtilMisc.toMap("shipmentId", shipmentId)); } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemGettingShipmentItemBilling", locale); - return ServiceUtil.returnError(errMsg); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemGettingShipmentItemBilling", locale)); } if (UtilValidate.isNotEmpty(shipmentItemBillings)) { GenericValue shipmentItemBilling = EntityUtil.getFirst(shipmentItemBillings); @@ -1636,9 +1680,9 @@ public class InvoiceServices { Map<String, Object> result = dispatcher.runSync("createInvoiceForOrder", serviceContext); invoicesCreated.add((String) result.get("invoiceId")); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingTroubleCallingCreateInvoiceForOrderService", locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Trouble calling createInvoiceForOrder service; invoice not created for shipment", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingTroubleCallingCreateInvoiceForOrderService", locale)); } } @@ -1673,7 +1717,8 @@ public class InvoiceServices { Locale locale = (Locale) context.get("locale"); String shipmentId = (String) context.get("shipmentId"); - String errorMsg = UtilProperties.getMessage(resource, "AccountingErrorCreatingInvoiceForShipment",UtilMisc.toMap("shipmentId",shipmentId), locale); + String errorMsg = UtilProperties.getMessage(resource, "AccountingErrorCreatingInvoiceForShipment", + UtilMisc.toMap("shipmentId", shipmentId), locale); boolean salesReturnFound = false; boolean purchaseReturnFound = false; @@ -1683,7 +1728,8 @@ public class InvoiceServices { // get the shipment and validate that it is a sales return GenericValue shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); if (shipment == null) { - return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, "AccountingShipmentNotFound",locale)); + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + "AccountingShipmentNotFound", locale)); } if (shipment.getString("shipmentTypeId").equals("SALES_RETURN")) { salesReturnFound = true; @@ -1691,7 +1737,8 @@ public class InvoiceServices { purchaseReturnFound = true; } if (!(salesReturnFound || purchaseReturnFound)) { - return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, "AccountingShipmentNotSalesReturnAndPurchaseReturn",locale)); + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + "AccountingShipmentNotSalesReturnAndPurchaseReturn", locale)); } // get the items of the shipment. They can come from ItemIssuance if the shipment were from a purchase return, ShipmentReceipt if it were from a sales return List<GenericValue> shippedItems = null; @@ -1844,7 +1891,9 @@ public class InvoiceServices { // determine invoice item type from the return item type String invoiceItemTypeId = getInvoiceItemType(delegator, returnItem.getString("returnItemTypeId"), null, invoiceTypeId, null); if (invoiceItemTypeId == null) { - return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, "AccountingNoKnownInvoiceItemTypeReturnItemType",UtilMisc.toMap("returnItemTypeId",returnItem.getString("returnItemTypeId")),locale)); + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + "AccountingNoKnownInvoiceItemTypeReturnItemType", + UtilMisc.toMap("returnItemTypeId", returnItem.getString("returnItemTypeId")), locale)); } BigDecimal quantity = BigDecimal.ZERO; if (shipmentReceiptFound) { @@ -1916,8 +1965,9 @@ public class InvoiceServices { // determine invoice item type from the return item type invoiceItemTypeId = getInvoiceItemType(delegator, adjustment.getString("returnAdjustmentTypeId"), null, invoiceTypeId, null); if (invoiceItemTypeId == null) { - return ServiceUtil.returnError(errorMsg + "No known invoice item type for the return adjustment type [" - + adjustment.getString("returnAdjustmentTypeId") + "]"); + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + "AccountingNoKnownInvoiceItemTypeReturnAdjustmentType", + UtilMisc.toMap("returnAdjustmentTypeId", adjustment.getString("returnAdjustmentTypeId")), locale)); } // prorate the adjustment amount by the returned amount; do not round ratio @@ -1977,8 +2027,9 @@ public class InvoiceServices { // determine invoice item type from the return item type String invoiceItemTypeId = getInvoiceItemType(delegator, adjustment.getString("returnAdjustmentTypeId"), null, invoiceTypeId, null); if (invoiceItemTypeId == null) { - return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, "AccountingNoKnownInvoiceItemTypeReturnAdjustmentType", - UtilMisc.toMap("returnAdjustmentTypeId",adjustment.getString("returnAdjustmentTypeId")),locale)); + return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, + "AccountingNoKnownInvoiceItemTypeReturnAdjustmentType", + UtilMisc.toMap("returnAdjustmentTypeId", adjustment.getString("returnAdjustmentTypeId")), locale)); } // prorate the adjustment amount by the actual to promised ratio @@ -2038,7 +2089,8 @@ public class InvoiceServices { Locale locale = (Locale) context.get("locale"); if (DECIMALS == -1 || ROUNDING == -1) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingAritmeticPropertiesNotConfigured",locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingAritmeticPropertiesNotConfigured", locale)); } String invoiceId = (String) context.get("invoiceId"); @@ -2047,7 +2099,8 @@ public class InvoiceServices { invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId)); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting Invoice for Invoice ID" + invoiceId, module); - return ServiceUtil.returnError("Problem getting Invoice for Invoice ID" + invoiceId); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingInvoiceNotFound", UtilMisc.toMap("invoiceId", invoiceId), locale)); } // Ignore invoices that aren't ready yet @@ -2072,9 +2125,10 @@ public class InvoiceServices { iter.remove(); } } catch (GenericEntityException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemGettingPaymentApplication",UtilMisc.toMap("invoiceId",invoiceId), locale); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Problem getting PaymentApplication(s) for Invoice ID " + invoiceId, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemGettingPaymentApplication", + UtilMisc.toMap("invoiceId", invoiceId), locale)); } Map<String, BigDecimal> payments = FastMap.newInstance(); @@ -2111,9 +2165,10 @@ public class InvoiceServices { try { dispatcher.runSync("setInvoiceStatus", svcCtx); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource, "AccountingProblemChangingInvoiceStatusTo",UtilMisc.toMap("newStatus","INVOICE_PAID"), locale); - Debug.logError(e, errMsg + svcCtx, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Problem changing invoice status to INVOICE_PAID" + svcCtx, module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingProblemChangingInvoiceStatusTo", + UtilMisc.toMap("newStatus", "INVOICE_PAID"), locale)); } } } else { @@ -2157,12 +2212,13 @@ public class InvoiceServices { try { createInvoiceItemResult = dispatcher.runSync("createInvoiceItem", createInvoiceItemContext); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource,"AccountingServiceErrorCreatingInvoiceItemFromOrder",locale) + ": " + e.toString(); - Debug.logError(e, errMsg, module); - ServiceUtil.returnError(errMsg); + Debug.logError(e, "Service/other problem creating InvoiceItem from order header adjustment", module); + ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingServiceErrorCreatingInvoiceItemFromOrder", locale) + ": " + e.toString()); } if (ServiceUtil.isError(createInvoiceItemResult)) { - ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceItemFromOrder",locale), null, null, createInvoiceItemResult); + ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceItemFromOrder", locale), null, null, createInvoiceItemResult); } // Create the OrderAdjustmentBilling record @@ -2176,7 +2232,8 @@ public class InvoiceServices { try { Map<String, Object> createOrderAdjustmentBillingResult = dispatcher.runSync("createOrderAdjustmentBilling", createOrderAdjustmentBillingContext); } catch (GenericServiceException e) { - ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingOrderAdjustmentBillingFromOrder",locale), null, null, createOrderAdjustmentBillingContext); + ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingOrderAdjustmentBillingFromOrder", locale), null, null, createOrderAdjustmentBillingContext); } } @@ -2215,12 +2272,13 @@ public class InvoiceServices { try { createInvoiceItemResult = dispatcher.runSync("createInvoiceItem", createInvoiceItemContext); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource,"AccountingServiceErrorCreatingInvoiceItemFromOrder",locale) + ": " + e.toString(); - Debug.logError(e, errMsg, module); - ServiceUtil.returnError(errMsg); + Debug.logError(e, "Service/other problem creating InvoiceItem from order header adjustment", module); + ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingServiceErrorCreatingInvoiceItemFromOrder", locale) + ": " + e.toString()); } if (ServiceUtil.isError(createInvoiceItemResult)) { - ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceItemFromOrder",locale), null, null, createInvoiceItemResult); + ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceItemFromOrder", locale), null, null, createInvoiceItemResult); } // Create the OrderAdjustmentBilling record @@ -2234,7 +2292,8 @@ public class InvoiceServices { try { Map<String, Object> createOrderAdjustmentBillingResult = dispatcher.runSync("createOrderAdjustmentBilling", createOrderAdjustmentBillingContext); } catch (GenericServiceException e) { - ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingOrderAdjustmentBillingFromOrder",locale), null, null, createOrderAdjustmentBillingContext); + ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingOrderAdjustmentBillingFromOrder", locale), null, null, createOrderAdjustmentBillingContext); } } @@ -2270,12 +2329,13 @@ public class InvoiceServices { try { createInvoiceTermResult = dispatcher.runSync("createInvoiceTerm", createInvoiceTermContext); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(resource,"AccountingServiceErrorCreatingInvoiceTermFromOrder",locale) + ": " + e.toString(); - Debug.logError(e, errMsg, module); - ServiceUtil.returnError(errMsg); + Debug.logError(e, "Service/other problem creating InvoiceItem from order header adjustment", module); + ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingServiceErrorCreatingInvoiceItemFromOrder", locale) + ": " + e.toString()); } if (ServiceUtil.isError(createInvoiceTermResult)) { - ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceTermFromOrder",locale), null, null, createInvoiceTermResult); + ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingErrorCreatingInvoiceTermFromOrder", locale), null, null, createInvoiceTermResult); } } } @@ -2322,7 +2382,8 @@ public class InvoiceServices { Locale locale = (Locale) context.get("locale"); if (DECIMALS == -1 || ROUNDING == -1) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingAritmeticPropertiesNotConfigured",locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingAritmeticPropertiesNotConfigured", locale)); } if (!context.containsKey("useHighestAmount")) { @@ -2407,7 +2468,7 @@ public class InvoiceServices { GenericValue payment = null; String currencyUomId = null; if (paymentId == null || paymentId.equals("")) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentIdBlankNotSupplied",locale)); + errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentIdBlankNotSupplied", locale)); } else { try { payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", paymentId)); @@ -2415,15 +2476,18 @@ public class InvoiceServices { ServiceUtil.returnError(e.getMessage()); } if (payment == null) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentRecordNotFound",UtilMisc.toMap("paymentId",paymentId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentRecordNotFound", UtilMisc.toMap("paymentId", paymentId), locale)); } paymentApplyAvailable = payment.getBigDecimal("amount").subtract(PaymentWorker.getPaymentApplied(payment)).setScale(DECIMALS,ROUNDING); if (payment.getString("statusId").equals("PMNT_CANCELLED")) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentCancelled", UtilMisc.toMap("paymentId",paymentId), locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentCancelled", UtilMisc.toMap("paymentId", paymentId), locale)); } if (payment.getString("statusId").equals("PMNT_CONFIRMED")) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentConfirmed", UtilMisc.toMap("paymentId",paymentId), locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentConfirmed", UtilMisc.toMap("paymentId", paymentId), locale)); } currencyUomId = payment.getString("currencyUomId"); @@ -2446,15 +2510,18 @@ public class InvoiceServices { ServiceUtil.returnError(e.getMessage()); } if (toPayment == null) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentRecordNotFound",UtilMisc.toMap("paymentId",toPaymentId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentRecordNotFound", UtilMisc.toMap("paymentId", toPaymentId), locale)); } toPaymentApplyAvailable = toPayment.getBigDecimal("amount").subtract(PaymentWorker.getPaymentApplied(toPayment)).setScale(DECIMALS,ROUNDING); if (toPayment.getString("statusId").equals("PMNT_CANCELLED")) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentCancelled", UtilMisc.toMap("paymentId",paymentId), locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentCancelled", UtilMisc.toMap("paymentId", paymentId), locale)); } if (toPayment.getString("statusId").equals("PMNT_CONFIRMED")) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentConfirmed", UtilMisc.toMap("paymentId",paymentId), locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentConfirmed", UtilMisc.toMap("paymentId", paymentId), locale)); } // if the amount to apply is less then required by the payment reduce it @@ -2465,15 +2532,17 @@ public class InvoiceServices { if (paymentApplicationId == null) { // only check for new application records, update on existing records is checked in the paymentApplication section if (toPaymentApplyAvailable.signum() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentAlreadyApplied",UtilMisc.toMap("paymentId",toPaymentId), locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentAlreadyApplied", UtilMisc.toMap("paymentId", toPaymentId), locale)); } else { // check here for too much application if a new record is // added (paymentApplicationId == null) if (amountApplied.compareTo(toPaymentApplyAvailable) > 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentLessRequested", + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentLessRequested", UtilMisc.<String, Object>toMap("paymentId",toPaymentId, - "paymentApplyAvailable",toPaymentApplyAvailable, - "amountApplied",amountApplied,"isoCode", currencyUomId),locale)); + "paymentApplyAvailable", toPaymentApplyAvailable, + "amountApplied", amountApplied, "isoCode", currencyUomId), locale)); } } } @@ -2481,7 +2550,8 @@ public class InvoiceServices { // check if at least one send is the same as one receiver on the other payment if (!payment.getString("partyIdFrom").equals(toPayment.getString("partyIdTo")) && !payment.getString("partyIdTo").equals(toPayment.getString("partyIdFrom"))) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingFromPartySameToParty", locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingFromPartySameToParty", locale)); } if (debug) Debug.logInfo("toPayment info retrieved and checked...", module); @@ -2497,7 +2567,8 @@ public class InvoiceServices { } if (invoice == null) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotFound",UtilMisc.toMap("invoiceId",invoiceId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoiceNotFound", UtilMisc.toMap("invoiceId", invoiceId), locale)); } else { if (invoice.getString("billingAccountId") != null) { billingAccountId = invoice.getString("billingAccountId"); @@ -2509,19 +2580,22 @@ public class InvoiceServices { GenericValue billingAccount = null; if (billingAccountId != null && !billingAccountId.equals("")) { try { - billingAccount = delegator.findByPrimaryKey("BillingAccount", UtilMisc.toMap("billingAccountId", billingAccountId)); + billingAccount = delegator.findByPrimaryKey("BillingAccount", + UtilMisc.toMap("billingAccountId", billingAccountId)); } catch (GenericEntityException e) { ServiceUtil.returnError(e.getMessage()); } if (billingAccount == null) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingBillingAccountNotFound",UtilMisc.toMap("billingAccountId",billingAccountId), locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingBillingAccountNotFound", UtilMisc.toMap("billingAccountId", billingAccountId), locale)); } // check the currency if (billingAccount.get("accountCurrencyUomId") != null && currencyUomId != null && !billingAccount.getString("accountCurrencyUomId").equals(currencyUomId)) { errorMessageList.add(UtilProperties.getMessage(resource, "AccountingBillingAccountCurrencyProblem", - UtilMisc.toMap("billingAccountId",billingAccountId,"accountCurrencyUomId",billingAccount.getString("accountCurrencyUomId"), - "paymentId",paymentId,"paymentCurrencyUomId", currencyUomId),locale)); + UtilMisc.toMap("billingAccountId", billingAccountId, + "accountCurrencyUomId", billingAccount.getString("accountCurrencyUomId"), + "paymentId", paymentId, "paymentCurrencyUomId", currencyUomId), locale)); } if (debug) Debug.logInfo("Billing Account info retrieved and checked...", module); @@ -2542,11 +2616,13 @@ public class InvoiceServices { } if (invoice == null) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotFound",UtilMisc.toMap("invoiceId",invoiceId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoiceNotFound", UtilMisc.toMap("invoiceId", invoiceId), locale)); } else { // check the invoice and when supplied the invoice item... if (invoice.getString("statusId").equals("INVOICE_CANCELLED")) { - errorMessageList.add(UtilProperties.getMessage(resource,"AccountingInvoiceCancelledCannotApplyTo",UtilMisc.toMap("invoiceId",invoiceId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoiceCancelledCannotApplyTo", UtilMisc.toMap("invoiceId", invoiceId), locale)); } // check the currency @@ -2580,26 +2656,30 @@ public class InvoiceServices { } if (invoiceTotal.signum() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource,"AccountingInvoiceTotalZero",UtilMisc.toMap("invoiceId",invoiceId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoiceTotalZero", UtilMisc.toMap("invoiceId", invoiceId), locale)); } else if (paymentApplicationId == null) { // only check for new records here...updates are checked in the paymentApplication section if (invoiceApplyAvailable.signum() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource,"AccountingInvoiceCompletelyApplied",UtilMisc.toMap("invoiceId",invoiceId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoiceCompletelyApplied", UtilMisc.toMap("invoiceId", invoiceId), locale)); } // check here for too much application if a new record(s) are // added (paymentApplicationId == null) else if (amountApplied.compareTo(invoiceApplyAvailable) > 0) { errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceLessRequested", - UtilMisc.<String, Object>toMap("invoiceId",invoiceId, - "invoiceApplyAvailable",invoiceApplyAvailable, - "amountApplied",amountApplied,"isoCode",invoice.getString("currencyUomId")),locale)); + UtilMisc.<String, Object>toMap("invoiceId", invoiceId, + "invoiceApplyAvailable", invoiceApplyAvailable, + "amountApplied", amountApplied, + "isoCode", invoice.getString("currencyUomId")), locale)); } } // check if at least one sender is the same as one receiver on the invoice if (!payment.getString("partyIdFrom").equals(invoice.getString("partyId")) && !payment.getString("partyIdTo").equals(invoice.getString("partyIdFrom"))) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingFromPartySameToParty", locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingFromPartySameToParty", locale)); } if (debug) Debug.logInfo("Invoice info retrieved and checked ...", module); @@ -2609,16 +2689,22 @@ public class InvoiceServices { if (invoiceItemSeqId != null) { // when itemSeqNr not provided delay checking on invoiceItemSeqId try { - invoiceItem = delegator.findByPrimaryKey("InvoiceItem", UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId)); + invoiceItem = delegator.findByPrimaryKey("InvoiceItem", + UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId)); } catch (GenericEntityException e) { ServiceUtil.returnError(e.getMessage()); } if (invoiceItem == null) { - errorMessageList.add(UtilProperties.getMessage(resource,"AccountingInvoiceItemNotFound",UtilMisc.toMap("invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoiceItemNotFound", + UtilMisc.toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId), locale)); } else { if (invoice.get("currencyUomId") != null && currencyUomId != null && !invoice.getString("currencyUomId").equals(currencyUomId)) { - errorMessageList.add(UtilProperties.getMessage(resource,"AccountingInvoicePaymentCurrencyProblem",UtilMisc.toMap("paymentCurrencyId", currencyUomId,"itemCurrency",invoice.getString("currencyUomId")) ,locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoicePaymentCurrencyProblem", + UtilMisc.toMap("paymentCurrencyId", currencyUomId, + "itemCurrency", invoice.getString("currencyUomId")), locale)); } // get the invoice item applied value @@ -2636,9 +2722,9 @@ public class InvoiceServices { errorMessageList.add("Invoice(" + invoiceId + ") item(" + invoiceItemSeqId + ") has " + invoiceItemApplyAvailable + " to apply but " + amountApplied + " is requested\n"); String uomId = invoice.getString("currencyUomId"); errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceItemLessRequested", - UtilMisc.<String, Object>toMap("invoiceId",invoiceId, "invoiceItemSeqId", invoiceItemSeqId, - "invoiceItemApplyAvailable",invoiceItemApplyAvailable, - "amountApplied",amountApplied,"isoCode",uomId),locale)); + UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "invoiceItemSeqId", invoiceItemSeqId, + "invoiceItemApplyAvailable", invoiceItemApplyAvailable, + "amountApplied", amountApplied, "isoCode", uomId), locale)); } } if (debug) Debug.logInfo("InvoiceItem info retrieved and checked against the Invoice (currency and amounts) ...", module); @@ -2649,15 +2735,16 @@ public class InvoiceServices { if (paymentApplicationId == null) { // only check for new application records, update on existing records is checked in the paymentApplication section if (paymentApplyAvailable.signum() == 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentAlreadyApplied",UtilMisc.toMap("paymentId",paymentId), locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentAlreadyApplied", UtilMisc.toMap("paymentId", paymentId), locale)); } else { // check here for too much application if a new record is // added (paymentApplicationId == null) if (amountApplied.compareTo(paymentApplyAvailable) > 0) { errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentLessRequested", - UtilMisc.<String, Object>toMap("paymentId",paymentId, - "paymentApplyAvailable",paymentApplyAvailable, - "amountApplied",amountApplied,"isoCode", currencyUomId),locale)); + UtilMisc.<String, Object>toMap("paymentId", paymentId, + "paymentApplyAvailable", paymentApplyAvailable, + "amountApplied", amountApplied,"isoCode", currencyUomId), locale)); } } } @@ -2677,13 +2764,16 @@ public class InvoiceServices { // prepare for creation } else { // retrieve existing paymentApplication try { - paymentApplication = delegator.findByPrimaryKey("PaymentApplication", UtilMisc.toMap("paymentApplicationId", paymentApplicationId)); + paymentApplication = delegator.findByPrimaryKey("PaymentApplication", + UtilMisc.toMap("paymentApplicationId", paymentApplicationId)); } catch (GenericEntityException e) { ServiceUtil.returnError(e.getMessage()); } if (paymentApplication == null) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentApplicationNotFound", UtilMisc.toMap("paymentApplicationId",paymentApplicationId), locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentApplicationNotFound", + UtilMisc.toMap("paymentApplicationId", paymentApplicationId), locale)); paymentApplicationId = null; } else { @@ -2719,7 +2809,11 @@ public class InvoiceServices { newPaymentApplyAvailable = paymentApplyAvailable.add(paymentApplyAvailable).subtract(amountApplied).setScale(DECIMALS, ROUNDING); } if (newPaymentApplyAvailable.compareTo(ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentNotEnough", UtilMisc.<String, Object>toMap("paymentId",paymentId,"paymentApplyAvailable",paymentApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")),"amountApplied",amountApplied),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentNotEnough", + UtilMisc.<String, Object>toMap("paymentId", paymentId, + "paymentApplyAvailable", paymentApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")), + "amountApplied", amountApplied), locale)); } if (invoiceId != null) { @@ -2731,33 +2825,51 @@ public class InvoiceServices { if (invoiceItemSeqId == null && paymentApplication.get("invoiceItemSeqId") == null) { newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING); if (invoiceApplyAvailable.compareTo(ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceApplyAvailable.negate(),"invoiceId",invoiceId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoiceNotEnough", + UtilMisc.<String, Object>toMap("tooMuch", newInvoiceApplyAvailable.negate(), + "invoiceId", invoiceId), locale)); } } else if (invoiceItemSeqId == null && paymentApplication.get("invoiceItemSeqId") != null) { // check if the item number changed from a real Item number to a null value newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING); if (invoiceApplyAvailable.compareTo(ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceApplyAvailable.negate(),"invoiceId",invoiceId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoiceNotEnough", + UtilMisc.<String, Object>toMap("tooMuch", newInvoiceApplyAvailable.negate(), + "invoiceId", invoiceId), locale)); } } else if (invoiceItemSeqId != null && paymentApplication.get("invoiceItemSeqId") == null) { // check if the item number changed from a null value to // a real Item number newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.subtract(amountApplied).setScale(DECIMALS, ROUNDING); if (newInvoiceItemApplyAvailable.compareTo(ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingItemInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceItemApplyAvailable.negate(),"invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingItemInvoiceNotEnough", + UtilMisc.<String, Object>toMap("tooMuch", newInvoiceItemApplyAvailable.negate(), + "invoiceId", invoiceId, + "invoiceItemSeqId", invoiceItemSeqId), locale)); } } else if (invoiceItemSeqId.equals(paymentApplication.getString("invoiceItemSeqId"))) { // check if the real item numbers the same // item number the same numeric value newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied).setScale(DECIMALS, ROUNDING); if (newInvoiceItemApplyAvailable.compareTo(ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingItemInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceItemApplyAvailable.negate(),"invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingItemInvoiceNotEnough", + UtilMisc.<String, Object>toMap("tooMuch", newInvoiceItemApplyAvailable.negate(), + "invoiceId", invoiceId, + "invoiceItemSeqId", invoiceItemSeqId), locale)); } } else { // item number changed only check new item newInvoiceItemApplyAvailable = invoiceItemApplyAvailable.add(amountApplied).setScale(DECIMALS, ROUNDING); if (newInvoiceItemApplyAvailable.compareTo(ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingItemInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",newInvoiceItemApplyAvailable.negate(),"invoiceId",invoiceId,"invoiceItemSeqId",invoiceItemSeqId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingItemInvoiceNotEnough", + UtilMisc.<String, Object>toMap("tooMuch", newInvoiceItemApplyAvailable.negate(), + "invoiceId", invoiceId, + "invoiceItemSeqId", invoiceItemSeqId), locale)); } } @@ -2776,7 +2888,10 @@ public class InvoiceServices { // check the invoice newInvoiceApplyAvailable = invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied").subtract(amountApplied)).setScale(DECIMALS, ROUNDING); if (newInvoiceApplyAvailable.compareTo(ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceNotEnough",UtilMisc.<String, Object>toMap("tooMuch",invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied),"invoiceId",invoiceId),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingInvoiceNotEnough", + UtilMisc.<String, Object>toMap("tooMuch", invoiceApplyAvailable.add(paymentApplication.getBigDecimal("amountApplied")).subtract(amountApplied), + "invoiceId", invoiceId), locale)); } } } @@ -2786,14 +2901,22 @@ public class InvoiceServices { if (toPaymentId != null && toPaymentId.equals(paymentApplication.getString("toPaymentId"))) { newToPaymentApplyAvailable = toPaymentApplyAvailable.subtract(paymentApplication.getBigDecimal("amountApplied")).add(amountApplied).setScale(DECIMALS, ROUNDING); if (newToPaymentApplyAvailable.compareTo(ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentNotEnough", UtilMisc.<String, Object>toMap("paymentId",toPaymentId,"paymentApplyAvailable",newToPaymentApplyAvailable,"amountApplied",amountApplied),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentNotEnough", + UtilMisc.<String, Object>toMap("paymentId", toPaymentId, + "paymentApplyAvailable", newToPaymentApplyAvailable, + "amountApplied", amountApplied), locale)); } } else if (toPaymentId != null) { // billing account entered number has changed so we have to // check the new billing account number. newToPaymentApplyAvailable = toPaymentApplyAvailable.add(amountApplied).setScale(DECIMALS, ROUNDING); if (newToPaymentApplyAvailable.compareTo(ZERO) < 0) { - errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentNotEnough", UtilMisc.<String, Object>toMap("paymentId",toPaymentId,"paymentApplyAvailable",newToPaymentApplyAvailable,"amountApplied",amountApplied),locale)); + errorMessageList.add(UtilProperties.getMessage(resource, + "AccountingPaymentNotEnough", + UtilMisc.<String, Object>toMap("paymentId", toPaymentId, + "paymentApplyAvailable", newToPaymentApplyAvailable, + "amountApplied", amountApplied), locale)); } } @@ -2811,16 +2934,24 @@ public class InvoiceServices { Debug.logInfo("checking finished, start processing with the following data... ", module); if (invoiceId != null) { [... 90 lines stripped ...] |
| Free forum by Nabble | Edit this page |
