You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by nm...@apache.org on 2021/05/14 15:55:10 UTC

[ofbiz-framework] branch trunk updated: Fixed: Quote and Invoice with null value on refresh base (OFBIZ-12239)

This is an automated email from the ASF dual-hosted git repository.

nmalin pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b8f67d2  Fixed: Quote and Invoice with null value on refresh base (OFBIZ-12239)
b8f67d2 is described below

commit b8f67d2e70627dbab647ab6df8572a7fe648b739
Author: Nicolas Malin <ni...@nereide.fr>
AuthorDate: Fri May 14 17:49:35 2021 +0200

    Fixed: Quote and Invoice with null value on refresh base
    (OFBIZ-12239)
    
    After a fresh data base init with only seed, if you create your company without invoice or quote prefix, your sequence will be generate with 'null' string where the invoice or quote prefix should be have :
    
    > null10001, null10002, ...
---
 .../accounting/groovyScripts/invoice/InvoiceServices.groovy      | 9 ++++-----
 applications/order/groovyScripts/quote/QuoteServices.groovy      | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy b/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy
index 306c849..83745ac 100644
--- a/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy
+++ b/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy
@@ -32,10 +32,10 @@ def getNextInvoiceId() {
     GenericValue partyAcctgPreference = from('PartyAcctgPreference').where(parameters).queryOne()
     if (Debug.infoOn()) logInfo("In getNextInvoiceId partyId is [${parameters.partyId}], partyAcctgPreference: ${partyAcctgPreference}")
 
-    String customMethodName = null;
-    String invoiceIdPrefix = '';
+    String customMethodName = null
+    String invoiceIdPrefix = ''
     if (partyAcctgPreference) {
-        invoiceIdPrefix = partyAcctgPreference.invoiceIdPrefix
+        invoiceIdPrefix = partyAcctgPreference.invoiceIdPrefix ?: ''
         //see OFBIZ-3765 beware of OFBIZ-3557
         GenericValue customMethod = partyAcctgPreference.getRelatedOne('InvoiceCustomMethod', true)
         if (customMethod) {
@@ -75,8 +75,7 @@ def getNextInvoiceId() {
     }
 
     // use invoiceIdTemp along with the invoiceIdPrefix to create the real ID
-    String invoiceId = invoiceIdPrefix + invoiceIdTemp
-    result.invoiceId = invoiceId
+    result.invoiceId = invoiceIdPrefix + invoiceIdTemp
     return result
 }
 
diff --git a/applications/order/groovyScripts/quote/QuoteServices.groovy b/applications/order/groovyScripts/quote/QuoteServices.groovy
index 1e5e551..3c76927 100644
--- a/applications/order/groovyScripts/quote/QuoteServices.groovy
+++ b/applications/order/groovyScripts/quote/QuoteServices.groovy
@@ -95,7 +95,7 @@ def getNextQuoteId() {
     }
 
     if (partyAcctgPreference) {
-        quoteId = "${partyAcctgPreference.quoteIdPrefix}${quoteId}"
+        quoteId = "${partyAcctgPreference.quoteIdPrefix?:''}${quoteId}"
     }
     return [successMessage: null, quoteId: quoteId]
 }