Merge 993a67369e42

This commit is contained in:
Heng Sin Low 2012-12-18 09:59:13 +08:00
commit 43dcf49178
6 changed files with 52 additions and 57 deletions

View File

@ -251,16 +251,6 @@ INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Clien
ALTER TABLE WS_WebServiceTypeAccess ADD WS_WebServiceTypeAccess_UU NVARCHAR2(36) DEFAULT NULL
;
-- Dec 17, 2012 12:03:20 PM IST
-- IDEMPIERE-460 Adding support for composite service
INSERT INTO AD_Column (IsEncrypted,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,AD_Column_UU,IsUpdateable,ColumnName,Name,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,IsAlwaysUpdateable) VALUES ('N',0,53163,205535,'D','N','N','N','N',36,'N',10,'N',1000001,'4a981564-a0d8-494e-b5a2-ae60bbb54404','Y','WS_WebServiceMethod_UU','WS_WebServiceMethod_UU',100,TO_DATE('2012-12-17 12:03:18','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-12-17 12:03:18','YYYY-MM-DD HH24:MI:SS'),100,0,'N')
;
-- Dec 17, 2012 12:03:20 PM IST
-- IDEMPIERE-460 Adding support for composite service
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=205535 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;

View File

@ -251,16 +251,6 @@ INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Clien
ALTER TABLE WS_WebServiceTypeAccess ADD COLUMN WS_WebServiceTypeAccess_UU VARCHAR(36) DEFAULT NULL
;
-- Dec 17, 2012 12:03:20 PM IST
-- IDEMPIERE-460 Adding support for composite service
INSERT INTO AD_Column (IsEncrypted,Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,AD_Element_ID,AD_Column_UU,IsUpdateable,ColumnName,Name,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,IsAlwaysUpdateable) VALUES ('N',0,53163,205535,'D','N','N','N','N',36,'N',10,'N',1000001,'4a981564-a0d8-494e-b5a2-ae60bbb54404','Y','WS_WebServiceMethod_UU','WS_WebServiceMethod_UU',100,TO_TIMESTAMP('2012-12-17 12:03:18','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-12-17 12:03:18','YYYY-MM-DD HH24:MI:SS'),100,0,'N')
;
-- Dec 17, 2012 12:03:20 PM IST
-- IDEMPIERE-460 Adding support for composite service
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Column_Trl_UU ) 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,Generate_UUID() FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=205535 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;

View File

@ -361,20 +361,14 @@ public class VAllocation extends Allocation
// Organization
if (name.equals("AD_Org_ID"))
{
if (value == null)
m_AD_Org_ID = 0;
else
m_AD_Org_ID = ((Integer) value).intValue();
m_AD_Org_ID = ((Integer) value).intValue();
loadBPartner();
}
// Charge
else if (name.equals("C_Charge_ID") )
{
if ( value == null )
m_C_Charge_ID = 0;
else
m_C_Charge_ID = ((Integer) value).intValue();
m_C_Charge_ID = ((Integer) value).intValue();
setAllocateButton();
}

View File

@ -16,6 +16,10 @@
*****************************************************************************/
package org.adempiere.webui.apps.form;
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_BPARTNER_ID;
import static org.compiere.model.SystemIDs.COLUMN_C_INVOICE_C_CURRENCY_ID;
import static org.compiere.model.SystemIDs.COLUMN_C_PERIOD_AD_ORG_ID;
import java.math.BigDecimal;
import java.util.Vector;
import java.util.logging.Level;
@ -47,18 +51,18 @@ import org.adempiere.webui.window.FDialog;
import org.compiere.apps.form.Allocation;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import static org.compiere.model.SystemIDs.*;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.Trx;
import org.compiere.util.TrxRunnable;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.North;
import org.zkoss.zul.South;
import org.zkoss.zul.Separator;
import org.zkoss.zul.South;
import org.zkoss.zul.Space;
/**
@ -409,20 +413,14 @@ public class WAllocation extends Allocation
// Organization
if (name.equals("AD_Org_ID"))
{
if (value == null)
m_AD_Org_ID = 0;
else
m_AD_Org_ID = ((Integer) value).intValue();
m_AD_Org_ID = ((Integer) value).intValue();
loadBPartner();
}
// Charge
else if (name.equals("C_Charge_ID") )
{
if ( value == null )
m_C_Charge_ID = 0;
else
m_C_Charge_ID = ((Integer) value).intValue();
m_C_Charge_ID = ((Integer) value).intValue();
setAllocateButton();
}
@ -535,10 +533,21 @@ public class WAllocation extends Allocation
Env.setContext(Env.getCtx(), form.getWindowNo(), "AD_Org_ID", m_AD_Org_ID);
else
Env.setContext(Env.getCtx(), form.getWindowNo(), "AD_Org_ID", "");
Trx trx = Trx.get(Trx.createTrxName("AL"), true);
statusBar.setStatusLine(saveData(form.getWindowNo(), dateField.getValue(), paymentTable, invoiceTable, trx.getTrxName()));
trx.commit();
trx.close();
try
{
Trx.run(new TrxRunnable()
{
public void run(String trxName)
{
statusBar.setStatusLine(saveData(form.getWindowNo(), dateField.getValue(), paymentTable, invoiceTable, trxName));
}
});
}
catch (Exception e)
{
FDialog.error(form.getWindowNo(), form, "Error", e.getLocalizedMessage());
return;
}
} // saveData
/**

View File

@ -195,9 +195,11 @@ public class WListItemRenderer implements ListitemRenderer<Object>, EventListene
int rowIndex, int columnIndex)
{
ListCell listcell = new ListCell();
WTableColumn column = getColumn(columnIndex);
if (column != null && column.getHeaderValue() != null) {
listcell.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, column.getHeaderValue().toString());
if (m_tableColumns.size() > columnIndex) {
WTableColumn column = getColumn(columnIndex);
if (column != null && column.getHeaderValue() != null) {
listcell.setWidgetAttribute(AdempiereWebUI.WIDGET_INSTANCE_NAME, column.getHeaderValue().toString());
}
}
boolean isCellEditable = table != null ? table.isCellEditable(rowIndex, columnIndex) : false;

View File

@ -138,9 +138,11 @@ public class Allocation
sql = new StringBuilder( MRole.getDefault(Env.getCtx(), false).addAccessSQL( sql.toString(), "p", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO ) );
log.fine("PaySQL=" + sql.toString());
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, m_C_Currency_ID);
pstmt.setTimestamp(2, (Timestamp)date);
pstmt.setInt(3, m_C_Currency_ID);
@ -148,7 +150,7 @@ public class Allocation
pstmt.setInt(5, m_C_BPartner_ID);
if (!isMultiCurrency)
pstmt.setInt(6, m_C_Currency_ID);
ResultSet rs = pstmt.executeQuery();
rs = pstmt.executeQuery();
while (rs.next())
{
Vector<Object> line = new Vector<Object>();
@ -171,13 +173,15 @@ public class Allocation
//
data.add(line);
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
finally
{
DB.close(rs, pstmt);
}
return data;
}
@ -266,9 +270,11 @@ public class Allocation
// role security
sql = new StringBuilder( MRole.getDefault(Env.getCtx(), false).addAccessSQL( sql.toString(), "i", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO ) );
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
pstmt = DB.prepareStatement(sql.toString(), null);
pstmt.setInt(1, m_C_Currency_ID);
pstmt.setTimestamp(2, (Timestamp)date);
pstmt.setInt(3, m_C_Currency_ID);
@ -278,7 +284,7 @@ public class Allocation
pstmt.setInt(7, m_C_BPartner_ID);
if (!isMultiCurrency)
pstmt.setInt(8, m_C_Currency_ID);
ResultSet rs = pstmt.executeQuery();
rs = pstmt.executeQuery();
while (rs.next())
{
Vector<Object> line = new Vector<Object>();
@ -309,13 +315,15 @@ public class Allocation
if (Env.ZERO.compareTo(open) != 0)
data.add(line);
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql.toString(), e);
}
finally
{
DB.close(rs, pstmt);
}
return data;
}
@ -441,6 +449,7 @@ public class Allocation
applied = applied.subtract(discount);
writeOff = Env.ZERO; // to be sure
overUnder = Env.ZERO;
totalDiff = Env.ZERO;
if (totalDiff.abs().compareTo(applied.abs()) < 0 // where less is available to allocate than open
&& totalDiff.signum() == applied.signum() ) // and the available amount has the same sign
@ -737,11 +746,12 @@ public class Allocation
// Allocation Line
MAllocationLine aLine = new MAllocationLine (alloc, chargeAmt.negate(),
Env.ZERO, Env.ZERO, Env.ZERO);
aLine.set_CustomColumn("C_Charge_ID", m_C_Charge_ID);
//aLine.set_CustomColumn("ChargeAmt", chargeAmt);
aLine.setC_Charge_ID(m_C_Charge_ID);
aLine.setC_BPartner_ID(m_C_BPartner_ID);
if (!aLine.save(trxName))
log.log(Level.SEVERE, "Allocation Line not saved - Charge=" + m_C_Charge_ID);
if (!aLine.save(trxName)) {
StringBuilder msg = new StringBuilder("Allocation Line not saved - Charge=").append(m_C_Charge_ID);
throw new AdempiereException(msg.toString());
}
unmatchedApplied = unmatchedApplied.add(chargeAmt);
}