ItEr42S17CUGravacionModelosUnidadesTraballoItEr41S20: Not letting update total Price since it was causing a division by zero when the number of units is zero.
The field now appears disabled.
This commit is contained in:
parent
acc1b103b9
commit
326847e9b4
3 changed files with 1 additions and 22 deletions
|
|
@ -21,7 +21,6 @@
|
|||
package org.navalplanner.business.materials.entities;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
|
||||
import org.hibernate.validator.Valid;
|
||||
|
|
@ -105,13 +104,6 @@ public class MaterialAssignment extends BaseEntity implements Comparable {
|
|||
return result.multiply(getUnitPrice());
|
||||
}
|
||||
|
||||
public void setTotalPrice(BigDecimal totalPrice) {
|
||||
BigDecimal unitPrice = totalPrice;
|
||||
unitPrice = unitPrice.divide(new BigDecimal(getUnits()), 3,
|
||||
RoundingMode.HALF_UP);
|
||||
setUnitPrice(unitPrice);
|
||||
}
|
||||
|
||||
public Date getEstimatedAvailability() {
|
||||
return estimatedAvailability;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,18 +204,6 @@ public class AssignedMaterialsToOrderElementController extends
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On changing unit price, recalculate total price and refresh categories tree
|
||||
*
|
||||
* @param row
|
||||
*/
|
||||
public void updateUnitPrice(Row row) {
|
||||
final MaterialAssignment materialAssignment = (MaterialAssignment) row.getValue();
|
||||
Doublebox unitPrice = (Doublebox) row.getChildren().get(4);
|
||||
unitPrice.setValue(materialAssignment.getUnitPrice().doubleValue());
|
||||
refreshTotalPriceAndTotalUnits(materialAssignment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds which {@link Treeitem} in tree is associated with category
|
||||
*
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@
|
|||
selectedItem="@{assignedMaterial.material.unitType}" disabled="true" />
|
||||
<doublebox value="@{assignedMaterial.unitPrice}"
|
||||
onChange="assignedMaterialsController.updateTotalPrice(self.parent)" />
|
||||
<doublebox value="@{assignedMaterial.totalPrice}"
|
||||
onChange="assignedMaterialsController.updateUnitPrice(self.parent)" />
|
||||
<doublebox value="@{assignedMaterial.totalPrice}" disabled="${true}"/>
|
||||
<label value="@{assignedMaterial.material.category.name}" width="150px" />
|
||||
<listbox mold="select" model="@{materialStatus}"
|
||||
selectedItem="@{assignedMaterial.status}"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue