From 3b98a7654161356b4616fcb1928d6e398a9fe41a Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Fri, 30 May 2008 19:34:40 +0000 Subject: [PATCH] MPrintFormat.getPrintFormat_ID * db fix * javadoc fix --- base/src/org/compiere/print/MPrintFormat.java | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/base/src/org/compiere/print/MPrintFormat.java b/base/src/org/compiere/print/MPrintFormat.java index 8b13b940be..f60a0659ae 100644 --- a/base/src/org/compiere/print/MPrintFormat.java +++ b/base/src/org/compiere/print/MPrintFormat.java @@ -856,30 +856,15 @@ public class MPrintFormat extends X_AD_PrintFormat //begin vpj-cd e-evolution /** - * Get ID of Print Format use Name - * @param String formatName - * @return int retValue + * Get ID of Print Format use Name + * @param String formatName + * @param AD_Table_ID + * @param AD_Client_ID + * @return AD_PrintFormat_ID */ public static int getPrintFormat_ID(String formatName, int AD_Table_ID, int AD_Client_ID) { - int retValue = 0; - String SQL = "SELECT AD_PrintFormat_ID FROM AD_PrintFormat WHERE Name = ? AND AD_Table_ID = ? AND AD_Client_ID = ?"; - try - { - PreparedStatement pstmt = DB.prepareStatement(SQL, null); - pstmt.setString(1, formatName); - pstmt.setInt(2, AD_Table_ID); - pstmt.setInt(3, AD_Client_ID); - ResultSet rs = pstmt.executeQuery(); - if (rs.next()) - retValue = rs.getInt(1); - rs.close(); - pstmt.close(); - } - catch (SQLException e) - { - retValue = -1; - } - return retValue; + final String sql = "SELECT AD_PrintFormat_ID FROM AD_PrintFormat WHERE Name = ? AND AD_Table_ID = ? AND AD_Client_ID = ?"; + return DB.getSQLValue(null, sql, formatName, AD_Table_ID, AD_Client_ID); } //end vpj-cd e-evolution