Fix 2.9.6 (#496)

* 2.9.6

* fix: syn: https://github.com/getrebuild/rebuild/pull/493/files#diff-8eced977fb292ae09a71a824079b4f5c4fce631e39c6c7508c447f73c8825244

* fix: Autp approval

* fix: Field hasError
This commit is contained in:
RB 2022-07-31 15:12:08 +08:00 committed by GitHub
parent f199fd182a
commit ed12e0ca81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 15 deletions

View file

@ -10,7 +10,7 @@
</parent>
<groupId>com.rebuild</groupId>
<artifactId>rebuild</artifactId>
<version>2.9.5</version>
<version>2.9.6</version>
<name>rebuild</name>
<description>Building your business-systems freely!</description>
<!-- UNCOMMENT USE TOMCAT -->

View file

@ -65,11 +65,11 @@ public class Application implements ApplicationListener<ApplicationStartedEvent>
/**
* Rebuild Version
*/
public static final String VER = "2.9.5";
public static final String VER = "2.9.6";
/**
* Rebuild Build [MAJOR]{1}[MINOR]{2}[PATCH]{2}[BUILD]{2}
*/
public static final int BUILD = 2090515;
public static final int BUILD = 2090616;
static {
// Driver for DB

View file

@ -402,6 +402,9 @@ public class ApprovalStepService extends InternalPersistService {
if (useApprover == null) useApprover = UserService.SYSTEM_USER;
if (useApproval == null) useApproval = APPROVAL_NOID;
// 作废之前
cancelAliveSteps(recordId, null, null, null, false);
ID stepId = createStepIfNeed(recordId, useApproval,
FlowNode.NODE_AUTOAPPROVAL, useApprover, false, FlowNode.NODE_ROOT);
Record step = EntityHelper.forUpdate(stepId, useApprover, false);

View file

@ -50,10 +50,8 @@ public class AttachmentAwareObserver extends OperatingObserver {
List<Record> creates = new ArrayList<>();
for (Field field : fileFields) {
if (record.hasValue(field.getName(), false)) {
Object value = record.getObjectValue(field.getName());
JSONArray filesJson = value instanceof JSON ? (JSONArray) value : parseFilesJson(value.toString());
for (Object file : filesJson) {
JSONArray files = parseFilesJson(record.getObjectValue(field.getName()));
for (Object file : files) {
Record add = createAttachment(
field, context.getAfterRecord().getPrimary(), (String) file, context.getOperator());
creates.add(add);
@ -78,8 +76,8 @@ public class AttachmentAwareObserver extends OperatingObserver {
for (Field field : fileFields) {
String fieldName = field.getName();
if (record.hasValue(fieldName)) {
JSONArray beforeFiles = parseFilesJson(before.getString(fieldName)); // 修改前
JSONArray afterFiles = parseFilesJson(record.getString(fieldName)); // 修改后
JSONArray beforeFiles = parseFilesJson(before.getObjectValue(fieldName)); // 修改前
JSONArray afterFiles = parseFilesJson(record.getObjectValue(fieldName)); // 修改后
for (Iterator<Object> iter = afterFiles.iterator(); iter.hasNext(); ) {
Object a = iter.next();
@ -150,11 +148,10 @@ public class AttachmentAwareObserver extends OperatingObserver {
updates.toArray(new Record[0]), deletes.toArray(new ID[0]), false);
}
private JSONArray parseFilesJson(String files) {
if (StringUtils.isBlank(files)) {
return JSONUtils.EMPTY_ARRAY;
}
return JSON.parseArray(files);
private JSONArray parseFilesJson(Object files) {
if (files instanceof JSON) return (JSONArray) files;
else if (files == null || StringUtils.isBlank(files.toString())) return JSONUtils.EMPTY_ARRAY;
else return JSON.parseArray(files.toString());
}
private Record createAttachment(Field field, ID recordId, String filePath, ID user) {

View file

@ -576,13 +576,13 @@ class RbFormElement extends React.Component {
*/
checkValue() {
const err = this.isValueError()
this.setState({ hasError: err || null })
const errMsg = err ? this.props.label + err : null
if (this.isValueUnchanged() && !this.props.$$$parent.isNew) {
if (err) this.props.$$$parent.setFieldValue(this.props.field, this.state.value, errMsg)
else this.props.$$$parent.setFieldUnchanged(this.props.field, this.state.value)
} else {
this.setState({ hasError: err })
this.props.$$$parent.setFieldValue(this.props.field, this.state.value, errMsg)
}
}