Fix problem in zkwebui - resource assignment cannot be created.
Steps to reproduce: - Create a Sales Order - Create a line selling Mary Consultant product - Try to create a resource assignment a Null Pointer Exception was thrown
This commit is contained in:
parent
f80fdada3b
commit
de8c0de43e
|
@ -30,10 +30,10 @@ import org.compiere.util.ValueNamePair;
|
||||||
*/
|
*/
|
||||||
public class ListItem extends org.zkoss.zul.Listitem
|
public class ListItem extends org.zkoss.zul.Listitem
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3445426943414051896L;
|
private static final long serialVersionUID = -8052056834118074979L;
|
||||||
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
|
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
|
||||||
|
|
||||||
public ListItem(String label, Object value)
|
public ListItem(String label, Object value)
|
||||||
|
@ -59,4 +59,10 @@ public class ListItem extends org.zkoss.zul.Listitem
|
||||||
public ValueNamePair toValueNamePair() {
|
public ValueNamePair toValueNamePair() {
|
||||||
return new ValueNamePair((String)getValue(), getLabel());
|
return new ValueNamePair((String)getValue(), getLabel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getValue().toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,10 @@ import org.zkoss.zul.Listitem;
|
||||||
*/
|
*/
|
||||||
public class Listbox extends org.zkoss.zul.Listbox implements EventListener
|
public class Listbox extends org.zkoss.zul.Listbox implements EventListener
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -411510408730815382L;
|
private static final long serialVersionUID = 2102597724705225997L;
|
||||||
private List<EventListener> doubleClickListeners = new ArrayList<EventListener>();
|
private List<EventListener> doubleClickListeners = new ArrayList<EventListener>();
|
||||||
private List<EventListener> onDropListeners = new ArrayList<EventListener>();
|
private List<EventListener> onDropListeners = new ArrayList<EventListener>();
|
||||||
private boolean draggable;
|
private boolean draggable;
|
||||||
|
@ -327,4 +327,17 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener
|
||||||
oddRowSclass = scls;
|
oddRowSclass = scls;
|
||||||
super.setOddRowSclass(scls);
|
super.setOddRowSclass(scls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuffer items = new StringBuffer("[");
|
||||||
|
for (ListItem item : getItems()) {
|
||||||
|
if (items.length() > 1)
|
||||||
|
items.append(", ");
|
||||||
|
items.append(item.toString());
|
||||||
|
}
|
||||||
|
items.append("]");
|
||||||
|
return items.toString();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,16 +221,14 @@ public class WAssignmentDialog extends Window implements EventListener
|
||||||
|
|
||||||
// Set Resource
|
// Set Resource
|
||||||
int S_Resource_ID = m_mAssignment.getS_Resource_ID();
|
int S_Resource_ID = m_mAssignment.getS_Resource_ID();
|
||||||
KeyNamePair[] resources = new KeyNamePair[m_lookup.size()];
|
|
||||||
m_lookup.keySet().toArray(resources);
|
for (ListItem item : fResource.getItems()) {
|
||||||
for (int i = 0; i < resources.length; i++)
|
if ( (Integer)item.getValue() == S_Resource_ID) {
|
||||||
{
|
fResource.setSelectedItem(item);
|
||||||
if (resources[i].getKey() == S_Resource_ID)
|
|
||||||
{
|
|
||||||
fResource.setSelectedIndex(i);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListItem listItem = fResource.getSelectedItem();
|
ListItem listItem = fResource.getSelectedItem();
|
||||||
KeyNamePair check = new KeyNamePair((Integer)listItem.getValue(), listItem.getLabel());
|
KeyNamePair check = new KeyNamePair((Integer)listItem.getValue(), listItem.getLabel());
|
||||||
if (check == null || check.getKey() != S_Resource_ID)
|
if (check == null || check.getKey() != S_Resource_ID)
|
||||||
|
@ -284,7 +282,9 @@ public class WAssignmentDialog extends Window implements EventListener
|
||||||
getDateAndTimeFrom(date);
|
getDateAndTimeFrom(date);
|
||||||
Timestamp assignDateFrom = new Timestamp(date.getTimeInMillis());
|
Timestamp assignDateFrom = new Timestamp(date.getTimeInMillis());
|
||||||
BigDecimal qty = fQty.getValue();
|
BigDecimal qty = fQty.getValue();
|
||||||
KeyNamePair uom = (KeyNamePair)m_lookup.get(fResource.getSelectedItem());
|
ListItem listItem = fResource.getSelectedItem();
|
||||||
|
KeyNamePair resource = listItem != null ? new KeyNamePair((Integer)listItem.getValue(), listItem.getLabel()) : null;
|
||||||
|
KeyNamePair uom = (KeyNamePair)m_lookup.get(resource);
|
||||||
int minutes = MUOMConversion.convertToMinutes(Env.getCtx(), uom.getKey(), qty);
|
int minutes = MUOMConversion.convertToMinutes(Env.getCtx(), uom.getKey(), qty);
|
||||||
Timestamp assignDateTo = TimeUtil.addMinutess(assignDateFrom, minutes);
|
Timestamp assignDateTo = TimeUtil.addMinutess(assignDateFrom, minutes);
|
||||||
m_mAssignment.setAssignDateTo (assignDateTo);
|
m_mAssignment.setAssignDateTo (assignDateTo);
|
||||||
|
@ -367,7 +367,7 @@ public class WAssignmentDialog extends Window implements EventListener
|
||||||
// Resource - Look up UOM
|
// Resource - Look up UOM
|
||||||
if (e.getTarget() == fResource)
|
if (e.getTarget() == fResource)
|
||||||
{
|
{
|
||||||
Object o = m_lookup.get(fResource.getSelectedItem());
|
Object o = m_lookup.get(resource);
|
||||||
if (o == null)
|
if (o == null)
|
||||||
lUOM.setValue(" ? ");
|
lUOM.setValue(" ? ");
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue