Menu

#21 Menu keys linked to iems have problems

open
nobody
None
5
2004-03-17
2004-03-17
No

Problem description:

Item voiding doesn't work correctly when using an item
linked menu key (ie config 3) to enter the same item
multiple times.

For example selecting Tall Americano 3 times, then
choosing one ofthem to void will result inthem all being
voided.

This is only the case if the menu keys are used. Using
the PLU key (LookupItem.class) is OK.

Reason:

Each item menu key loads an instance ofthe EjItem
class and then adds the same instance of EjItem to the
EJ every time it is pressed. Since there is only one
instance appearing multiple times in the journal, void one
= void them all.

This problem is also related to the problem of size
modifiers noted earlier.

Suggested Solution:

Use the events.LookupItem class on Item menu keys
instead of EjItem. EjItem doesn't seem to have been
designed to work that way.

LookupItem will need a slight mod. Add some code
something like this:
String input;
if (value > 0) {
//this has been activated by a menu key with a
direct item lookup
input = new Integer(value).toString();
} else {
input = context().inputLine().trim();
}

Add this at the top of the engage() method and the rest
of the code is fine.

The posk_key parameter wil be 0 for a normal PLU key.
It can be either the PLU or the SKU for Item linked menu
keys (except that the key editor won't allow a 10
character parameter)

Don't use EjItem directly from menu keys, use
LookupItem instead. This will ensure that each line in
the EJ is a distinct instance.

Discussion

  • RenGar

    RenGar - 2004-03-18

    Logged In: YES
    user_id=995554

    Since I have proved it and it me does not work.
    An exception gives me in the line 133 of the gui.MenuButton,
    a NullPointerException. I
    have added the code in engaged.

     
  • RenGar

    RenGar - 2004-03-18

    Logged In: YES
    user_id=995554

    Solved. But I also have had to change

    ejitem.engage(context().input());

    to

    ejitem.engage(Integer.valueOf(input).intValue());

    because

    context().input() != Integer.valueOf(input).intValue()

     
  • Clive Goransson

    Clive Goransson - 2004-06-29

    Logged In: YES
    user_id=987408

    I'm sorry, but I don't think this works all that well. It does
    get the config3 buttons to work effectively as far as voiding
    items goes, But the default PLU button value is 2, not 0,
    making all item values entered result as 2 instead of the
    inputted value, thanks to the if statement mentioned above.

     

Log in to post a comment.

MongoDB Logo MongoDB