[Bug #1247] Fixed issue with checkbox validation in Quality Form edition
FEA: ItEr75S04BugFixing
This commit is contained in:
parent
6eaf0388a9
commit
6de5eb8b0e
4 changed files with 17 additions and 14 deletions
|
|
@ -394,6 +394,10 @@ public class QualityForm extends BaseEntity implements IHumanIdentifiable{
|
|||
this.reportAdvance = BooleanUtils.toBoolean(reportAdvance);
|
||||
}
|
||||
|
||||
public boolean getReportAdvance() {
|
||||
return this.reportAdvance;
|
||||
}
|
||||
|
||||
public AdvanceType getAdvanceType() {
|
||||
return advanceType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,8 @@ public class QualityFormCRUDController extends BaseCRUDController<QualityForm> {
|
|||
.getFellowIfAny("qualityFormName");
|
||||
validate(boxName, boxName.getValue());
|
||||
|
||||
validateReportProgress();
|
||||
|
||||
List<Row> rows = gridQualityFormItems.getRows().getChildren();
|
||||
for (Row row : rows) {
|
||||
validate(row);
|
||||
|
|
@ -410,16 +412,14 @@ public class QualityFormCRUDController extends BaseCRUDController<QualityForm> {
|
|||
predicate = getSelectedName();
|
||||
}
|
||||
|
||||
public void validateReportProgress(Component comp) {
|
||||
Checkbox checkbox = (Checkbox) comp;
|
||||
if (checkbox != null) {
|
||||
if ((checkbox.isChecked()) && (!hasItemWithTotalPercentage())) {
|
||||
disabledCheckbocReportProgress(checkbox);
|
||||
messagesForUser
|
||||
.showMessage(
|
||||
Level.ERROR,
|
||||
_("The quality form must have an item with 100% value to report progress"));
|
||||
}
|
||||
public void validateReportProgress() {
|
||||
if ((getQualityForm().getReportAdvance())
|
||||
&& (!hasItemWithTotalPercentage())) {
|
||||
Checkbox checkBoxReportProgress = (Checkbox) editWindow
|
||||
.getFellowIfAny("checkBoxReportProgress");
|
||||
throw new WrongValueException(
|
||||
checkBoxReportProgress,
|
||||
_("The quality form must have an item with 100% value to report progress"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ public class QualityFormModel implements IQualityFormModel {
|
|||
@Override
|
||||
public Boolean isTotalPercentage(QualityFormItem item) {
|
||||
return (item.getPercentage() != null) ? (item.getPercentage()
|
||||
.equals(totalPercentage)) : false;
|
||||
.compareTo(totalPercentage) == 0) : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -64,8 +64,7 @@
|
|||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Report progress')}" />
|
||||
<checkbox id="checkBoxReportProgress" checked="@{controller.qualityForm.reportAdvance}"
|
||||
onCheck="controller.validateReportProgress(self);" />
|
||||
<checkbox id="checkBoxReportProgress" checked="@{controller.qualityForm.reportAdvance}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
|
@ -78,7 +77,7 @@
|
|||
<button label="${i18n:_('New quality form item')}"
|
||||
onClick="controller.createQualityFormItem()" />
|
||||
</hbox>
|
||||
<grid id="gridQualityFormItems" height="200px"
|
||||
<grid id="gridQualityFormItems"
|
||||
model="@{controller.qualityFormItems}" fixedLayout="true">
|
||||
<columns sizable="true">
|
||||
<column label="${i18n:_('Name')}"/>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue