ItEr60S04ValidacionEProbasFuncionaisItEr59S04: [Bug #540] Fixing bugs.

Now the import work reports shows a friendly message when there is not
any type of work reports with specified code.
This commit is contained in:
Susana Montes Pedreira 2010-06-28 13:09:09 +02:00 committed by Javier Moran Rua
parent d5c7bf25ec
commit abafe1f74d

View file

@ -62,9 +62,14 @@ public final class WorkReportConverter {
// Mandatory fields
workReport.setCode(workReportDTO.code);
WorkReportType workReportType = Registry.getWorkReportTypeDAO()
.findUniqueByCode(workReportDTO.workReportType);
workReport.setWorkReportType(workReportType);
try {
WorkReportType workReportType = Registry.getWorkReportTypeDAO()
.findUniqueByCode(workReportDTO.workReportType);
workReport.setWorkReportType(workReportType);
} catch (InstanceNotFoundException e) {
throw new ValidationException(
_("There is no type of work report with this code"));
}
for (WorkReportLineDTO workReportLineDTO : workReportDTO.workReportLines) {
workReport