danielales2541 commented on code in PR #4487:
URL: https://github.com/apache/fineract/pull/4487#discussion_r2032017870
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java:
##########
@@ -79,7 +81,7 @@ protected void writeDate(int colIndex, Row row, String value,
CellStyle dateCell
}
LocalDate date1 = LocalDate.parse(value, formatinDB);
DateTimeFormatter expectedFormat = new
DateTimeFormatterBuilder().appendPattern(dateFormat).toFormatter();
-
row.createCell(colIndex).setCellValue(expectedFormat.format(date1));
+
row.createCell(colIndex).setCellValue(Date.from(date1.atStartOfDay(ZoneId.systemDefault()).toInstant()));
Review Comment:
We switched to the second version because the first one writes the date as
text, which makes Excel not recognize it as a real date and causes validation
to fail. The second option stores the date as a Date object, allowing Excel to
properly apply date validations and related functions.
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java:
##########
@@ -79,7 +81,7 @@ protected void writeDate(int colIndex, Row row, String value,
CellStyle dateCell
}
LocalDate date1 = LocalDate.parse(value, formatinDB);
DateTimeFormatter expectedFormat = new
DateTimeFormatterBuilder().appendPattern(dateFormat).toFormatter();
-
row.createCell(colIndex).setCellValue(expectedFormat.format(date1));
+
row.createCell(colIndex).setCellValue(Date.from(date1.atStartOfDay(ZoneId.systemDefault()).toInstant()));
Review Comment:
> Can you please elaborate on this? To be honest, i have no idea what you
mean.... Maybe an example would help me...
We switched to the second version because the first one writes the date as
text, which makes Excel not recognize it as a real date and causes validation
to fail. The second option stores the date as a Date object, allowing Excel to
properly apply date validations and related functions.
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java:
##########
@@ -79,7 +81,7 @@ protected void writeDate(int colIndex, Row row, String value,
CellStyle dateCell
}
LocalDate date1 = LocalDate.parse(value, formatinDB);
DateTimeFormatter expectedFormat = new
DateTimeFormatterBuilder().appendPattern(dateFormat).toFormatter();
-
row.createCell(colIndex).setCellValue(expectedFormat.format(date1));
+
row.createCell(colIndex).setCellValue(Date.from(date1.atStartOfDay(ZoneId.systemDefault()).toInstant()));
Review Comment:
We switched to the second version because the first one writes the date as
text, which makes Excel not recognize it as a real date and causes validation
to fail. The second option stores the date as a Date object, allowing Excel to
properly apply date validations and related functions.
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java:
##########
@@ -176,19 +176,9 @@ public void validateForCreateCenterGroup(final JsonCommand
command) {
final String externalId =
this.fromApiJsonHelper.extractStringNamed(GroupingTypesApiConstants.externalIdParamName,
element);
baseDataValidator.reset().parameter(GroupingTypesApiConstants.externalIdParamName).value(externalId).notExceedingLengthOf(100);
}
-
- final Long centerId =
this.fromApiJsonHelper.extractLongNamed(GroupingTypesApiConstants.centerIdParamName,
element);
-
baseDataValidator.reset().parameter(GroupingTypesApiConstants.centerIdParamName).value(centerId).notNull().integerGreaterThanZero();
-
- // office is inherited from center
final Long officeId =
this.fromApiJsonHelper.extractLongNamed(GroupingTypesApiConstants.officeIdParamName,
element);
baseDataValidator.reset().parameter(GroupingTypesApiConstants.officeIdParamName).value(officeId).notNull().integerGreaterThanZero();
- if
(this.fromApiJsonHelper.parameterExists(GroupingTypesApiConstants.staffIdParamName,
element)) {
Review Comment:
yes, i am sorry
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/AbstractWorkbookPopulator.java:
##########
@@ -79,7 +81,7 @@ protected void writeDate(int colIndex, Row row, String value,
CellStyle dateCell
}
LocalDate date1 = LocalDate.parse(value, formatinDB);
DateTimeFormatter expectedFormat = new
DateTimeFormatterBuilder().appendPattern(dateFormat).toFormatter();
-
row.createCell(colIndex).setCellValue(expectedFormat.format(date1));
+
row.createCell(colIndex).setCellValue(Date.from(date1.atStartOfDay(ZoneId.systemDefault()).toInstant()));
Review Comment:
We switched to the second version because the first one writes the date as
text, which makes Excel not recognize it as a real date and causes validation
to fail. The second option stores the date as a Date object, allowing Excel to
properly apply date validations and related functions.
##########
fineract-core/src/main/java/org/apache/fineract/portfolio/calendar/data/CalendarData.java:
##########
@@ -194,6 +194,51 @@ private CalendarData(LocalDate startDate, boolean
repeating, EnumOptionData freq
this.duration = null;
}
+ public CalendarData(String title, String description, LocalDate startDate,
boolean repeating, EnumOptionData frequency,
+ Integer interval, EnumOptionData repeatsOnDay, String dateFormat,
String locale, String typeId) {
+ this.title = title;
+ this.description = description;
+ this.startDate = startDate;
+ this.repeating = repeating;
+ this.frequency = frequency;
+ this.interval = interval;
+ this.repeatsOnDay = repeatsOnDay;
+ this.dateFormat = dateFormat;
+ this.locale = locale;
+ this.typeId = typeId;
+
+ this.id = null;
Review Comment:
I understand, I delete it
##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/populator/centers/CentersWorkbookPopulator.java:
##########
@@ -95,10 +95,10 @@ private void setLayout(Sheet worksheet) {
writeString(CenterConstants.ACTIVATION_DATE_COL, rowHeader,
"Activation Date*");
writeString(CenterConstants.SUBMITTED_ON_DATE_COL, rowHeader,
"Submitted On Date");
writeString(CenterConstants.MEETING_START_DATE_COL, rowHeader,
"Meeting Start Date* (On or After)");
- writeString(CenterConstants.IS_REPEATING_COL, rowHeader, "Repeat*");
- writeString(CenterConstants.FREQUENCY_COL, rowHeader, "Frequency*");
- writeString(CenterConstants.INTERVAL_COL, rowHeader, "Interval*");
- writeString(CenterConstants.REPEATS_ON_DAY_COL, rowHeader, "Repeats
On*");
+ writeString(CenterConstants.IS_REPEATING_COL, rowHeader, "Repeat");
Review Comment:
yes ,are not mandatory
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/group/serialization/GroupingTypesDataValidator.java:
##########
@@ -176,19 +176,9 @@ public void validateForCreateCenterGroup(final JsonCommand
command) {
final String externalId =
this.fromApiJsonHelper.extractStringNamed(GroupingTypesApiConstants.externalIdParamName,
element);
baseDataValidator.reset().parameter(GroupingTypesApiConstants.externalIdParamName).value(externalId).notExceedingLengthOf(100);
}
-
- final Long centerId =
this.fromApiJsonHelper.extractLongNamed(GroupingTypesApiConstants.centerIdParamName,
element);
Review Comment:
in front it is not necessary but I add it
--
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]