Author: sichen
Date: Wed Mar 7 09:45:29 2007 New Revision: 515660 URL: http://svn.apache.org/viewvc?view=rev&rev=515660 Log: OFBIZ-781: Implement setting to control auto-approval of sales invoice Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml ofbiz/trunk/applications/product/entitydef/entitymodel.xml ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml 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?view=diff&rev=515660&r1=515659&r2=515660 ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Wed Mar 7 09:45:29 2007 @@ -740,14 +740,18 @@ } } - // should all be in place now, so set status to INVOICE_READY (unless it's a purchase invoice, which we sets to INVOICE_IN_PROCESS) - String nextStatusId = "INVOICE_READY"; - if (invoiceType.equals("PURCHASE_INVOICE")) { - nextStatusId = "INVOICE_IN_PROCESS"; - } - Map setInvoiceStatusResult = dispatcher.runSync("setInvoiceStatus", UtilMisc.toMap("invoiceId", invoiceId, "statusId", nextStatusId, "userLogin", userLogin)); - if (ServiceUtil.isError(setInvoiceStatusResult)) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceFromOrder",locale), null, null, setInvoiceStatusResult); + // Should all be in place now. Depending on the ProductStore.autoApproveInvoice setting, set status to INVOICE_READY (unless it's a purchase + // invoice, which we set to INVOICE_IN_PROCESS) + boolean autoApproveInvoice = UtilValidate.isEmpty(productStore.get("autoApproveInvoice")) || "Y".equals(productStore.getString("autoApproveInvoice")); + if(autoApproveInvoice) { + String nextStatusId = "INVOICE_READY"; + if (invoiceType.equals("PURCHASE_INVOICE")) { + nextStatusId = "INVOICE_IN_PROCESS"; + } + Map setInvoiceStatusResult = dispatcher.runSync("setInvoiceStatus", UtilMisc.toMap("invoiceId", invoiceId, "statusId", nextStatusId, "userLogin", userLogin)); + if (ServiceUtil.isError(setInvoiceStatusResult)) { + return ServiceUtil.returnError(UtilProperties.getMessage(resource,"AccountingErrorCreatingInvoiceFromOrder",locale), null, null, setInvoiceStatusResult); + } } // check to see if we are all paid up Modified: ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml?view=diff&rev=515660&r1=515659&r2=515660 ============================================================================== --- ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml (original) +++ ofbiz/trunk/applications/ecommerce/data/DemoProduct.xml Wed Mar 7 09:45:29 2007 @@ -49,7 +49,7 @@ authFraudMessage="Your order has been rejected and your account has been disabled due to fraud." authErrorMessage="Problem connecting to payment processor; we will continue to retry and notify you by email." storeCreditValidDays="90" - styleSheet="/images/ecommain.css" headerLogo="/images/ofbiz_logo.jpg"/> + styleSheet="/images/ecommain.css" headerLogo="/images/ofbiz_logo.jpg" autoApproveInvoice="Y"/> <ProductStorePaymentSetting productStoreId="9000" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_AUTH" paymentService="alwaysApproveCCProcessor"/> <ProductStorePaymentSetting productStoreId="9000" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_RELEASE" paymentService="testCCRelease"/> <ProductStorePaymentSetting productStoreId="9000" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_CAPTURE" paymentService="testCCCapture"/> Modified: ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml?view=diff&rev=515660&r1=515659&r2=515660 ============================================================================== --- ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml (original) +++ ofbiz/trunk/applications/ecommerce/data/DemoRentalProduct.xml Wed Mar 7 09:45:29 2007 @@ -28,7 +28,7 @@ authDeclinedMessage="There has been a problem with your method of payment. Please try a different method or call customer service." authFraudMessage="Your order has been rejected and your account has been disabled due to fraud." authErrorMessage="Problem connecting to payment processor; we will continue to retry and notify you by email." - styleSheet="/images/ecommain.css" headerLogo="/images/opentravelsystem_logo.jpg"/> + styleSheet="/images/ecommain.css" headerLogo="/images/opentravelsystem_logo.jpg" autoApproveInvoice="Y"/> <ProductStorePaymentSetting productStoreId="RentalStore" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_AUTH" paymentService="alwaysApproveCCProcessor"/> <ProductStorePaymentSetting productStoreId="RentalStore" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_RELEASE" paymentService="testCCRelease"/> <ProductStorePaymentSetting productStoreId="RentalStore" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_CAPTURE" paymentService="testCCCapture"/> Modified: ofbiz/trunk/applications/product/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?view=diff&rev=515660&r1=515659&r2=515660 ============================================================================== --- ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original) +++ ofbiz/trunk/applications/product/entitydef/entitymodel.xml Wed Mar 7 09:45:29 2007 @@ -3148,6 +3148,7 @@ <field name="autoOrderCcTryLaterNsf" type="indicator"><description>For auto-orders if Credit Cards fails for NSF (Not Sufficient Funds) try again later?</description></field> <field name="autoOrderCcTryLaterMax" type="numeric"><description>For auto-orders if Credit Cards fails for NSF try again how many times?</description></field> <field name="storeCreditValidDays" type="numeric"><description>How many days that store credit is valid for. Null value implies no expiration.</description></field> + <field name="autoApproveInvoice" type="indicator"><description>If Y or empty, sales invoices created from orders will be marked ready.</description></field> <prim-key field="productStoreId"/> <relation type="one" fk-name="PROD_STR_PRSTRGP" title="Primary" rel-entity-name="ProductStoreGroup"> <key-map field-name="primaryStoreGroupId" rel-field-name="productStoreGroupId"/> Modified: ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml?view=diff&rev=515660&r1=515659&r2=515660 ============================================================================== --- ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml (original) +++ ofbiz/trunk/specialpurpose/pos/data/DemoRetail.xml Wed Mar 7 09:45:29 2007 @@ -53,7 +53,7 @@ authDeclinedMessage="There has been a problem with your method of payment. Please try a different method or call customer service." authFraudMessage="Your order has been rejected and your account has been disabled due to fraud." authErrorMessage="Problem connecting to payment processor; we will continue to retry and notify you by email." - styleSheet="" headerLogo=""/> + styleSheet="" headerLogo="" autoApproveInvoice="Y"/> <ProductStorePaymentSetting productStoreId="9100" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_AUTH" paymentService="alwaysApproveWithCaptureCCProcessor"/> <ProductStorePaymentSetting productStoreId="9100" paymentMethodTypeId="CREDIT_CARD" paymentServiceTypeEnumId="PRDS_PAY_RELEASE" paymentService="testCCRelease"/> |
Free forum by Nabble | Edit this page |