if (endDate == null) {
DcSwingUtilities.displayWarningMessage("msgEnterReturnDate");
return;
}
Loan currentLoan;
Date startDate;
for (DcObject o : objects) {
currentLoan = DataManager.getCurrentLoan(o.getID());
startDate = (Date) currentLoan.getValue(Loan._A_STARTDATE);
if (startDate.compareTo(endDate) > 0) {
DcSwingUtilities.displayWarningMessage("msgEndDateMustBeAfterStartDate");
return;
}
}
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
int i = 0;
Loan currentLoan;
for (DcObject o : objects) {
currentLoan = DataManager.getCurrentLoan(o.getID());
if (currentLoan.getID() != null) {
currentLoan.setValue(Loan._D_OBJECTID, o.getID());
currentLoan.setValue(Loan._B_ENDDATE, endDate);
currentLoan.setValue(Loan._E_DUEDATE, null);
if (owner != null && i == objects.size() - 1) // last item
currentLoan.addRequest(new CloseWindowRequest(owner));
else if (owner == null)
setLoanInformation(currentLoan);
dco.setLoanInformation(currentLoan);
currentLoan.saveUpdate(false, false);
i++;
}
try {
wait(10);