ItEr36S14CUAdministracionCategoriaCosteItEr35S15: modified the listener of the "type" field to set the "price" field to the default one

The code of the listener has also been cleaned. A validation has
been removed because it's done in other point.
This commit is contained in:
Jacobo Aragunde Pérez 2009-12-02 20:58:32 +01:00 committed by Javier Moran Rua
parent 9f72725b7e
commit 073d60c501

View file

@ -226,14 +226,15 @@ public class CostCategoryCRUDController extends GenericForwardComposer
@Override
public void onEvent(Event event) throws Exception {
final Comboitem comboitem = autocomplete.getSelectedItem();
if (comboitem == null) {
throw new WrongValueException(autocomplete,
_("Please, select an item"));
}
// Update hourCost
HourCost hourCost = (HourCost) row.getValue();
hourCost.setType((TypeOfWorkHours) comboitem.getValue());
row.setValue(hourCost);
// Update the hourPrice in the hourCost
hourCost.setPriceCost(((TypeOfWorkHours) comboitem.getValue()).getDefaultPrice());
Util.reloadBindings(listHourCosts);
}
});
row.appendChild(autocomplete);