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

mridulpathak 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 c7503e0c62 Fixed: checkInvoiceStatusInProgress loses its specific 
error messages (OFBIZ-13587)
c7503e0c62 is described below

commit c7503e0c62cb92012c64152f91b9121de3624087
Author: Mridul Pathak <[email protected]>
AuthorDate: Wed Sep 16 13:29:41 2026 +0530

    Fixed: checkInvoiceStatusInProgress loses its specific error messages 
(OFBIZ-13587)
    
    The method was converted into a permission-service (used by 
createInvoiceItem/updateInvoiceItem/removeInvoiceItem/createInvoiceRole/removeInvoiceRole/createInvoiceTerm)
 that only returned hasPermission, never a failMessage. The original minilang 
raised distinct labeled errors distinguishing "invoice not found" from "can 
only update while in process." Without a failMessage, the permission framework 
substituted a generic "you do not have permission" message, losing the specific 
reason f [...]
---
 .../ofbiz/accounting/invoice/InvoiceServicesScript.groovy      | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
index 735edd253a..ce9b918a6b 100644
--- 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
+++ 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/invoice/InvoiceServicesScript.groovy
@@ -302,8 +302,14 @@ Map setInvoiceStatus() {
  */
 Map checkInvoiceStatusInProgress() {
     GenericValue invoice = from('Invoice').where(parameters).cache().queryOne()
-    boolean hasPermission = invoice && invoice.statusId == 'INVOICE_IN_PROCESS'
-    return success([hasPermission: hasPermission])
+    if (!invoice) {
+        return success([hasPermission: false, failMessage: 
label('AccountingUiLabels', 'AccountingInvoiceNotFound', parameters)])
+    }
+    if (invoice.statusId != 'INVOICE_IN_PROCESS') {
+        return success([hasPermission: false,
+                        failMessage: label('AccountingUiLabels', 
'AccountingInvoiceUpdateOnlyWithInProcessStatus', parameters)])
+    }
+    return success([hasPermission: true])
 }
 
 /**

Reply via email to