IDEMPIERE-3979 Record Access Exlude problem
This commit is contained in:
parent
ccf591b89b
commit
05da94ddf1
|
@ -110,7 +110,10 @@ public class GridField
|
||||||
* GridTab.processDependentFields will check this flag to avoid clearing of lookup field value that just have been set.
|
* GridTab.processDependentFields will check this flag to avoid clearing of lookup field value that just have been set.
|
||||||
**/
|
**/
|
||||||
private boolean m_lookupEditorSettingValue = false;
|
private boolean m_lookupEditorSettingValue = false;
|
||||||
|
private boolean m_lockedrecord=false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispose
|
* Dispose
|
||||||
*/
|
*/
|
||||||
|
@ -444,6 +447,8 @@ public class GridField
|
||||||
{
|
{
|
||||||
if (isVirtualColumn())
|
if (isVirtualColumn())
|
||||||
return false;
|
return false;
|
||||||
|
if (m_lockedrecord)
|
||||||
|
return false;
|
||||||
// Fields always enabled (are usually not updateable)
|
// Fields always enabled (are usually not updateable)
|
||||||
if (m_vo.ColumnName.equals("Posted")
|
if (m_vo.ColumnName.equals("Posted")
|
||||||
|| (m_vo.ColumnName.equals("Record_ID") && m_vo.displayType == DisplayType.Button)) // Zoom
|
|| (m_vo.ColumnName.equals("Record_ID") && m_vo.displayType == DisplayType.Button)) // Zoom
|
||||||
|
@ -2507,6 +2512,13 @@ public class GridField
|
||||||
return m_vo.displayType == DisplayType.Button && MColumn.ISTOOLBARBUTTON_Toolbar.equals(m_vo.IsToolbarButton);
|
return m_vo.displayType == DisplayType.Button && MColumn.ISTOOLBARBUTTON_Toolbar.equals(m_vo.IsToolbarButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean islockedrecord() {
|
||||||
|
return m_lockedrecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setlockedrecord(boolean m_lockedrecord) {
|
||||||
|
this.m_lockedrecord = m_lockedrecord;
|
||||||
|
}
|
||||||
public int getPA_DashboardContent_ID()
|
public int getPA_DashboardContent_ID()
|
||||||
{
|
{
|
||||||
return m_vo.PA_DashboardContent_ID;
|
return m_vo.PA_DashboardContent_ID;
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.compiere.model.Lookup;
|
||||||
import org.compiere.model.MBPartnerLocation;
|
import org.compiere.model.MBPartnerLocation;
|
||||||
import org.compiere.model.MLocation;
|
import org.compiere.model.MLocation;
|
||||||
import org.compiere.model.MLookup;
|
import org.compiere.model.MLookup;
|
||||||
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.util.CCache;
|
import org.compiere.util.CCache;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
@ -313,24 +314,38 @@ ContextMenuListener, IZoomableEditor
|
||||||
refreshList();
|
refreshList();
|
||||||
}
|
}
|
||||||
|
|
||||||
//still not in list, reset to zero
|
//still not in list, reset to zero
|
||||||
if (!getComponent().isSelected(value))
|
if (!getComponent().isSelected(value))
|
||||||
{
|
{
|
||||||
if (value instanceof Integer && gridField != null && gridField.getDisplayType() != DisplayType.ID &&
|
if (value instanceof Integer && gridField != null && gridField.getDisplayType() != DisplayType.ID &&
|
||||||
(gridTab==null || !gridTab.getTableModel().isImporting())) // for IDs is ok to be out of the list
|
(gridTab==null || !gridTab.getTableModel().isImporting())) // for IDs is ok to be out of the list
|
||||||
{
|
{
|
||||||
getComponent().setValue(null);
|
//if it is problem with record lock, just keep value (no trigger change) and set field readonly
|
||||||
if (curValue == null)
|
MRole role = MRole.getDefault(Env.getCtx(), false);
|
||||||
curValue = value;
|
if (role.isRecordAccess(gridTab.getAD_Table_ID() ,(int)value,false)){
|
||||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), curValue, null);
|
oldValue = value;
|
||||||
super.fireValueChange(changeEvent);
|
setReadWrite(false);
|
||||||
oldValue = null;
|
gridField.setlockedrecord(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getComponent().setValue(null);
|
||||||
|
if (curValue == null)
|
||||||
|
curValue = value;
|
||||||
|
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), curValue, null);
|
||||||
|
super.fireValueChange(changeEvent);
|
||||||
|
oldValue = null;
|
||||||
|
if (gridField!=null)
|
||||||
|
gridField.setlockedrecord(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oldValue = value;
|
oldValue = value;
|
||||||
|
if (gridField!=null)
|
||||||
|
gridField.setlockedrecord(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue