vishwasbabu commented on a change in pull request #514: [MIFOSX-2114] Change 
assignment staff to groups and clients in center.
URL: https://github.com/apache/fineract/pull/514#discussion_r261844402
 
 

 ##########
 File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java
 ##########
 @@ -247,9 +247,15 @@ public CommandProcessingResult createClient(final 
JsonCommand command) {
             }
 
             Staff staff = null;
-            final Long staffId = 
command.longValueOfParameterNamed(ClientApiConstants.staffIdParamName);
-            if (staffId != null) {
-                staff = 
this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(staffId, 
clientOffice.getHierarchy());
+            if (clientParentGroup != null) {
+                if (clientParentGroup.getParent() != null) {
+                    staff = clientParentGroup.getParent().getStaff();
+                }
+            } else {
+                final Long staffId = 
command.longValueOfParameterNamed(ClientApiConstants.staffIdParamName);
 
 Review comment:
   If the Client has a parent group, but the parent group does not have a 
center, the else condition would not execute and staffId passed in through the 
API call would be lost. You would now end up with a Client with no staff 
assigned when the API caller had explicitly passed in a staffId
   
   Ideally, the behavior should be such that.
   
   1) If the staffId is passed in through the API call, set the same to the 
client
   2) If not, inherit the staffId from the client's parent (if the client has a 
parent)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to