Improved: General refactoring and code improvements, package
org.apache.ofbiz.accounting.period.
Thanks Julian Leichert for reporting and providing the patch.
@@ -42,8 +42,9 @@ public class PeriodServices {
public static final String module = PeriodServices.class.getName();
public static final String resource = "AccountingUiLabels";
- /* find the date of the last closed CustomTimePeriod, or, if none available, the earliest date available of any
- * CustomTimePeriod
+ /*
+ * find the date of the last closed CustomTimePeriod, or, if none available, the
+ * earliest date available of any CustomTimePeriod
*/
public static Map<String, Object> findLastClosedDate(DispatchContext dctx, Map<String, ?> context) {
Delegator delegator = dctx.getDelegator();
@@ -62,23 +63,26 @@ public class PeriodServices {
Map<String, Object> result = ServiceUtil.returnSuccess();
try {
- // try to get the ending date of the most recent accounting time period before findDate which has been closed
- List<EntityCondition> findClosedConditions = UtilMisc.toList(EntityCondition.makeConditionMap("organizationPartyId", organizationPartyId),
+ // try to get the ending date of the most recent accounting time period before
+ // findDate which has been closed
+ List<EntityCondition> findClosedConditions = UtilMisc.toList(
+ EntityCondition.makeConditionMap("organizationPartyId", organizationPartyId),
EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN_EQUAL_TO, findDate),
EntityCondition.makeConditionMap("isClosed", "Y"));
if (UtilValidate.isNotEmpty(periodTypeId)) {
// if a periodTypeId was supplied, use it
findClosedConditions.add(EntityCondition.makeConditionMap("periodTypeId", periodTypeId));
}
- GenericValue closedTimePeriod = EntityQuery.use(delegator).from("CustomTimePeriod").select("customTimePeriodId", "periodTypeId", "isClosed", "fromDate", "thruDate")
+ GenericValue closedTimePeriod = EntityQuery.use(delegator).from("CustomTimePeriod")
+ .select("customTimePeriodId", "periodTypeId", "isClosed", "fromDate", "thruDate")
.where(findClosedConditions).orderBy("thruDate DESC").queryFirst();
if (UtilValidate.isNotEmpty(closedTimePeriod) && UtilValidate.isNotEmpty(closedTimePeriod.get("thruDate"))) {
lastClosedTimePeriod = closedTimePeriod;
lastClosedDate = lastClosedTimePeriod.getTimestamp("thruDate");
} else {
- // uh oh, no time periods have been closed? in that case, just find the earliest beginning of a time period for this organization
- // and optionally, for this period type
+ // uh oh, no time periods have been closed? in that case, just find the earliest
+ // beginning of a time period for this organization and optionally, for this period type
Map<String, String> findParams = UtilMisc.toMap("organizationPartyId", organizationPartyId);
if (UtilValidate.isNotEmpty(periodTypeId)) {
findParams.put("periodTypeId", periodTypeId);
