sys: HideUncreateFieldOnNewform

This commit is contained in:
devezhao-mbp 2020-07-19 01:53:13 +08:00
parent 09e1148b35
commit b7e76d3b41
2 changed files with 7 additions and 4 deletions

View file

@ -21,6 +21,8 @@ import com.rebuild.server.business.approval.ApprovalState;
import com.rebuild.server.configuration.ConfigEntry; import com.rebuild.server.configuration.ConfigEntry;
import com.rebuild.server.configuration.RobotApprovalManager; import com.rebuild.server.configuration.RobotApprovalManager;
import com.rebuild.server.configuration.RobotTriggerManager; 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.cache.NoRecordFoundException;
import com.rebuild.server.helper.fieldvalue.FieldValueWrapper; import com.rebuild.server.helper.fieldvalue.FieldValueWrapper;
import com.rebuild.server.helper.state.StateManager; import com.rebuild.server.helper.state.StateManager;
@ -60,9 +62,6 @@ public class FormsBuilder extends FormsManager {
// 引用记录 // 引用记录
public static final String DV_REFERENCE_PREFIX = "&"; 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) { public void buildModelElements(JSONArray elements, Entity entity, Record data, ID user) {
final User currentUser = Application.getUserStore().getUser(user); final User currentUser = Application.getUserStore().getUser(user);
final Date now = CalendarUtils.now(); final Date now = CalendarUtils.now();
final boolean hideUncreate = SysConfiguration.getBool(ConfigurableItem.HideUncreateFieldOnNewform);
// Check and clean // Check and clean
for (Iterator<Object> iter = elements.iterator(); iter.hasNext(); ) { for (Iterator<Object> iter = elements.iterator(); iter.hasNext(); ) {
@ -283,7 +283,7 @@ public class FormsBuilder extends FormsManager {
} }
final Field fieldMeta = entity.getField(fieldName); final Field fieldMeta = entity.getField(fieldName);
if (HIDE_UNCREATABLE_ONNEW && data == null && !fieldMeta.isCreatable()) { if (hideUncreate && data == null && !fieldMeta.isCreatable()) {
iter.remove(); iter.remove();
continue; continue;
} }

View file

@ -45,6 +45,9 @@ public enum ConfigurableItem {
// 启用最近搜素 // 启用最近搜素
EnableRecentlyUsed(true), EnableRecentlyUsed(true),
// 新建表单不显示不可创建字段
HideUncreateFieldOnNewform(false),
// 开放注册 // 开放注册
OpenSignUp(true), OpenSignUp(true),
// 登录背景图 // 登录背景图