Commit 669bfd88 authored by manohar's avatar manohar

MF89SUN092 various bug fixing


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91616 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4e3ff97b
......@@ -504,11 +504,11 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
}
if(stklotNo == null)
{
stklotNo = "";
stklotNo = " ";
}
if(stklotSl == null)
{
stklotSl = "";
stklotSl = " ";
}
if(stkquantity == null)
{
......@@ -531,10 +531,10 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
if (Double.parseDouble(balanceQty) > 0)
{
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<item_code>").append("<![CDATA[").append(stkItemCode.trim()).append("]]>").append("</item_code>\r\n");
valueXmlString.append("<loc_code>").append("<![CDATA[").append(stkLocCode.trim()).append("]]>").append("</loc_code>\r\n");
valueXmlString.append("<lot_no>").append("<![CDATA[").append(stklotNo.trim()).append("]]>").append("</lot_no>\r\n");
valueXmlString.append("<lot_sl>").append("<![CDATA[").append(stklotSl.trim()).append("]]>").append("</lot_sl>\r\n");
valueXmlString.append("<item_code>").append("<![CDATA[").append(stkItemCode).append("]]>").append("</item_code>\r\n");
valueXmlString.append("<loc_code>").append("<![CDATA[").append(stkLocCode).append("]]>").append("</loc_code>\r\n");
valueXmlString.append("<lot_no>").append("<![CDATA[").append(stklotNo).append("]]>").append("</lot_no>\r\n");
valueXmlString.append("<lot_sl>").append("<![CDATA[").append(stklotSl).append("]]>").append("</lot_sl>\r\n");
valueXmlString.append("<mfg_date>").append("<![CDATA[").append(stkMfgDate1).append("]]>").append("</mfg_date>\r\n");
valueXmlString.append("<exp_date>").append("<![CDATA[").append(stkExpDate1).append("]]>").append("</exp_date>\r\n");
//valueXmlString.append("<quantity>").append("<![CDATA[").append(balanceQty.trim()).append("]]>").append("</quantity>\r\n"); //Gulzar 13/03/07
......@@ -939,6 +939,10 @@ public class DespatchAct extends ActionHandlerEJB implements DespatchActLocal, D
{
lotSl = " ";
}
if((lotNo == null) || (lotNo != null && lotNo.trim().length() == 0))
{
lotNo = " ";
}
if(cQtyStr != null && cQtyStr.trim().length() > 0)
{
......
......@@ -106,12 +106,17 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
String errCode = "";
String errString = "";
String resultString = "";
String curUserId = "", curProfileId = "";
//String profileId =null;
double quantity = 0.0,pendingQty = 0.0;
int count = 0;
int count = 0, usrLev = 0;
String tApplication = null;
String key = null;
String tWinName = null;
String tMenuName = null;
String sqlStr = "";
try
{
if(conn == null)
......@@ -124,7 +129,61 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
userId = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"userId");
profileId = genericUtility.getColumnValue("profile_id", headerDom);
System.out.println("profileId ::- "+ profileId);
//System.out.println("profileId ::- "+ profileId);
// 24/03/12 manoharan get the current logged in user and show only the menus for which the current user has rights
curUserId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("Current userid curUserId ["+ curUserId + "] profileId [" + profileId + "]");
if (curUserId == null && curUserId.trim().length() == 0)
{
retTabSepStrBuff.append(" \t");
//LEVEL_1
retTabSepStrBuff.append(" \t");
//LEVEL_2
retTabSepStrBuff.append(" \t");
//LEVEL_3
retTabSepStrBuff.append(" \t");
//LEVEL_4
retTabSepStrBuff.append(" \t");
//LEVEL_5
retTabSepStrBuff.append(" \t");
//DESCR
retTabSepStrBuff.append(" \t");
//RIGHTS
retTabSepStrBuff.append(" \t");
//WIN_NAME
retTabSepStrBuff.append(" \t");
retTabSepStrBuff.append(" ").append("\t");
retTabSepStrBuff.append("\n");
resultString = retTabSepStrBuff.toString();
}
else
{
sql = " select profile_id,usr_lev from users where code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,curUserId);
rs = pstmt.executeQuery();
if(rs.next())
{
curProfileId = rs.getString("profile_id");
usrLev = rs.getInt("usr_lev");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("Current curProfileId ["+ curProfileId + "] usrLev [" + usrLev + "]");
////////////////
//If profile Id is blank or doesnt exist in the User_Rights table then prompt error
......@@ -164,16 +223,12 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
errString = itmDBAccessEJB.getErrorString("","PNOTEXIST","","",conn);
return errString;
}
}
catch(Exception e)
{
}
userRightsMap = new HashMap();
winNameMap = new HashMap();
menuNameMap = new HashMap();
String sqlStr = " SELECT ITM2MENU.APPLICATION, " +
sqlStr = " SELECT ITM2MENU.APPLICATION, " +
" ITM2MENU.LEVEL_1, " +
" ITM2MENU.LEVEL_2, " +
" ITM2MENU.LEVEL_3, " +
......@@ -182,7 +237,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
" ITM2MENU.WIN_NAME, " +
" ITM2MENU.DESCR, " +
" (SELECT USER_RIGHTS.RIGHTS FROM USER_RIGHTS " +
" WHERE USER_RIGHTS.PROFILE_ID = '" + profileId + "' " +
" WHERE USER_RIGHTS.PROFILE_ID = ? " +
" AND USER_RIGHTS.APPLICATION = ITM2MENU.APPLICATION " +
" AND USER_RIGHTS.MENU_ROW = ITM2MENU.LEVEL_1 " +
" AND USER_RIGHTS.MENU_COL = ITM2MENU.LEVEL_2 " +
......@@ -190,46 +245,27 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
" AND USER_RIGHTS.LEVEL_4 = ITM2MENU.LEVEL_4 " +
" AND USER_RIGHTS.LEVEL_5 = ITM2MENU.LEVEL_5 " +
" ) AS RIGHTS " +
" FROM ITM2MENU " +
" ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3, ITM2MENU.LEVEL_4, ITM2MENU.LEVEL_5 ";
/*
" SELECT ITM2MENU.APPLICATION, "+
" ITM2MENU.LEVEL_1, "+
" ITM2MENU.LEVEL_2, "+
" ITM2MENU.LEVEL_3, "+
" ITM2MENU.LEVEL_4, "+
" ITM2MENU.LEVEL_5, "+
" ITM2MENU.WIN_NAME, "+
" ITM2MENU.DESCR, "+
" USER_RIGHTS.RIGHTS "+
" FROM ITM2MENU "+
" LEFT OUTER JOIN USER_RIGHTS ON "+
" ITM2MENU.APPLICATION = USER_RIGHTS.APPLICATION "+
" AND ITM2MENU.LEVEL_1 = USER_RIGHTS.MENU_ROW "+
" AND ITM2MENU.LEVEL_2 = USER_RIGHTS.MENU_COL "+
" AND ITM2MENU.LEVEL_3 = USER_RIGHTS.MENU_SUBCOL "+
" AND ITM2MENU.LEVEL_4 = USER_RIGHTS.LEVEL_4 "+
" AND ITM2MENU.LEVEL_5 = USER_RIGHTS.LEVEL_5 "+
" WHERE (USER_RIGHTS.PROFILE_ID = '" + profileId + "'" +
" OR USER_RIGHTS.PROFILE_ID is null )" +
" ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3 ";
" FROM ITM2MENU " ;
if (usrLev > 0 )
{
sqlStr = sqlStr + " where exists (select 1 from user_rights u "
+ " where u.profile_id in ('" + curProfileId + "','" + profileId + "') "
+ " and u.application = ITM2MENU.application "
+ " and u.menu_row = ITM2MENU.level_1 "
+ " and u.menu_col = ITM2MENU.level_2 "
+ " and u.menu_subcol = ITM2MENU.level_3 "
+ " and u.level_4 = ITM2MENU.level_4 "
+ " and u.level_5 = ITM2MENU.level_5) " ;
}
sqlStr = sqlStr + " ORDER BY ITM2MENU.APPLICATION, ITM2MENU.LEVEL_1, ITM2MENU.LEVEL_2, ITM2MENU.LEVEL_3, ITM2MENU.LEVEL_4, ITM2MENU.LEVEL_5 ";
*/
try
{
pstmt = conn.prepareStatement(sqlStr);
System.out.println("The getData sql is:-"+ sqlStr);
pstmt.setString(1,profileId);
//System.out.println("The getData sql is:-"+ sqlStr);
rs = pstmt.executeQuery();
while (rs.next())
{
String tApplication = null;
String key = null;
String tWinName = null;
String tMenuName = null;
tApplication = rs.getString(1);
......@@ -277,6 +313,8 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
menuNameMap.put(key, tMenuName);
}//while
}
// end 24/03/12 manoharan
}//try
catch (SQLException e)
{
......@@ -742,7 +780,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
PreparedStatement pstmt = null;
ResultSet rs = null;
String alreadyExists = "N";
String sql = " SELECT RIGHTS FROM USER_RIGHTS "
+ " WHERE PROFILE_ID = ? "
+ " AND APPLICATION = ? "
......@@ -768,6 +806,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
if (rs.next())
{
foundRights = rs.getString(1);
alreadyExists = "Y";
}
rs.close();
rs = null;
......@@ -777,11 +816,11 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
System.out.println("Found rights in function ["+foundRights+"]");
if(foundRights == null && rights != null)
if(foundRights == null && rights != null && "N".equals(alreadyExists))
operation = 1;
else if(foundRights != null && rights != null)
else if((foundRights != null && rights != null) || ("Y".equals(alreadyExists) && foundRights == null && rights != null) )
operation = 2;
else if(foundRights != null && rights == null)
else if(foundRights != null && rights == null && "Y".equals(alreadyExists))
operation = 3;
return operation;
......
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