Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions org.adempiere.base/src/org/compiere/model/MRole.java
Expand Up @@ -1233,7 +1233,7 @@ public boolean isCanReport (int AD_Table_ID)
{
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
Expand Down Expand Up @@ -1277,7 +1277,7 @@ public boolean isCanExport (int AD_Table_ID)
{
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
Expand Down
Expand Up @@ -269,8 +269,10 @@ private void init()
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");
Expand Down Expand Up @@ -516,7 +518,8 @@ private void configureKeyMap()
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);
Expand Down Expand Up @@ -787,7 +790,8 @@ public void enablePrint(boolean enabled)
*/
public void enableReport(boolean enabled)
{
this.btnReport.setDisabled(!enabled);
if (btnReport != null)
this.btnReport.setDisabled(!enabled);
}

/**
Expand Down