Re: svn commit: r597038 - in /ofbiz/trunk/specialpurpose/pos: config/ screens/default/dialog/ src/org/ofbiz/pos/component/ src/org/ofbiz/pos/event/ src/org/ofbiz/pos/screen/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r597038 - in /ofbiz/trunk/specialpurpose/pos: config/ screens/default/dialog/ src/org/ofbiz/pos/component/ src/org/ofbiz/pos/event/ src/org/ofbiz/pos/screen/

Jacques Le Roux
Administrator
I totaly agree, this is the original design for entering values as long as there is only one value to enter (even in sequence for
some values without relation betwen them or with other stuffes)

Thanks

Jacques

> Author: lektran
> Date: Wed Nov 21 03:18:15 2007
> New Revision: 597038
>
> URL: http://svn.apache.org/viewvc?rev=597038&view=rev
> Log:
> Changed my mind about using a dialog for adding promo codes to a sale in pos, now you just enter the promo code into the main pos
input

>
> Removed:
>     ofbiz/trunk/specialpurpose/pos/screens/default/dialog/promocode.xml
>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/PromoCode.java
> Modified:
>     ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties
>     ofbiz/trunk/specialpurpose/pos/config/buttonevents.xml
>     ofbiz/trunk/specialpurpose/pos/config/pos.properties
>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java
>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/MenuEvents.java
>     ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java
>
> Modified: ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties?rev=597038&r1=597037&r2=597038&view=diff

> ==============================================================================
> --- ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties (original)
> +++ ofbiz/trunk/specialpurpose/pos/config/XuiLabels.properties Wed Nov 21 03:18:15 2007
> @@ -88,4 +88,3 @@
>  order_not_found=ORDER NOT FOUND
>  problems_reading_card=PROBLEMS READING SWIPED CARD
>  product_not_found=PRODUCT NOT FOUND
> -promo_page=This will be the promo page!
>
> Modified: ofbiz/trunk/specialpurpose/pos/config/buttonevents.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/config/buttonevents.xml?rev=597038&r1=597037&r2=597038&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/pos/config/buttonevents.xml (original)
> +++ ofbiz/trunk/specialpurpose/pos/config/buttonevents.xml Wed Nov 21 03:18:15 2007
> @@ -101,7 +101,7 @@
>      <event button-name="menuPromo" class-name="org.ofbiz.pos.event.NavagationEvents" method-name="showPromoScreen"
disable-lock="false"/>
>
>      <!-- pos promo menu events -->
> -    <event button-name="promoCode" class-name="org.ofbiz.pos.event.PromoEvents" method-name="promoCode" disable-lock="false"/>
> +    <event button-name="promoCode" class-name="org.ofbiz.pos.event.PromoEvents" method-name="addPromoCode" disable-lock="false"/>
>
>      <!-- pos mgr menu events -->
>      <event button-name="mgrOpenTerm" class-name="org.ofbiz.pos.event.ManagerEvents" method-name="openTerminal"
disable-lock="false"/>

>
> Modified: ofbiz/trunk/specialpurpose/pos/config/pos.properties
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/config/pos.properties?rev=597038&r1=597037&r2=597038&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/pos/config/pos.properties (original)
> +++ ofbiz/trunk/specialpurpose/pos/config/pos.properties Wed Nov 21 03:18:15 2007
> @@ -37,6 +37,7 @@
>  ENTCRC=Enter Credit Card Amount:
>  ENTGFC=Enter Gift Card Amount:
>  ENTOTH=Enter Other Payment Amount:
> +ENTPROMOCODE=Enter Promo Code:
>  GIFT_CARD=GIFT CARD
>  GROSS_SALES=GROSS SALES
>  Grand_Total=Grand Total
> @@ -44,7 +45,6 @@
>  ISOPEN=Register Is Open
>  ITEM=ITEM
>  Invalid_Selection=Invalid Selection!
> -LoadAPromoCode=Load a promotion code
>  LoadASale=Load a sale
>  LoadSaleListDblClickTip=You may use a double click to replace the current sale and delete this one
>  OPDRAM=Starting Drawer Amount:
>
> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java?rev=597038&r1=597037&r2=597038&view=diff

> ==============================================================================
> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java (original)
> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/Input.java Wed Nov 21 03:18:15 2007
> @@ -35,9 +35,10 @@
>  public class Input implements KeyboardReceiver, KeyListener {
>
>      public static final String module = Input.class.getName();
> -    private static final String[] validFunc = { "LOGIN", "OPEN", "CLOSE", "UNLOCK", "MGRLOGIN", "PAID", "TOTAL",
> -                                                "CREDIT", "GIFTCARD", "MSRINFO", "CHECK", "CHECKINFO", "REFNUM",
> -                                                "QTY", "VOID", "SHIFT", "PAID_IN" , "PAID_OUT" };
> +    private static final String[] validFunc = { "CHECK", "CHECKINFO", "CLOSE", "CREDIT", "GIFTCARD", "LOGIN", "MGRLOGIN",
> +                                                "MSRINFO", "OPEN", "PAID", "PAID_IN", "PAID_OUT", "PROMOCODE", "QTY",
> +                                                "REFNUM", "SHIFT", "TOTAL", "UNLOCK", "VOID"};
> +
>
>      protected Stack functionStack = new Stack();
>      protected Component[] pageComs = null;
>
> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/MenuEvents.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/MenuEvents.java?rev=597038&r1=597037&r2=597038&view=diff

> ==============================================================================
> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/MenuEvents.java (original)
> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/MenuEvents.java Wed Nov 21 03:18:15 2007
> @@ -109,6 +109,8 @@
>                  }
>              } else if ("SKU".equals(lastFunc[0])) {
>                  MenuEvents.addItem(pos, event);
> +            } else if ("PROMOCODE".equals(lastFunc[0])) {
> +                PromoEvents.addPromoCode(pos);
>              }
>          } else if (input.value().length() > 0) {
>              MenuEvents.addItem(pos, event);
>
> Modified: ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java?rev=597038&r1=597037&r2=597038&view=diff

> ==============================================================================
> --- ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java (original)
> +++ ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/event/PromoEvents.java Wed Nov 21 03:18:15 2007
> @@ -18,60 +18,43 @@
>   *******************************************************************************/
>  package org.ofbiz.pos.event;
>
> -import java.util.List;
> -import java.util.HashMap;
> -import java.util.Map;
> -import java.sql.Timestamp;
>  import java.util.Locale;
> -import java.text.DecimalFormat;
> -import java.text.ParseException;
>
> -import net.xoetrope.xui.XProjectManager;
> -
> -import org.ofbiz.base.util.cache.UtilCache;
> -import org.ofbiz.base.util.Debug;
> -import org.ofbiz.base.util.UtilMisc;
> -import org.ofbiz.base.util.UtilDateTime;
> -import org.ofbiz.base.util.UtilFormatOut;
> +import org.ofbiz.base.util.UtilProperties;
>  import org.ofbiz.base.util.UtilValidate;
> -import org.ofbiz.pos.device.DeviceLoader;
> -import org.ofbiz.pos.device.impl.Receipt;
> -import org.ofbiz.pos.screen.PosScreen;
> -import org.ofbiz.pos.screen.PaidInOut;
> -import org.ofbiz.pos.screen.PromoCode;
>  import org.ofbiz.pos.PosTransaction;
> -import org.ofbiz.pos.adaptor.SyncCallbackAdaptor;
>  import org.ofbiz.pos.component.Input;
>  import org.ofbiz.pos.component.Output;
> -import org.ofbiz.entity.GenericDelegator;
> -import org.ofbiz.entity.GenericEntityException;
> -import org.ofbiz.entity.GenericValue;
> -import org.ofbiz.entity.util.EntityListIterator;
> -import org.ofbiz.entity.condition.EntityExpr;
> -import org.ofbiz.entity.condition.EntityOperator;
> -import org.ofbiz.entity.condition.EntityConditionList;
> -import org.ofbiz.service.LocalDispatcher;
> -import org.ofbiz.service.GenericServiceException;
> -import org.ofbiz.service.ServiceUtil;
> -import org.ofbiz.guiapp.xui.XuiSession;
> -import org.ofbiz.base.util.UtilProperties;
> +import org.ofbiz.pos.screen.PosScreen;
>
>  public class PromoEvents {
>
>      public static final String module = PromoEvents.class.getName();
>
> -    public static void promoCode(PosScreen pos) {
> -
> +    public static void addPromoCode(PosScreen pos) {
>          PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession());
>          if (!trans.isOpen()) {
>              pos.showDialog("dialog/error/terminalclosed");
>              return;
>          }
> -
> -        PromoCode promoCode = new PromoCode(trans, pos);
> -        promoCode.openDlg();
> -        if (promoCode.isPromoLoaded()) {
> -            NavagationEvents.showPosScreen(pos);
> +        Input input = pos.getInput();
> +        String[] lastFunc = input.getLastFunction();
> +        if (lastFunc == null || !"PROMOCODE".equals(lastFunc[0])) {
> +            Output output = pos.getOutput();
> +            input.setFunction("PROMOCODE");
> +            output.print(UtilProperties.getMessage("pos","ENTPROMOCODE",Locale.getDefault()));
> +        } else if ("PROMOCODE".equals(lastFunc[0])) {
> +            String promoCode = input.value();
> +            if (UtilValidate.isNotEmpty(promoCode)) {
> +                String result = trans.addProductPromoCode(promoCode, pos);
> +                if (result != null) {
> +                    pos.showDialog("dialog/error/exception", result);
> +                    input.clearFunction("PROMOCODE");
> +                } else {
> +                    NavagationEvents.showPosScreen(pos);
> +                    pos.refresh();
> +                }
> +            }
>          }
>      }
>  }
>
>