IDEMPIERE-382 Prevent users to go to detail tabs if link fields are not filled / fix problem with zero ID tables
This commit is contained in:
parent
1ab3ea6f00
commit
8de7da2ea5
|
@ -26,6 +26,7 @@ import org.compiere.apps.ADialog;
|
|||
import org.compiere.apps.APanel;
|
||||
import org.compiere.model.DataStatusEvent;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.swing.CTabbedPane;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
|
@ -272,14 +273,15 @@ public class VTabbedPane extends CTabbedPane
|
|||
if (oldC != null && oldC instanceof GridController)
|
||||
{
|
||||
GridController oldGC = (GridController)oldC;
|
||||
int zeroValid = (MTable.isZeroIDTable(oldGC.getMTab().getTableName()) ? 1 : 0);
|
||||
if ((newGC.getTabLevel() > oldGC.getTabLevel()+1)
|
||||
|| (newGC.getTabLevel() > oldGC.getTabLevel() && oldGC.getMTab().getRecord_ID() <=0)) // TabLevel increase and parent ID <=0 IDEMPIERE 382
|
||||
|| (newGC.getTabLevel() > oldGC.getTabLevel() && oldGC.getMTab().getRecord_ID()+zeroValid <=0)) // TabLevel increase and parent ID <=0 IDEMPIERE 382
|
||||
{
|
||||
// validate
|
||||
// Search for right tab
|
||||
GridController rightGC = null;
|
||||
//boolean canJump = true;
|
||||
boolean canJump = oldGC.getMTab().getRecord_ID() <=0 ? false : true; // IDEMPIERE 382
|
||||
boolean canJump = oldGC.getMTab().getRecord_ID()+zeroValid <=0 ? false : true; // IDEMPIERE 382
|
||||
int currentLevel = newGC.getTabLevel();
|
||||
for (int i = index-1; i >=0; i--)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.adempiere.webui.part.AbstractUIPart;
|
|||
import org.compiere.model.DataStatusEvent;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Evaluator;
|
||||
|
@ -242,11 +243,14 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab
|
|||
currentLevel = tabPanel.getTabLevel();
|
||||
}
|
||||
}
|
||||
if (canJump && checkRecordID && oldTabpanel.getRecord_ID() <= 0)
|
||||
if (canJump && checkRecordID ) {
|
||||
int zeroValid = (MTable.isZeroIDTable(oldTabpanel.getTableName()) ? 1 : 0);
|
||||
if (oldTabpanel.getRecord_ID() + zeroValid <= 0)
|
||||
canJump = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return canJump;
|
||||
}
|
||||
|
||||
|
|
|
@ -870,6 +870,11 @@ public class ADSortTab extends Panel implements IADTabpanel
|
|||
return gridTab.getTabLevel();
|
||||
}
|
||||
|
||||
public String getTableName()
|
||||
{
|
||||
return gridTab.getTableName();
|
||||
}
|
||||
|
||||
public int getRecord_ID() {
|
||||
return gridTab.getRecord_ID();
|
||||
}
|
||||
|
|
|
@ -670,6 +670,14 @@ DataStatusListener, IADTabpanel
|
|||
return gridTab.getTabLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The tablename of this Tabpanel
|
||||
*/
|
||||
public String getTableName()
|
||||
{
|
||||
return gridTab.getTableName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The record ID of this Tabpanel
|
||||
*/
|
||||
|
|
|
@ -33,6 +33,11 @@ public interface IADTabpanel extends Component, Evaluatee {
|
|||
*/
|
||||
public int getTabLevel();
|
||||
|
||||
/**
|
||||
* @return tablename
|
||||
*/
|
||||
public String getTableName();
|
||||
|
||||
/**
|
||||
* @return record ID
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue