IDEMPIERE-5865 : Cannot Update Always Updatable checked column via Web Service (#2025)

* IDEMPIERE-5865 : Cannot Update Always Updatable checked column via Web Service

* IDEMPIERE-5865 : Cannot Update Always Updatable checked column via Web Service #2
This commit is contained in:
Zuhri Utama 2023-10-12 16:11:09 +07:00 committed by GitHub
parent b01dbc2f11
commit 793ffe6aef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 12 deletions

View File

@ -1008,12 +1008,6 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
if (po == null) if (po == null)
return rollbackAndSetError(trx, resp, ret, true, "Cannot create PO for " + tableName); return rollbackAndSetError(trx, resp, ret, true, "Cannot create PO for " + tableName);
if (po.get_ColumnIndex("Processed") >= 0 && po.get_ValueAsBoolean("Processed")) {
resp.setError("Record not updatable for " + table.getTableName() + "_ID = " + record_id);
resp.setIsError(true);
return ret;
}
// Setting value back from holder to new persistent po // Setting value back from holder to new persistent po
for (DataField field : fields) { for (DataField field : fields) {
int indx = poinfo.getColumnIndex(field.getColumn()); int indx = poinfo.getColumnIndex(field.getColumn());
@ -1186,6 +1180,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
//Clear ctx //Clear ctx
Env.clearWinContext(Env.getCtx(),0); Env.clearWinContext(Env.getCtx(),0);
boolean isProcessed = po.get_ColumnIndex("Processed")>=0 && po.get_ValueAsBoolean("Processed");
for (DataField field : fields) { for (DataField field : fields) {
// Implement lookup // Implement lookup
X_WS_WebServiceFieldInput fieldInput = m_webservicetype.getFieldInput(field.getColumn()); X_WS_WebServiceFieldInput fieldInput = m_webservicetype.getFieldInput(field.getColumn());
@ -1213,6 +1209,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
+ ": input column " + field.getColumn() + " does not exist"); + ": input column " + field.getColumn() + " does not exist");
} else { } else {
try { try {
if(!MColumn.get(fieldInput.getAD_Column_ID()).isAlwaysUpdateable() && isProcessed)
throw new IdempiereServiceFault("Document Processed", new QName("ProcessedDocument"));
setValueAccordingToClass(po, poinfo, field, idxcol,fieldInput); setValueAccordingToClass(po, poinfo, field, idxcol,fieldInput);
} catch (IdempiereServiceFault e) { } catch (IdempiereServiceFault e) {
log.log(Level.WARNING, "Error setting value", e); log.log(Level.WARNING, "Error setting value", e);
@ -1289,12 +1288,6 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
return rollbackAndSetError(trx, resp, ret, true, "No Record " + recordID + " in " + tableName); return rollbackAndSetError(trx, resp, ret, true, "No Record " + recordID + " in " + tableName);
POInfo poinfo = POInfo.getPOInfo(ctx, table.getAD_Table_ID()); POInfo poinfo = POInfo.getPOInfo(ctx, table.getAD_Table_ID());
if(po.get_ColumnIndex("Processed")>=0 && po.get_ValueAsBoolean("Processed")){
resp.setError("Record is processed and can not be updated");
resp.setIsError(true);
return ret;
}
DataRow dr = modelCRUD.getDataRow(); DataRow dr = modelCRUD.getDataRow();
StandardResponseDocument retResp = scanFields(dr.getFieldArray(), m_webservicetype, po, poinfo, trx, resp, ret); StandardResponseDocument retResp = scanFields(dr.getFieldArray(), m_webservicetype, po, poinfo, trx, resp, ret);