IDEMPIERE-5701: Improve logs when role cannot report or export (#1811)

* IDEMPIERE-5701: Improve logs when role cannot report or export

https://idempiere.atlassian.net/browse/IDEMPIERE-5701

* IDEMPIERE-5701: Reduce log level when role cannot report or export and hide Report button when role cannot report

Co-Authored-By: Carlos Ruiz <carg67@gmail.com>
This commit is contained in:
Nicolas Micoud 2023-05-04 00:06:53 +02:00 committed by GitHub
parent 969a2e66df
commit 0553878431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -1233,7 +1233,7 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport
{
if (!isCanReport()) // Role Level block
{
log.warning ("Role denied");
if (log.isLoggable(Level.FINE)) log.fine ("Role denied (" + MRole.getDefaultRole().getAD_Role_ID() + ") tableID=" + AD_Table_ID);
return false;
}
if (!isTableAccess(AD_Table_ID, true)) // No R/O Access to Table
@ -1277,7 +1277,7 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport
{
if (!isCanExport()) // Role Level block
{
log.warning ("Role denied");
if (log.isLoggable(Level.FINE)) log.fine ("Role denied (" + MRole.getDefaultRole().getAD_Role_ID() + ") tableID=" + AD_Table_ID);
return false;
}
if (!isTableAccess(AD_Table_ID, true)) // No R/O Access to Table

View File

@ -269,8 +269,10 @@ public class ADWindowToolbar extends ToolBar implements EventListener<Event>
btnParentRecord.setTooltiptext(btnParentRecord.getTooltiptext()+ " Alt+Up");
btnDetailRecord = createButton("DetailRecord", "Detail", "DetailRecord");
btnDetailRecord.setTooltiptext(btnDetailRecord.getTooltiptext()+ " Alt+Down");
btnReport = createButton("Report", "Report", "Report");
btnReport.setTooltiptext(btnReport.getTooltiptext()+ " Alt+R");
if (MRole.getDefault().isCanReport()) {
btnReport = createButton("Report", "Report", "Report");
btnReport.setTooltiptext(btnReport.getTooltiptext()+ " Alt+R");
}
btnArchive = createButton("Archive", "Archive", "Archive");
btnPrint = createButton("Print", "Print", "Print");
btnPrint.setTooltiptext(btnPrint.getTooltiptext()+ " Alt+P");
@ -516,7 +518,8 @@ public class ADWindowToolbar extends ToolBar implements EventListener<Event>
altKeyMap.put(KeyEvent.DOWN, btnDetailRecord);
altKeyMap.put(VK_F, btnFind);
altKeyMap.put(VK_Z, btnIgnore);
altKeyMap.put(VK_R, btnReport);
if (btnReport != null)
altKeyMap.put(VK_R, btnReport);
altKeyMap.put(VK_P, btnPrint);
altKeyMap.put(VK_O, btnProcess);
altKeyMap.put(VK_L, btnCustomize);
@ -787,7 +790,8 @@ public class ADWindowToolbar extends ToolBar implements EventListener<Event>
*/
public void enableReport(boolean enabled)
{
this.btnReport.setDisabled(!enabled);
if (btnReport != null)
this.btnReport.setDisabled(!enabled);
}
/**