ItEr38S05ValidacionEProbasFuncionaisItEr37S06: [Bug #132] Fixing bug.
If the value entered is empty(null) then zero is assigned
This commit is contained in:
parent
d3eaf14242
commit
e4bec67ebe
1 changed files with 8 additions and 4 deletions
|
|
@ -192,8 +192,8 @@ public class StretchesFunctionController extends GenericForwardComposer {
|
|||
|
||||
private void appendAmountWorkPercentage(Listitem item,
|
||||
final Stretch stretch) {
|
||||
final Decimalbox tempDecimalbox = new Decimalbox();
|
||||
Decimalbox decimalbox = Util.bind(tempDecimalbox,
|
||||
final Decimalbox decimalBox = new Decimalbox();
|
||||
Util.bind(decimalBox,
|
||||
new Util.Getter<BigDecimal>() {
|
||||
@Override
|
||||
public BigDecimal get() {
|
||||
|
|
@ -203,18 +203,22 @@ public class StretchesFunctionController extends GenericForwardComposer {
|
|||
}, new Util.Setter<BigDecimal>() {
|
||||
@Override
|
||||
public void set(BigDecimal value) {
|
||||
if(value==null){
|
||||
value = BigDecimal.ZERO;
|
||||
}
|
||||
value = value.setScale(2).divide(
|
||||
new BigDecimal(100), RoundingMode.DOWN);
|
||||
try {
|
||||
stretch.setAmountWorkPercentage(value);
|
||||
reloadStretchesListAndCharts();
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new WrongValueException(tempDecimalbox,
|
||||
throw new WrongValueException(
|
||||
decimalBox,
|
||||
_("Amount work percentage should be between 0 and 100"));
|
||||
}
|
||||
}
|
||||
});
|
||||
appendChild(item, decimalbox);
|
||||
appendChild(item, decimalBox);
|
||||
}
|
||||
|
||||
private void appendOperations(Listitem item, final Stretch stretch) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue