From: <gv...@us...> - 2007-04-18 13:42:27
|
Revision: 2143 http://svn.sourceforge.net/adempiere/?rev=2143&view=rev Author: gvishi Date: 2007-04-18 06:42:29 -0700 (Wed, 18 Apr 2007) Log Message: ----------- Initial Commit of Plain Posterita Webstore Added Paths: ----------- contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ApproveOrderEmailTemplate.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateCustomerEmailTemplate.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateOrderEmailTemplate.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ShipmentDispatchedEmailTemplate.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/AttributeValueKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BPartnerKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BankKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/CBPartnerKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/LocatorKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/OrganisationKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/PriceListVersionKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeSetKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeValueKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RegionKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RoleKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/SalesRepKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/WarehouseKeyNamePair.java contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/WebProductCategoryKeyNamePair.java Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ApproveOrderEmailTemplate.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ApproveOrderEmailTemplate.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ApproveOrderEmailTemplate.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,116 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +/** + * @author vishee + */ + +package org.posterita.emailTemplate; + +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; +import org.posterita.bean.CustomerBean; +import org.posterita.utils.Constants; +import org.posterita.utils.EmailTemplate; +import org.posterita.utils.SimpleEmailLayout; + +public class ApproveOrderEmailTemplate extends EmailTemplate +{ + + public ApproveOrderEmailTemplate(Properties ctx, CustomerBean receiver, CustomerBean sender, MOrder order) + { + super(receiver, sender); + this.message = getMessage(order); + this.ctx = ctx; + } + + public String getMessage(MOrder order) + { + // Email Header str + // Email Content Dear Value Customer <%customer.name%>, we welcome you to villao. This is your email <% receiver.name%> + // Email Footer + + if (order == null) + return ""; + + MBPartner partner = new MBPartner(new Properties(), order.getC_BPartner_ID(), null); + + StringBuffer msg = new StringBuffer(); + + MOrderLine[] lines = order.getLines(); + String[] strArr = new String[] {"Name", "Quantity"}; + + msg.append( + SimpleEmailLayout.header + + email_bundle.getString(Constants.SUBJECT) + + SimpleEmailLayout.separator + + SimpleEmailLayout.openTagTR_TD + + "Dear " + partner.getName() + " " + partner.getName2() + " " + + email_bundle.getString(Constants.CONTENT) + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.EMAIL_SIGNIN_INFO) + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.space + + + SimpleEmailLayout.openTagTR_TD + + "SO Order ID: " + order.get_ID() + + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.space + + //Inner table for displaying order info + + SimpleEmailLayout.openInnerTable() + + SimpleEmailLayout.innerTableHeader(strArr)); + + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + + String productName = line.getProduct().getName(); + + //if (productName != null) + //productName = productName.replaceAll(ProductManager.PRODUCT_ATTRIBUTES_DELIMETER, " "); + + String[] fields = new String[] {productName, line.getQtyOrdered().toString()}; + + msg.append(SimpleEmailLayout.innerTableRow(fields)); + + } + msg.append( SimpleEmailLayout.closeInnerTable() + //End of inner table + + + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.LOGIN_LINK) + + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.EMAIL_REGARDS) + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.footer(email_bundle.getString(Constants.SUBJECT))); + + return msg.toString(); + } + + +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ApproveOrderEmailTemplate.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateCustomerEmailTemplate.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateCustomerEmailTemplate.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateCustomerEmailTemplate.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,89 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +/** + * @author vishee + */ + +package org.posterita.emailTemplate; + + +import java.util.Properties; + +import org.posterita.bean.CustomerBean; +import org.posterita.utils.Constants; +import org.posterita.utils.EmailTemplate; +import org.posterita.utils.SimpleEmailLayout; + +public class CreateCustomerEmailTemplate extends EmailTemplate +{ + + public CreateCustomerEmailTemplate(Properties ctx, CustomerBean receiver, CustomerBean sender) + { + super(receiver, sender); + this.message = getMessage(); + this.ctx = ctx; + } + + public String getMessage() + { + // Email Header str + // Email Content Dear Value Customer <%customer.name%>, we welcome you to villao. This is your email <% receiver.name%> + // Email Footer + + String message = + SimpleEmailLayout.header + + email_bundle.getString(Constants.SUBJECT) + + SimpleEmailLayout.separator + + SimpleEmailLayout.openTagTR_TD + + email_bundle.getString(Constants.CONTENT) + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.EMAIL_SIGNIN_INFO) + + SimpleEmailLayout.closeAndStartTagTR_TD + + email_bundle.getString(Constants.LOGIN) + + receiver.getEmail() + + SimpleEmailLayout.closeAndStartTagTR_TD + + email_bundle.getString(Constants.PASSWORD) + + receiver.getPassword() + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.LOGIN_LINK) + + SimpleEmailLayout.closeAndStartTagTR_TD + + (Constants.WEBSTORE_LINK) + + (Constants.WEBSTORE_LOGIN_ACTION) + + ".do?" + + email_bundle.getString(Constants.ACTION) + + "=" + + Constants.SUCCESS + + email_bundle.getString("&" + Constants.EMAIL) + + "=" + + receiver.getEmail() + + email_bundle.getString("&" + Constants.PASSWORD) + + "=" + + receiver.getPassword() + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.EMAIL_REGARDS) + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.footer(email_bundle.getString(Constants.SUBJECT)); + + return message; + } + +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateCustomerEmailTemplate.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateOrderEmailTemplate.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateOrderEmailTemplate.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateOrderEmailTemplate.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,160 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +/** + * @author vishee + */ + +package org.posterita.emailTemplate; + + +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MCharge; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; +import org.posterita.bean.CustomerBean; +import org.posterita.businesslogic.ChargeManager; +import org.posterita.exception.OperationException; +import org.posterita.utils.Constants; +import org.posterita.utils.EmailTemplate; +import org.posterita.utils.SimpleEmailLayout; + +public class CreateOrderEmailTemplate extends EmailTemplate +{ + + public CreateOrderEmailTemplate(Properties ctx, CustomerBean receiver, CustomerBean sender, MOrder order) + { + super(receiver, sender); + this.message = getMessage(order); + this.ctx = ctx; + } + + public String getMessage(MOrder order) + { + + if (order == null) + return ""; + + MBPartner partner = new MBPartner(new Properties(), order.getC_BPartner_ID(), null); + + StringBuffer msg = new StringBuffer(); + + MOrderLine[] lines = order.getLines(); + + msg.append( + SimpleEmailLayout.header + + email_bundle.getString(Constants.SUBJECT) + + SimpleEmailLayout.separator + + SimpleEmailLayout.openTagTR_TD + + partner.getName() + " " + partner.getName2() + " " + + email_bundle.getString(Constants.CONTENT) + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.EMAIL_SIGNIN_INFO) + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.space + + + SimpleEmailLayout.openTagTR_TD + + "SO Order ID: " + order.get_ID() + + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.space + + + + + + SimpleEmailLayout.openInnerTable() + + + "<tr bgcolor=\"#666666\">" + + SimpleEmailLayout.openTagTD + + "<font style=\"font-size:12px; font-family: Verdana,Arial,Helvetica; color: #FFFFFF;\">Name</font>" + + SimpleEmailLayout.closeTagTD + + + SimpleEmailLayout.openTagTD + + "<font style=\"font-size:12px; font-family: Verdana,Arial,Helvetica; color: #FFFFFF;\">Quantity</font>" + + SimpleEmailLayout.closeTagTD + + SimpleEmailLayout.closeTagTR); + + + + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + + String productName = ""; + + MCharge charge = null; + + if (line.getProduct() == null) + try + { + charge = (MCharge) ChargeManager.loadCharge(order.getCtx(), line.getC_Charge_ID(), null); + productName = charge.getName(); + } + catch (OperationException e) + { + // TODO Auto-generated catch block + e.printStackTrace(); + } + else + { + productName = line.getProduct().getName(); + } + + //if (productName != null) + //productName = productName.replaceAll(ProductManager.PRODUCT_ATTRIBUTES_DELIMETER, " "); + + + + + msg.append( + "<tr bgcolor=\"#CCCCCC\">" + + SimpleEmailLayout.openTagTD + + "<font style=\"font-size:12px; font-family: Verdana,Arial,Helvetica;\">" + productName + "</font>" + + SimpleEmailLayout.closeTagTD + + + SimpleEmailLayout.openTagTD + + "<font style=\"font-size:12px; font-family: Verdana,Arial,Helvetica;\">" + line.getQtyOrdered() + "</font>" + + SimpleEmailLayout.closeTagTD + + + + SimpleEmailLayout.closeTagTR + ); + } + + + + msg.append( SimpleEmailLayout.closeInnerTable() + + + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.LOGIN_LINK) + + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.EMAIL_REGARDS) + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.footer(email_bundle.getString(Constants.SUBJECT))); + + return msg.toString(); + } + +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/CreateOrderEmailTemplate.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ShipmentDispatchedEmailTemplate.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ShipmentDispatchedEmailTemplate.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ShipmentDispatchedEmailTemplate.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,116 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +/** + * @author vishee + */ + +package org.posterita.emailTemplate; + +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.model.MOrder; +import org.compiere.model.MOrderLine; +import org.posterita.bean.CustomerBean; +import org.posterita.utils.Constants; +import org.posterita.utils.EmailTemplate; +import org.posterita.utils.SimpleEmailLayout; + +public class ShipmentDispatchedEmailTemplate extends EmailTemplate +{ + + public ShipmentDispatchedEmailTemplate(Properties ctx, CustomerBean receiver, CustomerBean sender, MOrder order) + { + super(receiver, sender); + this.message = getMessage(order); + this.ctx = ctx; + } + + public String getMessage(MOrder order) + { + // Email Header str + // Email Content Dear Value Customer <%customer.name%>, we welcome you to villao. This is your email <% receiver.name%> + // Email Footer + + if (order == null) + return ""; + + MBPartner partner = new MBPartner(new Properties(), order.getC_BPartner_ID(), null); + + StringBuffer msg = new StringBuffer(); + + MOrderLine[] lines = order.getLines(); + String[] strArr = new String[] {"Name", "Quantity"}; + + msg.append( + SimpleEmailLayout.header + + email_bundle.getString(Constants.SUBJECT) + + SimpleEmailLayout.separator + + SimpleEmailLayout.openTagTR_TD + + "Dear " + partner.getName() + " " + partner.getName2() + " " + + email_bundle.getString(Constants.CONTENT) + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.EMAIL_SIGNIN_INFO) + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.space + + + SimpleEmailLayout.openTagTR_TD + + "SO Order ID: " + order.get_ID() + + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.space + + //Inner table for displaying order info + + SimpleEmailLayout.openInnerTable() + + SimpleEmailLayout.innerTableHeader(strArr)); + + for (int i = 0; i < lines.length; i++) + { + MOrderLine line = lines[i]; + + String productName = line.getProduct().getName(); + + //if (productName != null) + //productName = productName.replaceAll(ProductManager.PRODUCT_ATTRIBUTES_DELIMETER, " "); + + String[] fields = new String[] {productName, line.getQtyOrdered().toString()}; + + msg.append(SimpleEmailLayout.innerTableRow(fields)); + + } + msg.append( SimpleEmailLayout.closeInnerTable() + //End of inner table + + + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.LOGIN_LINK) + + + SimpleEmailLayout.closeTagTR_space_StartTagTR + + email_bundle.getString(Constants.EMAIL_REGARDS) + + SimpleEmailLayout.closeTagTD_TR + + SimpleEmailLayout.footer(email_bundle.getString(Constants.SUBJECT))); + + return msg.toString(); + } + + +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/emailTemplate/ShipmentDispatchedEmailTemplate.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/AttributeValueKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/AttributeValueKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/AttributeValueKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,109 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +package org.posterita.keynamepair; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MAttributeValue; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; +import org.posterita.exception.SystemException; + + +public class AttributeValueKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyPairs(Properties ctx, String attributeName) throws OperationException, SystemException + { + ArrayList<KeyNamePair> keyNamePairs = new ArrayList<KeyNamePair>(); + + int ad_client_id = Env.getAD_Client_ID(ctx); + + String sql = "select attrIns.m_attributevalue_id,attrVal.name ATTRIBUTE_VALUE " + + "from M_PRODUCT prod,M_ATTRIBUTEINSTANCE attrIns ,M_attribute attr,M_attributeValue attrVal " + + "where prod.M_ATTRIBUTESETINSTANCE_id = attrIns.M_ATTRIBUTESETINSTANCE_id " + + "and attr.m_attribute_id = attrIns.m_attribute_id " + + "and attrIns.m_attributevalue_id = attrVal.m_attributevalue_id " + + "and attr.name = '" + attributeName + "' " + + "and attr.AD_CLIENT_ID = " + ad_client_id; + + PreparedStatement pstmt = null; + + System.out.println("Query for attributeValueKeyNamePair : " + sql); + + try + { + pstmt = DB.prepareStatement(sql.toString(), null); + ResultSet rs = pstmt.executeQuery(); + KeyNamePair pair = null; + + + while(rs.next()) + { + pair = new KeyNamePair(rs.getInt(1),rs.getString(2)); + keyNamePairs.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw new SystemException(e); + } + finally + { + try + { + pstmt.close(); + } + catch (Exception ex) + { + } + + pstmt = null; + } + + return keyNamePairs; + } + + public static ArrayList<KeyNamePair> getKeyNamePairs(Properties ctx, Integer attributeId, String trxName) throws OperationException + { + ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>(); + + try + { + list = getData(ctx, MAttributeValue.Table_Name, "M_ATTRIBUTE_ID=" + attributeId + " and isactive = 'Y'", trxName); + + } + catch (SQLException e) { + throw new OperationException(e.getMessage()); + } + + return list; + } + +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/AttributeValueKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BPartnerKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BPartnerKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BPartnerKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,53 @@ +/** + * + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Oct 6, 2005 by praveen + * + */ +package org.posterita.keynamepair; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MBPartner; +import org.compiere.util.Env; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; + + +public class BPartnerKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ad_org_id=" + Env.getAD_Org_ID(ctx) + " and isactive = 'Y'"; + + try + { + return getData(ctx, MBPartner.Table_Name, sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } + +} + Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BPartnerKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BankKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BankKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BankKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,48 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +package org.posterita.keynamepair; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MBank; +import org.compiere.util.Env; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; + + +public class BankKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ad_org_id=" + Env.getAD_Org_ID(ctx) + " and isactive = 'Y'"; + + try + { + return getData(ctx, MBank.Table_Name, sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/BankKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/CBPartnerKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/CBPartnerKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/CBPartnerKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,108 @@ +/** + * + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Oct 6, 2005 by praveen + * + */ +package org.posterita.keynamepair; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.exception.SystemException; + + +public class CBPartnerKeyNamePair +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws SystemException + { + ArrayList<KeyNamePair> bpList = new ArrayList<KeyNamePair>(); + + int ad_client_id = Env.getAD_Client_ID(ctx); + //int ad_org_id = Env.getAD_Org_ID(ctx); + + //MOrg org = new MOrg(ctx,ad_org_id,null); + + String orgType = ""; + +/* if(org.isAutomobile()) + { + orgType = " and isAutomobile = 'Y'"; + } + else + { + orgType = " and isMotorcycle = 'Y'"; + }*/ + + String sql = "select bp.C_BPARTNER_ID,bp.NAME" + + " from AD_ORG org, C_BPARTNER bp" + + " where org.AD_CLIENT_ID = " + ad_client_id + + " and org.isRetailer = 'Y'" + + " and org.AD_CLIENT_ID = bp.AD_CLIENT_ID" + + " and org.AD_ORG_ID = bp.AD_ORG_ID" + + " and bp.isactive = 'Y'"; + + sql = sql + orgType; + + PreparedStatement pstmt = null; + + pstmt = DB.prepareStatement(sql,null); + ResultSet rs; + KeyNamePair pair = null; + + try + { + rs = pstmt.executeQuery(); + + while (rs.next()) + { + pair = new KeyNamePair(rs.getInt(1),rs.getString(2)); + bpList.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw new SystemException(e.getMessage()); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return bpList; + } + +} + Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/CBPartnerKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/LocatorKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/LocatorKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/LocatorKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,100 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +package org.posterita.keynamepair; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MLocator; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.exception.OperationException; + +public class LocatorKeyNamePair +{ + public static ArrayList getKeyNamePair(Properties ctx) throws OperationException + { + ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>(); + + PreparedStatement prepStmt = null; + + try + { + int adOrgId = Env.getAD_Org_ID(ctx); + int adClientId = Env.getAD_Client_ID(ctx); + + String sqlStatement = "select M_LOCATOR_ID, VALUE from " + MLocator.Table_Name + " where AD_ORG_ID=" + adOrgId + " and AD_CLIENT_ID=" + adClientId + " and isactive = 'Y'"; + + prepStmt = DB.prepareStatement(sqlStatement, null); + ResultSet rs = prepStmt.executeQuery(); + + while(rs.next()) + { + int id = rs.getInt(1); + String name = rs.getString(2); + + KeyNamePair keyPair = new KeyNamePair(id, name); + list.add(keyPair); + } + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + return list; + } + + public static KeyNamePair getKeyNamePair(Properties ctx, int locatorId) throws OperationException + { + PreparedStatement prepStmt = null; + KeyNamePair keyPair = null; + try + { + int adOrgId = Env.getAD_Org_ID(ctx); + int adClientId = Env.getAD_Client_ID(ctx); + + String sqlStatement = "select M_LOCATOR_ID, VALUE from " + MLocator.Table_Name + " where AD_ORG_ID=" + adOrgId + " and AD_CLIENT_ID=" + adClientId + " and M_LOCATOR_ID=" + locatorId; + + prepStmt = DB.prepareStatement(sqlStatement, null); + ResultSet rs = prepStmt.executeQuery(); + + while(rs.next()) + { + int id = rs.getInt(1); + String name = rs.getString(2); + + keyPair = new KeyNamePair(id, name); + } + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + return keyPair; + } +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/LocatorKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/OrganisationKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/OrganisationKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/OrganisationKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,48 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +package org.posterita.keynamepair; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MOrg; +import org.compiere.util.KeyNamePair; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; + + +public class OrganisationKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList<KeyNamePair> getKeyNamePairs(Properties ctx, Integer orgId) throws OperationException + { + String sql = "AD_ORG_ID = " + orgId + " and isactive = 'Y'"; + + try + { + return getData(ctx, MOrg.Table_Name,sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/OrganisationKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/PriceListVersionKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/PriceListVersionKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/PriceListVersionKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,49 @@ +/** + * + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Aug 19, 2005 by praveen + * + */ +package org.posterita.keynamepair; + +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MPriceListVersion; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; + +public class PriceListVersionKeyNamePair +{ + public static ArrayList getKeyNamePairs(Properties ctx) + { + ArrayList<KeyNamePair> list = new ArrayList<KeyNamePair>(); + int id[] = MPriceListVersion.getAllIDs(MPriceListVersion.Table_Name,"AD_Client_id = "+Env.getAD_Client_ID(ctx),null); + + for(int i=0; i<id.length; i++) + { + MPriceListVersion mPriceListVersion = new MPriceListVersion(ctx, id[i], null); + KeyNamePair pair = mPriceListVersion.getKeyNamePair(); + list.add(pair); + } + + return list; + } +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/PriceListVersionKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,51 @@ +/** + * + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Jul 28, 2005 by praveen + * + */ +package org.posterita.keynamepair; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MAttribute; +import org.compiere.util.Env; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; + +public class ProductAttributeKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and ad_org_id=" + Env.getAD_Org_ID(ctx) + " order by m_attribute_id" + " and isactive = 'Y'"; + + try + { + return getData(ctx, MAttribute.Table_Name, sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } + +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeSetKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeSetKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeSetKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,51 @@ +/** + * + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Jul 28, 2005 by praveen + * + */ +package org.posterita.keynamepair; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MAttributeSet; +import org.compiere.util.Env; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; + +public class ProductAttributeSetKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and isactive = 'Y'"; + + try + { + return getData(ctx, MAttributeSet.Table_Name, sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } + +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeSetKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeValueKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeValueKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeValueKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,52 @@ +/** + * + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Jul 29, 2005 by praveen + * + */ +package org.posterita.keynamepair; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MAttributeValue; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; + +public class ProductAttributeValueKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList<KeyNamePair> getKeyNamePairs(Properties ctx, int attributeId, int productcategoryId) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + " and m_attribute_id=" + attributeId + " and m_product_category_id=" + productcategoryId + " and isactive = 'Y'"; + + try + { + return getData(ctx, MAttributeValue.Table_Name, sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } + +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/ProductAttributeValueKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RegionKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RegionKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RegionKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,47 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +package org.posterita.keynamepair; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MRegion; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; + + +public class RegionKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePairs(Properties ctx, Integer countryId) throws OperationException + { + String sql = "c_country_id = " + countryId + " and isactive = 'Y'"; + + try + { + return getData(ctx, MRegion.Table_Name,sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + } +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RegionKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RoleKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RoleKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RoleKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,49 @@ +/** + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +package org.posterita.keynamepair; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MRole; +import org.compiere.util.Env; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; + +public class RoleKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyName(Properties ctx) throws OperationException + { + String sql = "ad_client_id=" + Env.getAD_Client_ID(ctx) + "and ad_org_id=" + Env.getAD_Org_ID(ctx) + " and isactive = 'Y'"; + + try + { + return getData(ctx, MRole.Table_Name,sql); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + } +} Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/RoleKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/SalesRepKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/SalesRepKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/SalesRepKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,105 @@ +/** + * + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on Oct 6, 2005 by praveen + * + */ +package org.posterita.keynamepair; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.model.MOrg; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.KeyNamePair; +import org.posterita.exception.SystemException; + + +public class SalesRepKeyNamePair +{ + /** + * returns an arraylist of keyname pairs. + * key -> user_id + * name -> username + */ + public static ArrayList getKeyNamePairs(Properties ctx) throws SystemException + { + ArrayList<KeyNamePair> srList = new ArrayList<KeyNamePair>(); + + int ad_client_id = Env.getAD_Client_ID(ctx); + int ad_org_id = Env.getAD_Org_ID(ctx); + + new MOrg(ctx,ad_org_id,null); + + + String sql = "select c_bpartner_id,name " + + "from c_bpartner " + + "where issalesrep = 'Y' " + + "and isactive = 'Y' " + + "and ad_client_id = ? " + + "and ad_org_id = ? "; + + + PreparedStatement pstmt = null; + + pstmt = DB.prepareStatement(sql, null); + ResultSet rs; + KeyNamePair pair = null; + + try + { + pstmt.setInt(1,ad_client_id); + pstmt.setInt(2,ad_org_id); + + rs = pstmt.executeQuery(); + + while (rs.next()) + { + pair = new KeyNamePair(rs.getInt(1),rs.getString(2)); + srList.add(pair); + } + + rs.close(); + } + catch (SQLException e) + { + throw new SystemException(e.getMessage()); + } + finally + { + try + { + pstmt.close(); + } + catch(Exception e) + {} + + pstmt = null; + } + + return srList; + } + +} + Property changes on: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/SalesRepKeyNamePair.java ___________________________________________________________________ Name: svn:executable + * Added: contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/WarehouseKeyNamePair.java =================================================================== --- contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/WarehouseKeyNamePair.java (rev 0) +++ contributions/posteritaWebstore/WEB-INF/src/org/posterita/keynamepair/WarehouseKeyNamePair.java 2007-04-18 13:42:29 UTC (rev 2143) @@ -0,0 +1,72 @@ +/** + * + * Product: Posterita Web-Based POS, Webstore and Adempiere Plugin + * Copyright (C) 2007 Posterita Ltd + * This file is part of POSterita + * + * POSterita is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Created on 29-Jul-2005 by alok + * + */ +package org.posterita.keynamepair; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Properties; + +import org.compiere.util.Env; +import org.posterita.core.KeyNamePairUtil; +import org.posterita.exception.OperationException; + + +public class WarehouseKeyNamePair extends KeyNamePairUtil +{ + public static ArrayList getKeyNamePair(Properties ctx) throws OperationException + { + ArrayList list = new ArrayList(); + + try + { + list = getData(ctx,"M_WAREHOUSE","AD_ORG_ID="+ Env.getAD_Org_ID(ctx) + " and ad_client_Id=" + Env.getAD_Client_ID(ctx)+ " and isactive = 'Y'"); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + return list; + + } + + public static ArrayList getKeyNamePair(Properties ctx,int warehouseId) throws OperationException + { + ArrayList list = new ArrayList(); + + + + try + { + list = getData(ctx,"M_WAREHOUSE","AD_ORG_ID="+ Env.getAD_Org_ID(ctx) + " and ad_client_Id=" + Env.getAD_Client_ID(ctx)+ " and isactive = 'Y' and m_warehouse_id<>"+warehouseId); + } + catch (SQLException e) + { + throw new OperationException(e.getMessage()); + } + + return list; + + } +} Property changes on: contributions/poster... [truncated message content] |