mirror of
https://github.com/getrebuild/rebuild.git
synced 2024-11-11 01:14:42 +08:00
sys: HideUncreateFieldOnNewform
This commit is contained in:
parent
09e1148b35
commit
b7e76d3b41
2 changed files with 7 additions and 4 deletions
|
@ -21,6 +21,8 @@ import com.rebuild.server.business.approval.ApprovalState;
|
|||
import com.rebuild.server.configuration.ConfigEntry;
|
||||
import com.rebuild.server.configuration.RobotApprovalManager;
|
||||
import com.rebuild.server.configuration.RobotTriggerManager;
|
||||
import com.rebuild.server.helper.ConfigurableItem;
|
||||
import com.rebuild.server.helper.SysConfiguration;
|
||||
import com.rebuild.server.helper.cache.NoRecordFoundException;
|
||||
import com.rebuild.server.helper.fieldvalue.FieldValueWrapper;
|
||||
import com.rebuild.server.helper.state.StateManager;
|
||||
|
@ -60,9 +62,6 @@ public class FormsBuilder extends FormsManager {
|
|||
// 引用记录
|
||||
public static final String DV_REFERENCE_PREFIX = "&";
|
||||
|
||||
// 新建时不显示不可创建字段
|
||||
private static final boolean HIDE_UNCREATABLE_ONNEW = false;
|
||||
|
||||
/**
|
||||
* 表单-新建
|
||||
*
|
||||
|
@ -268,6 +267,7 @@ public class FormsBuilder extends FormsManager {
|
|||
public void buildModelElements(JSONArray elements, Entity entity, Record data, ID user) {
|
||||
final User currentUser = Application.getUserStore().getUser(user);
|
||||
final Date now = CalendarUtils.now();
|
||||
final boolean hideUncreate = SysConfiguration.getBool(ConfigurableItem.HideUncreateFieldOnNewform);
|
||||
|
||||
// Check and clean
|
||||
for (Iterator<Object> iter = elements.iterator(); iter.hasNext(); ) {
|
||||
|
@ -283,7 +283,7 @@ public class FormsBuilder extends FormsManager {
|
|||
}
|
||||
|
||||
final Field fieldMeta = entity.getField(fieldName);
|
||||
if (HIDE_UNCREATABLE_ONNEW && data == null && !fieldMeta.isCreatable()) {
|
||||
if (hideUncreate && data == null && !fieldMeta.isCreatable()) {
|
||||
iter.remove();
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -45,6 +45,9 @@ public enum ConfigurableItem {
|
|||
// 启用最近搜素
|
||||
EnableRecentlyUsed(true),
|
||||
|
||||
// 新建表单不显示不可创建字段
|
||||
HideUncreateFieldOnNewform(false),
|
||||
|
||||
// 开放注册
|
||||
OpenSignUp(true),
|
||||
// 登录背景图
|
||||
|
|
Loading…
Reference in a new issue