Refactoring of Create Client/U_WebMenu in Posterita

This commit is contained in:
shameem_z 2007-10-29 12:49:26 +00:00
parent adfa9e6453
commit f6c57ad49a
6 changed files with 212 additions and 498 deletions

View File

@ -30,10 +30,12 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.compiere.model.MStore;
import org.compiere.util.Env;
import org.posterita.Constants;
import org.posterita.beans.ApplicationParametersBean;
import org.posterita.businesslogic.ApplicationManager;
import org.posterita.businesslogic.StoreManager;
import org.posterita.core.TmkJSPEnv;
import org.posterita.exceptions.DefaultStoreException;
import org.posterita.lib.UdiConstants;
@ -51,10 +53,11 @@ public class GoToHomePageAction extends BaseDispatchAction
try
{
ApplicationManager.changeApplication(request, response);
Properties ctx = TmkJSPEnv.getCtx(request);
String forward = Env.getContext(ctx, UdiConstants.WEBPARAM6);
Properties ctx = Env.getCtx();
MStore store = StoreManager.getDefaultStore(ctx);
ApplicationManager.setApplicationParametersInContext(ctx, store.get_ID());
ctx = TmkJSPEnv.getCtx(request);
String forward = Env.getContext(ctx, UdiConstants.DEFAULT_FORWARD);
return mapping.findForward(forward);
}
@ -65,39 +68,38 @@ public class GoToHomePageAction extends BaseDispatchAction
}
}
public static final String LICENSE_INVALID = "clientLicensing";
public static final String CHOOSE_APPLICATION = "chooseApplication";
public ActionForward setApplicationParameters(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
DefaultForm df = (DefaultForm) form;
ApplicationParametersBean bean = (ApplicationParametersBean) df.getBean();
String appName = bean.getApplicationName();
Integer storeId = bean.getStoreId();
try
// Store not defined, should go to default store or choose from different stores
if (storeId == null)
{
ApplicationManager.changeApplication(request, response, appName);
Properties ctx = TmkJSPEnv.getCtx(request);
String defaultAppName = ApplicationManager.getApplicationType(ctx).toUpperCase();
String displayAppName = ApplicationManager.getApplicationName(bean.getApplicationName());
request.getSession().getServletContext().setAttribute(Constants.APP_NAME,displayAppName);
ApplicationManager.setApplicationNameInCookie(response, appName);
String forward = Env.getContext(ctx, UdiConstants.WEBPARAM6);
return mapping.findForward(forward);
return goToHomePage(mapping, form, request, response);
}
catch(DefaultStoreException ex)
Properties ctx = Env.getCtx();
MStore store = new MStore(ctx, storeId, null);
if (store.get_ID() == 0)
{
postGlobalError("error.store.default", ex.getMessage(), request);
return mapping.findForward(CHOOSE_APPLICATION);
//TODO: Add error message showing no store error to user
mapping.findForward(CHOOSE_APPLICATION);
}
ApplicationManager.setApplicationParametersInContext(ctx, storeId);
ctx = TmkJSPEnv.getCtx(request);
request.getSession().getServletContext().setAttribute(Constants.APP_NAME, bean.getApplicationName());
return mapping.findForward(UdiConstants.DEFAULT_FORWARD);
}
public static final String INIT_CHOOSE_APPLICATION = "initChooseApplication";

View File

@ -35,7 +35,7 @@ import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;
import org.compiere.model.MSession;
import org.compiere.model.MUser;
import org.compiere.model.X_U_Menu;
import org.compiere.model.X_U_WebMenu;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.WebUser;
@ -60,7 +60,7 @@ import org.posterita.exceptions.UserInactiveException;
import org.posterita.exceptions.UserNotFoundException;
import org.posterita.exceptions.WrongPasswordException;
import org.posterita.lib.UdiConstants;
import org.posterita.model.UDIU_Menu;
import org.posterita.model.U_WebMenu;
import org.posterita.struts.core.BaseDispatchAction;
import org.posterita.struts.core.DefaultForm;
import org.posterita.user.WebUserInfo;
@ -104,11 +104,11 @@ public class LoginAction extends BaseDispatchAction
if(userId != null)
{
X_U_Menu xmenu = new X_U_Menu(ctx,0,null);
X_U_WebMenu xmenu = new X_U_WebMenu(ctx,0,null);
xmenu.setName("Switch User");
xmenu.setMenuLink("LoginUserAction.do?action=loginUser&userId=" + userId);
UDIU_Menu menu = new UDIU_Menu(xmenu);
U_WebMenu menu = new U_WebMenu(xmenu);
//MenuItem menuItem = new MenuItem(menu);
leftMenusList.add(new MenuItem(menu));
}
@ -165,7 +165,8 @@ public class LoginAction extends BaseDispatchAction
WebUserInfo wuInfo = (WebUserInfo)session.getAttribute(WebUserInfo.NAME);
String appName = ApplicationManager.getApplicationType(ctx);
int storeId = Env.getContextAsInt(TmkJSPEnv.getCtx(request), UdiConstants.WSTORE_CTX_PARAM);
if (wuInfo != null)
{
WebUser wu = wuInfo.getUser();
@ -173,21 +174,16 @@ public class LoginAction extends BaseDispatchAction
wu.logout();
session.removeAttribute(WebUserInfo.NAME);
session.setMaxInactiveInterval(0);
}
if(appName.endsWith(Constants.APP_POS))
session.setMaxInactiveInterval(0);
try
{
ApplicationManager.changeApplication(request, response);
ctx = Env.getCtx();
ApplicationManager.setApplicationParametersInContext(ctx, storeId);
ctx = TmkJSPEnv.getCtx(request);
String forward = Env.getContext(ctx, UdiConstants.WEBPARAM6);
return mapping.findForward(forward);
return mapping.findForward(UdiConstants.DEFAULT_FORWARD);
}
catch(Exception ex)
{
@ -250,48 +246,36 @@ public class LoginAction extends BaseDispatchAction
return (mapping.getInputForward());
}
String strPosId = POSManager.getPOSIDFromCookie(request);
boolean isValidPOSId = false;
if(strPosId != null)
{
try
{
int posId = Integer.parseInt(strPosId);
isValidPOSId = POSManager.isPOSTerminalPresent(ctx, posId);
}
catch(Exception ex)
{}
}
String applicationName = ApplicationManager.getApplicationType(ctx);
if(applicationName.endsWith(Constants.APP_POS))
{
String strPosId = POSManager.getPOSIDFromCookie(request);
if(!isValidPOSId)
{
ArrayList list=POSManager.getAllPOSIDs(ctx);
request.getSession().setAttribute(Constants.POSIDS,list);
return mapping.findForward(CHOOSEPOS);
boolean isValidPOSId = false;
if(strPosId != null)
{
try
{
int posId = Integer.parseInt(strPosId);
isValidPOSId = POSManager.isPOSTerminalPresent(ctx, posId);
}
catch(Exception ex)
{}
}
if(!isValidPOSId)
{
ArrayList list=POSManager.getAllPOSIDs(ctx);
request.getSession().setAttribute(Constants.POSIDS,list);
return mapping.findForward(CHOOSEPOS);
}
else
{
SessionStorage.putPOSID(ctx,strPosId,request);
String currSymboleSales = POSTerminalManager.getPOSDefaultSellCurrency(ctx).getCurSymbol();
String currSymbolePurchase=POSTerminalManager.getPOSDefaultPurchaseCurrency(ctx).getCurSymbol();
request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales);
request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE_PURCHASE,currSymbolePurchase);
return mapping.findForward(CREATEPOSORDER);
}
}
return mapping.findForward(SUCCESS);
}
else
{
SessionStorage.putPOSID(ctx,strPosId,request);
String currSymboleSales = POSTerminalManager.getPOSDefaultSellCurrency(ctx).getCurSymbol();
String currSymbolePurchase=POSTerminalManager.getPOSDefaultPurchaseCurrency(ctx).getCurSymbol();
request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales);
request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE_PURCHASE,currSymbolePurchase);
return mapping.findForward(CREATEPOSORDER);
}
}
public ActionForward password(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception

View File

@ -128,50 +128,37 @@ public class POSLoginAction extends BaseDispatchAction
}
String applicationName = ApplicationManager.getApplicationType(ctx);
if(applicationName.endsWith(Constants.APP_POS))
String strPosId = POSManager.getPOSIDFromCookie(request);
boolean isValidPOSId = false;
if(strPosId != null)
{
String strPosId = POSManager.getPOSIDFromCookie(request);
boolean isValidPOSId = false;
if(strPosId != null)
try
{
try
{
int posId = Integer.parseInt(strPosId);
isValidPOSId = POSManager.isPOSTerminalPresent(ctx, posId);
}
catch(Exception ex)
{}
int posId = Integer.parseInt(strPosId);
isValidPOSId = POSManager.isPOSTerminalPresent(ctx, posId);
}
if(!isValidPOSId)
{
ArrayList list=POSManager.getAllPOSIDs(ctx);
request.getSession().setAttribute(Constants.POSIDS,list);
return mapping.findForward(CHOOSEPOS);
}
else
{
SessionStorage.putPOSID(ctx,strPosId,request);
String currSymboleSales = POSTerminalManager.getPOSDefaultSellCurrency(ctx).getCurSymbol();
String currSymbolePurchase=POSTerminalManager.getPOSDefaultPurchaseCurrency(ctx).getCurSymbol();
request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales);
request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE_PURCHASE,currSymbolePurchase);
return mapping.findForward(CREATEPOSORDER);
}
catch(Exception ex)
{}
}
SessionStorage.putOrg(ctx, request);
SessionStorage.putWebstoreUser(ctx, request, info.getUser().getAD_User_ID());
return mapping.findForward(SUCCESS);
if(!isValidPOSId)
{
ArrayList list=POSManager.getAllPOSIDs(ctx);
request.getSession().setAttribute(Constants.POSIDS,list);
return mapping.findForward(CHOOSEPOS);
}
else
{
SessionStorage.putPOSID(ctx,strPosId,request);
String currSymboleSales = POSTerminalManager.getPOSDefaultSellCurrency(ctx).getCurSymbol();
String currSymbolePurchase=POSTerminalManager.getPOSDefaultPurchaseCurrency(ctx).getCurSymbol();
request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE,currSymboleSales);
request.getSession().setAttribute(Constants.CURRENCY_SYMBOLE_PURCHASE,currSymbolePurchase);
return mapping.findForward(CREATEPOSORDER);
}
}
}

View File

@ -75,29 +75,11 @@ public class MenuAction extends BaseDispatchAction
if(rootMenuItem == null)
{
try
{
ApplicationManager.changeApplication(request, response);
ctx = TmkJSPEnv.getCtx(request);
String forward = Env.getContext(ctx, UdiConstants.WEBPARAM6);
return mapping.findForward(forward);
}
catch(DefaultStoreException ex)
{
postGlobalError("error.store.default", ex.getMessage(), request);
return mapping.findForward(CHOOSE_APPLICATION);
}
catch(Exception ex)
{
return mapping.findForward(APPLICATION_ERROR);
}
//TODO: Display error message or should kick to right store
mapping.findForward(CHOOSE_APPLICATION);
}
ArrayList subMenus = new ArrayList();
String applicationName = ApplicationManager.getApplicationType(ctx).toUpperCase();
if(bean.getMenuId()==null)
{
UDIPO udiPO = POSMenuFactory.getFactoryInstance(ctx).get(ctx, POSMenuFactory.PMENU_SALES_ID);
@ -109,67 +91,109 @@ public class MenuAction extends BaseDispatchAction
subMenus = rootMenuItem.getSubMenus(bean.getMenuId().intValue());
}
//subgrouping menus
ArrayList<MenuItem> menuItems = subMenus;
HashMap<String,ArrayList<MenuItem>> categoryMap = new HashMap<String,ArrayList<MenuItem>>();
if (applicationName.equalsIgnoreCase("POS"))
{
//subgrouping menus
ArrayList<MenuItem> menuItems = subMenus;
HashMap<String,ArrayList<MenuItem>> categoryMap = new HashMap<String,ArrayList<MenuItem>>();
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
ElementBean elementBean = null;
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
ElementBean elementBean = null;
String category = "";
ArrayList<MenuItem> list = null;
ArrayList<String> categories = new ArrayList<String>();
//group menus
for(MenuItem menuItem : menuItems)
{
category = menuItem.getCategory();
category = (category==null)? "" : category;
String category = "";
ArrayList<MenuItem> list = null;
ArrayList<String> categories = new ArrayList<String>();
//group menus
for(MenuItem menuItem : menuItems)
{
category = menuItem.getCategory();
category = (category==null)? "" : category;
if(!categories.contains(category))
{
categories.add(category);
}
list = categoryMap.get(category);
if(list==null)
{
list = new ArrayList<MenuItem>();
}
list.add(menuItem);
categoryMap.put(category,list);
}
//display groups
Iterator<String> iter = categories.iterator();
out.print("<table class=\"main\" cellspacing=\"10\">");
while(iter.hasNext())
{
out.print("<tr><td valign=\"top\" width=\"50%\">");
//----------------------------------------------------------------------------------------------------------------------
category = iter.next();
if(!categories.contains(category))
{
categories.add(category);
}
list = categoryMap.get(category);
if(list==null)
{
list = new ArrayList<MenuItem>();
}
list.add(menuItem);
categoryMap.put(category,list);
}
//display groups
Iterator<String> iter = categories.iterator();
out.print("<table class=\"main\" cellspacing=\"10\">");
while(iter.hasNext())
{
out.print("<tr><td valign=\"top\" width=\"50%\">");
//----------------------------------------------------------------------------------------------------------------------
category = iter.next();
list = categoryMap.get(category);
if((category != null)&&(category.length() != 0))
{
out.print("<fieldset class=\"submenu\">");
out.print("<legend>");
elementBean = ElementManager.getMsg(ctx,category);
out.print(elementBean.getName());
out.print("</legend>");
}//if
out.print("<ul>");
for(MenuItem m : list)
{
out.print("<li class=\"submenu\">");
out.print("<a href='" + m.getMenuLink() + "' class=\"submenu\">");
elementBean = ElementManager.getMsg(ctx,m.getName());
out.print(elementBean.getName());
out.print("</a>");
out.print("</li>");
}//for
out.print("</ul>");
if((category != null)&&(category.length() != 0))
{
out.print("</fieldset>");
}//if
//----------------------------------------------------------------------------------------------------------------------
out.print("</td><td valign=\"top\" width=\"50%\">");
if(!iter.hasNext())
{
out.print("&nbsp;");
}
else
{
//----------------------------------------------------------------------------------------------------------------------
category = iter.next();
list = categoryMap.get(category);
if((category != null)&&(category.length() != 0))
{
out.print("<fieldset class=\"submenu\">");
out.print("<legend>");
elementBean = ElementManager.getMsg(ctx,category);
out.print(elementBean.getName());
out.print("</legend>");
elementBean = ElementManager.getMsg(ctx,category);
out.print(elementBean.getName());
out.print("</legend>");
}//if
out.print("<ul>");
@ -177,11 +201,11 @@ public class MenuAction extends BaseDispatchAction
for(MenuItem m : list)
{
out.print("<li class=\"submenu\">");
out.print("<a href='" + m.getMenuLink() + "' class=\"submenu\">");
out.print("<a href=" + m.getMenuLink() + " class=\"submenu\">");
elementBean = ElementManager.getMsg(ctx,m.getName());
out.print(elementBean.getName());
out.print(elementBean.getName());
out.print("</a>");
out.print("</li>");
}//for
@ -194,67 +218,18 @@ public class MenuAction extends BaseDispatchAction
}//if
//----------------------------------------------------------------------------------------------------------------------
out.print("</td><td valign=\"top\" width=\"50%\">");
if(!iter.hasNext())
{
out.print("&nbsp;");
}
else
{
//----------------------------------------------------------------------------------------------------------------------
category = iter.next();
list = categoryMap.get(category);
if((category != null)&&(category.length() != 0))
{
out.print("<fieldset class=\"submenu\">");
out.print("<legend>");
elementBean = ElementManager.getMsg(ctx,category);
out.print(elementBean.getName());
out.print("</legend>");
}//if
out.print("<ul>");
for(MenuItem m : list)
{
out.print("<li class=\"submenu\">");
out.print("<a href=" + m.getMenuLink() + " class=\"submenu\">");
elementBean = ElementManager.getMsg(ctx,m.getName());
out.print(elementBean.getName());
out.print("</a>");
out.print("</li>");
}//for
out.print("</ul>");
if((category != null)&&(category.length() != 0))
{
out.print("</fieldset>");
}//if
//----------------------------------------------------------------------------------------------------------------------
}
out.print("</td></tr>");
}
out.print("</table>");
out.flush();
String menu = sw.toString();
request.getSession().setAttribute(Constants.MENU_ITEMS, menu);
return mapping.findForward(GET_POS_MENU_ITEMS);
}
out.print("</td></tr>");
}
return mapping.findForward(GET_MENU_ITEMS);
out.print("</table>");
out.flush();
String menu = sw.toString();
request.getSession().setAttribute(Constants.MENU_ITEMS, menu);
return mapping.findForward(GET_POS_MENU_ITEMS);
}
public static final String INIT_EDIT_LINKSTATUS = "initEditLinkStatus";

View File

@ -1,241 +0,0 @@
/**
* Product: Posterita Web-Based POS 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.struts.product;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.compiere.util.Env;
import org.compiere.util.Trx;
import org.posterita.Constants;
import org.posterita.beans.EditPriceBean;
import org.posterita.beans.PriceListBean;
import org.posterita.beans.ProductBean;
import org.posterita.beans.ProductPriceBean;
import org.posterita.businesslogic.ApplicationManager;
import org.posterita.businesslogic.PriceListManager;
import org.posterita.core.TrxPrefix;
import org.posterita.exceptions.ApplicationException;
import org.posterita.exceptions.OperationException;
import org.posterita.exceptions.SystemException;
import org.posterita.form.PriceListForm;
import org.posterita.lib.UdiConstants;
import org.posterita.struts.core.BaseDispatchAction;
import org.posterita.struts.core.DefaultForm;
public class PriceListAction extends BaseDispatchAction
{
public static final String INIT_PRICE_LIST = "initPriceList";
private Properties webstoreCtx = new Properties();
private Properties getWebstoreContext(HttpServletRequest request)
{
ApplicationManager.setApplicationParametersInContext(webstoreCtx, "webstore");
return webstoreCtx;
}
public static final String INIT_WEBSTORE_PRICE_LIST = "initWebstorePriceList";
public ActionForward initWebstorePriceList(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception
{
ActionForward fwd = init(mapping, form, request, response);
if(fwd!=null)
return fwd;
webstoreCtx = getWebstoreContext(request);
DefaultForm df = (DefaultForm) form;
ProductBean bean = (ProductBean) df.getBean();
df.setIsWebstoreFeatured("true");
int priceListId = Env.getContextAsInt(webstoreCtx, UdiConstants.PRICELIST_CTX_PARAM);
int priceListVersionId = PriceListManager.getPriceListVersionID(webstoreCtx, priceListId, null);
ArrayList<ProductPriceBean> productPriceList = new ArrayList<ProductPriceBean> ();
//if (bean.getSearchText() != null)
productPriceList = PriceListManager.getProductPriceList(webstoreCtx, priceListVersionId, bean.getSearchText(), bean.getIsSelfService(), bean.getProductClassification());
request.getSession().setAttribute(Constants.PRICE_LIST, productPriceList);
return mapping.findForward(INIT_WEBSTORE_PRICE_LIST);
}
public static final String INIT_EDIT_PRICE_LIST = "initEditPriceList";
public ActionForward initEditPriceList(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception
{
ActionForward fwd = init(mapping, form, request, response);
if(fwd!=null)
return fwd;
DefaultForm df = (DefaultForm) form;
PriceListBean bean = (PriceListBean) df.getBean();
request.getSession().setAttribute(Constants.PRODUCT_IDS, bean.getProductIds());
return mapping.findForward(INIT_EDIT_PRICE_LIST);
}
public static final String INIT_EDIT_WSTORE_PRICE_LIST = "initWebstoreEditPriceList";
public ActionForward initWebstoreEditPriceList(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException
{
ActionForward fwd = init(mapping, form, request, response);
if(fwd!=null)
return fwd;
DefaultForm df = (DefaultForm) form;
PriceListBean bean = (PriceListBean) df.getBean();
if(bean.getProductIds() == null || bean.getProductIds().length == 0)
{
postGlobalError("error.product.not.selected", request);
return mapping.getInputForward();
}
request.getSession().setAttribute(Constants.PRODUCT_IDS, bean.getProductIds());
return mapping.findForward(INIT_EDIT_WSTORE_PRICE_LIST);
}
public static final String EDIT_PRICE_LIST = "editPriceList";
public ActionForward editPriceLists(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws ApplicationException, OperationException, SystemException
{
ActionForward fwd = init(mapping, form, request, response);
if(fwd!=null)
return fwd;
webstoreCtx = getWebstoreContext(request);
DefaultForm df = (DefaultForm) form;
EditPriceBean bean = (EditPriceBean) df.getBean();
BigDecimal priceEntered = new BigDecimal(bean.getPrice().toString());
Integer productIds[] = (Integer[]) request.getSession().getAttribute(Constants.PRODUCT_IDS);
Integer priceListVersionId = (Integer) request.getSession().getAttribute(Constants.PRICE_LIST_VERSION_ID);
Trx trx = Trx.get(TrxPrefix.getPrefix(), true);
try
{
trx.start();
PriceListManager.editProductPrices(webstoreCtx,productIds, priceListVersionId.intValue(), priceEntered, trx.getTrxName());
trx.commit();
}
catch (OperationException e)
{
trx.rollback();
throw e;
}
catch (SystemException e)
{
trx.rollback();
throw e;
}
finally
{
trx.close();
}
PriceListForm plf = (PriceListForm) getForm(Constants.PriceListForm, Constants.InitPriceListAction, request);
PriceListBean plBean = new PriceListBean();
plBean.setPriceListVersionId(priceListVersionId);
plf.populate(plBean);
return mapping.findForward(EDIT_PRICE_LIST);
}
public static final String EDIT_WEBSTORE_PRICELIST = "editWebstorePriceList";
public ActionForward editWebstorePriceList(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws OperationException, ApplicationException, SystemException
{
ActionForward fwd = init(mapping, form, request, response);
if(fwd!=null)
return fwd;
webstoreCtx = getWebstoreContext(request);
DefaultForm df = (DefaultForm) form;
EditPriceBean bean = (EditPriceBean) df.getBean();
Integer productIds[] = (Integer[])request.getSession().getAttribute(Constants.PRODUCT_IDS);
int priceListId = Env.getContextAsInt(webstoreCtx, UdiConstants.PRICELIST_CTX_PARAM);
int priceListVersionId = PriceListManager.getPriceListVersionID(webstoreCtx, priceListId, null);
BigDecimal priceEntered = new BigDecimal(bean.getPrice().toString());
Trx trx = Trx.get(TrxPrefix.getPrefix(), true);
try
{
trx.start();
PriceListManager.editProductPrices(webstoreCtx,productIds, priceListVersionId, priceEntered, trx.getTrxName());
trx.commit();
}
catch (OperationException e)
{
trx.rollback();
throw e;
}
catch (SystemException e)
{
trx.rollback();
throw e;
}
finally
{
trx.close();
}
return mapping.findForward(EDIT_WEBSTORE_PRICELIST);
}
}

View File

@ -31,7 +31,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>POSterita</title>
<title>POSterita:. Create Client</title>
<link type="text/css" href="css/newPOS.jsp" rel="stylesheet">
<link type="text/css" href="css/common.jsp" rel="stylesheet">
<link rel="shortcut icon" href="images/posterita.jpg" type="image/jpg" />
@ -80,7 +80,7 @@
<tr>
<td>
<html:form action="/ClientAction">
<html:form action="/ClientAction" method="post" enctype="multipart/form-data">
<html:hidden property="action" value="createClient"/>
<%@ include file="/jsp/include/errors.jsp" %>
<table>
@ -164,7 +164,15 @@
</TR>
<tr>
<td>
&nbsp;
<fieldset>
<legend><font class="title">Accounting</font></legend>
<table width="100%" border="0" class="display">
<tr>
<td>Load Accounting Values</td>
<td><html:file value="" property="file"/></td>
</tr>
</table>
</fieldset>
</td>
<td align="right">
<html:button property="button" styleClass="save smallbutton" onclick="newsubmit(this)" tabindex="10" accesskey="s">
@ -172,8 +180,7 @@
</html:button>
</td>
</tr>
</table>
</table>
</html:form>
<SCRIPT>