Skip to content

Commit

Permalink
Fix 3.8.6 (#843)
Browse files Browse the repository at this point in the history
* fix: task-list

* fix: img in list

* fix: meta comp

* v3.8.6

* fix: dataimport fillinRecord

---------

Co-authored-by: RB <[email protected]>
  • Loading branch information
devezhao and getrebuild authored Dec 8, 2024
1 parent 557b06e commit 4281a27
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 23 deletions.
2 changes: 1 addition & 1 deletion @rbv
Submodule @rbv updated from 49ccf6 to 20b87f
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.8.5</version>
<version>3.8.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.8.5";
public static final String VER = "3.8.6";
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
public static final int BUILD = 3080510;
public static final int BUILD = 3080611;

static {
// Driver for DB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@ private void appendConfig4Db(Document config) {
.addAttribute("deletable", "true");

// 实体扩展配置
JSONObject extraAttrs;
if (StringUtils.isBlank((String) c[9])) {
extraAttrs = new JSONObject();
} else {
extraAttrs = JSON.parseObject((String) c[9]);
JSONObject extraAttrs = null;
if (JSONUtils.wellFormat((String) c[9])) {
try {
extraAttrs = JSON.parseObject((String) c[9]);
} catch (Exception ignored){}
}
if (extraAttrs == null) extraAttrs = new JSONObject();

extraAttrs.put("metaId", c[4]);
extraAttrs.put("comments", c[5]);
Expand Down Expand Up @@ -165,12 +166,13 @@ else if (dt == DisplayType.BARCODE) {
}

// 字段扩展配置
JSONObject extraAttrs;
JSONObject extraAttrs = null;
if (JSONUtils.wellFormat((String) c[14])) {
extraAttrs = JSON.parseObject((String) c[14]);
} else {
extraAttrs = new JSONObject();
try {
extraAttrs = JSON.parseObject((String) c[14]);
} catch (Exception ignored){}
}
if (extraAttrs == null) extraAttrs = new JSONObject();

extraAttrs.put("metaId", c[12]);
extraAttrs.put("comments", c[13]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import cn.devezhao.persist4j.engine.ID;
import cn.devezhao.persist4j.exception.JdbcException;
import com.rebuild.core.Application;
import com.rebuild.core.configuration.general.AutoFillinManager;
import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.metadata.EntityRecordCreator;
import com.rebuild.core.metadata.MetadataHelper;
Expand Down Expand Up @@ -193,6 +194,9 @@ protected Record checkoutRecord(Cell[] row, ID defaultOwning) {
}
}

// fix: 3.9 导入也生效
AutoFillinManager.instance.fillinRecord(checkout);

// Verify new record
// Throws DataSpecificationException
if (checkout.getPrimary() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,23 @@ protected Map<String, List<Map<String, Object>>> buildData() {

for (Map.Entry<String, String> e : varsMap.entrySet()) {
final String varName = e.getKey();
final String varNameNoAt = varName.replace(TemplateExtractor33.IMG_PREFIX, "");
final String fieldName = e.getValue();

String refKey = null;
if (varName.startsWith(NROW_PREFIX) || varName.startsWith(NROW_PREFIX2)) {
if (varName.startsWith(APPROVAL_PREFIX) || varName.startsWith(APPROVAL_PREFIX2)) {
refKey = varName.startsWith(NROW_PREFIX) ? APPROVAL_PREFIX : APPROVAL_PREFIX2;
} else if (varName.startsWith(DETAIL_PREFIX) || varName.startsWith(DETAIL_PREFIX2)) {
refKey = varName.startsWith(NROW_PREFIX) ? DETAIL_PREFIX : DETAIL_PREFIX2;
} else if (varNameNoAt.startsWith(DETAIL_PREFIX) || varNameNoAt.startsWith(DETAIL_PREFIX2)) {
refKey = varNameNoAt.startsWith(NROW_PREFIX) ? DETAIL_PREFIX : DETAIL_PREFIX2;
} else {
// 在客户中导出订单(下列 AccountId 为订单中引用客户的引用字段)
// .AccountId.SalesOrder.SalesOrderName or $AccountId$SalesOrder$SalesOrderName
String[] split = varName.substring(1).split("[.$]");
String[] split = varNameNoAt.substring(1).split("[.$]");
if (split.length < 2) throw new ReportsException("Bad REF (Miss .detail prefix?) : " + varName);

String refName2 = split[0] + split[1];
refKey = varName.substring(0, refName2.length() + 2 /* dots */);
refKey = varNameNoAt.substring(0, refName2.length() + 2 /* dots */);
}

Map<String, String> varsMapOfRef = varsMapOfRefs.getOrDefault(refKey, new HashMap<>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class TemplateExtractor33 extends TemplateExtractor {
// 排序
protected static final String SORT_ASC = ":asc";
protected static final String SORT_DESC = ":desc";
// H5,WORD 图片
public final static String IMG_PREFIX = "@";

private Map<String, String> sortFields = new HashMap<>();
private Set<String> inShapeVars = new HashSet<>();
Expand All @@ -66,10 +68,11 @@ public Map<String, String> transformVars(Entity entity) {
Map<String, String> map = new HashMap<>();
for (final String varName : vars) {
String thatName = ValueConvertFunc.splitName(varName);
String thatNameNoAt = thatName.replace(IMG_PREFIX, "");

// 列表型字段
if (thatName.startsWith(NROW_PREFIX) || thatName.startsWith(NROW_PREFIX2)) {
final String listField = thatName.substring(1).replace("$", ".");
final String listField = thatNameNoAt.substring(1).replace("$", ".");

// 占位
if (isPlaceholder(listField)) {
Expand All @@ -85,7 +88,7 @@ else if (thatName.startsWith(APPROVAL_PREFIX) || thatName.startsWith(APPROVAL_PR
}
}
// 明细实体
else if (thatName.startsWith(DETAIL_PREFIX) || thatName.startsWith(DETAIL_PREFIX2)) {
else if (thatNameNoAt.startsWith(DETAIL_PREFIX) || thatNameNoAt.startsWith(DETAIL_PREFIX2)) {
String detailField = listField.substring(DETAIL_PREFIX.length());
detailField = getFieldNameWithSort(DETAIL_PREFIX, detailField);

Expand All @@ -97,9 +100,9 @@ else if (thatName.startsWith(DETAIL_PREFIX) || thatName.startsWith(DETAIL_PREFIX
}
// REF
else {
String[] split = listField.split("\\.");
String ref2Field = split[0];
String ref2Entity = split.length > 1 ? split[1] : null;
String[] refSplit = listField.split("\\.");
String ref2Field = refSplit[0];
String ref2Entity = refSplit.length > 1 ? refSplit[1] : null;
Field ref2FieldMeta = ref2Entity != null && MetadataHelper.containsField(ref2Entity, ref2Field)
? MetadataHelper.getField(ref2Entity, ref2Field) : null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ private String buildCustomPlanSql(String planKey, ID projectId) {
return baseSql + String.format("modifiedOn < '%s'", dtf.format(CalendarUtils.addDay(-14)));
}
} else if (planKey.equals("0-0")) {
return "1=1";
// 列表视图
return "projectId = '" + projectId + "'";
}

throw new InvalidParameterException(Language.L("无效请求参数 (%s=%s)", "id", planKey));
Expand Down

0 comments on commit 4281a27

Please sign in to comment.