Skip to content

Commit

Permalink
Fix 3.5.6 (#713)
Browse files Browse the repository at this point in the history
* fix: v3.5.5/3.5.6 默认所有人可发起

* sync: v3.6 bugfix

* fix: 重复检查

* v3.5.6
  • Loading branch information
getrebuild committed Feb 5, 2024
1 parent d22881b commit d59326f
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion @rbv
Submodule @rbv updated from 5cd430 to 758474
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.rebuild</groupId>
<artifactId>rebuild</artifactId>
<version>3.5.5</version>
<version>3.5.6</version>
<name>rebuild</name>
<description>Building your business-systems freely!</description>
<url>https://getrebuild.com/</url>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rebuild/core/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public class Application implements ApplicationListener<ApplicationStartedEvent>
/**
* Rebuild Version
*/
public static final String VER = "3.5.5";
public static final String VER = "3.5.6";
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
public static final int BUILD = 3050510;
public static final int BUILD = 3050611;

static {
// Driver for DB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static Entity getEntity(String entityName) throws MissingMetaExcetion {
try {
return getMetadataFactory().getEntity(entityName);
} catch (MissingMetaExcetion ex) {
throw new MissingMetaExcetion(Language.L("实体 [%s] 已经不存在,请检查配置", entityName.toUpperCase()));
throw new MissingMetaExcetion(Language.L("实体 [%s] 已经不存在,请检查配置", StringUtils.upperCase(entityName)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,13 @@ public FlowDefinition[] getFlowDefinitions(ID recordId, ID user) {
// 发起人匹配
JSONArray users = root.getDataMap().getJSONArray("users");
if (users == null || users.isEmpty()) {
users = JSON.parseArray("['OWNS']");
// v3.5.5/3.5.6 默认所有人可发起
users = JSON.parseArray("['ALL']");
}

if (FlowNode.USER_ALL.equals(users.getString(0))
|| (FlowNode.USER_OWNS.equals(users.getString(0)) && owning.equals(user))
final String rootUser = users.getString(0);
if (FlowNode.USER_ALL.equals(rootUser)
|| (FlowNode.USER_OWNS.equals(rootUser) && owning.equals(user))
|| UserHelper.parseUsers(users, recordId).contains(user)) {

// 过滤条件
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,12 @@ record = record.getPrimary() == null ? create(record) : update(record);
}

/**
* 优先使用 `#createOrUpdate(Record) `
* 优先使用 `#createOrUpdate`。直接使用此方法请注意调用重复检查 `#getAndCheckRepeated`
*
* @param record
* @return
* @see #createOrUpdate(Record)
* @see #getAndCheckRepeated(Record, int)
*/
@Override
public Record create(Record record) {
Expand All @@ -226,7 +231,12 @@ public Record create(Record record) {
}

/**
* 优先使用 `#createOrUpdate(Record) `
* 优先使用 `#createOrUpdate`。直接使用此方法请注意调用重复检查 `#getAndCheckRepeated`
*
* @param record
* @return
* @see #createOrUpdate(Record)
* @see #getAndCheckRepeated(Record, int)
*/
@Override
public Record update(Record record) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected void executeJob() {
// 相关引用也在此时一并删除,因为记录已经彻底删除
// Field: recordId
String[] refs = new String[] {
"Attachment", "ShareAccess", "RobotApprovalStep", "NreferenceItem"
"Attachment", "ShareAccess", "RobotApprovalStep", "NreferenceItem", "TagItem"
};
for (String refName : refs) {
Entity refEntity = MetadataHelper.getEntity(refName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
import cn.devezhao.persist4j.Record;
import cn.devezhao.persist4j.engine.StandardRecord;
import cn.devezhao.persist4j.record.JsonRecordCreator;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.rebuild.core.metadata.easymeta.DisplayType;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;

Expand Down Expand Up @@ -46,6 +49,18 @@ public Record create(boolean ignoreNullValueWhenNew) {
continue;
}

// fix: v3.5.6/v3.6
DisplayType dt = EasyMetaFactory.getDisplayType(entity.getField(fileName));
if (dt == DisplayType.N2NREFERENCE || dt == DisplayType.TAG) {
// 只需保留一个作为标志,因为 NreferenceItem/TagItem 中并未删除
try {
JSONArray valueArray = (JSONArray) value;
value = valueArray.get(0);
} catch (Exception ignored) {
continue;
}
}

setFieldValue(entity.getField(fileName), value.toString(), record);
}
return record;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/web/assets/js/metadata/field-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ const _loadRefsLabel = function ($dv, $dvClear) {
$dv.attr('data-value-id', CURRENT_BIZZ)
$dvClear && $dvClear.removeClass('hide')
} else if (dvid) {
$.get(`/commons/search/read-labels?ids=${encodeURIComponent(dvid)}&ignoreMiss=true`, (res) => {
$.get(`/commons/search/read-labels?ids=${encodeURIComponent(dvid)}&ignoreMiss=false`, (res) => {
if (res.data) {
const ids = []
const labels = []
Expand Down

0 comments on commit d59326f

Please sign in to comment.