Integrate bug fixing from branch 350 into stable

This commit is contained in:
Carlos Ruiz 2008-04-09 18:01:52 +00:00
parent bfe004c117
commit 82a7e72261
26 changed files with 485 additions and 35 deletions

View File

@ -38,6 +38,7 @@ import javax.naming.NamingException;
import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager; import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperPrintManager; import net.sf.jasperreports.engine.JasperPrintManager;
@ -71,6 +72,8 @@ import org.compiere.utils.DigestOfFile;
* Modifications: Allow Jasper Reports to be able to be run on VPN profile (i.e: no direct connection to DB). * Modifications: Allow Jasper Reports to be able to be run on VPN profile (i.e: no direct connection to DB).
* Implemented ClientProcess for it to run on client. * Implemented ClientProcess for it to run on client.
* @author Ashley Ramdass * @author Ashley Ramdass
* @author victor.perez@e-evolution.com
* @see FR 1906632 http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1906632&group_id=176962
*/ */
public class ReportStarter implements ProcessCall, ClientProcess { public class ReportStarter implements ProcessCall, ClientProcess {
//logger //logger
@ -510,9 +513,27 @@ public class ReportStarter implements ProcessCall, ClientProcess {
//JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, DB.getConnectionRW()); //JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, DB.getConnectionRW());
conn = getConnection(); conn = getConnection();
JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, conn); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, params, conn);
if (reportData.isDirectPrint()) { if (reportData.isDirectPrint())
{
log.info( "ReportStarter.startProcess print report -" + jasperPrint.getName()); log.info( "ReportStarter.startProcess print report -" + jasperPrint.getName());
//RF 1906632
if(!processInfo.isBatch())
JasperPrintManager.printReport( jasperPrint, false); JasperPrintManager.printReport( jasperPrint, false);
else
{
// You can use JasperPrint to create PDF
// Used For the PH
try
{
File PDF = File.createTempFile("mail", ".pdf");
JasperExportManager.exportReportToPdfFile(jasperPrint, PDF.getAbsolutePath());
processInfo.setPDFReport(PDF);
}
catch (IOException e)
{
log.severe("ReportStarter.startProcess: Can not make PDF File - "+ e.getMessage());
}
}
// You can use JasperPrint to create PDF // You can use JasperPrint to create PDF
// JasperExportManager.exportReportToPdfFile(jasperPrint, "BasicReport.pdf"); // JasperExportManager.exportReportToPdfFile(jasperPrint, "BasicReport.pdf");

View File

@ -90,6 +90,8 @@ import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.Trx; import org.compiere.util.Trx;
import org.compiere.wf.MWFNode;
import org.compiere.wf.MWorkflow;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
@ -135,6 +137,8 @@ public class PackInHandler extends DefaultHandler {
private Map<String, ElementHandler>handlers = null; private Map<String, ElementHandler>handlers = null;
private List<Element> menus = new ArrayList<Element>(); private List<Element> menus = new ArrayList<Element>();
private List<Element> workflow = new ArrayList<Element>();
private List<Element> nodes = new ArrayList<Element>();
private List<DeferEntry> defer = new ArrayList<DeferEntry>(); private List<DeferEntry> defer = new ArrayList<DeferEntry>();
private Stack<Element> stack = new Stack<Element>(); private Stack<Element> stack = new Stack<Element>();
private PackIn packIn; private PackIn packIn;
@ -402,6 +406,17 @@ public class PackInHandler extends DefaultHandler {
if (stack.size() > 0) if (stack.size() > 0)
e.parent = stack.peek(); e.parent = stack.peek();
stack.push(e); stack.push(e);
if (elementValue.equals("workflow"))
{
workflow.add(e);
}
if (elementValue.equals("workflowNode"))
{
nodes.add(e);
}
ElementHandler handler = handlers.get(elementValue); ElementHandler handler = handlers.get(elementValue);
if (handler != null) if (handler != null)
handler.startElement(m_ctx, e); handler.startElement(m_ctx, e);
@ -635,6 +650,78 @@ public class PackInHandler extends DefaultHandler {
if (no == -1) if (no == -1)
log.info("Update to package list failed"); log.info("Update to package list failed");
if(workflow.size() > 0)
{
for (Element e : workflow)
{
Attributes atts = e.attributes;
String workflowName = atts.getValue("Name");
MWorkflow wf = null;
int workflow_id = IDFinder.get_IDWithColumn("AD_Workflow", "Name", workflowName ,m_AD_Client_ID , m_trxName);
if(workflow_id > 0)
{
wf = new MWorkflow(m_ctx, workflow_id , m_trxName);
int node_id = 0;
String name = atts.getValue("ADWorkflowNodeNameID");
if (name != null && name.trim().length() > 0)
{
MWFNode[] nodes = wf.getNodes(false, m_AD_Client_ID);
for (MWFNode node : nodes)
{
if (node.getName().trim().equals(name.trim()))
{
node_id = node.getAD_WF_Node_ID();
wf.setAD_WF_Node_ID(node_id);
if (!wf.save())
System.out.println("Can not save Start Node "+ name +"to Workflow " + workflowName + " do not exist ");
break;
}
}
if(node_id == 0)
System.out.println("Unresolved: Start Node to Workflow " + workflowName + " do not exist ");
else
break;
}
}
}
}
if(nodes.size() > 0)
{
for (Element e : nodes)
{
Attributes atts = e.attributes;
String nodeName = atts.getValue("Name");
MWFNode node = null;
int id = IDFinder.get_IDWithColumn("AD_WF_Node", "Name", nodeName , m_AD_Client_ID , m_trxName);
if(id > 0)
{
node = new MWFNode(m_ctx, id , m_trxName);
String workflowNodeName = atts.getValue("WorkflowNameID").trim();
if (workflowNodeName != null && workflowNodeName.trim().length() > 0)
{
int workflow_id = IDFinder.get_IDWithColumn("AD_Workflow", "Name",workflowNodeName, m_AD_Client_ID, m_trxName);
if (workflow_id > 0)
{
node.setWorkflow_ID(workflow_id);
if(!node.save())
{
System.out.println("can not save Workflow " + workflowNodeName );
}
}
else
System.out.println("Unresolved: Workflow " + workflowNodeName + " do not exist ");
}
}
}
}
logDocument.endElement("","","adempiereDocument"); logDocument.endElement("","","adempiereDocument");
logDocument.endDocument(); logDocument.endDocument();
try { try {
@ -661,6 +748,9 @@ public class PackInHandler extends DefaultHandler {
} }
} }
} }
} // endElement } // endElement
private void processMenuElements() throws SAXException { private void processMenuElements() throws SAXException {

View File

@ -279,6 +279,8 @@ public class PackOut extends SvrProcess
createSQL (rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement), rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_DBType), packOutDocument); createSQL (rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement), rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_DBType), packOutDocument);
else if (Type.compareTo("IMP") == 0) else if (Type.compareTo("IMP") == 0)
createImpFormat (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID), packOutDocument); createImpFormat (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID), packOutDocument);
else if (Type.compareTo("REF") == 0)
createReference (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID), packOutDocument);
else if (Type.compareTo("SNI") == 0) else if (Type.compareTo("SNI") == 0)
createSnipit( createSnipit(
rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory), rs.getString(X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory),

View File

@ -192,9 +192,9 @@ public class PrintFormatElementHandler extends AbstractElementHandler {
+ "FROM AD_PrintFormat " + "FROM AD_PrintFormat "
+ "WHERE AD_PrintFormat_ID in " + "WHERE AD_PrintFormat_ID in "
+ "(( select AD_PrintFormatChild_ID from AD_PrintFormatItem WHERE AD_PrintFormat_ID = " + "(( select AD_PrintFormatChild_ID from AD_PrintFormatItem WHERE AD_PrintFormat_ID = "
+ AD_PrintFormat_ID + " AND PrintFormatType = 'P'), " + AD_PrintFormat_ID + " AND PrintFormatType = 'P' GROUP BY AD_PrintFormatChild_ID ), "
+ AD_PrintFormat_ID + ")"; + AD_PrintFormat_ID + ") ";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
pstmt = DB.prepareStatement(sql, getTrxName(ctx)); pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try { try {

View File

@ -177,6 +177,37 @@ public class WorkflowElementHandler extends AbstractElementHandler {
if (name != null && name.trim().length() > 0) { if (name != null && name.trim().length() > 0) {
MWorkflow m_Workflow = new MWorkflow(ctx, element.recordId, getTrxName(ctx)); MWorkflow m_Workflow = new MWorkflow(ctx, element.recordId, getTrxName(ctx));
int id = get_IDWithMasterAndColumn(ctx, "AD_WF_Node", "Name", name, "AD_Workflow", m_Workflow.getAD_Workflow_ID()); int id = get_IDWithMasterAndColumn(ctx, "AD_WF_Node", "Name", name, "AD_Workflow", m_Workflow.getAD_Workflow_ID());
if (id <= 0) {
log.warning("Failed to resolve start node reference for workflow element. Workflow="
+ m_Workflow.getName() + " StartNode=" + name);
return;
}
m_Workflow.setAD_WF_Node_ID(id);
if (m_Workflow.save(getTrxName(ctx)) == true) {
log.info("m_Workflow update success");
record_log(ctx, 1, m_Workflow.getName(), "Workflow", m_Workflow
.get_ID(), 0, "Update", "AD_Workflow",
get_IDWithColumn(ctx, "AD_Table", "TableName",
"AD_Workflow"));
workflows.add(m_Workflow.getAD_Workflow_ID());
element.recordId = m_Workflow.getAD_Workflow_ID();
} else {
log.info("m_Workflow update fail");
record_log(ctx, 0, m_Workflow.getName(), "Workflow", m_Workflow
.get_ID(), 0, "Update", "AD_Workflow",
get_IDWithColumn(ctx, "AD_Table", "TableName",
"AD_Workflow"));
throw new POSaveFailedException("MWorkflow");
}
}
}
if (!element.defer && !element.skip && element.recordId > 0) {
Attributes atts = element.attributes;
//set start node
String name = atts.getValue("ADWorkflowNodeNameID");
if (name != null && name.trim().length() > 0) {
MWorkflow m_Workflow = new MWorkflow(ctx, element.recordId, getTrxName(ctx));
int id = get_IDWithColumn(ctx, "AD_WF_Node", "Name", name);
if (id <= 0) { if (id <= 0) {
element.deferEnd = true; element.deferEnd = true;
element.unresolved = "AD_WF_Node=" + name; element.unresolved = "AD_WF_Node=" + name;

View File

@ -90,6 +90,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
Object_Status = "New"; Object_Status = "New";
AD_Backup_ID = 0; AD_Backup_ID = 0;
} }
m_WFNode.setValue(atts.getValue("Value"));
m_WFNode.setName(workflowNodeName); m_WFNode.setName(workflowNodeName);
m_WFNode.setAD_Workflow_ID(workflowId); m_WFNode.setAD_Workflow_ID(workflowId);
@ -166,6 +167,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
} }
//[Bugs-1789058 ] //[Bugs-1789058 ]
/*
name = atts.getValue("WorkflowNameID"); name = atts.getValue("WorkflowNameID");
if (name != null && name.trim().length() > 0) { if (name != null && name.trim().length() > 0) {
id = get_IDWithColumn(ctx, "AD_Workflow", "Name", name); id = get_IDWithColumn(ctx, "AD_Workflow", "Name", name);
@ -178,7 +180,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
} }
if (id > 0) if (id > 0)
m_WFNode.setWorkflow_ID(id); m_WFNode.setWorkflow_ID(id);
} }*/
/* /*
* FIXME: Do we need TaskName ? if * FIXME: Do we need TaskName ? if
@ -221,6 +223,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
m_WFNode.setDynPriorityUnit (getStringValue(atts,"DynPriorityUnit")); m_WFNode.setDynPriorityUnit (getStringValue(atts,"DynPriorityUnit"));
m_WFNode.setIsActive(atts.getValue("isActive") != null ? Boolean m_WFNode.setIsActive(atts.getValue("isActive") != null ? Boolean
.valueOf(atts.getValue("isActive")).booleanValue() : true); .valueOf(atts.getValue("isActive")).booleanValue() : true);
m_WFNode.setValue(atts.getValue("Value"));
log.info("about to execute m_WFNode.save"); log.info("about to execute m_WFNode.save");
if (m_WFNode.save(getTrxName(ctx)) == true) { if (m_WFNode.save(getTrxName(ctx)) == true) {
log.info("m_WFNode save success"); log.info("m_WFNode save success");
@ -262,7 +265,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
String sql = null; String sql = null;
String name = null; String name = null;
atts.clear(); atts.clear();
atts.addAttribute("", "", "Value", "CDATA", (m_WF_Node.getValue() != null ? m_WF_Node.getValue() : ""));
atts.addAttribute("", "", "Name", "CDATA", atts.addAttribute("", "", "Name", "CDATA",
(m_WF_Node.getName() != null ? m_WF_Node.getName() : "")); (m_WF_Node.getName() != null ? m_WF_Node.getName() : ""));
@ -365,6 +368,8 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
(name != null ? name : "")); (name != null ? name : ""));
} else } else
atts.addAttribute("", "", "ADColumnNameID", "CDATA", ""); atts.addAttribute("", "", "ADColumnNameID", "CDATA", "");
atts.addAttribute("", "", "Value", "CDATA", (m_WF_Node
.getValue() != null ? m_WF_Node.getValue() : ""));
atts.addAttribute("", "", "Value", "CDATA", (m_WF_Node atts.addAttribute("", "", "Value", "CDATA", (m_WF_Node
.getValue() != null ? m_WF_Node.getValue() : "")); .getValue() != null ? m_WF_Node.getValue() : ""));

View File

@ -152,7 +152,7 @@ public class InOutGenerateRMA extends SvrProcess
shipment.setDescription(rma.getDescription()); shipment.setDescription(rma.getDescription());
shipment.setC_BPartner_ID(rma.getC_BPartner_ID()); shipment.setC_BPartner_ID(rma.getC_BPartner_ID());
shipment.setC_BPartner_Location_ID(originalReceipt.getC_BPartner_Location_ID()); shipment.setC_BPartner_Location_ID(originalReceipt.getC_BPartner_Location_ID());
shipment.setIsSOTrx(!rma.isSOTrx()); shipment.setIsSOTrx(rma.isSOTrx());
shipment.setC_DocType_ID(docTypeId); shipment.setC_DocType_ID(docTypeId);
shipment.setM_Warehouse_ID(originalReceipt.getM_Warehouse_ID()); shipment.setM_Warehouse_ID(originalReceipt.getM_Warehouse_ID());
shipment.setMovementType(MInOut.MOVEMENTTYPE_VendorReturns); shipment.setMovementType(MInOut.MOVEMENTTYPE_VendorReturns);

View File

@ -1185,6 +1185,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
*/ */
public boolean isDetail() public boolean isDetail()
{ {
// First Tab Level is not a detail
if (m_vo.TabLevel == 0)
return false;
// We have IsParent columns and/or a link column // We have IsParent columns and/or a link column
if (m_parents.size() > 0 || m_vo.AD_Column_ID != 0) if (m_parents.size() > 0 || m_vo.AD_Column_ID != 0)
return true; return true;

View File

@ -178,6 +178,21 @@ public interface I_AD_Package_Exp_Detail
public I_AD_Process getAD_Process() throws Exception; public I_AD_Process getAD_Process() throws Exception;
/** Column name AD_Reference_ID */
public static final String COLUMNNAME_AD_Reference_ID = "AD_Reference_ID";
/** Set Reference.
* System Reference and Validation
*/
public void setAD_Reference_ID (int AD_Reference_ID);
/** Get Reference.
* System Reference and Validation
*/
public int getAD_Reference_ID();
public I_AD_Reference getAD_Reference() throws Exception;
/** Column name AD_ReportView_ID */ /** Column name AD_ReportView_ID */
public static final String COLUMNNAME_AD_ReportView_ID = "AD_ReportView_ID"; public static final String COLUMNNAME_AD_ReportView_ID = "AD_ReportView_ID";

View File

@ -28,6 +28,8 @@ import org.compiere.util.*;
* Bank Statement Model * Bank Statement Model
* *
* @author Eldir Tomassen/Jorg Janke * @author Eldir Tomassen/Jorg Janke
* @author victor.perez@e-evolution.com fixed bug [ 1933645 ] Wrong balance Bank Statement
* @see http://sourceforge.net/tracker/?func=detail&atid=879332&aid=1933645&group_id=176962
* @version $Id: MBankStatement.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $ * @version $Id: MBankStatement.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
*/ */
public class MBankStatement extends X_C_BankStatement implements DocAction public class MBankStatement extends X_C_BankStatement implements DocAction
@ -404,7 +406,8 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
} }
// Update Bank Account // Update Bank Account
MBankAccount ba = MBankAccount.get(getCtx(), getC_BankAccount_ID()); MBankAccount ba = MBankAccount.get(getCtx(), getC_BankAccount_ID());
ba.setCurrentBalance(getEndingBalance()); //BF 1933645
ba.setCurrentBalance(ba.getCurrentBalance().add(getStatementDifference()));
ba.save(get_TrxName()); ba.save(get_TrxName());
// User Validation // User Validation

View File

@ -939,7 +939,7 @@ public class MInOut extends X_M_InOut implements DocAction
} }
// Shipment - Needs Order/RMA // Shipment - Needs Order/RMA
if (isSOTrx() && getC_Order_ID() == 0 && getM_RMA_ID() == 0) if (!getMovementType().contentEquals(MInOut.MOVEMENTTYPE_CustomerReturns) && isSOTrx() && getC_Order_ID() == 0 && getM_RMA_ID() == 0)
{ {
log.saveError("FillMandatory", Msg.translate(getCtx(), "C_Order_ID")); log.saveError("FillMandatory", Msg.translate(getCtx(), "C_Order_ID"));
return false; return false;
@ -951,7 +951,6 @@ public class MInOut extends X_M_InOut implements DocAction
MRMA rma = new MRMA(getCtx(), getM_RMA_ID(), get_TrxName()); MRMA rma = new MRMA(getCtx(), getM_RMA_ID(), get_TrxName());
MDocType docType = MDocType.get(getCtx(), rma.getC_DocType_ID()); MDocType docType = MDocType.get(getCtx(), rma.getC_DocType_ID());
setC_DocType_ID(docType.getC_DocTypeShipment_ID()); setC_DocType_ID(docType.getC_DocTypeShipment_ID());
setMovementType(MOVEMENTTYPE_CustomerReturns);
} }
return true; return true;

View File

@ -1520,7 +1520,7 @@ public class MOrder extends X_C_Order implements DocAction
* Calculate Tax and Total * Calculate Tax and Total
* @return true if tax total calculated * @return true if tax total calculated
*/ */
private boolean calculateTaxTotal() public boolean calculateTaxTotal()
{ {
log.fine(""); log.fine("");
// Delete Taxes // Delete Taxes

View File

@ -43,6 +43,7 @@ public class MRMALine extends X_M_RMALine
if (M_RMALine_ID == 0) if (M_RMALine_ID == 0)
{ {
setQty(Env.ONE); setQty(Env.ONE);
this.setQtyDelivered(Env.ONE);
} }
init(); init();

View File

@ -798,6 +798,8 @@ public class X_AD_Package_Exp_Common extends PO implements I_AD_Package_Exp_Comm
public static final String TYPE_Message = "MSG"; public static final String TYPE_Message = "MSG";
/** PrintFormat = PFT */ /** PrintFormat = PFT */
public static final String TYPE_PrintFormat = "PFT"; public static final String TYPE_PrintFormat = "PFT";
/** Reference = REF */
public static final String TYPE_Reference = "REF";
/** Set Type. /** Set Type.
@param Type @param Type
Type of Validation (SQL, Java Script, Java Language) Type of Validation (SQL, Java Script, Java Language)
@ -805,7 +807,7 @@ public class X_AD_Package_Exp_Common extends PO implements I_AD_Package_Exp_Comm
public void setType (String Type) public void setType (String Type)
{ {
if (Type == null || Type.equals("B") || Type.equals("C") || Type.equals("D") || Type.equals("F") || Type.equals("IMP") || Type.equals("M") || Type.equals("P") || Type.equals("R") || Type.equals("S") || Type.equals("SNI") || Type.equals("SQL") || Type.equals("T") || Type.equals("W") || Type.equals("X") || Type.equals("V") || Type.equals("MSG") || Type.equals("PFT")); else throw new IllegalArgumentException ("Type Invalid value - " + Type + " - Reference_ID=50004 - B - C - D - F - IMP - M - P - R - S - SNI - SQL - T - W - X - V - MSG - PFT"); if (Type == null || Type.equals("B") || Type.equals("C") || Type.equals("D") || Type.equals("F") || Type.equals("IMP") || Type.equals("M") || Type.equals("P") || Type.equals("R") || Type.equals("S") || Type.equals("SNI") || Type.equals("SQL") || Type.equals("T") || Type.equals("W") || Type.equals("X") || Type.equals("V") || Type.equals("MSG") || Type.equals("PFT") || Type.equals("REF")); else throw new IllegalArgumentException ("Type Invalid value - " + Type + " - Reference_ID=50004 - B - C - D - F - IMP - M - P - R - S - SNI - SQL - T - W - X - V - MSG - PFT - REF");
if (Type != null && Type.length() > 10) if (Type != null && Type.length() > 10)
{ {
log.warning("Length > 10 - truncated"); log.warning("Length > 10 - truncated");

View File

@ -395,6 +395,45 @@ public class X_AD_Package_Exp_Detail extends PO implements I_AD_Package_Exp_Deta
return ii.intValue(); return ii.intValue();
} }
public I_AD_Reference getAD_Reference() throws Exception
{
Class<?> clazz = MTable.getClass(I_AD_Reference.Table_Name);
I_AD_Reference result = null;
try {
Constructor<?> constructor = null;
constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});
result = (I_AD_Reference)constructor.newInstance(new Object[] {getCtx(), new Integer(getAD_Reference_ID()), get_TrxName()});
} catch (Exception e) {
log.log(Level.SEVERE, "(id) - Table=" + Table_Name + ",Class=" + clazz, e);
log.saveError("Error", "Table=" + Table_Name + ",Class=" + clazz);
throw e;
}
return result;
}
/** Set Reference.
@param AD_Reference_ID
System Reference and Validation
*/
public void setAD_Reference_ID (int AD_Reference_ID)
{
if (AD_Reference_ID < 1)
set_Value (COLUMNNAME_AD_Reference_ID, null);
else
set_Value (COLUMNNAME_AD_Reference_ID, Integer.valueOf(AD_Reference_ID));
}
/** Get Reference.
@return System Reference and Validation
*/
public int getAD_Reference_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Reference_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public I_AD_ReportView getAD_ReportView() throws Exception public I_AD_ReportView getAD_ReportView() throws Exception
{ {
Class<?> clazz = MTable.getClass(I_AD_ReportView.Table_Name); Class<?> clazz = MTable.getClass(I_AD_ReportView.Table_Name);
@ -1011,6 +1050,8 @@ public class X_AD_Package_Exp_Detail extends PO implements I_AD_Package_Exp_Deta
public static final String TYPE_Message = "MSG"; public static final String TYPE_Message = "MSG";
/** PrintFormat = PFT */ /** PrintFormat = PFT */
public static final String TYPE_PrintFormat = "PFT"; public static final String TYPE_PrintFormat = "PFT";
/** Reference = REF */
public static final String TYPE_Reference = "REF";
/** Set Type. /** Set Type.
@param Type @param Type
Type of Validation (SQL, Java Script, Java Language) Type of Validation (SQL, Java Script, Java Language)
@ -1018,7 +1059,7 @@ public class X_AD_Package_Exp_Detail extends PO implements I_AD_Package_Exp_Deta
public void setType (String Type) public void setType (String Type)
{ {
if (Type == null) throw new IllegalArgumentException ("Type is mandatory"); if (Type == null) throw new IllegalArgumentException ("Type is mandatory");
if (Type.equals("B") || Type.equals("C") || Type.equals("D") || Type.equals("F") || Type.equals("IMP") || Type.equals("M") || Type.equals("P") || Type.equals("R") || Type.equals("S") || Type.equals("SNI") || Type.equals("SQL") || Type.equals("T") || Type.equals("W") || Type.equals("X") || Type.equals("V") || Type.equals("MSG") || Type.equals("PFT")); else throw new IllegalArgumentException ("Type Invalid value - " + Type + " - Reference_ID=50004 - B - C - D - F - IMP - M - P - R - S - SNI - SQL - T - W - X - V - MSG - PFT"); if (Type.equals("B") || Type.equals("C") || Type.equals("D") || Type.equals("F") || Type.equals("IMP") || Type.equals("M") || Type.equals("P") || Type.equals("R") || Type.equals("S") || Type.equals("SNI") || Type.equals("SQL") || Type.equals("T") || Type.equals("W") || Type.equals("X") || Type.equals("V") || Type.equals("MSG") || Type.equals("PFT") || Type.equals("REF")); else throw new IllegalArgumentException ("Type Invalid value - " + Type + " - Reference_ID=50004 - B - C - D - F - IMP - M - P - R - S - SNI - SQL - T - W - X - V - MSG - PFT - REF");
if (Type.length() > 10) if (Type.length() > 10)
{ {
log.warning("Length > 10 - truncated"); log.warning("Length > 10 - truncated");

View File

@ -28,6 +28,8 @@ import org.compiere.util.*;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: ProcessInfo.java,v 1.2 2006/07/30 00:54:44 jjanke Exp $ * @version $Id: ProcessInfo.java,v 1.2 2006/07/30 00:54:44 jjanke Exp $
* @author victor.perez@e-evolution.com
* @see FR 1906632 http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1906632&group_id=176962
*/ */
public class ProcessInfo implements Serializable public class ProcessInfo implements Serializable
{ {
@ -113,6 +115,8 @@ public class ProcessInfo implements Serializable
private boolean m_printPreview = false; private boolean m_printPreview = false;
private boolean m_reportingProcess = false; private boolean m_reportingProcess = false;
//FR 1906632
private File m_pdf_report = null;
/** /**
* String representation * String representation
@ -645,4 +649,25 @@ public class ProcessInfo implements Serializable
{ {
m_reportingProcess = f; m_reportingProcess = f;
} }
//FR 1906632
/**
* Set PDF file generate to Jasper Report
* @param PDF File
*/
public void setPDFReport(File f)
{
m_pdf_report = f;
}
/**
* Get PDF file generate to Jasper Report
* @param f
*/
public File getPDFReport()
{
return m_pdf_report;
}
} // ProcessInfo } // ProcessInfo

View File

@ -407,7 +407,7 @@ public class TimeUtil
if (negative) if (negative)
return counter * -1; return counter * -1;
return counter; return counter;
} // getDatesBetrween } // getDaysBetween
/** /**
* Return Day + offset (truncates) * Return Day + offset (truncates)

View File

@ -245,7 +245,7 @@ public class VInvoiceGen extends CPanel
return sql.toString(); return sql.toString();
} }
private String getRMASql() private String getRMASQL()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
sql.append("SELECT rma.M_RMA_ID, org.Name, dt.Name, rma.DocumentNo, bp.Name, rma.Created, rma.Amt "); sql.append("SELECT rma.M_RMA_ID, org.Name, dt.Name, rma.DocumentNo, bp.Name, rma.Created, rma.Amt ");
@ -254,7 +254,7 @@ public class VInvoiceGen extends CPanel
sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID "); sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID ");
sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID "); sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID ");
sql.append("WHERE rma.DocStatus='CO' "); sql.append("WHERE rma.DocStatus='CO' ");
sql.append("AND dt.DocBaseType = 'SOO' "); sql.append("AND dt.DocBaseType = 'POO' ");
sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i "); sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i ");
sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) "); sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol "); sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol ");
@ -301,7 +301,7 @@ public class VInvoiceGen extends CPanel
} }
else else
{ {
sql = getRMASql(); sql = getRMASQL();
} }
// reset table // reset table

View File

@ -433,7 +433,7 @@ public final class InfoProduct extends Info implements ActionListener
where.append(" AND p.IsSummary='N'"); where.append(" AND p.IsSummary='N'");
// dynamic Where Clause // dynamic Where Clause
if (p_whereClause != null && p_whereClause.length() > 0) if (p_whereClause != null && p_whereClause.length() > 0)
where.append(" AND ") // replace fully qalified name with alias where.append(" AND ") // replace fully qualified name with alias
.append(Util.replace(p_whereClause, "M_Product.", "p.")); .append(Util.replace(p_whereClause, "M_Product.", "p."));
// //
prepareTable(getProductLayout(), prepareTable(getProductLayout(),
@ -966,7 +966,7 @@ public final class InfoProduct extends Info implements ActionListener
} // getProductLayout } // getProductLayout
/** /**
* System has Unforfirmed records * System has Unconfirmed records
* @return true if unconfirmed * @return true if unconfirmed
*/ */
private boolean isUnconfirmed() private boolean isUnconfirmed()

View File

@ -23,7 +23,7 @@ SELECT t.ad_window_id,
c.columnsql, c.columnsql,
c.fieldlength, c.fieldlength,
c.vformat, c.vformat,
c.defaultvalue, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.iskey,
c.isparent, c.isparent,
COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory,
@ -62,4 +62,4 @@ FROM ((((((AD_FIELD f
LEFT JOIN AD_VAL_RULE vr LEFT JOIN AD_VAL_RULE vr
ON ((vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)))) ON ((vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id))))
WHERE ((f.isactive = 'Y'::bpchar) AND WHERE ((f.isactive = 'Y'::bpchar) AND
(c.isactive = 'Y'::bpchar)) (c.isactive = 'Y'::bpchar));

View File

@ -24,7 +24,7 @@ SELECT trl.AD_LANGUAGE,
c.columnsql, c.columnsql,
c.fieldlength, c.fieldlength,
c.vformat, c.vformat,
c.defaultvalue, COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey, c.iskey,
c.isparent, c.isparent,
COALESCE(f.ismandatory, c.ismandatory) AS ismandatory, COALESCE(f.ismandatory, c.ismandatory) AS ismandatory,
@ -68,4 +68,4 @@ FROM (((((((AD_FIELD f
LEFT JOIN AD_VAL_RULE vr LEFT JOIN AD_VAL_RULE vr
ON ((vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id)))) ON ((vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id))))
WHERE ((f.isactive = 'Y'::bpchar) AND WHERE ((f.isactive = 'Y'::bpchar) AND
(c.isactive = 'Y'::bpchar)) (c.isactive = 'Y'::bpchar));

View File

@ -0,0 +1,38 @@
-- Dec 8, 2007 9:40:21 PM CST
-- Default comment for updating dictionary
ALTER TABLE AD_Package_Exp_Detail ADD AD_Reference_ID NUMBER(10)
/
-- Dec 8, 2007 9:33:11 PM CST
-- Default comment for updating dictionary
INSERT INTO AD_Column (Name,IsMandatory,IsTranslated,Description,IsIdentifier,SeqNo,Help,Version,IsActive,AD_Table_ID,AD_Column_ID,ColumnName,AD_Client_ID,AD_Org_ID,FieldLength,IsParent,Created,IsSyncDatabase,AD_Reference_ID,CreatedBy,Updated,AD_Element_ID,IsUpdateable,IsKey,IsSelectionColumn,UpdatedBy,IsAlwaysUpdateable,IsEncrypted,EntityType) VALUES ('Reference','N','N','System Reference and Validation','N',0,'The Reference could be a display type, list or table validation.',0,'Y',50006,53269,'AD_Reference_ID',0,0,10,'N',TO_DATE('2007-12-08 21:33:11','YYYY-MM-DD HH24:MI:SS'),'N',19,0,TO_DATE('2007-12-08 21:33:11','YYYY-MM-DD HH24:MI:SS'),120,'Y','N','N',0,'N','N','D')
/
-- Dec 8, 2007 9:33:11 PM CST
-- Default comment for updating dictionary
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=53269 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
/
-- Dec 8, 2007 9:33:55 PM CST
-- Default comment for updating dictionary
INSERT INTO AD_Ref_List (Created,CreatedBy,Updated,UpdatedBy,AD_Org_ID,AD_Ref_List_ID,AD_Reference_ID,Value,Name,IsActive,AD_Client_ID,EntityType) VALUES (TO_DATE('2007-12-08 21:33:55','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2007-12-08 21:33:55','YYYY-MM-DD HH24:MI:SS'),0,0,53227,50004,'REF','Reference','Y',0,'D')
/
-- Dec 8, 2007 9:33:55 PM CST
-- Default comment for updating dictionary
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=53227 AND EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Ref_List_ID!=t.AD_Ref_List_ID)
/
-- Dec 8, 2007 9:35:24 PM CST
-- Default comment for updating dictionary
INSERT INTO AD_Field (IsEncrypted,SortNo,AD_Org_ID,UpdatedBy,IsDisplayed,IsCentrallyMaintained,IsActive,Created,AD_Client_ID,AD_Field_ID,Description,DisplayLength,AD_Column_ID,IsFieldOnly,CreatedBy,Help,Updated,Name,AD_Tab_ID,IsSameLine,IsHeading,SeqNo,IsReadOnly,DisplayLogic,EntityType) VALUES ('N',0,0,0,'Y','Y','Y',TO_DATE('2007-12-08 21:35:23','YYYY-MM-DD HH24:MI:SS'),0,53284,'System Reference and Validation',0,53269,'N',0,'The Reference could be a display type, list or table validation.',TO_DATE('2007-12-08 21:35:23','YYYY-MM-DD HH24:MI:SS'),'Reference',50006,'N','N',270,'N','@Type@=''REF''','D')
/
-- Dec 8, 2007 9:35:24 PM CST
-- Default comment for updating dictionary
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=53284 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
/

View File

@ -0,0 +1 @@
-- placeholder - script just affect postgres

View File

@ -0,0 +1,40 @@
-- Dec 8, 2007 9:40:21 PM CST
-- Default comment for updating dictionary
ALTER TABLE AD_Package_Exp_Detail ADD COLUMN AD_Reference_ID NUMERIC(10)
;
-- Dec 8, 2007 9:33:11 PM CST
-- Default comment for updating dictionary
INSERT INTO AD_Column (Name,IsMandatory,IsTranslated,Description,IsIdentifier,SeqNo,Help,Version,IsActive,AD_Table_ID,AD_Column_ID,ColumnName,AD_Client_ID,AD_Org_ID,FieldLength,IsParent,Created,IsSyncDatabase,AD_Reference_ID,CreatedBy,Updated,AD_Element_ID,IsUpdateable,IsKey,IsSelectionColumn,UpdatedBy,IsAlwaysUpdateable,IsEncrypted,EntityType) VALUES ('Reference','N','N','System Reference and Validation','N',0,'The Reference could be a display type, list or table validation.',0,'Y',50006,53269,'AD_Reference_ID',0,0,10,'N',TO_TIMESTAMP('2007-12-08 21:33:11','YYYY-MM-DD HH24:MI:SS'),'N',19,0,TO_TIMESTAMP('2007-12-08 21:33:11','YYYY-MM-DD HH24:MI:SS'),120,'Y','N','N',0,'N','N','U')
;
-- Dec 8, 2007 9:33:11 PM CST
-- Default comment for updating dictionary
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=53269 AND EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Column_ID!=t.AD_Column_ID)
;
-- 08-dic-2007 21:05:21 CST
-- Default comment for updating dictionary
INSERT INTO AD_Ref_List (AD_Org_ID,AD_Ref_List_ID,AD_Reference_ID,Created,CreatedBy,EntityType,IsActive,Name,Updated,UpdatedBy,AD_Client_ID,Value) VALUES (0,53227,50004,TO_TIMESTAMP('2007-12-08 21:05:21','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Reference',TO_TIMESTAMP('2007-12-08 21:05:21','YYYY-MM-DD HH24:MI:SS'),100,0,'REF')
;
-- 08-dic-2007 21:05:21 CST
-- Default comment for updating dictionary
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=53227 AND EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Ref_List_ID!=t.AD_Ref_List_ID)
;
-- Dec 8, 2007 9:35:24 PM CST
-- Default comment for updating dictionary
INSERT INTO AD_Field (IsEncrypted,SortNo,AD_Org_ID,UpdatedBy,IsDisplayed,IsCentrallyMaintained,IsActive,Created,AD_Client_ID,AD_Field_ID,Description,DisplayLength,AD_Column_ID,IsFieldOnly,CreatedBy,Help,Updated,Name,AD_Tab_ID,IsSameLine,IsHeading,SeqNo,IsReadOnly,DisplayLogic,EntityType) VALUES ('N',0,0,0,'Y','Y','Y',TO_TIMESTAMP('2007-12-08 21:35:23','YYYY-MM-DD HH24:MI:SS'),0,53284,'System Reference and Validation',0,53269,'N',0,'The Reference could be a display type, list or table validation.',TO_TIMESTAMP('2007-12-08 21:35:23','YYYY-MM-DD HH24:MI:SS'),'Reference',50006,'N','N',270,'N','@Type@=''REF''','D')
;
-- 08-dic-2007 21:18:48 CST
-- Default comment for updating dictionary
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=53284 AND EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Field_ID!=t.AD_Field_ID)
;

View File

@ -0,0 +1,138 @@
DROP VIEW ad_field_v;
CREATE OR
REPLACE VIEW ad_field_v AS
SELECT t.ad_window_id,
f.ad_tab_id,
f.ad_field_id,
tbl.ad_table_id,
f.ad_column_id,
f.NAME,
f.description,
f.help,
f.isdisplayed,
f.displaylogic,
f.displaylength,
f.seqno,
f.sortno,
f.issameline,
f.isheading,
f.isfieldonly,
f.isreadonly,
f.isencrypted AS isencryptedfield,
f.obscuretype,
c.columnname,
c.columnsql,
c.fieldlength,
c.vformat,
COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey,
c.isparent,
COALESCE(f.ismandatory, c.ismandatory) AS ismandatory,
c.isidentifier,
c.istranslated,
COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
c.callout,
COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id,
COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id,
c.ad_process_id,
c.isalwaysupdateable,
c.readonlylogic,
c.isupdateable,
c.isencrypted AS isencryptedcolumn,
c.isselectioncolumn,
tbl.tablename,
c.valuemin,
c.valuemax,
fg.NAME AS fieldgroup,
vr.code AS validationcode,
f.Included_Tab_ID,
fg.FieldGroupType,
fg.IsCollapsedByDefault AS iscollapsedbydefault,
COALESCE(f.infofactoryclass, c.infofactoryclass) as infofactoryclass
FROM ((((((AD_FIELD f
JOIN AD_TAB t
ON ((f.ad_tab_id = t.ad_tab_id)))
LEFT JOIN AD_FIELDGROUP fg
ON ((f.ad_fieldgroup_id = fg.ad_fieldgroup_id)))
LEFT JOIN AD_COLUMN c
ON ((f.ad_column_id = c.ad_column_id)))
JOIN AD_TABLE tbl
ON ((c.ad_table_id = tbl.ad_table_id)))
JOIN AD_REFERENCE r
ON ((c.ad_reference_id = r.ad_reference_id)))
LEFT JOIN AD_VAL_RULE vr
ON ((vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id))))
WHERE ((f.isactive = 'Y'::bpchar) AND
(c.isactive = 'Y'::bpchar));
DROP VIEW ad_field_vt;
CREATE OR
REPLACE VIEW ad_field_vt AS
SELECT trl.AD_LANGUAGE,
t.ad_window_id,
f.ad_tab_id,
f.ad_field_id,
tbl.ad_table_id,
f.ad_column_id,
trl.NAME,
trl.description,
trl.help,
f.isdisplayed,
f.displaylogic,
f.displaylength,
f.seqno,
f.sortno,
f.issameline,
f.isheading,
f.isfieldonly,
f.isreadonly,
f.isencrypted AS isencryptedfield,
f.obscuretype,
c.columnname,
c.columnsql,
c.fieldlength,
c.vformat,
COALESCE(f.defaultvalue, c.defaultvalue) AS defaultvalue,
c.iskey,
c.isparent,
COALESCE(f.ismandatory, c.ismandatory) AS ismandatory,
c.isidentifier,
c.istranslated,
COALESCE(f.ad_reference_value_id, c.ad_reference_value_id) AS ad_reference_value_id,
c.callout,
COALESCE(f.ad_reference_id, c.ad_reference_id) AS ad_reference_id,
COALESCE(f.ad_val_rule_id, c.ad_val_rule_id) AS ad_val_rule_id,
c.ad_process_id,
c.isalwaysupdateable,
c.readonlylogic,
c.isupdateable,
c.isencrypted AS isencryptedcolumn,
c.isselectioncolumn,
tbl.tablename,
c.valuemin,
c.valuemax,
fgt.NAME AS fieldgroup,
vr.code AS validationcode,
f.Included_Tab_ID,
fg.FieldGroupType,
fg.IsCollapsedByDefault AS iscollapsedbydefault ,
COALESCE(f.infofactoryclass, c.infofactoryclass) as infofactoryclass
FROM (((((((AD_FIELD f
JOIN AD_FIELD_TRL trl
ON ((f.ad_field_id = trl.ad_field_id)))
JOIN AD_TAB t
ON ((f.ad_tab_id = t.ad_tab_id)))
LEFT JOIN AD_FIELDGROUP fg
ON (f.AD_FieldGroup_ID = fg.AD_FieldGroup_ID)
LEFT JOIN AD_FIELDGROUP_TRL fgt
ON (((f.ad_fieldgroup_id = fgt.ad_fieldgroup_id) AND
((trl.AD_LANGUAGE)::text = (fgt.AD_LANGUAGE)::text))))
LEFT JOIN AD_COLUMN c
ON ((f.ad_column_id = c.ad_column_id)))
JOIN AD_TABLE tbl
ON ((c.ad_table_id = tbl.ad_table_id)))
JOIN AD_REFERENCE r
ON ((c.ad_reference_id = r.ad_reference_id)))
LEFT JOIN AD_VAL_RULE vr
ON ((vr.ad_val_rule_id = COALESCE(f.ad_val_rule_id, c.ad_val_rule_id))))
WHERE ((f.isactive = 'Y'::bpchar) AND
(c.isactive = 'Y'::bpchar));

View File

@ -297,16 +297,12 @@ public class Adempiere implements Serializable
/** /**
* Calculate the number of days between start and end. * Calculate the number of days between start and end.
* @deprecated
* @param start start date * @param start start date
* @param end end date * @param end end date
* @return number of days (0 = same) * @return number of days (0 = same)
*/ */
static public int getDaysBetween (Timestamp start, Timestamp end) static public int getDaysBetween (Timestamp start, Timestamp end)
{ {
//check null
if (start == null || end == null) return 0;
boolean negative = false; boolean negative = false;
if (end.before(start)) if (end.before(start))
{ {
@ -329,6 +325,8 @@ public class Adempiere implements Serializable
calEnd.set(Calendar.SECOND, 0); calEnd.set(Calendar.SECOND, 0);
calEnd.set(Calendar.MILLISECOND, 0); calEnd.set(Calendar.MILLISECOND, 0);
// System.out.println("Start=" + start + ", End=" + end + ", dayStart=" + cal.get(Calendar.DAY_OF_YEAR) + ", dayEnd=" + calEnd.get(Calendar.DAY_OF_YEAR));
// in same year // in same year
if (cal.get(Calendar.YEAR) == calEnd.get(Calendar.YEAR)) if (cal.get(Calendar.YEAR) == calEnd.get(Calendar.YEAR))
{ {
@ -339,14 +337,11 @@ public class Adempiere implements Serializable
// not very efficient, but correct // not very efficient, but correct
int counter = 0; int counter = 0;
while (cal.get(Calendar.YEAR) < calEnd.get(Calendar.YEAR)) while (calEnd.after(cal))
{ {
GregorianCalendar yearEnd = new GregorianCalendar(cal.get(Calendar.YEAR), 12, 31, 0, 0, 0); cal.add (Calendar.DAY_OF_YEAR, 1);
int days = getDaysBetween(new Timestamp(cal.getTimeInMillis()), new Timestamp(yearEnd.getTimeInMillis())); counter++;
cal.add (Calendar.DAY_OF_YEAR, days + 1);
counter = counter + days + 1;
} }
counter = counter + getDaysBetween(new Timestamp(cal.getTimeInMillis()), new Timestamp(calEnd.getTimeInMillis()));
if (negative) if (negative)
return counter * -1; return counter * -1;
return counter; return counter;
@ -436,11 +431,11 @@ public class Adempiere implements Serializable
public static String charAt (String source, int posIndex) public static String charAt (String source, int posIndex)
{ {
posIndex = posIndex - 1; posIndex = posIndex - 1;
if (source == null || source.length() == 0 || posIndex < 0 || posIndex >= source.length()) if (source == null || source.length() == 0 || posIndex < 0 || posIndex > source.length())
return null; return null;
try try
{ {
return (source.substring(posIndex, posIndex+1)); return String.valueOf(source.charAt(posIndex));
} }
catch (Exception e) catch (Exception e)
{} {}