From 26aac62a4a4c1c9bfecdd07ceb69ea58e7a4ef57 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Sat, 12 Feb 2022 12:29:20 +0100 Subject: [PATCH] IDEMPIERE-5174 Disable System User (#1174) (#1182) Fix wrong comparison changed in commit a9c4f7b - test case failing Improve traceability of unit test --- .../src/org/compiere/model/MDocumentStatus.java | 4 ++-- .../idempiere/test/base/DocumentStatusTest.java | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MDocumentStatus.java b/org.adempiere.base/src/org/compiere/model/MDocumentStatus.java index 60f59100a1..3d9b6d873d 100644 --- a/org.adempiere.base/src/org/compiere/model/MDocumentStatus.java +++ b/org.adempiere.base/src/org/compiere/model/MDocumentStatus.java @@ -163,8 +163,8 @@ public class MDocumentStatus extends X_PA_DocumentStatus { * but as they are the administrators is not a problem */ if ( (access.getAD_Role_ID() == roleId && access.getAD_User_ID() == userId) - || (access.getAD_Role_ID() == roleId && access.getAD_User_ID() == SystemIDs.USER_SYSTEM) - || (access.getAD_Role_ID() == SystemIDs.ROLE_SYSTEM && access.getAD_User_ID() == userId) ) + || (access.getAD_Role_ID() == roleId && access.getAD_User_ID() == 0 ) // user not set + || (access.getAD_Role_ID() == 0 && access.getAD_User_ID() == userId) ) // role not set return true; } diff --git a/org.idempiere.test/src/org/idempiere/test/base/DocumentStatusTest.java b/org.idempiere.test/src/org/idempiere/test/base/DocumentStatusTest.java index d00f538995..fcf514a7fb 100644 --- a/org.idempiere.test/src/org/idempiere/test/base/DocumentStatusTest.java +++ b/org.idempiere.test/src/org/idempiere/test/base/DocumentStatusTest.java @@ -56,7 +56,9 @@ public class DocumentStatusTest extends AbstractTestCase { private static final int ROLE_GARDENWORLD_ADMIN_NOT_ADVANCED = 200001; private static final int WINDOW_ID_INVOICE_CUSTOMER = 167; - private static final int WINDOW_ID_SALES_ORDER = 143; + private static final int WINDOW_ID_NOTICE = 193; + private static final int WINDOW_ID_REQUEST = 201; + private static final int WINDOW_ID_WF_ACTIVITIES = 298; /** * https://idempiere.atlassian.net/browse/IDEMPIERE-4836 @@ -83,19 +85,19 @@ public class DocumentStatusTest extends AbstractTestCase { /* Document Status with no user or role access, visible to all */ MDocumentStatus noticeDS = new MDocumentStatus(Env.getCtx(), 0, getTrxName()); - noticeDS.setName("order Document Status Unit Test"); + noticeDS.setName("Notice Document Status Unit Test"); noticeDS.setEntityType(MEntityType.ENTITYTYPE_Dictionary); noticeDS.setAD_Table_ID(MOrder.Table_ID); - noticeDS.setAD_Window_ID(WINDOW_ID_SALES_ORDER); + noticeDS.setAD_Window_ID(WINDOW_ID_NOTICE); noticeDS.setSeqNo(20); noticeDS.saveEx(); /* Document Status with specific user access */ MDocumentStatus requestDS = new MDocumentStatus(Env.getCtx(), 0, getTrxName()); - requestDS.setName("Notice Document Status Unit Test"); + requestDS.setName("Request Document Status Unit Test"); requestDS.setEntityType(MEntityType.ENTITYTYPE_Dictionary); requestDS.setAD_Table_ID(MInvoice.Table_ID); - requestDS.setAD_Window_ID(WINDOW_ID_INVOICE_CUSTOMER); + requestDS.setAD_Window_ID(WINDOW_ID_REQUEST); requestDS.setSeqNo(30); requestDS.saveEx(); @@ -109,7 +111,7 @@ public class DocumentStatusTest extends AbstractTestCase { WorkflowActivitiesDS.setName("Workflow Activities Document Status Unit Test"); WorkflowActivitiesDS.setEntityType(MEntityType.ENTITYTYPE_Dictionary); WorkflowActivitiesDS.setAD_Table_ID(MInvoice.Table_ID); - WorkflowActivitiesDS.setAD_Window_ID(WINDOW_ID_INVOICE_CUSTOMER); + WorkflowActivitiesDS.setAD_Window_ID(WINDOW_ID_WF_ACTIVITIES); WorkflowActivitiesDS.setSeqNo(40); WorkflowActivitiesDS.saveEx();