Commit Graph

21892 Commits

Author SHA1 Message Date
Geert Janssens
28fa4c6465 core-utils - move wrapper code to bindings/guile
Note core-utils.i is used by both the guile and the python bindings so
it is moved up to the common bindings directory, while guile
specific changes are in bindings/guile.
2019-12-06 19:59:11 +01:00
Geert Janssens
18093b5e82 core-utils - move guile utils to bindings/guile 2019-12-06 19:59:11 +01:00
Geert Janssens
33e1ff645c Allow to pass include directories to the add_swig_xyz commands
This will be needed when the wrappers no longer live in
the same directory as the objects they are wrapping.
2019-12-06 19:59:11 +01:00
Geert Janssens
e493d42def Introduce gnucash-guile shared library
This (currently empty) library is intented to become
the standard api library for guile code that wants
to use the libgnucash functionality.
2019-12-06 19:59:11 +01:00
Geert Janssens
a0aa105826 libgnucash/scm - move to bindings/guile
A small step in the direction of making libgnucash guile-free.
2019-12-06 19:59:11 +01:00
Geert Janssens
9b803428ef split register - add tests for copy operations 2019-12-06 19:59:11 +01:00
Geert Janssens
f5e28c3d0f split register - drop scm copy interface 2019-12-06 19:41:50 +01:00
Geert Janssens
cb273b13a1 split register - use C copy interface instead of scm copy interface 2019-12-06 19:29:47 +01:00
Geert Janssens
543fab2513 split-register - port copy operations from scm to c
This is done with minimal interpretation, to be able to easily
compare with the original scheme code.
It will most likely be optimized in future commits
2019-12-06 19:29:11 +01:00
Geert Janssens
9f5cbb3a82 app-utils - move register's copy operations to ledger-core
They are only used by split-register.c in that directory
2019-12-04 19:23:14 +01:00
Geert Janssens
02afa33e54 app-utils - reduce guile-util api-surface
Make internal-use only function static and drop two unused functions.
2019-12-04 19:23:14 +01:00
Geert Janssens
efefac3e1e Dead code removal 2019-12-04 19:23:14 +01:00
Geert Janssens
f039cc80e9 Fix ninja-build check without running ninja-build first
The (gnucash reports) guile module should be built before the reports
depending on it.
2019-11-27 17:28:53 +01:00
Robert Fewell
cbc8cc8d8c Remove file committed by mistake 2019-11-25 20:43:39 +00:00
Robert Fewell
574d1a99f2 Add warning label in Import Account Matcher for Commodity
When an account is selected for matching the incoming source, at the
moment any account can be selected apart from a place holder account.
If the required commodity is passed in, display a warning if the
selected account is a different commodity and disable the OK button.
2019-11-25 16:18:27 +00:00
Robert Fewell
8afbe89772 Change image from a stock to an icon name 2019-11-25 16:18:27 +00:00
Robert Fewell
789339c4b7 Set ellipsis on Memo column of import matcher
On first load the Description and Memo columns are set to the width of
the longest piece of text which can force the Info column out of site
so add the 'ellipsize end' to the memo column which will help keep the
info column in view.
2019-11-25 16:18:27 +00:00
Robert Fewell
3ac440121d Info column in matcher looks odd if other columns are resized
The Info column has a cell_render_pixbuf and a cell_render_text aligned
to the left. If the info column is made larger, the text does not keep
to the left so split them into there own columns.
2019-11-25 16:18:27 +00:00
Robert Fewell
d50d3de8b5 Remove a vertical black line from import matcher
When change a row to skipping it, a pixbuf is created with just a
vertical black line and looks odd. There is no reason to create a
pixbuf so change the value in the store to NULL. Do the same when
the 'match missing' is displayed.
2019-11-25 16:18:27 +00:00
Robert Fewell
161bb5f65d Change import-main-matcher to display matched information
Change the import-main-matcher tree view to use a tree store and add
the matched information as a child row.
2019-11-25 16:18:21 +00:00
Christopher Lam
6c3b24a9b6 [html-style-info] remove font-face/size/color from style-info
These were unused in real code.
2019-11-25 20:38:16 +08:00
Christopher Lam
ea9d5fb197 Merge branch 'maint' 2019-11-25 19:45:26 +08:00
Christopher Lam
0973d54d6c [report-utilities] make gnc:owner-splits->aging-list less noisy
invoice processing messages dumped in debug mode. use gnc:msg
2019-11-25 18:35:26 +08:00
Christopher Lam
9adf8db1a2 [report-utilities] gnc:strify can render vectors too 2019-11-25 18:28:58 +08:00
Christopher Lam
aa451bc89d [balsheet-pnl] compact functions
readability fixes
2019-11-25 18:28:58 +08:00
Christopher Lam
d6a5c8ba54 [balsheet-pnl] accumulate column data report-dates
Previous would call gnc:account-get-balances-at-dates and
gnc:account-accumulate-at-dates to retrieve balances and
last-split. This commit reduces the O(2*N) operation to O(N) which
becomes significant with accounts with large number of splits.

Maybe we can reduce other account splitlist scans in the future; these
will be easier and would only require augmenting the record.
2019-11-25 18:28:58 +08:00
Frank H. Ellenberger
a261c8aadb Merge branch 'emacs' into maint 2019-11-25 07:14:05 +01:00
Frank H. Ellenberger
91183a2af5 drop emacs_trailer from xml files.
Modern versions of emacs know, how to behave on xml files.
2019-11-25 00:42:40 +01:00
Christopher Lam
e83f5b0568 Bug 797506 - New Aging errors out with guile backtrace in case of a few uncommon transactions
Some invalid txns with splits in the wrong APAR account can be
processed, creating cases whereby split->owner returns an invalid
freshly-allocated owner.
2019-11-24 23:09:55 +08:00
Christopher Lam
287b857a18 [html-style-info] deprecate font-face/size/color
Only 'font-color was demonstrated in hello-world.scm, and these were
never used in practice.
2019-11-23 22:55:14 +08:00
Christopher Lam
729bf5ae6a [hello-world] remove 'Text Color' option - will be deprecated
... because deleting an option does not cause crash in saved-reports.
2019-11-23 22:55:14 +08:00
Christopher Lam
101cc91698 [reports] use new api gnc:account-accumulate-at-dates
queries xaccSplitGetNoclosingBalance (which is a pointer dereference)
instead of a more complex conditional-based snippet for split->amount,
should be faster.

The category-barchart change will choose the appropriate split->elt
function according to the account type. This is more efficient than
the old split->amount function which includes a conditional.

Note we don't need to test for account being income/expense:
asset/liability accounts do not have Closing transactions. Therefore
we can use xaccSplitGetNoclosingBalance for splits from any account
type.
2019-11-23 22:55:14 +08:00
Christopher Lam
68b0abdfa6 [report-utilities] gnc:account-accumulate-at-dates: specify default elt
if acc has no splits before report-date, the nosplit->elt will specify
the default value to be inserted in the result list.

e.g. consider:

dates are (date1 date2 date3 date4 date5)
account has splits starting after date2:

(gnc:account-accumulate-at-dates account dates
 #:split->elt (const 'yea) #:nosplit->elt 'nay)

results in '(nay nay yea yea yea)
2019-11-23 22:55:14 +08:00
Robert Fewell
17d3938866 [I18N] Remove trailing colon and space from source file dialogue labels 2019-11-22 13:36:03 +00:00
Robert Fewell
5586ccaa5f [I18N] Remove trailing colon and space from glade dialogue labels - part2 2019-11-22 13:36:03 +00:00
Robert Fewell
6897f13e78 [I18N] Remove trailing colon and space from glade dialogue labels - part1 2019-11-22 13:36:03 +00:00
Christopher Lam
063a270499 [new-owner-report] fix: payment->invoice gets invoice totals
previously the payment-amount deduction loop used the
payment-split-list to obtain the invoice-posting-split's amount. this
would occasionally fail and would return the invoice-payment-split
amount, obtaining the wrong sign.

modify to retrieve the invoice total via gncInvoice API.

therefore payment-amount, minus gncInvoiceGetTotal(inv) amounts,
results in the overpayment amount.
2019-11-21 20:44:29 +08:00
Christopher Lam
b3493509d1 [balsheet-pnl] speed up by pre-generating account report-date splits
previous code was very inefficient: if an account had N old splits and
balance-sheet reported on M recent dates, it would scan splitlist
multiple times: (1) to retrieve splits, (2) filter until
column-date, (3) find the last one. i.e. total O(N * M * 3).

this algorithm pre-generates the account's report-date splits by
scanning each account only once, creating M splits which are queried
by get-cell-anchor-fn via list-ref. i.e. O(N)

it is immedialtely converted to a vector because we want O(1)
access. from get-cell-anchor-fn

a future optimisation may scan the accounts' splitlists once per
report run, acquiring all required data (i.e. last period split,
split->balance, closing entries) in 1 pass, to generate a column-data
record.
2019-11-21 20:11:49 +08:00
Christopher Lam
dda3da8416 [report-utilities][API] gnc:account-accumulate-at-dates
this is a generalised form from gnc:account-get-balances-at-dates to
accumulate a list from report dates.

this function will scan through account splitlist, processing each
split via split->elt, accumulating results at date boundaries into the
results list. it uses ice-9 match for conciseness.

in: acc   - account
    dates - a list of time64
    split->elt - an unary lambda. the result of calling (split->elt split)
                 will be accumulated onto the resulting list. by
                 default it returns the last split-balance before
                 date boundary, similar to gnc:account-get-balances-at-dates

out: (list elt0 elt1 ...), each entry is the result of split->elt
2019-11-21 19:54:18 +08:00
Christopher Lam
f0a189adbb [test-report-utilities] add test-get-account-at-dates 2019-11-21 19:54:14 +08:00
Christopher Lam
2671814251 [balsheet-pnl] income statement parent account can link to TR
this commit modifies the recursive-parent subtotal generator to also
include a link to a transaction report with all relevant accounts.
2019-11-20 21:31:51 +08:00
Christopher Lam
1ab95b5563 [invoice][i18n] enable i18n options helptext
and remove obsolete options "My Company" and "My Company ID"
2019-11-20 21:31:40 +08:00
Christopher Lam
21f053398f Merge remote-tracking branch 'origin/maint' 2019-11-19 23:07:10 +08:00
Christopher Lam
eea5ac98c0 [stylesheet-plain][html5] omit <h3></h3> when headline is empty.
We compare headline with "", rather than test (string-null? headline),
because headline may be either a string or a complex gnc:html-text
object.
2019-11-19 19:35:05 +08:00
Christopher Lam
9bb2e4a21a [html-fonts][html5] add html,body height 100vh
This CSS rule allows children elements (such as <canvas>) to inherit
100% viewport height for displaying full-screen charts. This is
necessary for standards-mode.

https://quirks.spec.whatwg.org/#the-html-element-fills-the-viewport-quirk
2019-11-19 19:34:56 +08:00
Christopher Lam
fbc7c9027e [scm/utilities] even more efficient list-flatten functions
because:

* list? is O(N), because it needs to test for an improper
list. improper lists are lists whose last pair's cdr cell is not
'(). null? and pair? are both O(1).

* avoids reverse which is also O(N): guile has unlimited stack
therefore we can do non-tail-call loop first to pass as parameter to
the tail-call loop. this removes the need for prepend-and-reverse.
2019-11-19 19:28:27 +08:00
Robert Fewell
043abcb436 Reformat the gnc_cell_renderer_date* source files
Change tabs to spaces and fix some spaces issues in the source files.
2019-11-18 16:18:27 +00:00
Robert Fewell
09746ca61d Fix GncPopupEntry missing property error
There was error in the trace file for GncPopupEntry of the format...
Object class GncPopupEntry doesn't implement property 'editing-canceled'
 from interface 'GtkCellEditable' so added one.
2019-11-18 16:17:20 +00:00
Robert Fewell
6a167389ad Bug 797492 - Lock up on 'Find Account'
If you list accounts with the "find accounts" dialogue, then delete an
account it has found (e.g. jump & delete), then return to the dialogue,
the dialogue doesn't refresh when the window regains the focus, so you
can accidentally jump to an account you have recently deleted which
will lock up Gnucash.

Fix this by listening to account events and then refresh the list.
2019-11-18 16:16:25 +00:00
Christopher Lam
de09259f13 Bug 797500 - valgrind errors - new/delete vs malloc/free
Mismatched new/g_free()
Change to new/guid_free() which calls delete
2019-11-17 09:55:51 +08:00