Project Service cannot Copy version250d by SureshQuest

Whenever bugs are encountered they are quashed and reported. Here you can see their quashings up close.

Moderators: sureshquest, arulmani, trifon

Project Service cannot Copy version250d by SureshQuest

Postby red1 » Mon Sep 06, 2004 7:08 pm

package org.compiere.model;

*/
public class MProjectTypePhase extends X_C_Phase
{
public MProjectTypePhase (Properties ctx, int C_Phase_ID)
{
super (ctx, C_Phase_ID);
if (C_Phase_ID == 0)
{
// setC_Phase_ID (0); // PK
// setC_ProjectType_ID (0); // Parent
// setName (null);
setSeqNo (0);
setStandardQty (Env.ZERO);
}
} // MProjectTypePhase

public MProjectTypePhase (Properties ctx, ResultSet rs)
{
super (ctx, rs);
} // MProjectTypePhase

/**
* Get Project Type Phases
* @return Array of phases
*/
public MProjectTypeTask[] getTasks()
{
ArrayList list = new ArrayList();
String sql = "SELECT * FROM C_Task WHERE C_Phase_ID=? ORDER BY SeqNo";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql);

// Commented by suresh to test the project service copy process.
//pstmt.setInt(1, getC_ProjectType_ID());
pstmt.setInt(1, getC_Phase_ID());

ResultSet rs = pstmt.executeQuery();
while (rs.next())
list.add(new MProjectTypeTask (getCtx(), rs));
rs.close();
pstmt.close();
pstmt = null;
}
catch (SQLException ex)
{
log.error("getTasks", ex);
}
try
{
if (pstmt != null)
pstmt.close();
}
catch (SQLException ex1)
{
}
pstmt = null;
//
MProjectTypeTask[] retValue = new MProjectTypeTask[list.size()];
list.toArray(retValue);
return retValue;
} // getPhases

} // MProjectTypePhase
THIS HAPPENED IN OLDER VERSION 250D – (?)

public MProjectTypeTask[] getTasks()
{
ArrayList list = new ArrayList();
String sql = "SELECT * FROM C_Task WHERE C_Phase_ID=? ORDER BY SeqNo";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement(sql);
// Bug - Copy ProjectType does not copy phases/tasks
// Reason - The statement didnt look at phase level to begin
// Remedy - see statement as replaced by the next
// pstmt.setInt(1, getC_ProjectType_ID());
pstmt.setInt(1, getC_Phase_ID());

ResultSet rs = pstmt.executeQuery();

-- For those who are programmers, look up the above java source: org.compiere.model.MProjectTypePhase, and implement the comments (actually it involves replacing a statement, then recompile).
the above was solved by sureshquest (from bangalore)
red1
Site Admin
 
Posts: 2740
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Return to BUGS Galore!

Who is online

Users browsing this forum: No registered users and 1 guest

cron