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.
|
||||
**/
|
||||
private boolean m_lookupEditorSettingValue = false;
|
||||
private boolean m_lockedrecord=false;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Dispose
|
||||
*/
|
||||
|
@ -444,6 +447,8 @@ public class GridField
|
|||
{
|
||||
if (isVirtualColumn())
|
||||
return false;
|
||||
if (m_lockedrecord)
|
||||
return false;
|
||||
// Fields always enabled (are usually not updateable)
|
||||
if (m_vo.ColumnName.equals("Posted")
|
||||
|| (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);
|
||||
}
|
||||
|
||||
public boolean islockedrecord() {
|
||||
return m_lockedrecord;
|
||||
}
|
||||
|
||||
public void setlockedrecord(boolean m_lockedrecord) {
|
||||
this.m_lockedrecord = m_lockedrecord;
|
||||
}
|
||||
public int getPA_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.MLocation;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -313,24 +314,38 @@ ContextMenuListener, IZoomableEditor
|
|||
refreshList();
|
||||
}
|
||||
|
||||
//still not in list, reset to zero
|
||||
//still not in list, reset to zero
|
||||
if (!getComponent().isSelected(value))
|
||||
{
|
||||
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
|
||||
{
|
||||
getComponent().setValue(null);
|
||||
if (curValue == null)
|
||||
curValue = value;
|
||||
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), curValue, null);
|
||||
super.fireValueChange(changeEvent);
|
||||
oldValue = null;
|
||||
//if it is problem with record lock, just keep value (no trigger change) and set field readonly
|
||||
MRole role = MRole.getDefault(Env.getCtx(), false);
|
||||
if (role.isRecordAccess(gridTab.getAD_Table_ID() ,(int)value,false)){
|
||||
oldValue = value;
|
||||
setReadWrite(false);
|
||||
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
|
||||
{
|
||||
oldValue = value;
|
||||
if (gridField!=null)
|
||||
gridField.setlockedrecord(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue