Skip to content

Commit 631c65e

Browse files
Merge pull request #786 from motech-implementations/motherUpdateException
mother and child update error check
2 parents e4c273f + 0363c6d commit 631c65e

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

kilkari/src/main/java/org/motechproject/nms/kilkari/service/impl/MctsBeneficiaryImportServiceImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ public MotherImportRejection importMotherRecord(Map<String, Object> record, Subs
197197
mother.setDateOfBirth(motherDOB);
198198
mother.setLastMenstrualPeriod(lmp);
199199
mother.setUpdatedDateNic(lastUpdatedDateNic);
200-
mctsMotherDataService.update(mother);
200+
if (mother.getId() != null) {
201+
mctsMotherDataService.update(mother);
202+
}
201203

202204

203205
// Check if existing subscription needs to be deactivated
@@ -390,7 +392,9 @@ public ChildImportRejection importChildRecord(Map<String, Object> record, Subscr
390392
}
391393
child.setDateOfBirth(dob);
392394
child.setUpdatedDateNic(lastUpdateDateNic);
393-
mctsChildDataService.update(child);
395+
if (child.getId() != null) {
396+
mctsChildDataService.update(child);
397+
}
394398

395399
List<DeactivatedBeneficiary> deactivatedUsers = null;
396400
synchronized(this) {
@@ -535,9 +539,7 @@ public boolean validateReferenceDate(DateTime referenceDate, SubscriptionPackTyp
535539
}
536540

537541
if (packType == SubscriptionPackType.PREGNANCY) {
538-
LOGGER.debug("here2");
539542
String referenceDateValidationError = pregnancyPack.isReferenceDateValidForPack(referenceDate);
540-
LOGGER.debug("Result: {}", referenceDateValidationError);
541543
if (!referenceDateValidationError.isEmpty()) {
542544
return false;
543545
}

rch/src/main/java/org/motechproject/nms/rch/service/impl/RchWebServiceFacadeImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,8 @@ public void readMotherResponseFromFile(MotechEvent event) throws RchFileManipula
828828
String fileName = (String) event.getParameters().get(Constants.FILE_NAME);
829829
LocalDate endDate = (LocalDate) event.getParameters().get(Constants.END_DATE_PARAM);
830830
LocalDate startDate = (LocalDate) event.getParameters().get(Constants.START_DATE_PARAM);
831-
LOGGER.info("RCH Asha file import entry point");
832-
LOGGER.info("Copying RCH Asha response file from remote server to local directory.");
831+
LOGGER.info("RCH Mother file import entry point");
832+
LOGGER.info("Copying RCH Mother response file from remote server to local directory.");
833833
retryScpFromRemoteToLocal(fileName, remoteLocation, endDate, startDate, stateId, RchUserType.MOTHER, 0);
834834
}
835835

@@ -939,8 +939,8 @@ public void readChildResponseFromFile(MotechEvent event) throws RchFileManipulat
939939
String fileName = (String) event.getParameters().get(Constants.FILE_NAME);
940940
LocalDate endDate = (LocalDate) event.getParameters().get(Constants.END_DATE_PARAM);
941941
LocalDate startDate = (LocalDate) event.getParameters().get(Constants.START_DATE_PARAM);
942-
LOGGER.info("RCH Asha file import entry point");
943-
LOGGER.info("Copying RCH Asha response file from remote server to local directory.");
942+
LOGGER.info("RCH Child file import entry point");
943+
LOGGER.info("Copying RCH Child response file from remote server to local directory.");
944944
retryScpFromRemoteToLocal(fileName, remoteLocation, endDate, startDate, stateId, RchUserType.CHILD, 0);
945945
}
946946

0 commit comments

Comments
 (0)