galovics commented on code in PR #2666:
URL: https://github.com/apache/fineract/pull/2666#discussion_r994477946


##########
fineract-provider/src/main/java/org/apache/fineract/organisation/staff/domain/Staff.java:
##########
@@ -110,24 +118,9 @@ public static Staff fromJson(final Office staffOffice, 
final JsonCommand command
             joiningDate = 
command.localDateValueOfParameterNamed(joiningDateParamName);
         }
 
-        return new Staff(staffOffice, firstname, lastname, externalId, 
mobileNo, isLoanOfficer, isActive, joiningDate);
-    }
-
-    protected Staff() {
-        //
-    }
-
-    private Staff(final Office staffOffice, final String firstname, final 
String lastname, final String externalId, final String mobileNo,
-            final boolean isLoanOfficer, final Boolean isActive, final 
LocalDate joiningDate) {
-        this.office = staffOffice;
-        this.firstname = StringUtils.defaultIfEmpty(firstname, null);
-        this.lastname = StringUtils.defaultIfEmpty(lastname, null);
-        this.externalId = StringUtils.defaultIfEmpty(externalId, null);
-        this.mobileNo = StringUtils.defaultIfEmpty(mobileNo, null);
-        this.loanOfficer = isLoanOfficer;
-        this.active = isActive == null ? true : isActive;
-        deriveDisplayName(firstname);
-        this.joiningDate = joiningDate;
+        return new 
Staff().setOffice(staffOffice).setFirstname(firstname).setLastname(lastname).setExternalId(externalId)

Review Comment:
   Don't see this logic
   ```
      private Staff(final Office staffOffice, final String firstname, final 
String lastname, final String externalId, final String mobileNo,
               final boolean isLoanOfficer, final Boolean isActive, final 
LocalDate joiningDate) {
           this.office = staffOffice;
           this.firstname = StringUtils.defaultIfEmpty(firstname, null);
           this.lastname = StringUtils.defaultIfEmpty(lastname, null);
           this.externalId = StringUtils.defaultIfEmpty(externalId, null);
           this.mobileNo = StringUtils.defaultIfEmpty(mobileNo, null);
           this.loanOfficer = isLoanOfficer;
           this.active = isActive == null ? true : isActive;
           deriveDisplayName(firstname);
           this.joiningDate = joiningDate;
       }
   ```



##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/jobs/executeemail/ExecuteEmailTasklet.java:
##########
@@ -178,7 +178,7 @@ private HashMap<String, String> 
replaceStretchyParamsWithActualClientParams(fina
             switch (entry.getKey()) {
                 case "selectOffice":
                     if (client.getStaff() != null) {
-                        actualParams.put(entry.getKey(), 
client.getStaff().officeId().toString());
+                        actualParams.put(entry.getKey(), 
client.getStaff().getId().toString());

Review Comment:
   This is a bug. You're using the Staff's ID, not the Staff's Office's ID.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to