IDEMPIERE-2125 Error in creating recent item avoids to save any record - refactor and apply same code from tbayen in two more places where is needed
This commit is contained in:
parent
d76804a007
commit
9d6fbe06d2
|
@ -1517,14 +1517,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
Env.getAD_Role_ID(ctx), adTabbox.getSelectedGridTab().getAD_Window_ID(),
|
Env.getAD_Role_ID(ctx), adTabbox.getSelectedGridTab().getAD_Window_ID(),
|
||||||
adTabbox.getSelectedGridTab().getAD_Tab_ID());
|
adTabbox.getSelectedGridTab().getAD_Tab_ID());
|
||||||
} else {
|
} else {
|
||||||
/* when a detail record is modified add header to recent items */
|
GridTab mainTab = getMainTabAbove();
|
||||||
GridTab mainTab = adTabbox.getSelectedGridTab(); // find parent tab (IDEMPIERE-2125 - tbayen)
|
|
||||||
while (mainTab != null && mainTab.getTabLevel() > 0) {
|
|
||||||
GridTab parentTab = mainTab.getParentTab();
|
|
||||||
if (parentTab == mainTab)
|
|
||||||
break;
|
|
||||||
mainTab = parentTab;
|
|
||||||
}
|
|
||||||
if (mainTab != null) {
|
if (mainTab != null) {
|
||||||
MRecentItem.addModifiedField(ctx, mainTab.getAD_Table_ID(),
|
MRecentItem.addModifiedField(ctx, mainTab.getAD_Table_ID(),
|
||||||
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx),
|
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx),
|
||||||
|
@ -2176,8 +2169,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
Env.getAD_Role_ID(ctx), adTabbox.getSelectedGridTab().getAD_Window_ID(),
|
Env.getAD_Role_ID(ctx), adTabbox.getSelectedGridTab().getAD_Window_ID(),
|
||||||
adTabbox.getSelectedGridTab().getAD_Tab_ID());
|
adTabbox.getSelectedGridTab().getAD_Tab_ID());
|
||||||
} else {
|
} else {
|
||||||
/* when a detail record is modified add header to recent items */
|
GridTab mainTab = getMainTabAbove();
|
||||||
GridTab mainTab = gridWindow.getTab(0);
|
|
||||||
if (mainTab != null) {
|
if (mainTab != null) {
|
||||||
MRecentItem.addModifiedField(ctx, mainTab.getAD_Table_ID(),
|
MRecentItem.addModifiedField(ctx, mainTab.getAD_Table_ID(),
|
||||||
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx),
|
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx),
|
||||||
|
@ -2191,7 +2183,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
MRecentItem.touchUpdatedRecord(ctx, adTabbox.getSelectedGridTab().getAD_Table_ID(),
|
MRecentItem.touchUpdatedRecord(ctx, adTabbox.getSelectedGridTab().getAD_Table_ID(),
|
||||||
adTabbox.getSelectedGridTab().getRecord_ID(), Env.getAD_User_ID(ctx));
|
adTabbox.getSelectedGridTab().getRecord_ID(), Env.getAD_User_ID(ctx));
|
||||||
} else {
|
} else {
|
||||||
GridTab mainTab = gridWindow.getTab(0);
|
GridTab mainTab = getMainTabAbove();
|
||||||
if (mainTab != null) {
|
if (mainTab != null) {
|
||||||
MRecentItem.touchUpdatedRecord(ctx, mainTab.getAD_Table_ID(),
|
MRecentItem.touchUpdatedRecord(ctx, mainTab.getAD_Table_ID(),
|
||||||
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx));
|
mainTab.getRecord_ID(), Env.getAD_User_ID(ctx));
|
||||||
|
@ -2209,6 +2201,18 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
callback.onCallback(true);
|
callback.onCallback(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GridTab getMainTabAbove() {
|
||||||
|
/* when a detail record is modified add header to recent items */
|
||||||
|
GridTab mainTab = adTabbox.getSelectedGridTab(); // find parent tab (IDEMPIERE-2125 - tbayen)
|
||||||
|
while (mainTab != null && mainTab.getTabLevel() > 0) {
|
||||||
|
GridTab parentTab = mainTab.getParentTab();
|
||||||
|
if (parentTab == mainTab)
|
||||||
|
break;
|
||||||
|
mainTab = parentTab;
|
||||||
|
}
|
||||||
|
return mainTab;
|
||||||
|
}
|
||||||
|
|
||||||
private void showLastError() {
|
private void showLastError() {
|
||||||
String msg = CLogger.retrieveErrorString(null);
|
String msg = CLogger.retrieveErrorString(null);
|
||||||
if (msg != null)
|
if (msg != null)
|
||||||
|
|
Loading…
Reference in New Issue