support client update properly and tidy up parameter names for client.
This commit is contained in:
+4
-5
@@ -25,17 +25,16 @@ label.office=Office:
|
||||
option.office.first.choice=--Select Office--
|
||||
label.lastname=Last name:
|
||||
label.firstname=First name:
|
||||
label.longname=Full name:
|
||||
label.longname=Client or Business name:
|
||||
label.joiningdate=Joining date:
|
||||
|
||||
error.msg.header=You have the following errors:
|
||||
validation.msg.client.officeId.cannot.be.blank=A client must be associated with an office.
|
||||
validation.msg.client.firstname.cannot.be.blank=First name cannot be blank.
|
||||
validation.msg.client.lastname.cannot.be.blank=Last name cannot be blank.
|
||||
validation.msg.client.joiningDateFormatted.cannot.be.blank=Joining date cannot be blank.
|
||||
validation.msg.client.fullname.must.be.provide.or.firstname.lastname=A fullname must be provided or else both firstname and lastname details.
|
||||
validation.msg.client.firstname.cannot.also.be.provided.when.fullname.is.populated=You cannot provide both fullname and firstname or lastname details. A fullname must be provided or else both firstname and lastname details.
|
||||
validation.msg.client.lastname.cannot.also.be.provided.when.fullname.is.populated=You cannot provide both fullname and firstname or lastname details. A fullname must be provided or else both firstname and lastname details.
|
||||
validation.msg.client.joiningDate.cannot.be.blank=Joining date cannot be blank.
|
||||
validation.msg.client.firstname.cannot.also.be.provided.when.clientOrBusinessName.is.populated=You cannot provide both fullname and firstname or lastname details. A fullname must be provided or else both firstname and lastname details.
|
||||
validation.msg.client.lastname.cannot.also.be.provided.when.clientOrBusinessName.is.populated=You cannot provide both fullname and firstname or lastname details. A fullname must be provided or else both firstname and lastname details.
|
||||
|
||||
error.msg.client.id.invalid=Client does not exist.
|
||||
error.msg.office.id.invalid=Office does not exist.
|
||||
|
||||
+3
-4
@@ -31,10 +31,9 @@ error.msg.header=You have the following errors:(fr)
|
||||
validation.msg.client.officeId.cannot.be.blank=A client must be associated with an office.(fr)
|
||||
validation.msg.client.firstname.cannot.be.blank=First name cannot be blank.(fr)
|
||||
validation.msg.client.lastname.cannot.be.blank=Last name cannot be blank.(fr)
|
||||
validation.msg.client.joiningDateFormatted.cannot.be.blank=Joining date cannot be blank.(fr)
|
||||
validation.msg.client.fullname.must.be.provide.or.firstname.lastname=A fullname must be provided or else both firstname and lastname details.(fr)
|
||||
validation.msg.client.firstname.cannot.also.be.provided.when.fullname.is.populated=You cannot provide both fullname and firstname or lastname details. A fullname must be provided or else both firstname and lastname details.(fr)
|
||||
validation.msg.client.lastname.cannot.also.be.provided.when.fullname.is.populated=You cannot provide both fullname and firstname or lastname details. A fullname must be provided or else both firstname and lastname details.(fr)
|
||||
validation.msg.client.joiningDate.cannot.be.blank=Joining date cannot be blank.(fr)
|
||||
validation.msg.client.firstname.cannot.also.be.provided.when.clientOrBusinessName.is.populated=You cannot provide both fullname and firstname or lastname details. A fullname must be provided or else both firstname and lastname details.(fr)
|
||||
validation.msg.client.lastname.cannot.also.be.provided.when.clientOrBusinessName.is.populated=You cannot provide both fullname and firstname or lastname details. A fullname must be provided or else both firstname and lastname details.(fr)
|
||||
|
||||
error.msg.client.id.invalid=Client does not exist.(fr)
|
||||
error.msg.office.id.invalid=Office does not exist.(fr)
|
||||
|
||||
@@ -350,15 +350,15 @@
|
||||
<tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<label for="fullname"><spring:message code="label.longname"/></label>
|
||||
<input id="fullname" name="fullname" title="" type="text" value="{{=fullname}}" style="width:100%"/>
|
||||
<label for="clientOrBusinessName"><spring:message code="label.longname"/></label>
|
||||
<input id="clientOrBusinessName" name="clientOrBusinessName" title="" type="text" value="{{=fullname}}" style="width:100%"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="hidden" id="dateFormat" name="dateFormat" value="dd MMMM yyyy" />
|
||||
<label for="joiningDateFormatted"><spring:message code="label.joiningdate"/></label>
|
||||
<input id="joiningDateFormatted" name="joiningDateFormatted" title="" type="text" class="datepickerfield" value="{{=$ctx.globalDate(joinedDate)}}"/>
|
||||
<label for="joiningDate"><spring:message code="label.joiningdate"/></label>
|
||||
<input id="joiningDate" name="joiningDate" title="" type="text" class="datepickerfield" value="{{=$ctx.globalDate(joinedDate)}}"/>
|
||||
</form>
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.mifosng.platform;
|
||||
|
||||
import org.mifosng.data.command.ImportClientCommand;
|
||||
import org.mifosng.data.command.ImportLoanCommand;
|
||||
import org.mifosng.data.command.ImportLoanRepaymentsCommand;
|
||||
import org.mifosng.platform.api.commands.ImportClientCommand;
|
||||
|
||||
public interface ImportPlatformService {
|
||||
|
||||
|
||||
@@ -22,14 +22,14 @@ import org.mifosng.data.LoanSchedule;
|
||||
import org.mifosng.data.MoneyData;
|
||||
import org.mifosng.data.ScheduledLoanInstallment;
|
||||
import org.mifosng.data.command.CalculateLoanScheduleCommand;
|
||||
import org.mifosng.data.command.ClientCommand;
|
||||
import org.mifosng.data.command.ImportClientCommand;
|
||||
import org.mifosng.data.command.ImportLoanCommand;
|
||||
import org.mifosng.data.command.ImportLoanRepaymentsCommand;
|
||||
import org.mifosng.data.command.LoanStateTransitionCommand;
|
||||
import org.mifosng.data.command.LoanTransactionCommand;
|
||||
import org.mifosng.data.command.SubmitApproveDisburseLoanCommand;
|
||||
import org.mifosng.data.command.SubmitLoanApplicationCommand;
|
||||
import org.mifosng.platform.api.commands.ClientCommand;
|
||||
import org.mifosng.platform.api.commands.ImportClientCommand;
|
||||
import org.mifosng.platform.client.domain.Client;
|
||||
import org.mifosng.platform.client.domain.ClientRepository;
|
||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||
@@ -118,7 +118,7 @@ public class ImportPlatformServiceImpl implements ImportPlatformService {
|
||||
for (ClientCommand client : command.getClients()) {
|
||||
Office clientOffice = findById(allOffices, client.getOfficeId());
|
||||
|
||||
Client newClient = Client.newClient(currentUser.getOrganisation(), clientOffice, client.getFirstname(), client.getLastname(), client.getJoiningDate(), client.getExternalId());
|
||||
Client newClient = Client.newClient(currentUser.getOrganisation(), clientOffice, client.getFirstname(), client.getLastname(), client.getJoiningLocalDate(), client.getExternalId());
|
||||
|
||||
newClientCollection.add(newClient);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ import org.mifosng.data.ClientLoanAccountSummaryCollectionData;
|
||||
import org.mifosng.data.EntityIdentifier;
|
||||
import org.mifosng.data.NoteData;
|
||||
import org.mifosng.data.OfficeLookup;
|
||||
import org.mifosng.data.command.ClientCommand;
|
||||
import org.mifosng.data.command.NoteCommand;
|
||||
import org.mifosng.platform.api.commands.ClientCommand;
|
||||
import org.mifosng.platform.api.infrastructure.ApiDataConversionService;
|
||||
import org.mifosng.platform.api.infrastructure.ApiJSONFormattingService;
|
||||
import org.mifosng.platform.client.service.ClientReadPlatformService;
|
||||
@@ -112,10 +112,10 @@ public class ClientApiResource {
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public Response enrollClient(final ClientCommand command) {
|
||||
|
||||
LocalDate joiningDate = apiDataConversionService.convertFrom(
|
||||
command.getJoiningDateFormatted(), "joiningDateFormatted",
|
||||
LocalDate joiningLocalDate = apiDataConversionService.convertFrom(
|
||||
command.getJoiningDate(), "joiningDate",
|
||||
command.getDateFormat());
|
||||
command.setJoiningDate(joiningDate);
|
||||
command.setJoiningLocalDate(joiningLocalDate);
|
||||
|
||||
Long clientId = this.clientWritePlatformService.enrollClient(command);
|
||||
|
||||
@@ -129,10 +129,10 @@ public class ClientApiResource {
|
||||
public Response updateClient(@PathParam("clientId") final Long clientId,
|
||||
final ClientCommand command) {
|
||||
|
||||
LocalDate joiningDate = apiDataConversionService.convertFrom(
|
||||
command.getJoiningDateFormatted(), "joiningDateFormatted",
|
||||
LocalDate joiningLocalDate = apiDataConversionService.convertFrom(
|
||||
command.getJoiningDate(), "joiningDate",
|
||||
command.getDateFormat());
|
||||
command.setJoiningDate(joiningDate);
|
||||
command.setJoiningLocalDate(joiningLocalDate);
|
||||
command.setId(clientId);
|
||||
|
||||
EntityIdentifier identifier = this.clientWritePlatformService
|
||||
|
||||
+31
-31
@@ -1,4 +1,4 @@
|
||||
package org.mifosng.data.command;
|
||||
package org.mifosng.platform.api.commands;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@@ -10,24 +10,24 @@ public class ClientCommand {
|
||||
private Long id;
|
||||
private String firstname;
|
||||
private String lastname;
|
||||
private String fullname;
|
||||
private String clientOrBusinessName;
|
||||
private Long officeId;
|
||||
private String externalId;
|
||||
|
||||
private String dateFormat;
|
||||
private String joiningDateFormatted;
|
||||
private LocalDate joiningDate;
|
||||
private String joiningDate;
|
||||
private LocalDate joiningLocalDate;
|
||||
|
||||
protected ClientCommand() {
|
||||
//
|
||||
}
|
||||
|
||||
public ClientCommand(final String firstname, final String lastname, String fullname, final Long officeId, final LocalDate joiningDate) {
|
||||
public ClientCommand(final String firstname, final String lastname, final String clientOrBusinessName, final Long officeId, final LocalDate joiningDate) {
|
||||
this.firstname = firstname;
|
||||
this.lastname = lastname;
|
||||
this.fullname = fullname;
|
||||
this.clientOrBusinessName = clientOrBusinessName;
|
||||
this.officeId = officeId;
|
||||
this.joiningDate = joiningDate;
|
||||
this.joiningLocalDate = joiningDate;
|
||||
}
|
||||
|
||||
public String getFirstname() {
|
||||
@@ -54,14 +54,6 @@ public class ClientCommand {
|
||||
this.officeId = officeId;
|
||||
}
|
||||
|
||||
public LocalDate getJoiningDate() {
|
||||
return this.joiningDate;
|
||||
}
|
||||
|
||||
public void setJoiningDate(final LocalDate joiningDate) {
|
||||
this.joiningDate = joiningDate;
|
||||
}
|
||||
|
||||
public String getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
@@ -70,14 +62,6 @@ public class ClientCommand {
|
||||
this.externalId = externalId;
|
||||
}
|
||||
|
||||
public String getFullname() {
|
||||
return fullname;
|
||||
}
|
||||
|
||||
public void setFullname(String fullname) {
|
||||
this.fullname = fullname;
|
||||
}
|
||||
|
||||
public String getDateFormat() {
|
||||
return dateFormat;
|
||||
}
|
||||
@@ -86,14 +70,6 @@ public class ClientCommand {
|
||||
this.dateFormat = dateFormat;
|
||||
}
|
||||
|
||||
public String getJoiningDateFormatted() {
|
||||
return joiningDateFormatted;
|
||||
}
|
||||
|
||||
public void setJoiningDateFormatted(String joiningDateFormatted) {
|
||||
this.joiningDateFormatted = joiningDateFormatted;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -101,4 +77,28 @@ public class ClientCommand {
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getJoiningDate() {
|
||||
return joiningDate;
|
||||
}
|
||||
|
||||
public void setJoiningDate(String joiningDate) {
|
||||
this.joiningDate = joiningDate;
|
||||
}
|
||||
|
||||
public LocalDate getJoiningLocalDate() {
|
||||
return joiningLocalDate;
|
||||
}
|
||||
|
||||
public void setJoiningLocalDate(LocalDate joiningLocalDate) {
|
||||
this.joiningLocalDate = joiningLocalDate;
|
||||
}
|
||||
|
||||
public String getClientOrBusinessName() {
|
||||
return clientOrBusinessName;
|
||||
}
|
||||
|
||||
public void setClientOrBusinessName(String clientOrBusinessName) {
|
||||
this.clientOrBusinessName = clientOrBusinessName;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,10 +1,11 @@
|
||||
package org.mifosng.data.command;
|
||||
package org.mifosng.platform.api.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
|
||||
@XmlRootElement
|
||||
public class ImportClientCommand {
|
||||
|
||||
@@ -13,7 +13,7 @@ import javax.persistence.UniqueConstraint;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.data.command.ClientCommand;
|
||||
import org.mifosng.platform.api.commands.ClientCommand;
|
||||
import org.mifosng.platform.infrastructure.AbstractAuditableCustom;
|
||||
import org.mifosng.platform.organisation.domain.Office;
|
||||
import org.mifosng.platform.organisation.domain.Organisation;
|
||||
@@ -88,13 +88,13 @@ public class Client extends AbstractAuditableCustom<AppUser, Long> {
|
||||
}
|
||||
|
||||
public void update(ClientCommand command) {
|
||||
this.joiningDate = command.getJoiningDate().toDate();
|
||||
this.joiningDate = command.getJoiningLocalDate().toDate();
|
||||
this.firstName = command.getFirstname();
|
||||
this.lastName = command.getLastname();
|
||||
|
||||
if (StringUtils.isNotBlank(command.getFullname())) {
|
||||
if (StringUtils.isNotBlank(command.getClientOrBusinessName())) {
|
||||
this.firstName = null;
|
||||
this.lastName = command.getFullname().trim();
|
||||
this.lastName = command.getClientOrBusinessName().trim();
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(command.getExternalId())) {
|
||||
@@ -114,7 +114,7 @@ public class Client extends AbstractAuditableCustom<AppUser, Long> {
|
||||
if (StringUtils.isNotBlank(firstname)) {
|
||||
this.firstName = firstname;
|
||||
}
|
||||
if (StringUtils.isNotBlank(firstname)) {
|
||||
if (StringUtils.isNotBlank(lastname)) {
|
||||
this.lastName = lastname;
|
||||
}
|
||||
if (externalId != null) {
|
||||
|
||||
+13
-10
@@ -5,8 +5,8 @@ import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.mifosng.data.ApiParameterError;
|
||||
import org.mifosng.data.command.ClientCommand;
|
||||
import org.mifosng.platform.DataValidatorBuilder;
|
||||
import org.mifosng.platform.api.commands.ClientCommand;
|
||||
import org.mifosng.platform.exceptions.PlatformApiDataValidationException;
|
||||
|
||||
public class ClientCommandValidator {
|
||||
@@ -22,18 +22,21 @@ public class ClientCommandValidator {
|
||||
|
||||
DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("client");
|
||||
|
||||
if (command.getFullname() != null && StringUtils.isNotBlank(command.getFullname())) {
|
||||
baseDataValidator.reset().parameter("firstname").value(command.getFirstname()).mustBeBlankWhenParameterProvided("fullname", command.getFullname());
|
||||
baseDataValidator.reset().parameter("lastname").value(command.getLastname()).mustBeBlankWhenParameterProvided("fullname", command.getFullname());
|
||||
} else if (StringUtils.isBlank(command.getFullname())) {
|
||||
if (command.getClientOrBusinessName() != null && StringUtils.isNotBlank(command.getClientOrBusinessName())) {
|
||||
baseDataValidator.reset().parameter("firstname").value(command.getFirstname()).mustBeBlankWhenParameterProvided("clientOrBusinessName", command.getClientOrBusinessName());
|
||||
baseDataValidator.reset().parameter("lastname").value(command.getLastname()).mustBeBlankWhenParameterProvided("clientOrBusinessName", command.getClientOrBusinessName());
|
||||
} else if (StringUtils.isBlank(command.getClientOrBusinessName())) {
|
||||
baseDataValidator.reset().parameter("firstname").value(command.getFirstname()).ignoreIfNull().notBlank();
|
||||
baseDataValidator.reset().parameter("lastname").value(command.getLastname()).ignoreIfNull().notBlank();
|
||||
}
|
||||
|
||||
baseDataValidator.reset().parameter("joiningDateFormatted").value(command.getJoiningDateFormatted()).ignoreIfNull().notBlank();
|
||||
baseDataValidator.reset().parameter("joiningDate").value(command.getJoiningDate()).ignoreIfNull().notBlank();
|
||||
baseDataValidator.reset().parameter("externalId").value(command.getExternalId()).ignoreIfNull().notExceedingLengthOf(100);
|
||||
baseDataValidator.reset().parameter("officeId").value(command.getOfficeId()).ignoreIfNull().notNull().greaterThanZero();
|
||||
|
||||
baseDataValidator.reset().anyOfNotNull(command.getFirstname(), command.getLastname(), command.getClientOrBusinessName(),
|
||||
command.getJoiningLocalDate(), command.getExternalId(), command.getOfficeId());
|
||||
|
||||
if (!dataValidationErrors.isEmpty()) {
|
||||
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", dataValidationErrors);
|
||||
}
|
||||
@@ -44,15 +47,15 @@ public class ClientCommandValidator {
|
||||
|
||||
DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("client");
|
||||
|
||||
if (StringUtils.isNotBlank(command.getFullname())) {
|
||||
baseDataValidator.reset().parameter("firstname").value(command.getFirstname()).mustBeBlankWhenParameterProvided("fullname", command.getFullname());
|
||||
baseDataValidator.reset().parameter("lastname").value(command.getLastname()).mustBeBlankWhenParameterProvided("fullname", command.getFullname());
|
||||
if (StringUtils.isNotBlank(command.getClientOrBusinessName())) {
|
||||
baseDataValidator.reset().parameter("firstname").value(command.getFirstname()).mustBeBlankWhenParameterProvided("clientOrBusinessName", command.getClientOrBusinessName());
|
||||
baseDataValidator.reset().parameter("lastname").value(command.getLastname()).mustBeBlankWhenParameterProvided("clientOrBusinessName", command.getClientOrBusinessName());
|
||||
} else {
|
||||
baseDataValidator.reset().parameter("firstname").value(command.getFirstname()).notBlank();
|
||||
baseDataValidator.reset().parameter("lastname").value(command.getLastname()).notBlank();
|
||||
}
|
||||
|
||||
baseDataValidator.reset().parameter("joiningDateFormatted").value(command.getJoiningDateFormatted()).notBlank();
|
||||
baseDataValidator.reset().parameter("joiningDate").value(command.getJoiningDate()).notBlank();
|
||||
baseDataValidator.reset().parameter("externalId").value(command.getExternalId()).notExceedingLengthOf(100);
|
||||
baseDataValidator.reset().parameter("officeId").value(command.getOfficeId()).notNull().greaterThanZero();
|
||||
|
||||
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
package org.mifosng.platform.client.service;
|
||||
|
||||
import org.mifosng.data.EntityIdentifier;
|
||||
import org.mifosng.data.command.ClientCommand;
|
||||
import org.mifosng.data.command.NoteCommand;
|
||||
import org.mifosng.platform.api.commands.ClientCommand;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface ClientWritePlatformService {
|
||||
@@ -10,12 +10,12 @@ public interface ClientWritePlatformService {
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE', 'CAN_ENROLL_NEW_CLIENT_ROLE')")
|
||||
Long enrollClient(ClientCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
EntityIdentifier updateClientDetails(ClientCommand command);
|
||||
|
||||
// FIXME - add permission for adding and updating client notes.
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
EntityIdentifier addClientNote(NoteCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasAnyRole('PORTFOLIO_MANAGEMENT_SUPER_USER_ROLE')")
|
||||
EntityIdentifier updateNote(NoteCommand command);
|
||||
|
||||
|
||||
}
|
||||
+16
-12
@@ -6,8 +6,8 @@ import static org.mifosng.platform.Specifications.officesThatMatch;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.mifosng.data.EntityIdentifier;
|
||||
import org.mifosng.data.command.ClientCommand;
|
||||
import org.mifosng.data.command.NoteCommand;
|
||||
import org.mifosng.platform.api.commands.ClientCommand;
|
||||
import org.mifosng.platform.client.domain.Client;
|
||||
import org.mifosng.platform.client.domain.ClientRepository;
|
||||
import org.mifosng.platform.client.domain.Note;
|
||||
@@ -56,12 +56,12 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
|
||||
String firstname = command.getFirstname();
|
||||
String lastname = command.getLastname();
|
||||
if (StringUtils.isNotBlank(command.getFullname())) {
|
||||
lastname = command.getFullname();
|
||||
if (StringUtils.isNotBlank(command.getClientOrBusinessName())) {
|
||||
lastname = command.getClientOrBusinessName();
|
||||
firstname = null;
|
||||
}
|
||||
|
||||
Client newClient = Client.newClient(currentUser.getOrganisation(), clientOffice, firstname, lastname, command.getJoiningDate(), command.getExternalId());
|
||||
Client newClient = Client.newClient(currentUser.getOrganisation(), clientOffice, firstname, lastname, command.getJoiningLocalDate(), command.getExternalId());
|
||||
|
||||
this.clientRepository.save(newClient);
|
||||
|
||||
@@ -76,16 +76,20 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
|
||||
ClientCommandValidator validator = new ClientCommandValidator(command);
|
||||
validator.validateForUpdate();
|
||||
|
||||
Office clientOffice = this.officeRepository.findOne(officesThatMatch(currentUser.getOrganisation(), command.getOfficeId()));
|
||||
if (clientOffice == null) {
|
||||
throw new OfficeNotFoundException(command.getOfficeId());
|
||||
}
|
||||
|
||||
Office clientOffice = null;
|
||||
Long officeId = command.getOfficeId();
|
||||
if (officeId != null) {
|
||||
clientOffice = this.officeRepository.findOne(officesThatMatch(currentUser.getOrganisation(), officeId));
|
||||
if (clientOffice == null) {
|
||||
throw new OfficeNotFoundException(command.getOfficeId());
|
||||
}
|
||||
}
|
||||
|
||||
String firstname = command.getFirstname();
|
||||
String lastname = command.getLastname();
|
||||
if (StringUtils.isNotBlank(command.getFullname())) {
|
||||
lastname = command.getFullname();
|
||||
if (StringUtils.isNotBlank(command.getClientOrBusinessName())) {
|
||||
lastname = command.getClientOrBusinessName();
|
||||
firstname = null;
|
||||
}
|
||||
|
||||
@@ -93,7 +97,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
||||
if (clientForUpdate == null) {
|
||||
throw new ClientNotFoundException(command.getId());
|
||||
}
|
||||
clientForUpdate.update(clientOffice, firstname, lastname, command.getExternalId(), command.getJoiningDate());
|
||||
clientForUpdate.update(clientOffice, firstname, lastname, command.getExternalId(), command.getJoiningLocalDate());
|
||||
|
||||
this.clientRepository.save(clientForUpdate);
|
||||
|
||||
|
||||
+3
@@ -2,10 +2,13 @@ package org.mifosng.platform.loanproduct.service;
|
||||
|
||||
import org.mifosng.data.EntityIdentifier;
|
||||
import org.mifosng.platform.api.commands.LoanProductCommand;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface LoanProductWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
EntityIdentifier createLoanProduct(LoanProductCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
EntityIdentifier updateLoanProduct(LoanProductCommand command);
|
||||
}
|
||||
+3
@@ -1,10 +1,13 @@
|
||||
package org.mifosng.platform.organisation.service;
|
||||
|
||||
import org.mifosng.platform.api.commands.OfficeCommand;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
public interface OfficeWritePlatformService {
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
Long createOffice(final OfficeCommand command);
|
||||
|
||||
@PreAuthorize(value = "hasRole('ORGANISATION_ADMINISTRATION_SUPER_USER_ROLE')")
|
||||
Long updateOffice(final OfficeCommand command);
|
||||
}
|
||||
@@ -7,10 +7,10 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.mifosng.data.command.ImportClientCommand;
|
||||
import org.mifosng.data.command.ImportLoanCommand;
|
||||
import org.mifosng.data.command.ImportLoanRepaymentsCommand;
|
||||
import org.mifosng.platform.ImportPlatformService;
|
||||
import org.mifosng.platform.api.commands.ImportClientCommand;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -7,10 +7,10 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.mifosng.data.command.ImportClientCommand;
|
||||
import org.mifosng.data.command.ImportLoanCommand;
|
||||
import org.mifosng.data.command.ImportLoanRepaymentsCommand;
|
||||
import org.mifosng.platform.ImportPlatformService;
|
||||
import org.mifosng.platform.api.commands.ImportClientCommand;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
Reference in New Issue
Block a user