Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.compile.nullAnalysis.mode": "automatic"
}
57 changes: 0 additions & 57 deletions api/src/main/java/org/openmrs/module/billing/ModuleSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public class ModuleSettings {

public static final String RECEIPT_REPORT_ID_PROPERTY = "billing.defaultReceiptReportId";

public static final String CASHIER_SHIFT_REPORT_ID_PROPERTY = "billing.defaultShiftReportId";

public static final String TIMESHEET_REQUIRED_PROPERTY = "billing.timesheetRequired";

public static final String ROUNDING_MODE_PROPERTY = "billing.roundingMode";

public static final String ROUND_TO_NEAREST_PROPERTY = "billing.roundToNearest";
Expand Down Expand Up @@ -55,10 +51,6 @@ public class ModuleSettings {

public static final String DEPARTMENT_REVENUE_REPORT_ID_PROPERTY = "billing.reports.departmentRevenue";

public static final String SHIFT_SUMMARY_REPORT_ID_PROPERTY = "billing.reports.shiftSummary";

public static final String DAILY_SHIFT_SUMMARY_REPORT_ID_PROPERTY = "billing.reports.dailyShiftSummary";

public static final String PAYMENTS_BY_PAYMENT_MODE_REPORT_ID_PROPERTY = "billing.reports.paymentsByPaymentMode";

private static final AdministrationService administrationService;
Expand Down Expand Up @@ -109,14 +101,6 @@ public void apply(Integer parameter) {
}
});

getIntProperty(CASHIER_SHIFT_REPORT_ID_PROPERTY, new Action1<Integer>() {

@Override
public void apply(Integer parameter) {
cashierSettings.setDefaultShiftReportId(parameter);
}
});

getIntProperty(RECEIPT_REPORT_ID_PROPERTY, new Action1<Integer>() {

@Override
Expand All @@ -130,14 +114,6 @@ public void apply(Integer parameter) {
cashierSettings.setCashierRoundingMode(property);
}

getBoolProperty(TIMESHEET_REQUIRED_PROPERTY, new Action1<Boolean>() {

@Override
public void apply(Boolean parameter) {
cashierSettings.setCashierTimesheetRequired(parameter);
}
});

getIntProperty(PATIENT_DASHBOARD_2_BILL_COUNT, DEFAULT_PATIENT_DASHBOARD_2_BILL_COUNT, new Action1<Integer>() {

@Override
Expand All @@ -162,22 +138,6 @@ public void apply(Integer parameter) {
}
});

getIntProperty(SHIFT_SUMMARY_REPORT_ID_PROPERTY, new Action1<Integer>() {

@Override
public void apply(Integer parameter) {
cashierSettings.setShiftSummaryReportId(parameter);
}
});

getIntProperty(DAILY_SHIFT_SUMMARY_REPORT_ID_PROPERTY, new Action1<Integer>() {

@Override
public void apply(Integer parameter) {
cashierSettings.setDailyShiftSummaryReportId(parameter);
}
});

getIntProperty(PAYMENTS_BY_PAYMENT_MODE_REPORT_ID_PROPERTY, new Action1<Integer>() {

@Override
Expand All @@ -197,33 +157,16 @@ public static void saveSettings(CashierSettings cashierSettings) {
setBoolProperty(ADJUSTMENT_REASON_FIELD, cashierSettings.getAdjustmentReasonField());
setBoolProperty(ALLOW_BILL_ADJUSTMENT, cashierSettings.getAllowBillAdjustment());
setBoolProperty(AUTOFILL_PAYMENT_AMOUNT, cashierSettings.getAutoFillPaymentAmount());
setIntProperty(CASHIER_SHIFT_REPORT_ID_PROPERTY, cashierSettings.getDefaultShiftReportId());
setIntProperty(ROUND_TO_NEAREST_PROPERTY, cashierSettings.getCashierRoundingToNearest());
setIntProperty(RECEIPT_REPORT_ID_PROPERTY, cashierSettings.getDefaultReceiptReportId());
setStringProperty(ROUNDING_MODE_PROPERTY, cashierSettings.getCashierRoundingMode());
setBoolProperty(TIMESHEET_REQUIRED_PROPERTY, cashierSettings.getCashierTimesheetRequired());
setIntProperty(PATIENT_DASHBOARD_2_BILL_COUNT, cashierSettings.getPatientDashboard2BillCount());
setIntProperty(DEPARTMENT_COLLECTIONS_REPORT_ID_PROPERTY, cashierSettings.getDepartmentCollectionsReportId());
setIntProperty(DEPARTMENT_REVENUE_REPORT_ID_PROPERTY, cashierSettings.getDepartmentRevenueReportId());
setIntProperty(SHIFT_SUMMARY_REPORT_ID_PROPERTY, cashierSettings.getShiftSummaryReportId());
setIntProperty(DAILY_SHIFT_SUMMARY_REPORT_ID_PROPERTY, cashierSettings.getDailyShiftSummaryReportId());
setIntProperty(PAYMENTS_BY_PAYMENT_MODE_REPORT_ID_PROPERTY, cashierSettings.getPaymentsByPaymentModeReportId());
}

// TODO: These functions should be moved to a commons-level base class for module settings classes
private static Boolean getBoolProperty(String propertyName) {
Boolean result = null;
String property = administrationService.getGlobalProperty(propertyName);
if (!StringUtils.isEmpty(property)) {
result = Boolean.parseBoolean(property);
}

return result;
}

private static void getBoolProperty(String propertyName, Action1<Boolean> action) {
getBoolProperty(propertyName, null, action);
}

private static void getBoolProperty(String propertyName, Boolean defaultValue, Action1<Boolean> action) {
String property = administrationService.getGlobalProperty(propertyName);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ public CashierOptionsServiceGpImpl() {
* @return The {@link CashierOptions}
* @should throw APIException if rounding is set but rounding item is not
* @should throw APIException if rounding is set but rounding item cannot be found
* @should not throw exception if numeric options are null
* @should default to false if timesheet required is not specified
* @should load cashier options from the database
* @should not throw exception if numeric options are null * @should load cashier options from the
* database
*/
public CashierOptions getOptions() {
CashierOptions options = new CashierOptions();
Expand All @@ -47,7 +46,6 @@ public CashierOptions getOptions() {
if (StringUtils.isEmpty(options.getRoundingItemUuid())) {
setRoundingOptionsForEmptyUuid(options);
}
setTimesheetOptions(options);

return options;
}
Expand Down Expand Up @@ -113,19 +111,4 @@ private void setRoundingOptionsForEmptyUuid(CashierOptions options) {
options.setRoundingMode(CashierOptions.RoundingMode.MID);
options.setRoundToNearest(0);
}

private void setTimesheetOptions(CashierOptions options) {
String timesheetRequiredProperty = Context.getAdministrationService()
.getGlobalProperty(ModuleSettings.TIMESHEET_REQUIRED_PROPERTY);
if (StringUtils.isNotBlank(timesheetRequiredProperty)) {
try {
options.setTimesheetRequired(Boolean.parseBoolean(timesheetRequiredProperty));
}
catch (Exception ex) {
options.setTimesheetRequired(false);
}
} else {
options.setTimesheetRequired(false);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public class CashierOptions {

private int defaultReceiptReportId;

private boolean timesheetRequired = false;

public String getRoundingItemUuid() {
return roundingItemUuid;
}
Expand Down Expand Up @@ -59,14 +57,6 @@ public void setDefaultReceiptReportId(int defaultReceiptReportId) {
this.defaultReceiptReportId = defaultReceiptReportId;
}

public boolean isTimesheetRequired() {
return timesheetRequired;
}

public void setTimesheetRequired(boolean timesheetRequired) {
this.timesheetRequired = timesheetRequired;
}

/**
* Defines the collection of constants to be used for setting the rounding mode
*/
Expand Down
Loading