BUg550 再テスト後、文字列フィールド以外に、変数nullを挿入しようとした場合のエラーメッセージ修正 、Bug540 再テスト後、保存成功時に変数の値が挿入されないのを修正

This commit is contained in:
Moriyukina2
2024-07-31 11:17:04 +09:00
parent c50e84a01f
commit 48d2d9c473

View File

@@ -75,10 +75,12 @@ export class InsertValueAction implements IAction{
checkVariableValueBlank(fieldType :string | undefined,inputValueArray :any,fieldCode :string,fieldRequired :boolean | undefined,event :any): boolean{
let blankCheck;
if(inputValueArray === null && fieldType !== "SINGLE_LINE_TEXT" && fieldType !== "MULTI_LINE_TEXT" && fieldType !== "RICH_TEXT" && fieldType !== "LINK"){
//正規表現チェック
for(let i =0;i<inputValueArray.length;i++){
blankCheck = inputValueArray[i].match(/^(\s| )*$/);//空文字・半角スペース・タブ文字・改行・改ページ・全角スペース
}
}
if(blankCheck !== null){
//空白文字を空白文字が非対応のフィールドに挿入しようとしている場合、例外を発生させる
@@ -349,7 +351,6 @@ export class InsertValueAction implements IAction{
//ユーザー選択フィールドに挿入時、ユーザーオブジェクトのcodeを代入する
if(fieldType.includes('USER_SELECT')){
//変数の値取得
// variableValue = getContextVarByPath(context.variables,inputValue);
if(!Array.isArray(objectValue)){
variableValue.push(objectValue.code);
}else{
@@ -475,7 +476,6 @@ export class InsertValueAction implements IAction{
const getContextVarByPath = (obj: any, path: string) => {
return path.split(".").reduce((o, k) => (o || {})[k], obj);
};
//オブジェクト変数で、値の指定がある場合は、変数名のみ取得
var variablesName = fieldValue.substr(0, fieldValue.indexOf('.'));
if(variablesName){
@@ -486,6 +486,12 @@ export class InsertValueAction implements IAction{
objectValue = getContextVarByPath(context.variables,fieldValue)
}
//文字列型のフィールド以外に、空白文字の変数の値を挿入する場合、エラーを出す
if(fieldType !== "SINGLE_LINE_TEXT" && fieldType !== "MULTI_LINE_TEXT" && fieldType !== "RICH_TEXT" && fieldType !== "LINK"
&& objectValue === null){
throw new Error("「"+fieldCode+"」"+"フィールドに挿入しようとした変数は、値がnullのため、処理を中断しました。");
}
//オブジェクト変数の場合、プロパティを取得し、何のオブジェクト変数か判断する
if(objectValue !== null && typeof objectValue === 'object'){
let objectProperties=[]
@@ -510,8 +516,8 @@ export class InsertValueAction implements IAction{
fieldValueArray[0] = variableValue;
}
//変数がfieldValueArrayに代入できなかった場合、エラーを出す
if(objectValue === undefined && fieldValueArray === undefined){
//変数がfieldValueArrayに代入できなかった場合、エラーを出す
if(fieldValueArray === undefined){
throw new Error("「"+fieldCode+"」"+"フィールドに入れようとした変数は、無効な入力形式です。");
}
@@ -656,7 +662,13 @@ export class InsertValueAction implements IAction{
}
//kintone async/await による非同期処理(レコード更新)
if(correctFormattedValue){
await updateRecord(fieldCode,event,correctFormattedValue);
//条件式の結果がtureかつ、値を正しい形式配列に変換できた場合、フィールドに値配列をセットする
}else if(correctValues.length > 0){
await updateRecord(fieldCode,event,correctValues);
}
// await updateRecord(fieldCode,event,correctFormattedValue);
};
result= {