diff --git a/libgnucash/app-utils/gnc-option.cpp b/libgnucash/app-utils/gnc-option.cpp index 55c52bb602..9492d7d313 100644 --- a/libgnucash/app-utils/gnc-option.cpp +++ b/libgnucash/app-utils/gnc-option.cpp @@ -152,7 +152,7 @@ GncOptionDateValue::get_value() const return static_cast(GncDateTime(now)); } static const char* date_type_str[] {"absolute", "relative"}; -static const std::array date_period_str +static const std::array date_period_str { "today", "start-this-month", "end-this-month", diff --git a/libgnucash/app-utils/gnc-optiondb.i b/libgnucash/app-utils/gnc-optiondb.i index f3e58f2260..98cbc908a1 100644 --- a/libgnucash/app-utils/gnc-optiondb.i +++ b/libgnucash/app-utils/gnc-optiondb.i @@ -184,6 +184,22 @@ using Account = struct account_s; %ignore GncOptionDateValue(GncOptionDateValue&&); %ignore GncOptionDateValue::operator=(const GncOptionDateValue&); %ignore GncOptionDateValue::operator=(GncOptionDateValue&&); +%rename(absolute) RelativeDatePeriod::ABSOLUTE; +%rename(today) RelativeDatePeriod::TODAY; +%rename(start_this_month) RelativeDatePeriod::START_THIS_MONTH; +%rename(end_this_month) RelativeDatePeriod::END_THIS_MONTH; +%rename(start_prev_month) RelativeDatePeriod::START_PREV_MONTH; +%rename(end_prev_month) RelativeDatePeriod::END_PREV_MONTH; +%rename(start_current_quarter) RelativeDatePeriod::START_CURRENT_QUARTER; +%rename(end_current_quarter) RelativeDatePeriod::END_CURRENT_QUARTER; +%rename(start_prev_quarter) RelativeDatePeriod::START_PREV_QUARTER; +%rename(end_prev_quarter) RelativeDatePeriod::END_PREV_QUARTER; +%rename(start_cal_year) RelativeDatePeriod::START_CAL_YEAR; +%rename(end_cal_yea) RelativeDatePeriod::END_CAL_YEAR; +%rename(start_prev_year) RelativeDatePeriod::START_PREV_YEAR; +%rename(end_prev_year) RelativeDatePeriod::END_PREV_YEAR; +%rename(start_accounting_period) RelativeDatePeriod::START_ACCOUNTING_PERIOD; +%rename(end_accounting_period) RelativeDatePeriod::END_ACCOUNTING_PERIOD; %typemap(typecheck, precedence=SWIG_TYPECHECK_INT64) time64 { $1 = scm_is_signed_integer($input, INT64_MAX, INT64_MIN); diff --git a/libgnucash/app-utils/test/test-gnc-optiondb.scm b/libgnucash/app-utils/test/test-gnc-optiondb.scm index dde592513b..7ecb2f9512 100644 --- a/libgnucash/app-utils/test/test-gnc-optiondb.scm +++ b/libgnucash/app-utils/test/test-gnc-optiondb.scm @@ -183,12 +183,13 @@ (test-begin "test-gnc-test-date-option") (let* ((option-db (gnc-option-db-new)) (date-opt (gnc-register-date-interval-option option-db "foo" "bar" - "baz" "Phony Option")) + "baz" "Phony Option" + (RelativeDatePeriod-today))) (a-time (gnc-dmy2time64 11 07 2019))) (test-equal (current-time) (gnc-option-value option-db "foo" "bar")) (gnc-set-option option-db "foo" "bar" a-time) - (test-equal a-time (gnc-option-value option-db "foo" "bar")) - (test-end "test-gnc-test-date-option"))) + (test-equal a-time (gnc-option-value option-db "foo" "bar"))) + (test-end "test-gnc-test-date-option")) (define (test-gnc-make-number-range-option) (test-begin "test-gnc-number-range-option")