You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "airajena (via GitHub)" <gi...@apache.org> on 2026/03/01 04:27:16 UTC

Re: [PR] FINERACT-1932: Fineract modularization [fineract]

airajena commented on code in PR #5562:
URL: https://github.com/apache/fineract/pull/5562#discussion_r2868406509


##########
fineract-core/src/main/java/org/apache/fineract/organisation/staff/domain/Staff.java:
##########
@@ -112,6 +113,67 @@ public static Staff fromJson(final Office staffOffice, final JsonCommand command
         return new Staff(staffOffice, firstname, lastname, externalId, mobileNo, isLoanOfficer, isActive, joiningDate);
     }
 
+    public static Staff fromRequest(final Office staffOffice, final StaffRequest request) {
+        final String firstname = request.getFirstname();
+        final String lastname = request.getLastname();
+        final String externalId = request.getExternalId();
+        final String mobileNo = request.getMobileNo();
+        final boolean isLoanOfficer = request.getIsLoanOfficer() != null ? request.getIsLoanOfficer() : false;
+        final Boolean isActive = request.getIsActive();
+
+        LocalDate joiningDate = null;
+        return new Staff(staffOffice, firstname, lastname, externalId, mobileNo, isLoanOfficer, isActive, joiningDate);
+    }
+
+    public Map<String, Object> update(final StaffRequest request) {
+        final Map<String, Object> actualChanges = new LinkedHashMap<>(7);
+
+        if (request.getOfficeId() != null && !request.getOfficeId().equals(this.office.getId())) {
+            actualChanges.put("officeId", request.getOfficeId());
+        }
+
+        boolean firstnameChanged = false;
+        if (request.getFirstname() != null && !request.getFirstname().equals(this.firstname)) {
+            actualChanges.put("firstname", request.getFirstname());
+            this.firstname = request.getFirstname();
+            firstnameChanged = true;
+        }
+
+        boolean lastnameChanged = false;
+        if (request.getLastname() != null && !request.getLastname().equals(this.lastname)) {
+            actualChanges.put("lastname", request.getLastname());
+            this.lastname = request.getLastname();
+            lastnameChanged = true;
+        }
+
+        // Fixed: Combined the flags you created above

Review Comment:
   I feel such comments should be avoided. 



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org