Commit Graph

27 Commits

Author SHA1 Message Date
Christopher Lam
bf671d4fc7 [c-interface] Deprecate gnc:make-string-database
It's only used by date-utilities.scm

This removes the date-utilities -> c-interface dependency.
2020-12-23 23:58:09 +08:00
Christopher Lam
59ec912928 [modularise] (gnucash app-utils) 2020-12-09 06:40:07 +08:00
Christopher Lam
a2ef6ed6a5 Use proper format syntax 2020-12-04 18:37:35 +08:00
Christopher Lam
72982de588 Revert "[date-utilities] Convert reldate list into srfi-9 records"
This reverts commit 3be7935965.
2020-11-22 21:56:42 +08:00
Christopher Lam
3be7935965 [date-utilities] Convert reldate list into srfi-9 records 2020-11-22 21:14:13 +08:00
Christopher Lam
d546a617ad ensure averaging-multipler returns exact numbers rather than floats 2020-07-19 17:46:01 +08:00
Christopher Lam
428c8c501c [guile-3] change _ to G_
In guile-3 _ is a reserved symbol. Change to G_ by guile gettext
convention.
2020-07-12 19:03:26 +08:00
Geert Janssens
bd311d5dfb report - expose wrapped api directly from report-core.scm
With that in place we no longer need to (gnc:module-load "gnucash/report" 0)
the report gncmodule. An ordinary (use-modules (gnucash report)) suffices

Note: as gncmod-report did additional initialization, most reports
needed additional tweaks like using app-utils.
And in app-utils the initialization of the relative date terms
has been tweaked as well to run whenever the app-utils module
gets loaded first time, rather than having this initialized by
gncmod-report.
2019-12-06 20:38:21 +01:00
Geert Janssens
d777128e6f app-utils - simplify and move gettext wrappers
1. Instead of creating a C wrapper around gettext to then wrap in
guile, use guile's builtin gettext support directly.

The code still defines the _ and N_ shorthands. However it doesn't
really warant a separate module just for these two shorthands.
Instead define them in core-utils. So all code wanting to use
_ or N_ in guile should now use the (gnucash core-utils) module.

The bulk of this commit is actually deleting the scm-gettext
target and using (gnucash core-utils) instead of (gnucash gettext).

2. As the definition of _ and N_ is removed from app-utils.scm,
the app-utils test for a functional N_ macro has been moved to a
new test file in the guile bindinds tests.

3. The (gnucash gettext) module has been deprecated. Use
(gnucash core-utils) from now on.
2019-12-06 19:59:12 +01:00
Christopher Lam
0f6ad8263b Remove deprecated functions 2019-09-18 21:20:05 +08:00
Christopher Lam
f64dd0860f Bug 752395 - Start Day of weekly report doesn't respond to change in locale
Redefines some functions to ensure weekly grouping in transaction
report obeys locale's start-of-week.
2019-08-15 13:18:46 +08:00
Christopher Lam
681e023cd5 [date-utilities][API] deprecate unused exports, add comments
* deprecated:
  gnc:make-reldate-hash
  gnc:reldate-string-db
  gnc:relative-date-values
  gnc:get-relative-date-strings

* remove gnc:reldate-list, unused

* comment sections
2019-07-25 20:22:12 +08:00
Christopher Lam
7e9ec00906 [date-utilities] tidy up gnc:make-date-interval-list 2019-07-24 23:44:56 +08:00
Christopher Lam
ed42f8acb6 Bug 797197 - Transaction report: Error message when sorting on month
guile's strftime is/was buggy; cannot handle non-UTF8 locales. Use
gnc_print_time64 instead. see the following

http://lists.gnu.org/archive/html/bug-guile/2019-05/msg00003.html
2019-05-27 21:20:29 +08:00
christopherlam
d711cc35f8 Bug 639049 - Asset Barchart Report includes also the first day of next month transactions
If the original date is an end-of-month date, we take it as an
indicator they always want monthdelta dates to be end-of-months.

This works for monthly/quarterly/halfyearly/annual.

Addendum to commit 65bfeaf5de which was
deemed to be an incomplete fix.

Also I'd forgotten to activate a test in test-date-utilities. Enable it.
2019-03-21 19:44:33 +08:00
Christopher Lam
a4789fcac5 bugfix: fix crasher when loading saved-report with unknown choices.
If a saved-report with e.g. relative date, multichoice option is
unknown, the report would crash, and the Report-Options would
segfault. This commit fixes both: report-date defaults to 'today',
multichoice-options defaults to default-value.

Following this commit, if a report loads a saved-report or .gcm from a
future version, a gnc:warn will be emitted and the report will not
crash; it will use relative-date today. Multichoice will remain the
default value. Report Options will not segfault.

The user will be notified via a gnc:gui-warn dialog
2019-02-17 11:25:06 +08:00
Christopher Lam
65bfeaf5de [date-utilities] bugfix: date-intervals produces good month deltas
Instead of recursing the date, we calculate the next month using an
index-based multiplier, and apply modulo/remainder as appropriate to
determine the next month/year.

Then we attempt to create new mktime, and if the resulting mktime's
month is not as expected, reduce the mday by 1 until resulting month
is correct. This fixes monthly intervals for end-of-month days.

Test via monthly/quarterly deltas, and also includes leapyear
calculation.
2019-02-13 22:23:44 +08:00
John Ralls
dedb5265f0 Merge branch 'maint' into unstable 2018-03-25 09:36:21 -07:00
Christopher Lam
8fef1adcc4 date-utilities: bugfix weekly render
This was introduced by 48bdab3.
2018-03-01 12:14:53 +08:00
John Ralls
48bdab38d4 Replace sprintf with Guile's built-in format. 2018-02-17 15:24:44 -08:00
Christopher Lam
cc097a3f35 [mod|inc|dec]date64 API rename back to date
This commit mass renames new t64 API back to the original names.
2018-01-11 21:07:02 +11:00
Christopher Lam
ee8f9053e8 REMOVE-TIMEPAIR: libgnucash/app-utils/app-utils.scm & date-utilities.scm
This commit removes timepair API functions defined in date-utilities.scm
2018-01-08 22:56:50 +11:00
Christopher Lam
7550ccf537 date-utilities.scm: optimize leapyear calc 2018-01-08 13:01:29 +11:00
Christopher Lam
33a7bb73db Bugzilla 790526 Correct weeknum calculator
This change will fix 'num-of-weeks-since-1/jan/1970' which formerly used quotient to remove
the fractional part of the division. For negative values of num-of-weeks, the number is truncated
in the wrong direction (i.e. towards 0). This change uses floor instead to ensure the num-of-weeks
found is the nearest integer LESS than the fractional number.
2018-01-08 13:01:29 +11:00
Christopher Lam
335165104b ADD-TIME64-API: libgnucash/app-utils/app-utils.scm & date-utilities.scm 2018-01-08 13:01:29 +11:00
John Ralls
e1d3385428 Handle mid-pacific timezones in date-sensitive tests. 2017-12-15 10:13:41 -08:00
Geert Janssens
83d14e1c1c Restructure the src directory
It is split into
- /libgnucash (for the non-gui bits)
- /gnucash (for the gui)
- /common (misc source files used by both)
- /bindings (currently only holds python bindings)

This is the first step in restructuring the code. It will need much
more fine tuning later on.
2017-08-10 18:45:00 +02:00