hg merge release-1.0c (forward-porting)

This commit is contained in:
Carlos Ruiz 2013-09-05 14:40:02 -05:00
commit e9844b4724
22 changed files with 119 additions and 31 deletions

View File

@ -0,0 +1,15 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Sep 4, 2013 2:23:31 PM COT
-- IDEMPIERE-1329 Images are being saved with EntityType=D
ALTER TABLE AD_Image MODIFY EntityType VARCHAR2(40) DEFAULT 'U'
;
-- Sep 4, 2013 2:23:32 PM COT
UPDATE AD_Image SET EntityType='U' WHERE EntityType IS NULL OR (EntityType='D' AND AD_Image_ID>=1000000)
;
SELECT register_migration_script('201309041432_IDEMPIERE-1329.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- Sep 4, 2013 2:23:31 PM COT
-- IDEMPIERE-1329 Images are being saved with EntityType=D
INSERT INTO t_alter_column values('ad_image','EntityType','VARCHAR(40)',null,'U')
;
-- Sep 4, 2013 2:23:32 PM COT
UPDATE AD_Image SET EntityType='U' WHERE EntityType IS NULL OR (EntityType='D' AND AD_Image_ID>=1000000)
;
SELECT register_migration_script('201309041432_IDEMPIERE-1329.sql') FROM dual
;

View File

@ -44,6 +44,7 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Evaluatee; import org.compiere.util.Evaluatee;
import org.compiere.util.Evaluator; import org.compiere.util.Evaluator;
import org.compiere.util.Util;
/** /**
* Grid Field Model. * Grid Field Model.
@ -897,8 +898,17 @@ public class GridField
*/ */
public String get_ValueAsString (Properties ctx, String variableName) public String get_ValueAsString (Properties ctx, String variableName)
{ {
//ref column
String foreignColumn = "";
int f = variableName.indexOf('.');
if (f > 0) {
foreignColumn = variableName.substring(f+1, variableName.length());
variableName = variableName.substring(0, f);
}
String value = null;
if( m_vo.TabNo == 0) if( m_vo.TabNo == 0)
return Env.getContext (ctx, m_vo.WindowNo, variableName, true); value = Env.getContext (ctx, m_vo.WindowNo, variableName, true);
else else
{ {
boolean tabOnly = false; boolean tabOnly = false;
@ -907,8 +917,27 @@ public class GridField
variableName = variableName.substring(1); variableName = variableName.substring(1);
tabOnly = true; tabOnly = true;
} }
return Env.getContext (ctx, m_vo.WindowNo, m_vo.TabNo, variableName, tabOnly, true); value = Env.getContext (ctx, m_vo.WindowNo, m_vo.TabNo, variableName, tabOnly, true);
} }
if (!Util.isEmpty(value) && !Util.isEmpty(foreignColumn) && variableName.endsWith("_ID")
&& getGridTab() != null) {
String refValue = "";
int id = 0;
try {
id = Integer.parseInt(value);
} catch (Exception e){}
if (id > 0) {
MColumn column = MColumn.get(ctx, getGridTab().getTableName(), variableName);
if (column != null) {
String foreignTable = column.getReferenceTableName();
refValue = DB.getSQLValueString(null,
"SELECT " + foreignColumn + " FROM " + foreignTable + " WHERE "
+ foreignTable + "_ID = ?", id);
}
}
return refValue;
}
return value;
} // get_ValueAsString } // get_ValueAsString

View File

@ -2451,7 +2451,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// Table Open? // Table Open?
if (!m_mTable.isOpen()) if (!m_mTable.isOpen())
{ {
if (targetRow >= 0)
log.log (Level.SEVERE, "Table not open", new Exception("Table not open")); log.log (Level.SEVERE, "Table not open", new Exception("Table not open"));
return -1; return -1;
} }
// Row Count // Row Count

View File

@ -266,7 +266,7 @@ public class MAllocationLine extends X_C_AllocationLine
log.warning("C_BPartner_ID different - Invoice=" + getC_BPartner_ID() + " - Payment=" + payment.getC_BPartner_ID()); log.warning("C_BPartner_ID different - Invoice=" + getC_BPartner_ID() + " - Payment=" + payment.getC_BPartner_ID());
if (reverse) if (reverse)
{ {
if (!payment.isCashTrx()) if (!payment.isCashbookTrx())
{ {
payment.setIsAllocated(false); payment.setIsAllocated(false);
payment.saveEx(); payment.saveEx();

View File

@ -41,7 +41,7 @@ public class MDocType extends X_C_DocType
/** /**
* *
*/ */
private static final long serialVersionUID = 2641885482012907072L; private static final long serialVersionUID = -6556521509479670059L;
/** /**
* Return the first Doc Type for this BaseType * Return the first Doc Type for this BaseType
@ -357,4 +357,14 @@ public class MDocType extends X_C_DocType
return relatedDocTypeId; return relatedDocTypeId;
} }
/**
* Get translated doctype name
* @return Name if available translated
*/
public String getNameTrl()
{
return get_Translation (COLUMNNAME_Name, Env.getAD_Language(getCtx()));
} // getNameTrl
} // MDocType } // MDocType

View File

@ -591,7 +591,7 @@ public class MInOut extends X_M_InOut implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo()); StringBuilder msgreturn = new StringBuilder().append(dt.getNameTrl()).append(" ").append(getDocumentNo());
return msgreturn.toString(); return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo

View File

@ -204,7 +204,7 @@ public class MInventory extends X_M_Inventory implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo()); StringBuilder msgreturn = new StringBuilder().append(dt.getNameTrl()).append(" ").append(getDocumentNo());
return msgreturn.toString(); return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo

View File

@ -1046,7 +1046,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo()); StringBuilder msgreturn = new StringBuilder().append(dt.getNameTrl()).append(" ").append(getDocumentNo());
return msgreturn.toString(); return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo

View File

@ -887,7 +887,7 @@ public class MJournal extends X_GL_Journal implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo()); StringBuilder msgreturn = new StringBuilder().append(dt.getNameTrl()).append(" ").append(getDocumentNo());
return msgreturn.toString(); return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo

View File

@ -808,7 +808,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
StringBuilder msgreturn = new StringBuilder().append(dt.getName()).append(" ").append(getDocumentNo()); StringBuilder msgreturn = new StringBuilder().append(dt.getNameTrl()).append(" ").append(getDocumentNo());
return msgreturn.toString(); return msgreturn.toString();
} // getDocumentInfo } // getDocumentInfo

View File

@ -153,7 +153,7 @@ public class MMovement extends X_M_Movement implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo(); return dt.getNameTrl() + " " + getDocumentNo();
} // getDocumentInfo } // getDocumentInfo
/** /**

View File

@ -591,7 +591,7 @@ public class MOrder extends X_C_Order implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID() > 0 ? getC_DocType_ID() : getC_DocTypeTarget_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID() > 0 ? getC_DocType_ID() : getC_DocTypeTarget_ID());
return dt.getName() + " " + getDocumentNo(); return dt.getNameTrl() + " " + getDocumentNo();
} // getDocumentInfo } // getDocumentInfo
/** /**

View File

@ -200,7 +200,7 @@ public final class MPayment extends X_C_Payment
} // resetNew } // resetNew
/** /**
* Is Cashbook Transfer Trx * Is Cash Trx
* @return true if Cash Trx * @return true if Cash Trx
*/ */
public boolean isCashTrx() public boolean isCashTrx()
@ -208,6 +208,14 @@ public final class MPayment extends X_C_Payment
return "X".equals(getTenderType()); return "X".equals(getTenderType());
} // isCashTrx } // isCashTrx
/**
* Is Cashbook Trx
* @return true if this is a cashbook trx
*/
public boolean isCashbookTrx() {
return isCashTrx() && !MSysConfig.getBooleanValue(MSysConfig.CASH_AS_PAYMENT, true , getAD_Client_ID());
}
/************************************************************************** /**************************************************************************
* Set Credit Card. * Set Credit Card.
* Need to set PatmentProcessor after Amount/Currency Set * Need to set PatmentProcessor after Amount/Currency Set
@ -650,7 +658,7 @@ public final class MPayment extends X_C_Payment
{ {
// @Trifon - CashPayments // @Trifon - CashPayments
//if ( getTenderType().equals("X") ) { //if ( getTenderType().equals("X") ) {
if ( isCashTrx() && !MSysConfig.getBooleanValue(MSysConfig.CASH_AS_PAYMENT, true , getAD_Client_ID())) { if ( isCashbookTrx()) {
// Cash Book Is mandatory // Cash Book Is mandatory
if ( getC_CashBook_ID() <= 0 ) { if ( getC_CashBook_ID() <= 0 ) {
log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@")); log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@"));
@ -1965,7 +1973,7 @@ public final class MPayment extends X_C_Payment
// @Trifon - CashPayments // @Trifon - CashPayments
//if ( getTenderType().equals("X") ) { //if ( getTenderType().equals("X") ) {
if ( isCashTrx() && !MSysConfig.getBooleanValue(MSysConfig.CASH_AS_PAYMENT, true , getAD_Client_ID())) { if ( isCashbookTrx()) {
// Create Cash Book entry // Create Cash Book entry
if ( getC_CashBook_ID() <= 0 ) { if ( getC_CashBook_ID() <= 0 ) {
log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@")); log.saveError("Error", Msg.parseTranslation(getCtx(), "@Mandatory@: @C_CashBook_ID@"));
@ -2048,6 +2056,7 @@ public final class MPayment extends X_C_Payment
return DocAction.STATUS_Completed; return DocAction.STATUS_Completed;
} // completeIt } // completeIt
/** /**
* Set the definite document number after completed * Set the definite document number after completed
*/ */
@ -2750,7 +2759,7 @@ public final class MPayment extends X_C_Payment
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo(); return dt.getNameTrl() + " " + getDocumentNo();
} // getDocumentInfo } // getDocumentInfo
/** /**

View File

@ -206,7 +206,7 @@ public class MRMA extends X_M_RMA implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo(); return dt.getNameTrl() + " " + getDocumentNo();
} // getDocumentInfo } // getDocumentInfo
/** /**

View File

@ -70,7 +70,7 @@ public class DocActionTemplate extends PO implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), 0); MDocType dt = MDocType.get(getCtx(), 0);
return dt.getName() + " " + getDocumentNo(); return dt.getNameTrl() + " " + getDocumentNo();
} // getDocumentInfo } // getDocumentInfo
/** /**

View File

@ -289,6 +289,8 @@ public class Evaluator
// log.fine( variable); // log.fine( variable);
if (variable.startsWith("~")) if (variable.startsWith("~"))
variable = variable.substring(1); variable = variable.substring(1);
if (variable.indexOf(".") > 0)
variable = variable.substring(0, variable.indexOf("."));
list.add(variable); list.add(variable);
} }
} // parseDepends } // parseDepends

View File

@ -387,7 +387,7 @@ public class MDDOrder extends X_DD_Order implements DocAction
public String getDocumentInfo() public String getDocumentInfo()
{ {
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
return dt.getName() + " " + getDocumentNo(); return dt.getNameTrl() + " " + getDocumentNo();
} // getDocumentInfo } // getDocumentInfo
/** /**

View File

@ -928,6 +928,10 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
{ {
gridTab.resetDetailForNewParentRecord(); gridTab.resetDetailForNewParentRecord();
} }
else
{
gridTab.setCurrentRow(-1, true);
}
} }
/** /**

View File

@ -219,7 +219,7 @@ public class WAttachment extends Window implements EventListener<Event>
this.setMaximizable(true); this.setMaximizable(true);
this.setWidth("700px"); this.setWidth("700px");
this.setHeight("85%"); this.setHeight("85%");
this.setTitle("Attachment"); this.setTitle(Msg.getMsg(Env.getCtx(), "Attachment"));
this.setClosable(true); this.setClosable(true);
this.setSizable(true); this.setSizable(true);
this.setBorder("normal"); this.setBorder("normal");

View File

@ -82,6 +82,8 @@ public class WImageDialog extends Window implements EventListener<Event>
if (m_mImage == null) if (m_mImage == null)
m_mImage = MImage.get (Env.getCtx(), 0); m_mImage = MImage.get (Env.getCtx(), 0);
else else
{
if (m_mImage.getData()!=null)
{ {
try { try {
AImage aImage = new AImage(m_mImage.getName(), m_mImage.getData()); AImage aImage = new AImage(m_mImage.getName(), m_mImage.getData());
@ -91,6 +93,7 @@ public class WImageDialog extends Window implements EventListener<Event>
log.log(Level.WARNING, "load image", e); log.log(Level.WARNING, "load image", e);
} }
} }
}
fileButton.setLabel(m_mImage.getName()); fileButton.setLabel(m_mImage.getName());
AEnv.showCenterScreen(this); AEnv.showCenterScreen(this);
@ -183,8 +186,9 @@ public class WImageDialog extends Window implements EventListener<Event>
} }
else if (m_mImage != null && m_mImage.getAD_Image_ID() > 0) else if (m_mImage != null && m_mImage.getAD_Image_ID() > 0)
{ {
m_mImage.deleteEx(true); m_mImage.setBinaryData(null);
m_mImage = null; m_mImage.setName("-");
m_mImage.saveEx();
} }
detach(); detach();
} }
@ -197,6 +201,7 @@ public class WImageDialog extends Window implements EventListener<Event>
{ {
AImage img = null; AImage img = null;
image.setContent(img); image.setContent(img);
fileButton.setLabel("-");
} }
} }

View File

@ -96,7 +96,7 @@ function Calc()
var value = calcText.value; var value = calcText.value;
if (separator != '.') if (separator != '.')
{ {
var re = new RegExp("[" + separator + "]"); var re = new RegExp("[" + separator + "]", "g");
value = value.replace(re,'.'); value = value.replace(re,'.');
} }
var result = "" + eval(value); var result = "" + eval(value);