Commit 6011e998 authored by Ajit Deshmukh's avatar Ajit Deshmukh

Updated the components for the Remark field configuration

parent 40d197c8
......@@ -47,18 +47,23 @@ public class ManageSQLSubmit extends ActionHandlerEJB {
conn = connDriver.getConnectDB(userInfo.getTransDB());
String ExecutiveApproval = "";
String ExecutionRights = "";
String wfStatus = "";
String checkExecAprvVal = "select exec_aprv, exec_rights from sql_changes where tran_id = ?";
String checkExecAprvVal = "select exec_aprv, exec_rights, wf_status from sql_changes where tran_id = ?";
PreparedStatement checkExecAprvValPs = conn.prepareStatement(checkExecAprvVal);
checkExecAprvValPs.setString(1, tranID);
ResultSet checkExecAprvValRs = checkExecAprvValPs.executeQuery();
while (checkExecAprvValRs.next()) {
ExecutiveApproval = checkNull(checkExecAprvValRs.getString("exec_aprv"));
ExecutionRights = checkNull(checkExecAprvValRs.getString("exec_rights"));
wfStatus = checkNull(checkExecAprvValRs.getString("wf_status"));
}
BaseLogger.log("3", null, null, "ManageSQLSubmit exec_aprv:: " + ExecutiveApproval);
BaseLogger.log("3", null, null, "ManageSQLSubmit exec_rights:: " + ExecutionRights);
BaseLogger.log("3", null, null, "ManageSQLSubmit wfStatus:: " + wfStatus);
if (checkExecAprvValPs != null) {
checkExecAprvValPs.close();
......@@ -69,6 +74,11 @@ public class ManageSQLSubmit extends ActionHandlerEJB {
checkExecAprvValRs = null;
}
if(wfStatus.trim().equalsIgnoreCase("S") || wfStatus.trim().equalsIgnoreCase("A")){
BaseLogger.log("3", null, null, "Transaction already submitted....");
return itmDBAccessEJB.getErrorString("", "VTCAN127", "", "", conn);
}
if(ExecutionRights.trim().equalsIgnoreCase("A") || ExecutionRights.trim().equalsIgnoreCase("P") || ExecutionRights.trim().equalsIgnoreCase("C") || ExecutionRights.trim().equalsIgnoreCase("Q")){
BaseLogger.log("3", null, null, "For Execution Rights A, P, C and Q can not be submit....");
return itmDBAccessEJB.getErrorString("", "MSQLNS", "", "", conn);
......@@ -113,7 +123,7 @@ public class ManageSQLSubmit extends ActionHandlerEJB {
}
public boolean updateSubmittedBy(UserInfoBean userInfo, String tranID, Connection conn) {
String updateSQL = "UPDATE SQL_CHANGES SET EMP_CODE__GIVEN = ? WHERE TRAN_ID = ?";
String updateSQL = "UPDATE SQL_CHANGES SET EMP_CODE__GIVEN = ?, WF_STATUS = 'S' WHERE TRAN_ID = ?";
try (
PreparedStatement psmt = conn.prepareStatement(updateSQL);) {
......
......@@ -8,6 +8,7 @@ import java.sql.Statement;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.w3c.dom.Element;
import ibase.system.config.ConnDriver;
import ibase.webitm.ejb.ITMDBAccessEJB;
......@@ -552,18 +553,94 @@ public class ManageSql extends ValidatorEJB {
else if ("itm_defaultedit".equalsIgnoreCase(currentColumn))
{
String applDB = checkNull(genericUtility.getColumnValue("appl_db", dom));
String wfStatus = checkNull(genericUtility.getColumnValue("wf_status", dom));
String selEnterprises = checkNull(genericUtility.getColumnValue("enterprises", dom));
String empgName = "";
String deptCode = "";
BaseLogger.log("3", null, null, "wfStatus>>>"+ wfStatus);
if (applDB.equalsIgnoreCase("E"))
{
valueXmlString.append("<enterprises protect='1'>").append("<![CDATA[" + selEnterprises + "]]>").append("</enterprises>");
// ✅ APPLY ONLY WHEN WF_STATUS = A
if(wfStatus != null && wfStatus.trim().equalsIgnoreCase("A")) {
BaseLogger.log("3", getUserInfo(), null,
"wfStatus is A (Workflow approved). Applying protect flag.");
NodeList detailList = dom.getElementsByTagName("Detail1");
if (detailList != null && detailList.getLength() > 0) {
Element detailElem = (Element) detailList.item(0);
NodeList childNodes = detailElem.getChildNodes();
BaseLogger.log("3", getUserInfo(), null,
"Detail1 child count: " + childNodes.getLength());
for (int i = 0; i < childNodes.getLength(); i++) {
Node node = childNodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element) node;
String tagName = elem.getTagName();
// 🔹 Get value
String value = "";
if (elem.getFirstChild() != null) {
value = elem.getFirstChild().getNodeValue();
}
// 🔹 Handle null string
if (value == null || "null".equalsIgnoreCase(value)) {
value = "";
}
// 🔹 Append to valueXmlString (fixed)
valueXmlString.append("<")
.append(tagName)
.append(" protect=\"1\">")
.append("<![CDATA[")
.append(value.trim())
.append("]]>")
.append("</")
.append(tagName)
.append(">");
BaseLogger.log("3", getUserInfo(), null,
"Applied protect=1 and appended tag: " + tagName +
" value: " + value);
}
}
}
else {
BaseLogger.log("3", getUserInfo(), null, "Detail1 node NOT found in DOM");
}
}
else {
BaseLogger.log("3", getUserInfo(), null, "profileId:: "+profileId);
BaseLogger.log("3", getUserInfo(), null, "wfStatus:: "+wfStatus);
if(profileId.trim().equalsIgnoreCase("MSDEVTL") && !wfStatus.trim().equalsIgnoreCase("A")){
valueXmlString.append("<exec_aprv protect='0'>").append("<![CDATA["+execAprv+"]]>").append("</exec_aprv>\r\n");
}
else
{
valueXmlString.append("<enterprises protect='0'>").append("<![CDATA[" + selEnterprises + "]]>").append("</enterprises>");
else{
valueXmlString.append("<exec_aprv protect='1'>").append("<![CDATA["+execAprv+"]]>").append("</exec_aprv>\r\n");
}
BaseLogger.log("3", getUserInfo(), null,
"workflow not approved. Skipping protect. Status: " + wfStatus);
}
BaseLogger.log("3", getUserInfo(), null, "valueXmlString:: "+valueXmlString.toString());
// if (applDB.equalsIgnoreCase("E"))
// {
// valueXmlString.append("<enterprises protect='1'>").append("<![CDATA[" + selEnterprises + "]]>").append("</enterprises>");
// }
// else
// {
// valueXmlString.append("<enterprises protect='0'>").append("<![CDATA[" + selEnterprises + "]]>").append("</enterprises>");
// }
//changed by Ashish.J
valueXmlString.append("<emp_code__given>").append("<![CDATA[" + userId + "]]>").append("</emp_code__given>");
......@@ -620,12 +697,6 @@ public class ManageSql extends ValidatorEJB {
//changed by Ashish.J
if(profileId.trim().equalsIgnoreCase("MSDEVTL")){
valueXmlString.append("<exec_aprv protect='0'>").append("<![CDATA["+execAprv+"]]>").append("</exec_aprv>\r\n");
}
else{
valueXmlString.append("<exec_aprv protect='1'>").append("<![CDATA["+execAprv+"]]>").append("</exec_aprv>\r\n");
}
}
else if (currentColumn.trim().equalsIgnoreCase("req_id"))
{
......
......@@ -168,3 +168,34 @@ update user_rights set ACC_FILT = 'EXEC_RIGHTS IN (''C'', ''A'', ''Q'', ''P'')'
update user_rights set rights = 'QC', ACC_FILT = 'EXEC_RIGHTS IN (''C'', ''A'', ''Q'', ''P'')' where PROFILE_ID = 'MSQC';
update user_rights set rights = 'PEA', ACC_FILT = 'EXEC_RIGHTS IS NULL AND TRIM(EMP_CODE__MERGE) = ''<loginCode>''' where PROFILE_ID = 'MSDEV';
-----------4th MAY-----------------
update genmst set FLD_MIN = 'SELECT COUNT(1)
FROM sql_changes s
WHERE s.tran_id = ?
AND (
EXISTS (
SELECT 1 FROM USERS u
WHERE u.code = ?
AND (
(INSTR('','' || REGEXP_REPLACE(u.profile_id, ''\s+'', '''') || '','', '',MSDEV,'') > 0 AND s.exec_rights = ''D'')
OR (INSTR('','' || REGEXP_REPLACE(u.profile_id, ''\s+'', '''') || '','', '',MSQC,'') > 0 AND s.exec_rights in (''Q'',''C'',''P'',''A''))
OR (INSTR('','' || REGEXP_REPLACE(u.profile_id, ''\s+'', '''') || '','', '',MSADMIN,'') > 0 AND s.exec_rights = ''A'')
OR (INSTR('','' || REGEXP_REPLACE(u.profile_id, ''\s+'', '''') || '','', '',MSPILOT,'') > 0 AND s.exec_rights = ''P'')
)
)
OR EXISTS (
SELECT 1 FROM USER_SITE us
WHERE us.user_id = ?
AND us.site_code = ?
AND (
(INSTR('','' || REGEXP_REPLACE(us.profile_id, ''\s+'', '''') || '','', '',MSDEV,'') > 0 AND s.exec_rights = ''D'')
OR (INSTR('','' || REGEXP_REPLACE(us.profile_id, ''\s+'', '''') || '','', '',MSQC,'') > 0 AND s.exec_rights in (''Q'',''C'',''P'',''A''))
OR (INSTR('','' || REGEXP_REPLACE(us.profile_id, ''\s+'', '''') || '','', '',MSADMIN,'') > 0 AND s.exec_rights = ''A'')
OR (INSTR('','' || REGEXP_REPLACE(us.profile_id, ''\s+'', '''') || '','', '',MSPILOT,'') > 0 AND s.exec_rights = ''P'')
)
)
)' where error_cd = 'IV_PRRGTS';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment