From 786f6c191544122169de295a5861d1e69a17a8ed Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Mon, 15 Sep 2008 13:38:22 +0000 Subject: [PATCH] BF [ 2104835 ] NULLS LAST not supported in postgresql 8.2 or earlier http://sourceforge.net/tracker/?func=detail&atid=879332&aid=2104835&group_id=176962 --- base/src/org/eevolution/model/MPPProductPlanning.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/base/src/org/eevolution/model/MPPProductPlanning.java b/base/src/org/eevolution/model/MPPProductPlanning.java index 414b9adfe1..a386609d39 100644 --- a/base/src/org/eevolution/model/MPPProductPlanning.java +++ b/base/src/org/eevolution/model/MPPProductPlanning.java @@ -12,6 +12,7 @@ * For the text or an alternative of this public license, you may reach us * * Copyright (C) 2003-2007 e-Evolution,SC. All Rights Reserved. * * Contributor(s): Victor Perez www.e-evolution.com * + * Teo Sarca, www.arhipac.ro * *****************************************************************************/ package org.eevolution.model; @@ -151,7 +152,9 @@ public class MPPProductPlanning extends X_PP_Product_Planning + " AND (S_Resource_ID IN (0,?) OR S_Resource_ID IS NULL)"; return new Query(ctx, Table_Name, whereClause, trxName) .setParameters(new Object[]{Env.getAD_Client_ID(ctx), M_Product_ID, AD_Org_ID, M_Warehouse_ID, S_Resource_ID}) - .setOrderBy("AD_Org_ID is null, AD_Org_ID DESC, M_Warehouse_ID is null,M_Warehouse_ID DESC , S_Resource_ID is null, S_Resource_ID DESC ") + .setOrderBy("COALESCE(AD_Org_ID, 0) DESC" + +", COALESCE(M_Warehouse_ID, 0) DESC" + +", COALESCE(S_Resource_ID, 0) DESC") .first(); }