hg merge release-2.0 (merge release2 into development)

This commit is contained in:
Carlos Ruiz 2014-03-07 22:20:51 -05:00
commit 5583a606c2
30 changed files with 201 additions and 90 deletions

View File

@ -0,0 +1,23 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Mar 7, 2014 10:13:16 PM COT
-- IDEMPIERE-85 Add confirmation on TreeMaintenance when moving all nodes
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','Add to Tree',200255,'D','0f54ecd3-b5ea-47de-8ff9-a3a7ffe0826f','AddToTree','Y',TO_DATE('2014-03-07 22:13:15','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-07 22:13:15','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 7, 2014 10:13:32 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','Add ALL to Tree',200256,'D','b544cbd4-9d28-401d-93a5-6351b6480108','AddAllToTree','Y',TO_DATE('2014-03-07 22:13:32','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-07 22:13:32','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 7, 2014 10:13:44 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','Delete from Tree',200257,'D','27c456c5-4044-4502-8e7b-f42e1097f25b','DeleteFromTree','Y',TO_DATE('2014-03-07 22:13:43','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-07 22:13:43','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 7, 2014 10:13:54 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','Delete ALL from Tree',200258,'D','ed972baa-3e1b-4819-b62a-fbf8047cd62d','DeleteAllFromTree','Y',TO_DATE('2014-03-07 22:13:53','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-03-07 22:13:53','YYYY-MM-DD HH24:MI:SS'),0,0)
;
SELECT register_migration_script('201403072215_IDEMPIERE-85.sql') FROM dual
;

View File

@ -0,0 +1,20 @@
-- Mar 7, 2014 10:13:16 PM COT
-- IDEMPIERE-85 Add confirmation on TreeMaintenance when moving all nodes
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','Add to Tree',200255,'D','0f54ecd3-b5ea-47de-8ff9-a3a7ffe0826f','AddToTree','Y',TO_TIMESTAMP('2014-03-07 22:13:15','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-07 22:13:15','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 7, 2014 10:13:32 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','Add ALL to Tree',200256,'D','b544cbd4-9d28-401d-93a5-6351b6480108','AddAllToTree','Y',TO_TIMESTAMP('2014-03-07 22:13:32','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-07 22:13:32','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 7, 2014 10:13:44 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','Delete from Tree',200257,'D','27c456c5-4044-4502-8e7b-f42e1097f25b','DeleteFromTree','Y',TO_TIMESTAMP('2014-03-07 22:13:43','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-07 22:13:43','YYYY-MM-DD HH24:MI:SS'),0,0)
;
-- Mar 7, 2014 10:13:54 PM COT
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('I','Delete ALL from Tree',200258,'D','ed972baa-3e1b-4819-b62a-fbf8047cd62d','DeleteAllFromTree','Y',TO_TIMESTAMP('2014-03-07 22:13:53','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-03-07 22:13:53','YYYY-MM-DD HH24:MI:SS'),0,0)
;
SELECT register_migration_script('201403072215_IDEMPIERE-85.sql') FROM dual
;

View File

@ -38,7 +38,7 @@ import org.compiere.util.Msg;
* @author victor.perez@e-evolution.com, www.e-evolution.com
* <li>RF [ 2214883 ] Remove SQL code and Replace for Query http://sourceforge.net/tracker/index.php?func=detail&aid=2214883&group_id=176962&atid=879335
*/
public final class MAcctSchemaElement extends X_C_AcctSchema_Element
public class MAcctSchemaElement extends X_C_AcctSchema_Element
{

View File

@ -49,7 +49,7 @@ import org.compiere.util.Msg;
* <li>BF [ 2880182 ] Error you can allocate a payment to invoice that was paid
* <li> https://sourceforge.net/tracker/index.php?func=detail&aid=2880182&group_id=176962&atid=879332
*/
public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
public class MAllocationHdr extends X_C_AllocationHdr implements DocAction
{
/**
*

View File

@ -29,7 +29,7 @@ import org.compiere.util.CLogger;
*
* @author Mario Calderon / Carlos Ruiz
*/
public final class MCity extends X_C_City
public class MCity extends X_C_City
implements Comparator<Object>, Serializable
{
/**

View File

@ -147,7 +147,7 @@ public class MCostDetail extends X_M_CostDetail
BigDecimal Amt, BigDecimal Qty,
String Description, String trxName)
{
MCostDetail cd = get (as.getCtx(), "C_InvoiceLine_ID=? AND Coalesce(M_CostElement_ID,0)="+M_CostElement_ID,
MCostDetail cd = get (as.getCtx(), "C_InvoiceLine_ID=? AND Coalesce(M_CostElement_ID,0)="+M_CostElement_ID+" AND M_Product_ID="+M_Product_ID,
C_InvoiceLine_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName);
//
if (cd == null) // createNew
@ -921,6 +921,16 @@ public class MCostDetail extends X_M_CostDetail
private boolean process (MAcctSchema as, MProduct product, MCostElement ce,
int Org_ID, int M_ASI_ID)
{
//handle compatibility issue between average invoice and average po
String costingMethod = product.getCostingMethod(as);
if (X_M_Cost.COSTINGMETHOD_AverageInvoice.equals(costingMethod)) {
if (ce.isAveragePO())
return true;
} else if (X_M_Cost.COSTINGMETHOD_AveragePO.equals(costingMethod)) {
if (ce.isAverageInvoice())
return true;
}
MCost cost = MCost.get(product, M_ASI_ID, as,
Org_ID, ce.getM_CostElement_ID(), get_TrxName());
@ -1139,7 +1149,7 @@ public class MCostDetail extends X_M_CostDetail
{
if (adjustment)
{
String costingMethod = getM_InventoryLine().getM_Inventory().getCostingMethod();
costingMethod = getM_InventoryLine().getM_Inventory().getCostingMethod();
if (MCostElement.COSTINGMETHOD_AverageInvoice.equals(costingMethod))
{
cost.setWeightedAverage(amt.multiply(cost.getCurrentQty()), qty);
@ -1164,7 +1174,7 @@ public class MCostDetail extends X_M_CostDetail
{
if (adjustment)
{
String costingMethod = getM_InventoryLine().getM_Inventory().getCostingMethod();
costingMethod = getM_InventoryLine().getM_Inventory().getCostingMethod();
if (MCostElement.COSTINGMETHOD_AveragePO.equals(costingMethod))
{
cost.setWeightedAverage(amt.multiply(cost.getCurrentQty()), qty);
@ -1234,7 +1244,7 @@ public class MCostDetail extends X_M_CostDetail
{
if (adjustment)
{
String costingMethod = getM_InventoryLine().getM_Inventory().getCostingMethod();
costingMethod = getM_InventoryLine().getM_Inventory().getCostingMethod();
if (MCostElement.COSTINGMETHOD_StandardCosting.equals(costingMethod))
{
cost.add(amt.multiply(cost.getCurrentQty()), qty);

View File

@ -41,7 +41,7 @@ import static org.compiere.model.SystemIDs.*;
* * @author Michael Judd (Akuna Ltd)
* <li>BF [ 2695078 ] Country is not translated on invoice
*/
public final class MCountry extends X_C_Country
public class MCountry extends X_C_Country
implements Comparator<Object>, Serializable
{
/**

View File

@ -37,7 +37,7 @@ import org.compiere.util.Msg;
* @author Jorg Janke
* @version $Id: MPaySelectionCheck.java,v 1.3 2006/07/30 00:51:02 jjanke Exp $
*/
public final class MPaySelectionCheck extends X_C_PaySelectionCheck
public class MPaySelectionCheck extends X_C_PaySelectionCheck
{
/**
*

View File

@ -77,7 +77,7 @@ import org.compiere.util.ValueNamePair;
* @author Carlos Ruiz - globalqss [ 2141475 ] Payment <> allocations must not be completed - implement lots of validations on prepareIt
* @version $Id: MPayment.java,v 1.4 2006/10/02 05:18:39 jjanke Exp $
*/
public final class MPayment extends X_C_Payment
public class MPayment extends X_C_Payment
implements DocAction, ProcessCall, PaymentInterface
{

View File

@ -40,7 +40,7 @@ import static org.compiere.model.SystemIDs.*;
* @author Jorg Janke
* @version $Id: MRegion.java,v 1.3 2006/07/30 00:58:36 jjanke Exp $
*/
public final class MRegion extends X_C_Region
public class MRegion extends X_C_Region
implements Comparator<Object>, Serializable
{
/**

View File

@ -33,7 +33,7 @@ import org.compiere.wf.MWFNode;
* @author Jorg Janke
* @version $Id: MTreeNode.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
*/
public final class MTreeNode extends DefaultMutableTreeNode
public class MTreeNode extends DefaultMutableTreeNode
{
/**
*

View File

@ -125,10 +125,10 @@ public class VTreeMaintenance extends TreeMaintenance
cbAllNodes.setEnabled (false);
cbAllNodes.setText (Msg.translate(Env.getCtx(), "IsAllNodes"));
treeInfo.setText (" ");
bAdd.setToolTipText("Add to Tree");
bAddAll.setToolTipText("Add ALL to Tree");
bDelete.setToolTipText("Delete from Tree");
bDeleteAll.setToolTipText("Delete ALL from Tree");
bAdd.setToolTipText(Msg.getMsg(Env.getCtx(), "AddToTree"));
bAddAll.setToolTipText(Msg.getMsg(Env.getCtx(), "AddAllToTree"));
bDelete.setToolTipText(Msg.getMsg(Env.getCtx(), "DeleteFromTree"));
bDeleteAll.setToolTipText(Msg.getMsg(Env.getCtx(), "DeleteAllFromTree"));
bAdd.addActionListener(this);
bAddAll.addActionListener(this);
bDelete.addActionListener(this);

View File

@ -77,7 +77,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
/**
*
*/
private static final long serialVersionUID = 6505634026383902627L;
private static final long serialVersionUID = 5875869799688466929L;
private static final String SAVED_CONTEXT = "saved.context";
@ -103,8 +103,6 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
public static final String EXECUTION_CARRYOVER_SESSION_KEY = "execution.carryover";
public static final String ZK_DESKTOP_SESSION_KEY = "zk.desktop";
private static final String CLIENT_INFO = "client.info";
private static boolean eventThreadEnabled = false;
@ -246,7 +244,6 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
IDesktop appDesktop = createDesktop();
appDesktop.setClientInfo(clientInfo);
appDesktop.createPart(this.getPage());
ctx.put(ZK_DESKTOP_SESSION_KEY, new WeakReference<Desktop>(this.getPage().getDesktop()));
this.getPage().getDesktop().setAttribute(APPLICATION_DESKTOP_KEY, new WeakReference<IDesktop>(appDesktop));
//track browser tab per session

View File

@ -34,7 +34,6 @@ import java.util.logging.Level;
import javax.servlet.ServletRequest;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.desktop.IDesktop;
import org.adempiere.webui.session.SessionManager;
@ -749,8 +748,7 @@ public final class AEnv
if (inUIThread) {
return Executions.getCurrent().getDesktop();
} else {
@SuppressWarnings("unchecked")
WeakReference<Desktop> ref = (WeakReference<Desktop>) Env.getCtx().get(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY);
WeakReference<Desktop> ref = DesktopRunnable.getThreadLocalDesktop();
return ref != null ? ref.get() : null;
}
}

View File

@ -0,0 +1,49 @@
/**
*
*/
package org.adempiere.webui.apps;
import java.lang.ref.WeakReference;
import org.zkoss.zk.ui.Desktop;
/**
* If your background task need access to desktop, wrap your runnable with this, i.e new DesktopRunnable(yourRunnable, desktop).
* You can then use AEnv.getDesktop() in your runnable to get access to desktop.
* @author hengsin
*
*/
public class DesktopRunnable implements Runnable {
private Runnable runnable;
private WeakReference<Desktop> desktopWeakRef;
private static ThreadLocal<WeakReference<Desktop>> threadLocalDesktop = new ThreadLocal<WeakReference<Desktop>>() {
protected WeakReference<Desktop> initialValue()
{
return null;
}
};
public DesktopRunnable(Runnable runnable, Desktop desktop) {
this.runnable = runnable;
this.desktopWeakRef = new WeakReference<Desktop>(desktop);
}
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
@Override
public void run() {
try {
threadLocalDesktop.set(desktopWeakRef);
runnable.run();
} finally {
threadLocalDesktop.remove();
}
}
/* package */static WeakReference<Desktop> getThreadLocalDesktop() {
return threadLocalDesktop.get();
}
}

View File

@ -6,7 +6,6 @@ import static org.compiere.model.SystemIDs.PROCESS_M_INOUT_GENERATE;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.lang.ref.WeakReference;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -20,8 +19,6 @@ import java.util.logging.Level;
import org.adempiere.util.Callback;
import org.adempiere.util.ContextRunnable;
import org.adempiere.util.IProcessUI;
import org.adempiere.util.ServerContext;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel;
@ -108,9 +105,10 @@ import com.lowagie.text.pdf.PdfWriter;
public class ProcessDialog extends Window implements EventListener<Event>, IProcessUI, IHelpContext
{
/**
* generate serial version ID
*
*/
private static final long serialVersionUID = 5545731871518761455L;
private static final long serialVersionUID = 6316822220179816250L;
private static final String MESSAGE_DIV_STYLE = "max-height: 150pt; overflow: auto; margin: 10px;";
private Div messageDiv;
private Center center;
@ -347,15 +345,8 @@ public class ProcessDialog extends Window implements EventListener<Event>, IProc
}
public void runProcess() {
//prepare context for background thread
Properties context = ServerContext.getCurrentInstance();
if (context.get(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY) == null) {
Desktop desktop = this.getDesktop();
context.put(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY, new WeakReference<Desktop>(desktop));
}
processDialogRunnable = new ProcessDialogRunnable();
future = Adempiere.getThreadPoolExecutor().submit(processDialogRunnable);
future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(processDialogRunnable, getDesktop()));
}
private void onComplete() {

View File

@ -17,7 +17,6 @@
package org.adempiere.webui.apps;
import java.io.File;
import java.lang.ref.WeakReference;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -30,8 +29,6 @@ import java.util.logging.Level;
import org.adempiere.util.Callback;
import org.adempiere.util.ContextRunnable;
import org.adempiere.util.IProcessUI;
import org.adempiere.util.ServerContext;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel;
@ -50,7 +47,6 @@ import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.au.out.AuEcho;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
@ -74,13 +70,14 @@ import org.zkoss.zul.Vlayout;
*/
public class ProcessModalDialog extends Window implements EventListener<Event>, IProcessUI, DialogEvents
{
/**
*
*/
private static final long serialVersionUID = -3708004619583382450L;
private static final String ON_STATUS_UPDATE = "onStatusUpdate";
private static final String ON_COMPLETE = "onComplete";
/**
* generated serial version ID
*/
private static final long serialVersionUID = -7109707014309321369L;
private boolean m_autoStart;
private VerticalBox dialogBody;
@ -379,15 +376,8 @@ public class ProcessModalDialog extends Window implements EventListener<Event>,
* internal use, don't call this directly
*/
public void runProcess() {
//prepare context for background thread
Properties context = ServerContext.getCurrentInstance();
if (context.get(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY) == null) {
Desktop desktop = this.getDesktop();
context.put(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY, new WeakReference<Desktop>(desktop));
}
processDialogRunnable = new ProcessDialogRunnable();
future = Adempiere.getThreadPoolExecutor().submit(processDialogRunnable);
future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(processDialogRunnable, getDesktop()));
}
private void hideBusyDialog() {

View File

@ -144,10 +144,10 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
cbAllNodes.setEnabled (false);
cbAllNodes.setText (Msg.translate(Env.getCtx(), "IsAllNodes"));
treeInfo.setText (" ");
bAdd.setTooltiptext("Add to Tree");
bAddAll.setTooltiptext("Add ALL to Tree");
bDelete.setTooltiptext("Delete from Tree");
bDeleteAll.setTooltiptext("Delete ALL from Tree");
bAdd.setTooltiptext(Msg.getMsg(Env.getCtx(), "AddToTree"));
bAddAll.setTooltiptext(Msg.getMsg(Env.getCtx(), "AddAllToTree"));
bDelete.setTooltiptext(Msg.getMsg(Env.getCtx(), "DeleteFromTree"));
bDeleteAll.setTooltiptext(Msg.getMsg(Env.getCtx(), "DeleteAllFromTree"));
bAdd.addActionListener(this);
bAddAll.addActionListener(this);
bDelete.addActionListener(this);

View File

@ -49,6 +49,7 @@ public class WFNodeContainer
private int currentRow = 1;
private int currentColumn = 0;
private int noOfColumns = 4;
private int maxColumn = 0;
private int rowCount = 0;
private WorkflowGraphScene graphScene = new WorkflowGraphScene();
@ -146,6 +147,9 @@ public class WFNodeContainer
w.setRow(currentRow);
nodes[currentColumn - 1] = node.getAD_WF_Node_ID();
if (currentColumn > maxColumn) {
maxColumn = currentColumn;
}
if (currentRow < oldRow) {
currentRow = oldRow;
@ -227,6 +231,10 @@ public class WFNodeContainer
return noOfColumns;
}
public int getMaxColumnWithNode() {
return maxColumn;
}
public GraphScene<Integer, MWFNodeNext> getGraphScene() {
return graphScene;
}

View File

@ -187,14 +187,15 @@ public class WFPanel extends Borderlayout implements EventListener<Event>, IHelp
try {
int row = nodeContainer.getRowCount();
int maxCol = nodeContainer.getMaxColumnWithNode();
for(int i = 0; i < row; i++) {
Tr tr = new Tr();
table.appendChild(tr);
for(int c = 0; c < 4; c++) {
for(int c = 0; c < maxCol; c++) {
BufferedImage t = new BufferedImage(WFGraphLayout.COLUMN_WIDTH, WFGraphLayout.ROW_HEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics2D tg = t.createGraphics();
Td td = new Td();
// td.setStyle("border: 1px dotted lightgray");
td.setSclass("workflow-panel-table");
tr.appendChild(td);
int x = c * WFGraphLayout.COLUMN_WIDTH;

View File

@ -14,6 +14,7 @@
package org.adempiere.webui.desktop;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.adempiere.webui.AdempiereWebUI;
@ -26,6 +27,7 @@ import org.compiere.model.MMenu;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Session;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Window.Mode;
@ -39,13 +41,10 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
private transient ClientInfo clientInfo;
private List<Object> windows = null;
@SuppressWarnings("unused")
private static final CLogger logger = CLogger.getCLogger(AbstractDesktop.class);
public AbstractDesktop() {
windows = new ArrayList<Object>();
}
/**
@ -112,6 +111,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
* @param win
*/
public int registerWindow(Object win) {
List<Object> windows = getWindows();
int retValue = windows.size();
windows.add(win);
return retValue;
@ -121,6 +121,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
* @param WindowNo
*/
public void unregisterWindow(int WindowNo) {
List<Object> windows = getWindows();
if (WindowNo < windows.size())
windows.set(WindowNo, null);
Env.clearWinContext(WindowNo);
@ -132,6 +133,7 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
* @return Object
*/
public Object findWindow(int WindowNo) {
List<Object> windows = getWindows();
if (WindowNo < windows.size())
return windows.get(WindowNo);
else
@ -297,7 +299,14 @@ public abstract class AbstractDesktop extends AbstractUIPart implements IDesktop
}
protected List<Object> getWindows(){
return windows;
Session session = getComponent().getDesktop().getSession();
@SuppressWarnings("unchecked")
List<Object> list = (List<Object>) session.getAttribute("windows.list");
if (list == null) {
list = new ArrayList<Object>();
session.setAttribute("windows.list", list);
}
return Collections.synchronizedList(list);
}
}

View File

@ -30,6 +30,7 @@ import org.adempiere.util.ServerContext;
import org.adempiere.webui.adwindow.ADWindow;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.BusyDialog;
import org.adempiere.webui.apps.DesktopRunnable;
import org.adempiere.webui.apps.ProcessDialog;
import org.adempiere.webui.apps.WReport;
import org.adempiere.webui.component.Tab;
@ -266,7 +267,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
}
};
Adempiere.getThreadPoolExecutor().submit(runnable);
Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(runnable,layout.getDesktop()));
ToolBar toolbar = new ToolBar();
windowContainer.getComponent().appendChild(toolbar);

View File

@ -17,7 +17,6 @@
package org.adempiere.webui.session;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -133,8 +132,6 @@ public class SessionContextListener implements ExecutionInit,
//set locale
Locales.setThreadLocal(Env.getLanguage(ServerContext.getCurrentInstance()).getLocale());
}
Properties ctx = ServerContext.getCurrentInstance();
ctx.put(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY, new WeakReference<Desktop>(exec.getDesktop()));
}
}

View File

@ -48,6 +48,7 @@ public interface ITheme {
//stylesheet url
public static final String THEME_STYLESHEET = "/css/theme.css.dsp";
//http://books.zkoss.org/wiki/ZK_Developer's_Reference/Internationalization/Locale-Dependent_Resources#Specifying_Locale-_and_browser-dependent_URL
public static final String THEME_STYLESHEET_BY_BROWSER = "/css/theme*.css.dsp*";
//theme preference

View File

@ -21,7 +21,6 @@ import static org.compiere.model.SystemIDs.WINDOW_PRINTFORMAT;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.StringWriter;
import java.lang.ref.WeakReference;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
@ -36,11 +35,10 @@ import javax.servlet.http.HttpServletRequest;
import org.adempiere.exceptions.DBException;
import org.adempiere.pdf.Document;
import org.adempiere.util.ContextRunnable;
import org.adempiere.util.ServerContext;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.apps.BusyDialog;
import org.adempiere.webui.apps.DesktopRunnable;
import org.adempiere.webui.apps.WReport;
import org.adempiere.webui.apps.form.WReportCustomization;
import org.adempiere.webui.component.Checkbox;
@ -138,7 +136,7 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
/**
*
*/
private static final long serialVersionUID = 6208607687967139151L;
private static final long serialVersionUID = 3463776496724974142L;
/** Window No */
private int m_WindowNo = -1;
@ -461,21 +459,14 @@ public class ZkReportViewer extends Window implements EventListener<Event>, ITab
}
private void renderReport() {
//prepare context for background thread
Properties context = ServerContext.getCurrentInstance();
if (context.get(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY) == null) {
Desktop desktop = this.getDesktop();
context.put(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY, new WeakReference<Desktop>(desktop));
}
media = null;
Listitem selected = previewType.getSelectedItem();
if (selected == null || "PDF".equals(selected.getValue())) {
future = Adempiere.getThreadPoolExecutor().submit(new PDFRendererRunnable(this));
future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(new PDFRendererRunnable(this),getDesktop()));
} else if ("HTML".equals(previewType.getSelectedItem().getValue())) {
future = Adempiere.getThreadPoolExecutor().submit(new HTMLRendererRunnable(this));
future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(new HTMLRendererRunnable(this),getDesktop()));
} else if ("XLS".equals(previewType.getSelectedItem().getValue())) {
future = Adempiere.getThreadPoolExecutor().submit(new XLSRendererRunnable(this));
future = Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(new XLSRendererRunnable(this),getDesktop()));
}
}

View File

@ -1764,6 +1764,10 @@ table.z-vbox > tbody > tr > td > table {
.workflow-activity-form {
}
.workflow-panel-table {
border: 0px;
}
<%-- find window --%>
.find-window {
}

View File

@ -0,0 +1,2 @@
<%@ page contentType="text/css;charset=UTF-8" %>
<%@ taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" %>

View File

@ -0,0 +1,2 @@
<%@ page contentType="text/css;charset=UTF-8" %>
<%@ taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" %>

View File

@ -421,7 +421,8 @@ public class Allocation
if (col == i_payment)
{
if ( open.signum() > 0 && applied.signum() == -open.signum() )
if (! MSysConfig.getBooleanValue("ALLOW_APPLY_PAYMENT_TO_CREDITMEMO", false, Env.getAD_Client_ID(Env.getCtx()))
&& open.signum() > 0 && applied.signum() == -open.signum() )
applied = applied.negate();
if (! MSysConfig.getBooleanValue("ALLOW_OVER_APPLIED_PAYMENT", false, Env.getAD_Client_ID(Env.getCtx())))
if ( open.abs().compareTo( applied.abs() ) < 0 )
@ -758,7 +759,7 @@ public class Allocation
}
if ( unmatchedApplied.signum() != 0 )
log.log(Level.SEVERE, "Allocation not balanced -- out by " + unmatchedApplied );
throw new AdempiereException("Allocation not balanced -- out by " + unmatchedApplied);
// Should start WF
if (alloc.get_ID() != 0)

View File

@ -26,6 +26,7 @@ import org.compiere.model.MTree_NodeMM;
import org.compiere.model.MTree_NodePR;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
public class TreeMaintenance {
@ -51,14 +52,29 @@ public class TreeMaintenance {
String fromClause = m_tree.getSourceTableName(false); // fully qualified
String columnNameX = m_tree.getSourceTableName(true);
String actionColor = m_tree.getActionColorName();
String sql = "SELECT t." + columnNameX
+ "_ID,t.Name,t.Description,t.IsSummary,"
+ actionColor
+ " FROM " + fromClause
// + " WHERE t.IsActive='Y'" // R/O
+ " ORDER BY 2";
sql = MRole.getDefault().addAccessSQL(sql,
String fieldName = null;
String fieldDescription = null;
String join = null;
if (m_tree.getTreeType().equals(MTree.TREETYPE_Menu) // IDEMPIERE-1581 (see MTree.getNodeDetails)
&& ! Env.isBaseLanguage(Env.getCtx(), "AD_Menu")) {
fieldName = "trl.Name";
fieldDescription ="trl.Description";
join = " LEFT JOIN AD_Menu_Trl trl ON (t.AD_Menu_ID = trl.AD_Menu_ID AND trl.AD_Language='"
+ Env.getAD_Language(Env.getCtx()) + "')";
} else {
fieldName ="t.Name";
fieldDescription ="t.Description";
join = "";
}
StringBuilder sqlb = new StringBuilder("SELECT t.")
.append(columnNameX)
.append("_ID,").append(fieldName).append(",").append(fieldDescription).append(",t.IsSummary,")
.append(actionColor)
.append(" FROM ").append(fromClause).append(join)
// .append(" WHERE t.IsActive='Y'") // R/O
.append(" ORDER BY 2");
String sql = MRole.getDefault().addAccessSQL(sqlb.toString(),
"t", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
log.config(sql);
//