Merge branch 'maint'

Resolves most merge conflicts. The only bit I was unable
to merge from maint into master is the use of match-lambda
in category-barchart.scm. This will have to be redone manually.
This commit is contained in:
Geert Janssens 2020-01-14 19:56:35 +01:00
commit 45cfb8937a
143 changed files with 994403 additions and 890084 deletions

166
NEWS
View File

@ -1,5 +1,169 @@
Version history:
------- -------
3.8 - 29 December 2019
The ninth release of the 3.x stable series.
Note for German FinTS users: This release includes the latest fixes
in support of the PSD2 changes. The Mac and Windows bundles include
the current beta releases of AQBanking and its support library needed
to work with most German banks' implementations of FinTS.
Translators, Note Well: The obsolete "disambiguation prefix" translator
comments are removed in favor of three-parameter gettext(). See
https://lists.gnucash.org/pipermail/gnucash-devel/2019-September/044199.html
The following bugs have been fixed:
Bug 412151 - Not handling exception when guile is compiled w/o regexp
support
Disable qif-import and make-regexp if guile is compiled
without regex.
Bug 724219 - Customer Summary includes Closing Entries when reporting
across the end of year
Bug 743943 - "Edit->Post Invoice" is ambiguous.
Bug 759005 - Print negatives in red.
Bug 787295 - Allow UI jump from Business accounts to their relevant
invoice/bill/voucher
Bug 796530 - [txn csv importer] usability suggestions
Bug 796736 - Register cell pop up columns width to narrow
Bug 796945 - Find Transaction Split Search Search Criteria window does
not scroll when added criteria exceed a certain amount
Bug 797078 - "Automatic decimal point" Should Not Cause 2 Different
Behaviors
Bug 797086 - Import customer dialog headers not translated
Bug 797279 - Reports RTL do not support RTL
Bug 797326 - Enhancement: budget's Estimate tool should ignore Closing
Entries
Bug 797356 - ninja check fails with GCC-9
Bug 797390 - xaccAccountRecomputeBalance also tallies no-closing
balances
Bug 797397 - Import Map Editor - Deletion not limited by current filter.
Bug 797401 - Invoice Reports need an overall page width set
Bug 797405 - HBCI Import PIN entry window is hidden behind log window,
program stuck
Bug 797408 - Find Transaction Window -> Search Criteria Section -> Add
Search Criteria -> Section does not expand to new size to
include a newly added Search Criteria
Bug 797416 - Enter key does not move to blank tx or next line
Bug 797418 - In budget report, column with Actual Totals for
Liabilities and Income are reversed
Bug 797430 - SEPA transfers are not executed
Avoid double init of gui Patch by Mike Pieper. Thanks!
Bug 797453 - Chart of Accounts is slow to update / redraw
Bug 797459 - Installation (for 3.7) Readme Version number shows 2.2.x
Bug 797462 - gnc:strify reports the amount and value incorrectly
Bug 797473 - UTF8 characters not processed correctly with aqbanking6
Bug 797481 - crash on close of unsaved tabs by pressing [X]
Bug 797482 - Can't edit date when using Edit Payment function
Bug 797492 - Lock up on 'Find Account'
Bug 797500 - valgrind errors - new/delete vs malloc/free
Bug 797506 - New Aging errors out with guile backtrace in case of a few
uncommon transactions
Bug 797519 - Budget Viewer Totals do not redraw upon to Sign-Reversal
changes
Bug 797520 - Balance Sheet (Multicolumn) the retained earnings amount
in the equity section has its sign reversed
Bug 797521 - Receivable Aging (beta): include earliest split
Bug 797521 - Receivable Aging (beta): prepayments logic doesn't work,
appears to use incorrect absolute value logic
Bug 797532 - Crash/Coredump Lots
Other repairs or enhancements not marked as bugs:
The Customer/Employee/Vendor reports have been rewritten. The new
versions may be found in Reports>Experimental.
[stylesheet-css] a user-customisable CSS based stylesheet
New stylesheet. Exposes a single text box for full CSS
customisability.
Allow account selection by typing into the post-to field of the payment
window
When sizing some register columns take account of 'Tot' being added.
Take account for the pop up button border in the register.
Change the date sample so it has the maximum text width possible
[new-owner-report] bugfix: balance row needs variable linked cols
Improve translations by scriptedly removing the removed colon suffix.
[report-utilities] bugfix: aging-list was incorrect. off-by-1 error.
[report-utilities] bugfix: overpayment works for AP accounts.
Swap the buttons around on the Budget Open dialogue
Swap the OK and Cancel buttons so they conform to the normal layout.
[report-utilities] bugfix: fix overpayment detection
For 1 payment to >1 invoices, previously would miscalculate
overpayment.
[budgets.scm] Budget reports handle both natural & reversed budgets.
This change is protected by a Feature: Using it will prevent the file
from being opened by earlier versions of GnuCash.
[gnc-budget-view.c] totals - 5 fundamental types
previous showed income/expense/transfers/totals budget totals, of
uncertain meaning. now shows income/expense/asset/liability/equity
budget totals. The 5 lines also become sensitive to the global
sign-reverse property.
bindings-python - drop references to gnucash-env
We no longer ship a gnucash-env script, directly use python(3)
instead
[balsheet-pnl] fix: single-date balsheet missed printing date
[balsheet-pnl] fix: hide Equity sections when not needed
* If currencies are not converted, Unrealized Gains are meaningless.
Hide them. * If there are no income/expense accounts, retained
earnings will be nil. Remove row.
Ignore trailing noise on imported transaction account numbers.
AQBanking6 uses a separate method for retrieving account numbers for
account info and transactions, where the transactions method can have
additional characters, most often the ISO4217 currency code. That
results in match failures when importing. As a work-around, compare
only the length of the account-info-generated online id when
comparing it to the transaction-generated one. Note that this is only
a partial solution: At least one German bank also appends characters
to the transaction-generated bank id and that will still cause the
match to fail.
[dialog-payment] Add warning label if payment is unattached
Completing a payment for a customer without associating with an open
invoice is allowable and is used for prepayments. Enable a warning to
inform that the payment does not have an invoice/bill document attached.
[aging] update error reporting
This error handling was for transactions in APAR accounts whereby
Transaction Currency != Owner Currency. An example is a manually
entered transaction, then assigned as payment to a customer with a
different currency. Update to modern API calls. Show the culprit
split details. Fixed example output: IGNORING TRANSACTION! Invoice
Owner: [None:] Transaction:Txn<d:28/10/19> Splits are:
Split<d:28/10/19,acc:Current,amt:$150.00,val:£150.00>
Split<d:28/10/19,acc:AR,amt:$0.00,val:-£150.00> Transaction
Currency:GBP Client Currency:AUD
Fixed German IBAN error message
Allow edit of some fields for posted invoice
Allow editing of some fields for posted invoice. For reasons, see bug
report: https://bugs.gnucash.org/show_bug.cgi?id=797400
[average-balance] show monetaries instead of numbers in data table
UK VAT template: replace obsolete EEC and EC by EU
Implements the presentation of static optical TAN challenges (photoTAN
and QR) inside the enter TAN dialogue.
[budget] fixcrash: fix crasher for some periods
eg. the following combo would previously crash: - periods from next
to current - use accumulated amounts
[budget] fixcrash: prevent crash if periods start > end
It's silly to input start-period > end-period. Nevertheless handle it
by swapping them instead of crashing. i.e. report budget periods from
end to start.
[budget-flow] fixcrash: exchange-fn needs to specify exchange date
because some exchange-fn *do* require date eg. pricedb-nearest. use
the period end-date for the exchange date.
[portfolio report] There's no report-currency. Use currency.
[window-report] show backtrace when report crashes
* exposes a SCM string last-captured-error containing last backtrace
* when rendering report-crash window, include it
New Scheme Functions:
gnc:html-markup-ol: creates an HTML ordered list.
gnc:multiline-to-html-textt: creates html-text with <br/> elements.
gnc:make-html-table-cell/min-width: Create a table-cell with min-width
style attribute
gnc:collector+ and gnc:collector-
New Deprecations:
gnc:html-table-append-ruler/at!
gnc:html-table-remove-last-row!
Translations Updated: Chinese(Simplified), Croatian, German, Hebrew, Ukrainian
3.7 - 8 September 2019
The eighth release of the 3.x stable series.
@ -7,7 +171,7 @@ Note for German FinTS users: This release in concert with AQBanking
5.8.0 is the first release to support the new product registration
requirement that goes into effect 15 September 2019.
The following bugs have been fixed:
The following bugs have been fixed:
Bug 605602 - precision of Financial Calculator seems to depend on
locale

View File

@ -292,6 +292,7 @@ void qof_book_set_string_option(QofBook* book, const char* opt_name, const char*
SET_ENUM("TXN-TYPE-NONE");
SET_ENUM("TXN-TYPE-INVOICE");
SET_ENUM("TXN-TYPE-PAYMENT");
SET_ENUM("TXN-TYPE-LINK");
SET_ENUM("ACCT-TYPE-INVALID");
SET_ENUM("ACCT-TYPE-NONE");

View File

@ -1,6 +1,9 @@
set(cmake_FILES GncAddGSchemaTargets.cmake GncAddSchemeTargets.cmake GncAddSwigCommand.cmake GncAddTest.cmake
MacroAddSourceFileCompileFlags.cmake MacroAppendForeach.cmake
MakeDist.cmake MakeDistFiles.cmake MakeDistCheck.cmake)
set(cmake_FILES
GncAddGSchemaTargets.cmake GncAddSchemeTargets.cmake
GncAddSwigCommand.cmake GncAddTest.cmake GncPkgConfig.cmake
MacroAddSourceFileCompileFlags.cmake MacroAppendForeach.cmake
MakeDist.cmake MakeDistFiles.cmake MakeDistCheck.cmake
)
set_dist_list(cmake_modules_DIST CMakeLists.txt COPYING-CMAKE-SCRIPTS.txt ${cmake_FILES})

View File

@ -22,7 +22,7 @@ add_subdirectory(fr_CH)
add_subdirectory(fr_FR)
add_subdirectory(he)
add_subdirectory(hr)
add_subdirectory(hu_HU)
add_subdirectory(hu)
add_subdirectory(it)
add_subdirectory(ja)
add_subdirectory(ko)
@ -47,7 +47,7 @@ set_local_dist(dist_list CMakeLists.txt )
set(accounts_DIST ${C_DIST} ${CA_DIST} ${CS_DIST} ${DA_DIST} ${DE_AT_DIST} ${DE_CH_DIST} ${DE_DE_DIST} ${EL_GR_DIST}
${EN_GB_DIST} ${EN_IN_DIST} ${ES_ES_DIST} ${ES_MX_DIST} ${FI_FI_DIST} ${FR_BE_DIST} ${FR_CA_DIST}
${FR_CH_DIST} ${FR_FR_DIST} ${HE_DIST} ${HR_DIST} ${HU_HU_DIST} ${IT_DIST} ${JA_DIST} ${KO_DIST} ${LT_DIST}
${FR_CH_DIST} ${FR_FR_DIST} ${HE_DIST} ${HR_DIST} ${HU_DIST} ${IT_DIST} ${JA_DIST} ${KO_DIST} ${LT_DIST}
${LV_DIST} ${NB_DIST} ${NL_DIST} ${PL_DIST} ${PT_BR_DIST} ${PT_PT_DIST} ${RU_DIST} ${SK_DIST}
${SV_AX_DIST} ${SV_FI_DIST} ${SV_SE_DIST} ${TR_TR_DIST} ${ZH_CN_DIST}
${ZH_HK_DIST} ${ZH_TW_DIST} ${dist_list} PARENT_SCOPE)

View File

@ -19,6 +19,6 @@ set(account_DATA
set_dist_list(HU_HU_DIST ${account_DATA} CMakeLists.txt)
install(FILES ${account_DATA} DESTINATION ${ACCOUNTS_INSTALL_DIR}/hu_HU)
file(COPY ${account_DATA} DESTINATION ${ACCOUNTS_BUILD_DIR}/hu_HU)
install(FILES ${account_DATA} DESTINATION ${ACCOUNTS_INSTALL_DIR}/hu)
file(COPY ${account_DATA} DESTINATION ${ACCOUNTS_BUILD_DIR}/hu)

View File

@ -53,7 +53,7 @@ the subaccount (e.g. A:C for Assets:Cash.)")
N_( "Want to see all your subaccount transactions in one register? \
From the Accounts tab in the main window, highlight the parent account \
and select Edit -> Open Subaccounts from the menu.")
and select Edit->Open Subaccounts from the menu.")
N_( "When entering dates, you can type '+' or '-' to increment or \
decrement the selected date. You can use '+' and '-' to increment and \
@ -78,12 +78,12 @@ headings to change the display.")
N_( "You can pack multiple reports into a single window, \
providing all the financial information you want at a glance. \
To do so, use the Sample & Custom -> \"Custom Multicolumn Report\" \
To do so, use the Sample & Custom->\"Custom Multicolumn Report\" \
report.")
N_( "Style Sheets affect how reports are displayed. Choose \
a style sheet for your report as a report option, and use \
the Edit -> Style Sheets menu to customize style sheets.")
the Edit->Style Sheets menu to customize style sheets.")
N_( "To raise the accounts menu in the transfer field of a register \
page, press the Menu key or the Ctrl-Down key combination.")
@ -101,12 +101,12 @@ you can choose the monthly basic frequency and then set 'Every \
registers after midnight, to get the new date as default for new \
transactions. It is not necessary to restart GnuCash.")
N_( "To search through all your transactions, start a search (Edit -> \
N_( "To search through all your transactions, start a search (Edit->\
Find...) from the main accounts hierarchy page. To limit your search \
to a single account, start the search from that account's register.")
N_( "To visually compare on screen the contents of 2 tabs, \
in one of the tabs, select Window -> New Window with Page \
in one of the tabs, select Window->New Window with Page \
from the menu to duplicate that tab in a new window.")
N_( "There is a theory that if ever anyone discovers what \

View File

@ -1470,7 +1470,6 @@ gnc_search_dialog_test (void)
display = get_display_list (GNC_ID_SPLIT);
/* FIXME: All this does is leak. */
/* (keep the line break below to avoid a translator comment) */
gnc_search_dialog_create (NULL, GNC_ID_SPLIT,
_("Find Transaction"),
params, display,

View File

@ -31,8 +31,8 @@
static QofLogModule log_module = GNC_MOD_REGISTER;
static void shared_quickfill_pref_changed (gpointer prefs, gchar *pref, gpointer qfb);
static void listen_for_account_events (QofInstance *entity, QofEventId event_type,
gpointer user_data, gpointer event_data);
static void listen_for_account_events (QofInstance *entity, QofEventId event_type,
gpointer user_data, gpointer event_data);
/* Column indices for the list store */
#define ACCOUNT_NAME 0
@ -74,7 +74,7 @@ shared_quickfill_destroy (QofBook *book, gpointer key, gpointer user_data)
shared_quickfill_pref_changed,
qfb);
gnc_quickfill_destroy (qfb->qf);
g_object_unref(qfb->list_store);
g_object_unref (qfb->list_store);
qof_event_unregister_handler (qfb->listener);
g_free (qfb);
}
@ -97,18 +97,17 @@ shared_quickfill_find_accounts (GtkTreeModel *model,
GtkTreeRowReference* ref;
GList *tmp;
gtk_tree_model_get(model, iter, ACCOUNT_POINTER, &account, -1);
for (tmp = data->accounts; tmp; tmp = g_list_next(tmp))
gtk_tree_model_get (model, iter, ACCOUNT_POINTER, &account, -1);
for (tmp = data->accounts; tmp; tmp = g_list_next (tmp))
{
if (tmp->data == account)
{
ref = gtk_tree_row_reference_new(model, path);
data->refs = g_list_append(data->refs, ref);
data->accounts = g_list_remove_link(data->accounts, tmp);
ref = gtk_tree_row_reference_new (model, path);
data->refs = g_list_append (data->refs, ref);
data->accounts = g_list_remove_link (data->accounts, tmp);
return (data->accounts == NULL);
}
}
return FALSE;
}
@ -124,11 +123,13 @@ load_shared_qf_cb (Account *account, gpointer data)
if (qfb->dont_add_cb)
{
gboolean skip = (qfb->dont_add_cb) (account, qfb->dont_add_data);
if (skip) return;
if (skip)
return;
}
name = gnc_get_account_name_for_register (account);
if (NULL == name) return;
if (NULL == name)
return;
gnc_quickfill_insert (qfb->qf, name, QUICKFILL_ALPHA);
if (qfb->load_list_store)
{
@ -138,7 +139,7 @@ load_shared_qf_cb (Account *account, gpointer data)
ACCOUNT_POINTER, account,
-1);
}
g_free(name);
g_free (name);
}
@ -148,10 +149,10 @@ shared_quickfill_pref_changed (gpointer prefs, gchar *pref, gpointer user_data)
QFB *qfb = user_data;
/* Reload the quickfill */
gnc_quickfill_purge(qfb->qf);
gtk_list_store_clear(qfb->list_store);
gnc_quickfill_purge (qfb->qf);
gtk_list_store_clear (qfb->list_store);
qfb->load_list_store = TRUE;
gnc_account_foreach_descendant(qfb->root, load_shared_qf_cb, qfb);
gnc_account_foreach_descendant (qfb->root, load_shared_qf_cb, qfb);
qfb->load_list_store = FALSE;
}
@ -165,7 +166,7 @@ build_shared_quickfill (QofBook *book, Account *root, const char * key,
{
QFB *qfb;
qfb = g_new0(QFB, 1);
qfb = g_new0 (QFB, 1);
qfb->qf = gnc_quickfill_new ();
qfb->book = book;
qfb->root = root;
@ -173,8 +174,8 @@ build_shared_quickfill (QofBook *book, Account *root, const char * key,
qfb->dont_add_cb = cb;
qfb->dont_add_data = data;
qfb->load_list_store = TRUE;
qfb->list_store =
gtk_list_store_new (NUM_ACCOUNT_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER);
qfb->list_store = gtk_list_store_new (NUM_ACCOUNT_COLUMNS,
G_TYPE_STRING, G_TYPE_POINTER);
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL,
GNC_PREF_ACCOUNT_SEPARATOR,
@ -186,11 +187,10 @@ build_shared_quickfill (QofBook *book, Account *root, const char * key,
shared_quickfill_pref_changed,
qfb);
gnc_account_foreach_descendant(root, load_shared_qf_cb, qfb);
gnc_account_foreach_descendant (root, load_shared_qf_cb, qfb);
qfb->load_list_store = FALSE;
qfb->listener =
qof_event_register_handler (listen_for_account_events, qfb);
qfb->listener = qof_event_register_handler (listen_for_account_events, qfb);
qof_book_set_data_fin (book, key, qfb, shared_quickfill_destroy);
@ -198,8 +198,7 @@ build_shared_quickfill (QofBook *book, Account *root, const char * key,
}
QuickFill *
gnc_get_shared_account_name_quickfill (Account *root,
const char * key,
gnc_get_shared_account_name_quickfill (Account *root, const char * key,
AccountBoolCB cb, gpointer cb_data)
{
QFB *qfb;
@ -208,15 +207,15 @@ gnc_get_shared_account_name_quickfill (Account *root,
book = gnc_account_get_book (root);
qfb = qof_book_get_data (book, key);
if (qfb) return qfb->qf;
if (qfb)
return qfb->qf;
qfb = build_shared_quickfill (book, root, key, cb, cb_data);
return qfb->qf;
}
GtkListStore *
gnc_get_shared_account_name_list_store (Account *root,
const char * key,
gnc_get_shared_account_name_list_store (Account *root, const char * key,
AccountBoolCB cb, gpointer cb_data)
{
QFB *qfb;
@ -225,7 +224,8 @@ gnc_get_shared_account_name_list_store (Account *root,
book = gnc_account_get_book (root);
qfb = qof_book_get_data (book, key);
if (qfb) return qfb->list_store;
if (qfb)
return qfb->list_store;
qfb = build_shared_quickfill (book, root, key, cb, cb_data);
return qfb->list_store;
@ -236,8 +236,8 @@ gnc_get_shared_account_name_list_store (Account *root,
* for account modification events, and add new accounts.
*/
static void
listen_for_account_events (QofInstance *entity, QofEventId event_type,
gpointer user_data, gpointer event_data)
listen_for_account_events (QofInstance *entity, QofEventId event_type,
gpointer user_data, gpointer event_data)
{
QFB *qfb = user_data;
QuickFill *qf = qfb->qf;
@ -253,9 +253,9 @@ listen_for_account_events (QofInstance *entity, QofEventId event_type,
if (0 == (event_type & (QOF_EVENT_MODIFY | QOF_EVENT_ADD | QOF_EVENT_REMOVE)))
return;
if (!GNC_IS_ACCOUNT (entity))
if (!GNC_IS_ACCOUNT(entity))
return;
account = GNC_ACCOUNT (entity);
account = GNC_ACCOUNT(entity);
ENTER("entity %p, event type %x, user data %p, ecent data %p",
entity, event_type, user_data, event_data);
@ -266,7 +266,7 @@ listen_for_account_events (QofInstance *entity, QofEventId event_type,
return;
}
name = gnc_get_account_name_for_register(account);
name = gnc_get_account_name_for_register (account);
if (NULL == name)
{
LEAVE("account has no name");
@ -280,57 +280,70 @@ listen_for_account_events (QofInstance *entity, QofEventId event_type,
/* Find the account (and all its descendants) in the model. The
* full name of all these accounts has changed. */
data.accounts = gnc_account_get_descendants(account);
data.accounts = g_list_prepend(data.accounts, account);
gtk_tree_model_foreach(GTK_TREE_MODEL(qfb->list_store),
shared_quickfill_find_accounts, &data);
data.accounts = gnc_account_get_descendants (account);
data.accounts = g_list_prepend (data.accounts, account);
gtk_tree_model_foreach (GTK_TREE_MODEL(qfb->list_store),
shared_quickfill_find_accounts, &data);
/* Update the existing items in the list store. Its possible
* that the change has caused an existing item to now become
* hidden, in which case it needs to be removed from the list
* store. Otherwise its a simple update of the name string. */
for (tmp = data.refs; tmp; tmp = g_list_next(tmp))
for (tmp = data.refs; tmp; tmp = g_list_next (tmp))
{
path = gtk_tree_row_reference_get_path(tmp->data);
gtk_tree_row_reference_free(tmp->data);
if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(qfb->list_store),
&iter, path))
gchar *old_name, *new_name;
path = gtk_tree_row_reference_get_path (tmp->data);
gtk_tree_row_reference_free (tmp->data);
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL(qfb->list_store),
&iter, path))
{
gtk_tree_path_free(path);
gtk_tree_path_free (path);
continue;
}
gtk_tree_path_free(path);
gtk_tree_model_get(GTK_TREE_MODEL(qfb->list_store), &iter,
ACCOUNT_POINTER, &account,
-1);
gtk_tree_path_free (path);
gtk_tree_model_get (GTK_TREE_MODEL(qfb->list_store), &iter,
ACCOUNT_POINTER, &account,
ACCOUNT_NAME, &old_name,
-1);
new_name = gnc_get_account_name_for_register (account);
/* check if the name has changed */
match = gnc_quickfill_get_string_match (qf, old_name);
if (match && (g_strcmp0 (old_name, new_name) != 0))
gnc_quickfill_remove (qf, old_name, QUICKFILL_ALPHA);
if (qfb->dont_add_cb &&
qfb->dont_add_cb(account, qfb->dont_add_data))
qfb->dont_add_cb (account, qfb->dont_add_data))
{
gtk_list_store_remove(qfb->list_store, &iter);
gnc_quickfill_remove (qf, new_name, QUICKFILL_ALPHA);
gtk_list_store_remove (qfb->list_store, &iter);
}
else
{
gchar *aname = gnc_get_account_name_for_register(account);
gtk_list_store_set(qfb->list_store, &iter,
ACCOUNT_NAME, aname,
-1);
g_free(aname);
gnc_quickfill_insert (qf, new_name, QUICKFILL_ALPHA);
gtk_list_store_set (qfb->list_store, &iter,
ACCOUNT_NAME, new_name,
-1);
}
g_free (old_name);
g_free (new_name);
}
/* Any accounts that weren't found in the tree are accounts that
* were hidden but have now become visible. Add them to the list
* store. */
for (tmp = data.accounts; tmp; tmp = g_list_next(tmp))
for (tmp = data.accounts; tmp; tmp = g_list_next (tmp))
{
account = tmp->data;
if (qfb->dont_add_cb)
{
if (qfb->dont_add_cb(account, qfb->dont_add_data))
if (qfb->dont_add_cb (account, qfb->dont_add_data))
{
continue;
}
}
gnc_quickfill_insert (qf, name, QUICKFILL_ALPHA);
gtk_list_store_append (qfb->list_store, &iter);
gtk_list_store_set (qfb->list_store, &iter,
ACCOUNT_NAME, name,
@ -343,38 +356,39 @@ listen_for_account_events (QofInstance *entity, QofEventId event_type,
DEBUG("remove %s", name);
/* Remove from qf */
gnc_quickfill_remove(qfb->qf, name, QUICKFILL_ALPHA);
gnc_quickfill_remove (qfb->qf, name, QUICKFILL_ALPHA);
/* Does the account exist in the model? */
data.accounts = g_list_append(NULL, account);
gtk_tree_model_foreach(GTK_TREE_MODEL(qfb->list_store),
shared_quickfill_find_accounts, &data);
data.accounts = g_list_append (NULL, account);
gtk_tree_model_foreach (GTK_TREE_MODEL(qfb->list_store),
shared_quickfill_find_accounts, &data);
/* Remove from list store */
for (tmp = data.refs; tmp; tmp = g_list_next(tmp))
for (tmp = data.refs; tmp; tmp = g_list_next (tmp))
{
path = gtk_tree_row_reference_get_path (tmp->data);
gtk_tree_row_reference_free (tmp->data);
if (gtk_tree_model_get_iter(GTK_TREE_MODEL(qfb->list_store),
&iter, path))
if (gtk_tree_model_get_iter (GTK_TREE_MODEL(qfb->list_store),
&iter, path))
{
gtk_list_store_remove(qfb->list_store, &iter);
gtk_list_store_remove (qfb->list_store, &iter);
}
gtk_tree_path_free(path);
gtk_tree_path_free (path);
}
break;
case QOF_EVENT_ADD:
DEBUG("add %s", name);
if (qfb->dont_add_cb &&
qfb->dont_add_cb(account, qfb->dont_add_data))
qfb->dont_add_cb (account, qfb->dont_add_data))
break;
match = gnc_quickfill_get_string_match (qf, name);
if (match)
{
match_str = gnc_quickfill_string (match);
if (match_str && (g_strcmp0(match_str, name) != 0))
if (match_str && (g_strcmp0 (match_str, name) != 0))
{
PINFO ("got match for %s", name);
break;
@ -396,10 +410,10 @@ listen_for_account_events (QofInstance *entity, QofEventId event_type,
}
if (data.accounts)
g_list_free(data.accounts);
g_list_free (data.accounts);
if (data.refs)
g_list_free(data.refs);
g_free(name);
g_list_free (data.refs);
g_free (name);
LEAVE(" ");
}

View File

@ -68,13 +68,11 @@ typedef gboolean (*AccountBoolCB) (Account *, gpointer);
* it). This code does not currently listen to account-destroy
* events.
*/
QuickFill * gnc_get_shared_account_name_quickfill (Account *root,
const char * key,
AccountBoolCB skip_cb,
gpointer cb_data);
QuickFill *
gnc_get_shared_account_name_quickfill (Account *root, const char * key,
AccountBoolCB skip_cb, gpointer cb_data);
GtkListStore *
gnc_get_shared_account_name_list_store (Account *root,
const char * key,
gnc_get_shared_account_name_list_store (Account *root, const char * key,
AccountBoolCB cb, gpointer cb_data);
#endif

View File

@ -139,6 +139,11 @@ gnc_account_sel_class_init (GNCAccountSelClass *klass)
static void
combo_changed_cb(GNCAccountSel *gas, gpointer combo)
{
gint selected = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
if (selected == gas->currentSelection)
return;
gas->currentSelection = selected;
g_signal_emit_by_name(gas, "account_sel_changed");
}
@ -152,6 +157,7 @@ gnc_account_sel_init (GNCAccountSel *gas)
gas->initDone = FALSE;
gas->acctTypeFilters = FALSE;
gas->newAccountButton = NULL;
gas->currentSelection = -1;
g_object_set(gas, "spacing", 2, (gchar*)NULL);

View File

@ -51,6 +51,7 @@ typedef struct
/* The state of this pointer also serves as a flag about what state
* the widget is in WRT the new-account-button ability. */
GtkWidget *newAccountButton;
gint currentSelection;
#if 0 /* completion not implemented. */
GCompletion *completion;

View File

@ -107,13 +107,13 @@ static gboolean autosave_confirm(GtkWidget *toplevel)
"GnuCash has a feature to save the file automatically every %d minute, "
"just as if you had pressed the \"Save\" button each time. \n\n"
"You can change the time interval or turn off this feature under "
"Edit -> Preferences -> General -> Auto-save time interval. \n\n"
"Edit->Preferences->General->Auto-save time interval. \n\n"
"Should your file be saved automatically?",
"Your data file needs to be saved to your hard disk to save your changes. "
"GnuCash has a feature to save the file automatically every %d minutes, "
"just as if you had pressed the \"Save\" button each time. \n\n"
"You can change the time interval or turn off this feature under "
"Edit -> Preferences -> General -> Auto-save time interval. \n\n"
"Edit->Preferences->General->Auto-save time interval. \n\n"
"Should your file be saved automatically?",
interval_mins),
interval_mins);

View File

@ -444,7 +444,7 @@ show_session_error (GtkWindow *parent,
case ERR_SQL_DB_TOO_NEW:
fmt = _("This database is from a newer version of GnuCash. "
"This version can read it, but cannot safely save to it. "
"It will be marked read-only until you do File>Save As, "
"It will be marked read-only until you do File->Save As, "
"but data may be lost in writing to the old version.");
gnc_warning_dialog (parent, "%s", fmt);
uh_oh = TRUE;

View File

@ -3353,6 +3353,8 @@ gnc_main_window_update_tab_position (gpointer prefs, gchar *pref, gpointer user_
GtkPositionType position = GTK_POS_TOP;
GncMainWindowPrivate *priv;
g_return_if_fail (GNC_IS_MAIN_WINDOW(user_data));
window = GNC_MAIN_WINDOW(user_data);
ENTER ("window %p", window);

View File

@ -277,7 +277,7 @@ void gnc_plugin_set_important_actions (GtkActionGroup *action_group,
* contained in this group.
*
* @param action_names A NULL terminated list of actions names that
* should modified.
* should be modified.
*
* @param property_name The property name to be changed on the
* specified actions. The only two GtkAction properties that it makes

View File

@ -81,7 +81,7 @@ gtc_sr_is_trans_readonly_and_warn (GncTreeViewSplitReg *view, Transaction *trans
"%s", title);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", _("The date of this transaction is older than the \"Read-Only Threshold\" set for this book. "
"This setting can be changed in File -> Properties -> Accounts."));
"This setting can be changed in File->Properties->Accounts."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
return TRUE;
@ -1357,7 +1357,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
"%s", _("Cannot store a transaction at this date"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", _("The entered date of the duplicated transaction is older than the \"Read-Only Threshold\" set for this book. "
"This setting can be changed in File -> Properties -> Accounts."));
"This setting can be changed in File->Properties->Accounts."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);

View File

@ -477,7 +477,7 @@ gnc_tree_util_split_reg_parse_date (GDate *parsed, const char *datestr)
"%s", _("Cannot store a transaction at this date"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", _("The entered date of the new transaction is older than the \"Read-Only Threshold\" set for this book. "
"This setting can be changed in File -> Properties -> Accounts."));
"This setting can be changed in File->Properties->Accounts."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
#endif

View File

@ -252,7 +252,7 @@ gnc_get_ea_locale_dir(const char *top_dir)
*/
locale = g_getenv("LANG");
if (g_strcmp0(locale, "Swedish_Sweden") == 0)
locale = g_strdup("sv_SV");
locale = g_strdup("sv_SE");
else if (g_strcmp0(locale, "Swedish_Finland") == 0)
locale =g_strdup("sv_FI");
else

View File

@ -163,7 +163,7 @@ struct _invoice_window
GtkWidget * posted_date;
GtkWidget * active_check;
GtkWidget * paid_label;
GtkWidget * owner_box;
GtkWidget * owner_label;
GtkWidget * owner_choice;
@ -1942,13 +1942,39 @@ gnc_invoice_update_window (InvoiceWindow *iw, GtkWidget *widget)
gtk_label_set_text(GTK_LABEL(iw->paid_label), _("PAID"));
else
gtk_label_set_text(GTK_LABEL(iw->paid_label), _("UNPAID"));
if (widget)
gtk_widget_show (widget);
else
gtk_widget_show (iw_get_window(iw));
}
GncInvoiceType
gnc_invoice_get_type_from_window (InvoiceWindow *iw)
{
/* uses the same approach as gnc_invoice_get_title
not called gnc_invoice_get_type because of name collisions
*/
switch (gncOwnerGetType(&iw->owner))
{
case GNC_OWNER_CUSTOMER:
return iw->is_credit_note ? GNC_INVOICE_CUST_CREDIT_NOTE
: GNC_INVOICE_CUST_INVOICE;
break;
case GNC_OWNER_VENDOR:
return iw->is_credit_note ? GNC_INVOICE_VEND_CREDIT_NOTE
: GNC_INVOICE_VEND_INVOICE;
break;
case GNC_OWNER_EMPLOYEE:
return iw->is_credit_note ? GNC_INVOICE_EMPL_CREDIT_NOTE
: GNC_INVOICE_EMPL_INVOICE;
break;
default:
return GNC_INVOICE_UNDEFINED;
break;
}
}
gchar *
gnc_invoice_get_title (InvoiceWindow *iw)
{

View File

@ -77,6 +77,8 @@ gchar *gnc_invoice_get_help (InvoiceWindow *iw);
gchar *gnc_invoice_get_title (InvoiceWindow *iw);
GncInvoiceType gnc_invoice_get_type_from_window(InvoiceWindow *iw);
#ifdef __GNC_PLUGIN_PAGE_H
#include "gnc-main-window.h"
GncPluginPage *gnc_invoice_recreate_page (GncMainWindow *window, GKeyFile *key_file, const gchar *group_name);

View File

@ -432,7 +432,7 @@ gnc_payment_window_fill_docs_list (PaymentWindow *pw)
g_return_if_fail (pw->docs_list_tree_view && GTK_IS_TREE_VIEW(pw->docs_list_tree_view));
/* Get a list of open lots for this owner and post account */
if (pw->owner.owner.undefined)
if (pw->owner.owner.undefined && pw->post_acct)
list = xaccAccountFindOpenLots (pw->post_acct, gncOwnerLotMatchOwnerFunc,
&pw->owner, NULL);

View File

@ -42,6 +42,7 @@
#include "gnc-ui-util.h"
#include "gnc-window.h"
#include "dialog-utils.h"
#include "gncInvoice.h"
/* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI;
@ -92,7 +93,6 @@ static void gnc_plugin_page_invoice_cmd_entryDown (GtkAction *action, GncPluginP
/************************************************************
* Actions *
************************************************************/
// FIXME: The texts are wrong if we have a Bill or Expence Voucher.
static GtkActionEntry gnc_plugin_page_invoice_actions [] =
{
/* Toplevel */
@ -106,8 +106,8 @@ static GtkActionEntry gnc_plugin_page_invoice_actions [] =
G_CALLBACK (gnc_plugin_page_invoice_cmd_new_account)
},
{
"FilePrintAction", "document-print", N_("Print Invoice"), "<primary>p",
N_("Make a printable invoice"),
"FilePrintAction", "document-print", "_Print Invoice", "<primary>p",
"Make a printable invoice",
G_CALLBACK (gnc_plugin_page_invoice_cmd_print)
},
@ -128,23 +128,23 @@ static GtkActionEntry gnc_plugin_page_invoice_actions [] =
G_CALLBACK (gnc_plugin_page_invoice_cmd_paste)
},
{
"EditEditInvoiceAction", GNC_ICON_INVOICE_EDIT, N_("_Edit Invoice"), NULL,
N_("Edit this invoice"),
"EditEditInvoiceAction", GNC_ICON_INVOICE_EDIT, "_Edit Invoice", NULL,
"Edit this invoice",
G_CALLBACK (gnc_plugin_page_invoice_cmd_edit)
},
{
"EditDuplicateInvoiceAction", GNC_ICON_INVOICE_DUPLICATE, N_("_Duplicate Invoice"),
NULL, N_("Create a new invoice as a duplicate of the current one"),
"EditDuplicateInvoiceAction", GNC_ICON_INVOICE_DUPLICATE, "_Duplicate Invoice",
NULL, "Create a new invoice as a duplicate of the current one",
G_CALLBACK (gnc_plugin_page_invoice_cmd_duplicateInvoice)
},
{
"EditPostInvoiceAction", GNC_ICON_INVOICE_POST, N_("_Post Invoice"), NULL,
N_("Post this Invoice to your Chart of Accounts"),
"EditPostInvoiceAction", GNC_ICON_INVOICE_POST, "_Post Invoice", NULL,
"Post this invoice to your Chart of Accounts",
G_CALLBACK (gnc_plugin_page_invoice_cmd_post)
},
{
"EditUnpostInvoiceAction", GNC_ICON_INVOICE_UNPOST, N_("_Unpost Invoice"), NULL,
N_("Unpost this Invoice and make it editable"),
"EditUnpostInvoiceAction", GNC_ICON_INVOICE_UNPOST, "_Unpost Invoice", NULL,
"Unpost this invoice and make it editable",
G_CALLBACK (gnc_plugin_page_invoice_cmd_unpost)
},
@ -173,7 +173,7 @@ static GtkActionEntry gnc_plugin_page_invoice_actions [] =
},
{
"BlankEntryAction", "go-bottom", N_("_Blank"), NULL,
N_("Move to the blank entry at the bottom of the Invoice"),
"Move to the blank entry at the bottom of the Invoice",
G_CALLBACK (gnc_plugin_page_invoice_cmd_blank)
},
{
@ -194,20 +194,20 @@ static GtkActionEntry gnc_plugin_page_invoice_actions [] =
/* Business menu */
{
"BusinessNewInvoiceAction", GNC_ICON_INVOICE_NEW, N_("New _Invoice"), "",
N_("Create a new invoice for the same owner as the current one"),
"BusinessNewInvoiceAction", GNC_ICON_INVOICE_NEW, "New _Invoice", "",
"Create a new invoice for the same owner as the current one",
G_CALLBACK (gnc_plugin_page_invoice_cmd_new_invoice)
},
{
"ToolsProcessPaymentAction", GNC_ICON_INVOICE_PAY, N_("_Pay Invoice"), NULL,
N_("Enter a payment for the owner of this Invoice"),
"ToolsProcessPaymentAction", GNC_ICON_INVOICE_PAY, "_Pay Invoice", NULL,
"Enter a payment for the owner of this invoice",
G_CALLBACK (gnc_plugin_page_invoice_cmd_pay_invoice)
},
/* Reports menu */
{
"ReportsCompanyReportAction", NULL, N_("_Company Report"), NULL,
N_("Open a company report window for the owner of this Invoice"),
"Open a company report window for the owner of this invoice",
G_CALLBACK (gnc_plugin_page_invoice_cmd_company_report)
},
};
@ -261,22 +261,121 @@ static const gchar *can_unpost_actions[] =
NULL
};
/** Short labels for use on the toolbar buttons. */
static action_toolbar_labels toolbar_labels[] =
static action_toolbar_labels invoice_action_labels[] =
{
{ "RecordEntryAction", N_("Enter") },
{ "CancelEntryAction", N_("Cancel") },
{ "DeleteEntryAction", N_("Delete") },
{ "DuplicateEntryAction", N_("Duplicate") },
{ "EntryUpAction", N_("Up") },
{ "EntryDownAction", N_("Down") },
{ "BlankEntryAction", N_("Blank") },
{ "EditPostInvoiceAction", N_("Post") },
{ "EditUnpostInvoiceAction", N_("Unpost") },
{ "ToolsProcessPaymentAction", N_("Pay") },
{ NULL, NULL },
{"FilePrintAction", N_("_Print Invoice")},
{"EditEditInvoiceAction", N_("_Edit Invoice")},
{"EditDuplicateInvoiceAction", N_("_Duplicate Invoice")},
{"EditPostInvoiceAction", N_("_Post Invoice")},
{"EditUnpostInvoiceAction", N_("_Unpost Invoice")},
{"BusinessNewInvoiceAction", N_("New _Invoice")},
{"ToolsProcessPaymentAction", N_("_Pay Invoice")},
{NULL, NULL},
};
static action_toolbar_labels bill_action_labels[] =
{
{"FilePrintAction", N_("_Print Bill")},
{"EditEditInvoiceAction", N_("_Edit Bill")},
{"EditDuplicateInvoiceAction", N_("_Duplicate Bill")},
{"EditPostInvoiceAction", N_("_Post Bill")},
{"EditUnpostInvoiceAction", N_("_Unpost Bill")},
{"BusinessNewInvoiceAction", N_("New _Bill")},
{"ToolsProcessPaymentAction", N_("_Pay Bill")},
{NULL, NULL},
};
static action_toolbar_labels voucher_action_labels[] =
{
{"FilePrintAction", N_("_Print Voucher")},
{"EditEditInvoiceAction", N_("_Edit Voucher")},
{"EditDuplicateInvoiceAction", N_("_Duplicate Voucher")},
{"EditPostInvoiceAction", N_("_Post Voucher")},
{"EditUnpostInvoiceAction", N_("_Unpost Voucher")},
{"BusinessNewInvoiceAction", N_("New _Voucher")},
{"ToolsProcessPaymentAction", N_("_Pay Voucher")},
{NULL, NULL},
};
static action_toolbar_labels creditnote_action_labels[] =
{
{"FilePrintAction", N_("_Print Credit Note")},
{"EditEditInvoiceAction", N_("_Edit Credit Note")},
{"EditDuplicateInvoiceAction", N_("_Duplicate Credit Note")},
{"EditPostInvoiceAction", N_("_Post Credit Note")},
{"EditUnpostInvoiceAction", N_("_Unpost Credit Note")},
{"BusinessNewInvoiceAction", N_("New _Credit Note")},
{"ToolsProcessPaymentAction", N_("_Pay Credit Note")},
{NULL, NULL},
};
static action_toolbar_labels invoice_action_tooltips[] = {
{"FilePrintAction", N_("Make a printable invoice")},
{"EditEditInvoiceAction", N_("Edit this invoice")},
{"EditDuplicateInvoiceAction", N_("Create a new invoice as a duplicate of the current one")},
{"EditPostInvoiceAction", N_("Post this invoice to your Chart of Accounts")},
{"EditUnpostInvoiceAction", N_("Unpost this invoice and make it editable")},
{"BusinessNewInvoiceAction", N_("Create a new invoice for the same owner as the current one")},
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the invoice")},
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this invoice") },
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this invoice") },
{NULL, NULL},
};
static action_toolbar_labels bill_action_tooltips[] = {
{"FilePrintAction", N_("Make a printable bill")},
{"EditEditInvoiceAction", N_("Edit this bill")},
{"EditDuplicateInvoiceAction", N_("Create a new bill as a duplicate of the current one")},
{"EditPostInvoiceAction", N_("Post this bill to your Chart of Accounts")},
{"EditUnpostInvoiceAction", N_("Unpost this bill and make it editable")},
{"BusinessNewInvoiceAction", N_("Create a new bill for the same owner as the current one")},
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the bill")},
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this bill") },
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this bill") },
{NULL, NULL},
};
static action_toolbar_labels voucher_action_tooltips[] = {
{"FilePrintAction", N_("Make a printable voucher")},
{"EditEditInvoiceAction", N_("Edit this voucher")},
{"EditDuplicateInvoiceAction", N_("Create a new voucher as a duplicate of the current one")},
{"EditPostInvoiceAction", N_("Post this voucher to your Chart of Accounts")},
{"EditUnpostInvoiceAction", N_("Unpost this voucher and make it editable")},
{"BusinessNewInvoiceAction", N_("Create a new voucher for the same owner as the current one")},
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the voucher")},
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this voucher") },
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this voucher") },
{NULL, NULL},
};
static action_toolbar_labels creditnote_action_tooltips[] = {
{"FilePrintAction", N_("Make a printable credit note")},
{"EditEditInvoiceAction", N_("Edit this credit note")},
{"EditDuplicateInvoiceAction", N_("Create a new credit note as a duplicate of the current one")},
{"EditPostInvoiceAction", N_("Post this credit note to your Chart of Accounts")},
{"EditUnpostInvoiceAction", N_("Unpost this credit note and make it editable")},
{"BusinessNewInvoiceAction", N_("Create a new credit note for the same owner as the current one")},
{"BlankEntryAction", N_("Move to the blank entry at the bottom of the credit note")},
{"ToolsProcessPaymentAction", N_("Enter a payment for the owner of this credit note") },
{"ReportsCompanyReportAction", N_("Open a company report window for the owner of this credit note") },
{NULL, NULL},
};
/** Short labels for use on the toolbar buttons. */
static action_toolbar_labels toolbar_labels[] = {
{"RecordEntryAction", N_("Enter")},
{"CancelEntryAction", N_("Cancel")},
{"DeleteEntryAction", N_("Delete")},
{"DuplicateEntryAction", N_("Duplicate")},
{"EntryUpAction", N_("Up")},
{"EntryDownAction", N_("Down")},
{"BlankEntryAction", N_("Blank")},
{"EditPostInvoiceAction", N_("Post")},
{"EditUnpostInvoiceAction", N_("Unpost")},
{"ToolsProcessPaymentAction", N_("Pay")},
{NULL, NULL},
};
/************************************************************/
/* Data Structures */
@ -401,7 +500,40 @@ void
gnc_plugin_page_invoice_update_menus (GncPluginPage *page, gboolean is_posted, gboolean can_unpost)
{
GtkActionGroup *action_group;
GncPluginPageInvoicePrivate *priv;
GncInvoiceType invoice_type;
GtkAction *action;
gint i, j;
action_toolbar_labels *label_list;
action_toolbar_labels *tooltip_list;
gboolean is_readonly = qof_book_is_readonly(gnc_get_current_book());
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);
invoice_type = gnc_invoice_get_type_from_window(priv->iw);
switch (invoice_type) {
case GNC_INVOICE_CUST_INVOICE:
label_list = invoice_action_labels;
tooltip_list = invoice_action_tooltips;
break;
case GNC_INVOICE_VEND_INVOICE:
label_list = bill_action_labels;
tooltip_list = bill_action_tooltips;
break;
case GNC_INVOICE_EMPL_INVOICE:
label_list = voucher_action_labels;
tooltip_list = voucher_action_tooltips;
break;
case GNC_INVOICE_CUST_CREDIT_NOTE: // fallthrough
case GNC_INVOICE_VEND_CREDIT_NOTE: // fallthrough
case GNC_INVOICE_EMPL_CREDIT_NOTE: // fallthrough
label_list = creditnote_action_labels;
tooltip_list = creditnote_action_tooltips;
break;
default: // catches GNC_INVOICE_UNDEFINED, use invoice by default
label_list = invoice_action_labels;
tooltip_list = invoice_action_tooltips;
}
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(page));
@ -421,6 +553,22 @@ gnc_plugin_page_invoice_update_menus (GncPluginPage *page, gboolean is_posted, g
"sensitive", can_unpost);
gnc_plugin_update_actions (action_group, invoice_book_readwrite_actions,
"sensitive", !is_readonly);
for (i = 0; label_list[i].action_name; i++)
{
/* update the action labels */
action = gtk_action_group_get_action(action_group,
label_list[i].action_name);
gtk_action_set_label(action, _(label_list[i].label));
}
for (i = 0; tooltip_list[i].action_name; i++)
{
/* update the action tooltips */
action = gtk_action_group_get_action(action_group,
tooltip_list[i].action_name);
gtk_action_set_tooltip(action, _(tooltip_list[i].label));
}
}

View File

@ -3840,7 +3840,7 @@ gnc_plugin_page_register_cmd_view_sort_by (GtkAction *action,
priv->sd.dialog = dialog;
gtk_window_set_transient_for(GTK_WINDOW(dialog),
gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window)));
/* Translations: The %s is the name of the plugin page */
/* Translators: The %s is the name of the plugin page */
title = g_strdup_printf(_("Sort %s by..."),
gnc_plugin_page_get_page_name(GNC_PLUGIN_PAGE(page)));
gtk_window_set_title(GTK_WINDOW(dialog), title);

View File

@ -1165,10 +1165,10 @@ gnc_plugin_page_report_constr_init(GncPluginPageReport *plugin_page, gint report
gchar *saved_reports_path = gnc_build_userdata_path (SAVED_REPORTS_FILE);
gchar *report_save_str = g_strdup_printf (
_("Update the current report's saved configuration. "
"The report will be saved in the file %s. "), saved_reports_path);
"The report configuration will be saved in the file %s. "), saved_reports_path);
gchar *report_saveas_str = g_strdup_printf (
_("Add the current report's configuration to the `Saved Report Configurations' menu. "
"The report will be saved in the file %s. "), saved_reports_path);
_("Add the current report's configuration to the `Reports->Saved Report Configurations' menu. "
"The report configuration will be saved in the file %s. "), saved_reports_path);
GtkActionEntry report_actions[] =
{

View File

@ -1099,7 +1099,7 @@ is_trans_readonly_and_warn (GtkWindow *parent, Transaction *trans)
"%s", title);
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
"%s", _("The date of this transaction is older than the \"Read-Only Threshold\" set for this book. "
"This setting can be changed in File -> Properties -> Accounts."));
"This setting can be changed in File->Properties->Accounts."));
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
return TRUE;

View File

@ -6,7 +6,7 @@ Name=GnuCash
GenericName=Finance Management
Comment=Manage your finances, accounts, and investments
Exec=gnucash %f
# Icon file name, do not translate unless you also provide a localized icon file. Alternatively use the English "gnucash-icon" as msgstr
# Translators: Icon file name, do not translate unless you also provide a localized icon file. Alternatively use the English "gnucash-icon" as msgstr
Icon=gnucash-icon
StartupNotify=true
Terminal=false

View File

@ -135,7 +135,11 @@ Select location and file name for the Import, then click "OK"...
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Delete Settings</property>
<property name="tooltip_text" translatable="yes">Delete Settings
Deletes the settings saved under the name as entered in the adjacent text field.
There are two reserved names which can never be deleted:
- No settings
- Gnucash default export format</property>
<signal name="clicked" handler="csv_price_imp_preview_del_settings_cb" swapped="no"/>
<child>
<object class="GtkImage" id="image2">
@ -157,7 +161,11 @@ Select location and file name for the Import, then click "OK"...
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Save Settings</property>
<property name="tooltip_text" translatable="yes">Save Settings
Saves current settings under the name as entered in the adjacent text field.
There are two reserved names which can't be used to save custom settings:
- No settings
- Gnucash default export format</property>
<signal name="clicked" handler="csv_price_imp_preview_save_settings_cb" swapped="no"/>
<child>
<object class="GtkImage" id="image1">

View File

@ -126,7 +126,11 @@ Select location and file name for the Import, then click 'OK'...
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Delete Settings</property>
<property name="tooltip_text" translatable="yes">Delete Settings
Deletes the settings saved under the name as entered in the adjacent text field.
There are two reserved names which can never be deleted:
- No settings
- Gnucash default export format</property>
<signal name="clicked" handler="csv_tximp_preview_del_settings_cb" swapped="no"/>
<child>
<object class="GtkImage" id="image2">
@ -148,7 +152,11 @@ Select location and file name for the Import, then click 'OK'...
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Save Settings</property>
<property name="tooltip_text" translatable="yes">Save Settings
Saves current settings under the name as entered in the adjacent text field.
There are two reserved names which can't be used to save custom settings:
- No settings
- Gnucash default export format</property>
<signal name="clicked" handler="csv_tximp_preview_save_settings_cb" swapped="no"/>
<child>
<object class="GtkImage" id="image1">

View File

@ -574,7 +574,7 @@
<object class="GtkLabel" id="label29">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Invoice Entries</property>
<property name="label" translatable="yes">Entries</property>
</object>
</child>
</object>

View File

@ -195,8 +195,7 @@
<signal name="changed" handler="gnc_payment_dialog_post_to_changed_cb" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry">
<property name="can_focus">False</property>
<property name="overwrite_mode">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>

View File

@ -1141,8 +1141,8 @@ many months before the current month:</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_markup">Present the new account list dialog when you choose File -&gt; New File.</property>
<property name="tooltip_text" translatable="yes">Present the new account list dialog when you choose File -&gt; New File.</property>
<property name="tooltip_markup">Present the new account list dialog when you choose File-&gt;New File.</property>
<property name="tooltip_text" translatable="yes">Present the new account list dialog when you choose File-&gt;New File.</property>
<property name="halign">start</property>
<property name="margin_left">12</property>
<property name="use_underline">True</property>

View File

@ -63,6 +63,7 @@ G_GNUC_UNUSED static QofLogModule log_module = G_LOG_DOMAIN;
static AB_BANKING *gnc_AB_BANKING = NULL;
static gint gnc_AB_BANKING_refcount = 0;
static gchar* create_online_id(const gchar *bankcode, const gchar *accountnumber);
static gpointer join_ab_strings_cb(const gchar *str, gpointer user_data);
static Account *gnc_ab_accinfo_to_gnc_acc(GtkWidget *parent,
AB_IMEXPORTER_ACCOUNTINFO *account_info);
@ -316,6 +317,28 @@ gnc_AB_VALUE_to_readable_string(const AB_VALUE *value)
return g_strdup_printf("%.2f", 0.0);
}
static gchar*
create_online_id(const gchar *bankcode, const gchar *accountnumber)
{
gchar *online_id;
/* The accountnumber may have leading zeros, depending on where them
* accountnumber is came from, e.g. the accountnumber of accountinfo
* has no leading zeros while the (local)accountnumber of a transaction
* has leading zeros.
* So remove all leading '0', to get a consistent online_id.
*/
while (accountnumber && *accountnumber == '0')
accountnumber++;
online_id = g_strconcat(bankcode ? bankcode : "",
accountnumber ? accountnumber : "",
(gchar*)NULL);
return online_id;
}
/**
* Take a string from a GWEN_STRINGLIST, strip invalid utf8 and join it
* to the rest.
@ -328,7 +351,7 @@ join_ab_strings_cb(const gchar *str, gpointer user_data)
if (!str || !*str)
return NULL;
tmp = g_strdup(str);
g_strstrip(tmp);
gnc_utf8_strip_invalid_and_controls(tmp);
@ -392,7 +415,7 @@ gnc_ab_get_purpose(const AB_TRANSACTION *ab_trans, gboolean is_ofx)
g_return_val_if_fail(ab_trans, g_strdup(""));
if (!is_ofx && gnc_prefs_get_bool(GNC_PREFS_GROUP_AQBANKING, GNC_PREF_USE_TRANSACTION_TXT))
if (!is_ofx && gnc_prefs_get_bool(GNC_PREFS_GROUP_AQBANKING, GNC_PREF_USE_TRANSACTION_TXT))
{
/* According to AqBanking, some of the non-swift lines have a special
* meaning. Some banks place valuable text into the transaction text,
@ -646,9 +669,7 @@ gnc_ab_accinfo_to_gnc_acc(GtkWidget *parent, AB_IMEXPORTER_ACCOUNTINFO *acc_info
bankcode = AB_ImExporterAccountInfo_GetBankCode(acc_info);
accountnumber = AB_ImExporterAccountInfo_GetAccountNumber(acc_info);
online_id = g_strconcat(bankcode ? bankcode : "",
accountnumber ? accountnumber : "",
(gchar*)NULL);
online_id = create_online_id(bankcode, accountnumber);
gnc_acc = gnc_import_select_account(
parent, online_id, 1, AB_ImExporterAccountInfo_GetAccountName(acc_info),
NULL, ACCT_TYPE_NONE, NULL, NULL);
@ -687,9 +708,7 @@ gnc_ab_txn_to_gnc_acc(GtkWidget *parent, const AB_TRANSACTION *transaction)
return NULL;
}
online_id = g_strconcat(bankcode ? bankcode : "",
accountnumber ? accountnumber : "",
(gchar*)NULL);
online_id = create_online_id(bankcode, accountnumber);
gnc_acc = gnc_import_select_account(
parent, online_id, 1, AB_Transaction_GetLocalName(transaction),
NULL, ACCT_TYPE_NONE, NULL, NULL);

View File

@ -1600,10 +1600,14 @@ void CsvImpTransAssist::preview_refresh_table ()
g_object_unref (combostore);
/* Also reset the base account combo box as it's value may have changed due to column changes here */
g_signal_handlers_block_by_func (acct_selector, (gpointer) csv_tximp_preview_acct_sel_cb, this);
gnc_account_sel_set_account(GNC_ACCOUNT_SEL(acct_selector),
tx_imp->base_account() , false);
g_signal_handlers_unblock_by_func (acct_selector, (gpointer) csv_tximp_preview_acct_sel_cb, this);
auto base_acct = gnc_account_sel_get_account(GNC_ACCOUNT_SEL(acct_selector));
if (tx_imp->base_account() != base_acct)
{
g_signal_handlers_block_by_func (acct_selector, (gpointer) csv_tximp_preview_acct_sel_cb, this);
gnc_account_sel_set_account(GNC_ACCOUNT_SEL(acct_selector),
tx_imp->base_account() , false);
g_signal_handlers_unblock_by_func (acct_selector, (gpointer) csv_tximp_preview_acct_sel_cb, this);
}
/* Make the things actually appear. */
gtk_widget_show_all (GTK_WIDGET(treeview));

View File

@ -124,25 +124,25 @@ gnc_plugin_customer_import_showGUI(GtkWindow *parent)
column = gtk_tree_view_column_new_with_attributes (description, renderer, "text", column_id, NULL); \
gtk_tree_view_column_set_resizable (column, TRUE); \
gtk_tree_view_append_column (GTK_TREE_VIEW (gui->tree_view), column);
CREATE_COLUMN (_("id"), CI_ID);
CREATE_COLUMN (_("company"), CI_COMPANY);
CREATE_COLUMN (_("name"), CI_NAME);
CREATE_COLUMN (_("addr1"), CI_ADDR1);
CREATE_COLUMN (_("addr2"), CI_ADDR2);
CREATE_COLUMN (_("addr3"), CI_ADDR3);
CREATE_COLUMN (_("addr4"), CI_ADDR4);
CREATE_COLUMN (_("phone"), CI_PHONE);
CREATE_COLUMN (_("fax"), CI_FAX);
CREATE_COLUMN (_("email"), CI_EMAIL);
CREATE_COLUMN (_("notes"), CI_NOTES);
CREATE_COLUMN (_("shipname"), CI_SHIPNAME);
CREATE_COLUMN (_("shipaddr1"), CI_SHIPADDR1);
CREATE_COLUMN (_("shipaddr2"), CI_SHIPADDR2);
CREATE_COLUMN (_("shipaddr3"), CI_SHIPADDR3);
CREATE_COLUMN (_("shipaddr4"), CI_SHIPADDR4);
CREATE_COLUMN (_("shipphone"), CI_SHIPPHONE);
CREATE_COLUMN (_("shipfax"), CI_SHIPFAX);
CREATE_COLUMN (_("shipemail"), CI_SHIPEMAIL);
CREATE_COLUMN (_("ID"), CI_ID);
CREATE_COLUMN (_("Company"), CI_COMPANY);
CREATE_COLUMN (_("Name"), CI_NAME);
CREATE_COLUMN (_("Address 1"), CI_ADDR1);
CREATE_COLUMN (_("Address 2"), CI_ADDR2);
CREATE_COLUMN (_("Address 3"), CI_ADDR3);
CREATE_COLUMN (_("Address 4"), CI_ADDR4);
CREATE_COLUMN (_("Phone"), CI_PHONE);
CREATE_COLUMN (_("Fax"), CI_FAX);
CREATE_COLUMN (_("Email"), CI_EMAIL);
CREATE_COLUMN (_("Notes"), CI_NOTES);
CREATE_COLUMN (_("Shipping Name"), CI_SHIPNAME);
CREATE_COLUMN (_("Shipping Address 1"), CI_SHIPADDR1);
CREATE_COLUMN (_("Shipping Address 2"), CI_SHIPADDR2);
CREATE_COLUMN (_("Shipping Address 3"), CI_SHIPADDR3);
CREATE_COLUMN (_("Shipping Address 4"), CI_SHIPADDR4);
CREATE_COLUMN (_("Shipping Phone"), CI_SHIPPHONE);
CREATE_COLUMN (_("Shipping Fax"), CI_SHIPFAX);
CREATE_COLUMN (_("Shipping Email"), CI_SHIPEMAIL);
gui->component_id = gnc_register_gui_component ("dialog-customer-import-gui",
NULL,

View File

@ -760,8 +760,7 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
/* prevent the rows being dragged to a different order */
gtk_tree_view_set_reorderable (view, FALSE);
/* Add the columns *
* (keep the line break below to avoid a translator comment) */
/* Add the columns */
add_text_column (view, _("Date"), DOWNLOADED_COL_DATE_TXT, FALSE);
info->account_column = add_text_column (view, _("Account"), DOWNLOADED_COL_ACCOUNT, FALSE);
gtk_tree_view_column_set_visible (info->account_column, show_account);

View File

@ -608,11 +608,10 @@ void gnc_file_log_replay (GtkWindow *parent)
{
int err = errno;
perror("File open failed");
/* Translators: First argument is the filename,
* second argument is the error.
*/
gnc_error_dialog(NULL,
/* Translation note:
* First argument is the filename,
* second argument is the error.
*/
_("Failed to open log file: %s: %s"),
selected_filename,
strerror(err));

View File

@ -624,10 +624,10 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
{
// As we now have the commodity, select the account with that commodity.
investment_account_text = g_strdup_printf( /* This string is a default account
name. It MUST NOT contain the
character ':' anywhere in it or
in any translations. */
/* Translators: This string is a default account name. It MUST
* NOT contain the character ':' anywhere in it or in any
* translations. */
investment_account_text = g_strdup_printf(
_("Stock account for security \"%s\""),
sanitize_string (data.security_data_ptr->secname));
@ -793,10 +793,10 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void *user_data)
if (income_account == NULL)
{
DEBUG("Couldn't find an associated income account");
investment_account_text = g_strdup_printf( /* This string is a default account
name. It MUST NOT contain the
character ':' anywhere in it or
in any translations. */
/* Translators: This string is a default account
* name. It MUST NOT contain the character ':' anywhere
* in it or in any translations. */
investment_account_text = g_strdup_printf(
_("Income account for security \"%s\""),
sanitize_string (data.security_data_ptr->secname));
income_account = gnc_import_select_account(

View File

@ -637,7 +637,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
/* Translators: The 'sample:' items are
strings which are not displayed, but only
used to estimate widths. */
C_("sample", "12/12/2000"),
C_("sample", "22/02/2000"),
CELL_ALIGN_RIGHT,
FALSE,
FALSE);
@ -645,7 +645,7 @@ gnc_split_register_layout_add_cells (SplitRegister *reg,
gnc_register_add_cell (layout,
DDUE_CELL,
DATE_CELL_TYPE_NAME,
C_("sample", "12/12/2000"),
C_("sample", "22/02/2000"),
CELL_ALIGN_RIGHT,
FALSE,
FALSE);

View File

@ -620,7 +620,7 @@ gnc_split_register_duplicate_current (SplitRegister *reg)
"%s", _("Cannot store a transaction at this date"));
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
"%s", _("The entered date of the duplicated transaction is older than the \"Read-Only Threshold\" set for this book. "
"This setting can be changed in File -> Properties -> Accounts."));
"This setting can be changed in File->Properties->Accounts."));
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);

View File

@ -103,7 +103,7 @@ check_readonly_threshold (const gchar *datestr, GDate *d, gboolean warn)
gchar *dialog_msg = _("The entered date of the transaction is "
"older than the \"Read-Only Threshold\" set for "
"this book. This setting can be changed in "
"File -> Properties -> Accounts, resetting to the threshold.");
"File->Properties->Accounts, resetting to the threshold.");
gchar *dialog_title = _("Cannot store a transaction at this date");
GtkWidget *dialog = gtk_message_dialog_new(gnc_ui_get_main_window (NULL),
0,

View File

@ -56,6 +56,8 @@ enum
TARGET_COMPOUND_TEXT
};
#define MIN_BUTT_WIDTH 20 // minimum size for a button excluding border
static GtkBoxClass *gnc_item_edit_parent_class;
static GtkToggleButtonClass *gnc_item_edit_tb_parent_class;
@ -111,12 +113,19 @@ gnc_item_edit_tb_get_preferred_width (GtkWidget *widget,
{
GncItemEditTb *tb = GNC_ITEM_EDIT_TB (widget);
GncItemEdit *item_edit = GNC_ITEM_EDIT(tb->sheet->item_editor);
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(tb));
GtkBorder border;
gint x, y, w, h = 2, width = 0;
gnc_item_edit_get_pixel_coords (GNC_ITEM_EDIT (item_edit), &x, &y, &w, &h);
width = ((h - 2)*2)/3;
if (width < 22) // minimum size for a button
width = 22;
gtk_style_context_get_border (context, GTK_STATE_FLAG_NORMAL, &border);
if (width < MIN_BUTT_WIDTH + border.left + border.right)
width = MIN_BUTT_WIDTH + border.left + border.right;
*minimal_width = *natural_width = width;
item_edit->button_width = width;
}
static void
@ -220,6 +229,9 @@ gnc_item_edit_get_pixel_coords (GncItemEdit *item_edit,
SheetBlock *block;
int xd, yd;
if (sheet == NULL)
return;
block = gnucash_sheet_get_block (sheet, item_edit->virt_loc.vcell_loc);
if (block == NULL)
return;
@ -248,6 +260,8 @@ gnc_item_edit_update (GncItemEdit *item_edit)
{
gint x = 0, y = 0, w, h;
if (item_edit == NULL || item_edit->sheet == NULL)
return FALSE;
gnc_item_edit_get_pixel_coords (item_edit, &x, &y, &w, &h);
gtk_layout_move (GTK_LAYOUT(item_edit->sheet),
GTK_WIDGET(item_edit), x, y);
@ -319,6 +333,7 @@ gnc_item_edit_init (GncItemEdit *item_edit)
item_edit->popup_user_data = NULL;
item_edit->style = NULL;
item_edit->button_width = MIN_BUTT_WIDTH;
gnc_virtual_location_init(&item_edit->virt_loc);
}
@ -561,7 +576,8 @@ draw_arrow_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
gint height = gtk_widget_get_allocated_height (widget);
gint size;
gtk_render_background (context, cr, 0, 0, width, height);
// allow room for a border
gtk_render_background (context, cr, 2, 2, width - 4, height - 4);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_ARROW);
@ -646,6 +662,28 @@ gnc_item_edit_get_property (GObject *object,
}
}
/* FIXME: Idle events calling gnc_item_edit_update can fire after the
* GncItemEdit is finalized, but because the GncItemEdit class is
* defined by hand instead of with the GType macros there's no way to
* run gnc_item_edit_dispose or gnc_item_edit_finalize to null out the
* pointers. We resort instead to a weak reference to null out the
* sheet when it gets finalized to prevent gnc_item_edit_upate from
* accessing the freed sheet.
*
* https://bugs.gnucash.org/show_bug.cgi?id=797481
*
* Note that this is still not bulletproof, after all we're still
* using the GncItemEdit after it has been freed but without a dispose
* function to do this correctly we're a bit stuck.
*/
static void
sheet_destroyed (gpointer data, GObject *table)
{
GncItemEdit *item_edit = (GncItemEdit*)data;
if (item_edit)
item_edit->sheet = NULL;
}
static void
gnc_item_edit_set_property (GObject *object,
guint param_id,
@ -653,11 +691,18 @@ gnc_item_edit_set_property (GObject *object,
GParamSpec *pspec)
{
GncItemEdit *item_edit = GNC_ITEM_EDIT (object);
switch (param_id)
{
case PROP_SHEET:
if (item_edit->sheet)
g_object_weak_unref(G_OBJECT(item_edit->sheet),
(GWeakNotify)sheet_destroyed,
(gpointer)item_edit);
item_edit->sheet = GNUCASH_SHEET (g_value_get_object (value));
if (item_edit->sheet)
g_object_weak_ref(G_OBJECT(item_edit->sheet),
(GWeakNotify)sheet_destroyed,
(gpointer)item_edit);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@ -720,7 +765,9 @@ gnc_item_edit_class_init (GncItemEditClass *gnc_item_edit_class)
widget_class->get_preferred_height = gnc_item_edit_get_preferred_height;
}
/* FIXME: This way of initializing GObjects is obsolete. We should be
* using G_DECLARE_FINAL_TYPE instead of rolling _get_type by hand.
*/
GType
gnc_item_edit_get_type (void)
{
@ -797,6 +844,25 @@ gnc_item_edit_get_padding_border (GncItemEdit *item_edit, Sides side)
}
}
gint
gnc_item_edit_get_button_width (GncItemEdit *item_edit)
{
if (item_edit)
{
if (gtk_widget_is_visible (GTK_WIDGET(item_edit->popup_toggle.tbutton)))
return item_edit->button_width;
else
{
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET(item_edit->popup_toggle.tbutton));
GtkBorder border;
gtk_style_context_get_border (context, GTK_STATE_FLAG_NORMAL, &border);
return MIN_BUTT_WIDTH + border.left + border.right;
}
}
return MIN_BUTT_WIDTH + 2; // add the default border
}
static gboolean
button_press_cb (GtkWidget *widget, GdkEventButton *event, gpointer *pointer)
{

View File

@ -94,6 +94,7 @@ typedef struct
GtkBorder padding;
GtkBorder margin;
GtkBorder border;
gint button_width;
/* Where are we */
VirtualLocation virt_loc;
@ -161,6 +162,8 @@ void gnc_item_edit_focus_out (GncItemEdit *item_edit);
gint gnc_item_edit_get_margin (GncItemEdit *item_edit, Sides side);
gint gnc_item_edit_get_padding_border (GncItemEdit *item_edit, Sides side);
gint gnc_item_edit_get_button_width (GncItemEdit *item_edit);
GType gnc_item_edit_tb_get_type (void);
GtkWidget *gnc_item_edit_tb_new (GnucashSheet *sheet);

View File

@ -2268,6 +2268,7 @@ gnucash_sheet_col_max_width (GnucashSheet *sheet, gint virt_col, gint cell_col)
SheetBlockStyle *style;
PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet), "");
GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
const gchar *type_name;
g_return_val_if_fail (virt_col >= 0, 0);
g_return_val_if_fail (virt_col < sheet->num_virt_cols, 0);
@ -2287,12 +2288,17 @@ gnucash_sheet_col_max_width (GnucashSheet *sheet, gint virt_col, gint cell_col)
continue;
if (cell_col < style->ncols)
{
for (cell_row = 0; cell_row < style->nrows; cell_row++)
{
VirtualLocation virt_loc;
const char *text;
virt_loc.vcell_loc = vcell_loc;
if (virt_row == 0)
virt_loc.vcell_loc = sheet->table->current_cursor_loc.vcell_loc;
else
virt_loc.vcell_loc = vcell_loc;
virt_loc.phys_row_offset = cell_row;
virt_loc.phys_col_offset = cell_col;
@ -2313,13 +2319,22 @@ gnucash_sheet_col_max_width (GnucashSheet *sheet, gint virt_col, gint cell_col)
width += (gnc_item_edit_get_margin (item_edit, left_right) +
gnc_item_edit_get_padding_border (item_edit, left_right));
// get the cell type so we can add the button width to the
// text width if required.
type_name = gnc_table_get_cell_type_name (sheet->table, virt_loc);
if ((g_strcmp0 (type_name, DATE_CELL_TYPE_NAME) == 0)
|| (g_strcmp0 (type_name, COMBO_CELL_TYPE_NAME) == 0))
{
width += gnc_item_edit_get_button_width (item_edit) + 2; // add 2 for the button margin
}
max = MAX (max, width);
}
}
}
g_object_unref (layout);
return max + 1; // add 1 for the border
return max;
}
void

View File

@ -209,6 +209,11 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
width += gnc_item_edit_get_margin (item_edit, left_right) +
gnc_item_edit_get_padding_border (item_edit, left_right);
// This is used on new popup cells to get the default
// width of text plus toggle button.
if (cell && cell->is_popup)
width += gnc_item_edit_get_button_width (item_edit) + 2; // + 2 for the button margin
cd->pixel_height += gnc_item_edit_get_margin (item_edit, top_bottom) +
gnc_item_edit_get_padding_border (item_edit, top_bottom);
}
@ -224,11 +229,6 @@ set_dimensions_pass_one (GnucashSheet *sheet, CellBlock *cursor,
if (cd->pixel_width > 0)
continue;
// This is used on new account popup cells to get the default
// width of text plus toggle button.
if (cell && cell->is_popup)
width += cd->pixel_height; // toggle button is square, use cell height
cd->pixel_width = MAX (cd->pixel_width, width);
}

View File

@ -84,11 +84,6 @@ gnc_table_save_state (Table *table, gchar * state_section, gchar * account_fulln
if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_GENERAL, GNC_PREF_SAVE_GEOMETRY))
return;
key = g_strdup_printf ("Register state for \"%s\"", account_fullname);
g_key_file_set_comment (state_file, state_section, NULL, key, NULL);
g_free (key);
sheet = GNUCASH_SHEET (table->ui_data);
widths = gnc_header_widths_new ();
@ -113,6 +108,10 @@ gnc_table_save_state (Table *table, gchar * state_section, gchar * account_fulln
g_key_file_remove_key (state_file, state_section, key, NULL);
g_free (key);
}
key = g_strdup_printf ("Register state for \"%s\"", account_fullname);
g_key_file_set_comment (state_file, state_section, NULL, key, NULL);
g_free (key);
gnc_header_widths_destroy (widths);
}

View File

@ -204,17 +204,33 @@
(define gnc:html-table-set-caption!
(record-modifier <html-table> 'caption))
(define gnc:html-table-col-headers
;; note the following function is now generally unused.
(define (gnc:html-table-col-headers table)
(issue-deprecation-warning "gnc:html-table-col-headers is deprecated. \
use gnc:html-table-multirow-col-headers instead.")
(let ((headers ((record-accessor <html-table> 'col-headers) table)))
(cond
((not headers) #f)
((null? (cdr headers)) (car headers))
(else (gnc:warn "gnc:html-table-col-headers used on a table object \
with multiple rows. returning the first row only.") (car headers)))))
(define (gnc:html-table-set-col-headers! table col-headers)
(gnc:html-table-set-multirow-col-headers! table (list col-headers)))
(define gnc:html-table-multirow-col-headers
(record-accessor <html-table> 'col-headers))
(define gnc:html-table-set-col-headers!
(define gnc:html-table-set-multirow-col-headers!
(record-modifier <html-table> 'col-headers))
(define gnc:html-table-row-headers
(record-accessor <html-table> 'row-headers))
(define (gnc:html-table-row-headers table)
(issue-deprecation-warning "gnc:html-table-row-headers is unused.")
((record-accessor <html-table> 'row-headers) table))
(define gnc:html-table-set-row-headers!
(record-modifier <html-table> 'row-headers))
(define (gnc:html-table-set-row-headers! table . rest)
(issue-deprecation-warning "gnc:html-table-set-row-headers! is unused.")
(apply (record-modifier <html-table> 'row-headers) table rest))
(define gnc:html-table-style
(record-accessor <html-table> 'style))
@ -435,7 +451,7 @@
;; compile the col styles with the header style pushed; we'll
;; recompile them later, but this will have the benefit of
;; compiling in the col-header-style.
(let ((ch (gnc:html-table-col-headers table)))
(let ((ch (gnc:html-table-multirow-col-headers table)))
(when ch
(gnc:html-document-push-style doc (gnc:html-table-col-headers-style table))
@ -450,25 +466,29 @@
;; render the headers
(push (gnc:html-document-markup-start doc "thead" #t))
(push (gnc:html-document-markup-start doc "tr" #t))
(let lp ((ch ch)
(colnum 0))
(unless (null? ch)
(let ((hdr (car ch)))
(gnc:html-document-push-style
doc (gnc:html-table-col-style table colnum))
(unless (gnc:html-table-cell? hdr)
(push (gnc:html-document-markup-start doc "th" #t)))
(push (gnc:html-object-render hdr doc))
(unless (gnc:html-table-cell? hdr)
(push (gnc:html-document-markup-end doc "th")))
(gnc:html-document-pop-style doc)
(lp (cdr ch)
(+ colnum
(if (gnc:html-table-cell? hdr)
(gnc:html-table-cell-colspan hdr)
1))))))
(push (gnc:html-document-markup-end doc "tr"))
(for-each
(lambda (ch-row)
(push (gnc:html-document-markup-start doc "tr" #t))
(let lp ((ch-row ch-row) (colnum 0))
(unless (null? ch-row)
(let* ((hdr (car ch-row))
(table-cell? (gnc:html-table-cell? hdr))
(col-style (gnc:html-table-col-style table colnum)))
(gnc:html-document-push-style doc col-style)
(cond
(table-cell?
(push (gnc:html-object-render hdr doc)))
(else
(push (gnc:html-document-markup-start doc "th" #t))
(push (gnc:html-object-render hdr doc))
(push (gnc:html-document-markup-end doc "th"))))
(gnc:html-document-pop-style doc)
(lp (cdr ch-row)
(+ colnum
(if table-cell? (gnc:html-table-cell-colspan hdr) 1))))))
(push (gnc:html-document-markup-end doc "tr")))
ch)
(push (gnc:html-document-markup-end doc "thead"))
;; pop the col header style

View File

@ -125,8 +125,8 @@
(sort-and-delete-duplicates
(map xaccAccountGetCommodity accounts)
(lambda (a b)
(string<? (gnc-commodity-get-mnemonic a)
(gnc-commodity-get-mnemonic b)))
(string<? (gnc-commodity-get-unique-name a)
(gnc-commodity-get-unique-name b)))
gnc-commodity-equiv)))
@ -140,8 +140,7 @@
(define (gnc:accounts-and-all-descendants accountslist)
(sort-and-delete-duplicates
(apply append accountslist (map gnc-account-get-descendants accountslist))
(lambda (a b)
(string<? (gnc-account-get-full-name a) (gnc-account-get-full-name b)))
(lambda (a b) (< (xaccAccountOrder a b) 0))
equal?))
;;; Here's a statistics collector... Collects max, min, total, and makes

View File

@ -569,6 +569,8 @@
(export gnc:html-table-set-caption!)
(export gnc:html-table-col-headers)
(export gnc:html-table-set-col-headers!)
(export gnc:html-table-multirow-col-headers)
(export gnc:html-table-set-multirow-col-headers!)
(export gnc:html-table-row-headers)
(export gnc:html-table-set-row-headers!)
(export gnc:html-table-style)

View File

@ -376,8 +376,8 @@ more than one currency. This report is not designed to cope with this possibilit
(N_ "Sort order.")
'increasing
(list
(vector 'increasing (N_ "Increasing") (N_ "0 -> $999,999.99, A->Z."))
(vector 'decreasing (N_ "Decreasing") (N_ "$999,999.99 -> $0, Z->A.")))))
(vector 'increasing (N_ "Increasing") (N_ "0 .. 999,999.99, A .. Z."))
(vector 'decreasing (N_ "Decreasing") (N_ "999,999.99 .. 0, Z .. A.")))))
(add-option
(gnc:make-simple-boolean-option

View File

@ -96,15 +96,6 @@ below parent and children groups."))
(define optname-amount-links (N_ "Display amounts as hyperlinks"))
(define opthelp-amount-links (N_ "Shows each amounts in the table as a hyperlink to a register or report."))
;; closing entries filter - for P&L report
(define pagename-entries "Closing Entries")
(define optname-closing-pattern (N_ "Closing Entries pattern"))
(define opthelp-closing-pattern (N_ "Any text in the Description column which identifies closing entries."))
(define optname-closing-casing (N_ "Closing Entries pattern is case-sensitive"))
(define opthelp-closing-casing (N_ "Causes the Closing Entries Pattern match to be case-sensitive."))
(define optname-closing-regexp (N_ "Closing Entries Pattern is regular expression"))
(define opthelp-closing-regexp (N_ "Causes the Closing Entries Pattern to be treated as a regular expression."))
;; section labels
(define optname-label-sections (N_ "Label sections"))
(define opthelp-label-sections (N_ "Whether or not to include a label for sections."))
@ -347,23 +338,7 @@ also show overall period profit & loss."))
(add-option
(gnc:make-simple-boolean-option
gnc:pagename-general optname-include-overall-period
"c6" opthelp-include-overall-period #f))
;; closing entry match criteria
(add-option
(gnc:make-string-option
pagename-entries optname-closing-pattern
"a" opthelp-closing-pattern (_ "Closing Entries")))
(add-option
(gnc:make-simple-boolean-option
pagename-entries optname-closing-casing
"b" opthelp-closing-casing #f))
(add-option
(gnc:make-simple-boolean-option
pagename-entries optname-closing-regexp
"c" opthelp-closing-regexp #f)))
"c6" opthelp-include-overall-period #f)))
(gnc:options-set-default-section options gnc:pagename-general)
@ -795,10 +770,11 @@ also show overall period profit & loss."))
(gnc:make-commodity-collector))
#:split->elt
(lambda (s)
(val-coll 'add
(xaccTransGetCurrency (xaccSplitGetParent s))
(xaccSplitGetValue s))
(make-datum s (amt->monetary (xaccSplitGetBalance s))
(unless (xaccTransGetIsClosingTxn (xaccSplitGetParent s))
(val-coll 'add
(xaccTransGetCurrency (xaccSplitGetParent s))
(xaccSplitGetValue s)))
(make-datum s (amt->monetary (xaccSplitGetNoclosingBalance s))
(gnc:collector+ val-coll)))))))
accounts))
@ -1139,10 +1115,7 @@ also show overall period profit & loss."))
(gnc:html-markup-anchor chart (_ "Barchart")))))))
((eq? report-type 'pnl)
(let* ((closing-str (get-option pagename-entries optname-closing-pattern))
(closing-cased (get-option pagename-entries optname-closing-casing))
(closing-regexp (get-option pagename-entries optname-closing-regexp))
(include-overall-period? (get-option gnc:pagename-general
(let* ((include-overall-period? (get-option gnc:pagename-general
optname-include-overall-period))
(col-idx->datepair
(lambda (idx)
@ -1161,44 +1134,13 @@ also show overall period profit & loss."))
(cons (list-ref balancelist idx)
(list-ref balancelist (1+ idx))))))
(closing-entries (let ((query (qof-query-create-for-splits)))
(qof-query-set-book query (gnc-get-current-book))
(xaccQueryAddAccountMatch
query income-expense
QOF-GUID-MATCH-ANY QOF-QUERY-AND)
(if (and closing-str (not (string-null? closing-str)))
(xaccQueryAddDescriptionMatch
query closing-str closing-cased closing-regexp
QOF-COMPARE-CONTAINS QOF-QUERY-AND))
(xaccQueryAddClosingTransMatch query #t QOF-QUERY-OR)
(let ((splits (qof-query-run query)))
(qof-query-destroy query)
splits)))
;; this function will query the above closing-entries for
;; splits within the date range, and produce the total
;; amount for these closing entries
(closing-adjustment
(lambda (account col-idx)
(define datepair (col-idx->datepair col-idx))
(define (include-split? split)
(and (equal? (xaccSplitGetAccount split) account)
(<= (car datepair)
(xaccTransGetDate (xaccSplitGetParent split))
(cdr datepair))))
(let ((account-closing-splits (filter include-split? closing-entries)))
(gnc:make-gnc-monetary
(xaccAccountGetCommodity account)
(apply + (map xaccSplitGetAmount account-closing-splits))))))
(get-cell-monetary-fn
(lambda (account col-idx)
(let* ((balances (assoc-ref accounts-balances account))
(monetarypair (col-idx->monetarypair balances col-idx)))
(monetary-less
(cdr monetarypair)
(car monetarypair)
(closing-adjustment account col-idx)))))
(car monetarypair)))))
(get-cell-anchor-fn
(lambda (account col-idx)

View File

@ -26,6 +26,7 @@
(define-module (gnucash reports standard category-barchart))
(use-modules (srfi srfi-1))
(use-modules (srfi srfi-9))
(use-modules (ice-9 match))
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils))
@ -87,16 +88,12 @@ developing over time"))
(define optname-averaging (N_ "Show Average"))
(define opthelp-averaging (N_ "Select whether the amounts should be shown over the full time period or rather as the average e.g. per month."))
(define (options-generator account-types reverse-balance? do-intervals?)
(define (options-generator account-types do-intervals?)
(let* ((options (gnc:new-options))
(add-option
(lambda (new-option)
(gnc:register-option options new-option))))
;; save off the reverse-balance option
(add-option
(gnc:make-internal-option "__report" "reverse-balance?" reverse-balance?))
;; General tab
(gnc:options-add-date-interval!
options gnc:pagename-general
@ -215,7 +212,7 @@ developing over time"))
;; *really* complicated.
(define (category-barchart-renderer report-obj reportname reportguid
account-types do-intervals?)
account-types do-intervals? reverse-bal?)
;; A helper functions for looking up option values.
(define (get-option section name)
(gnc:option-value
@ -254,7 +251,6 @@ developing over time"))
(height (get-option gnc:pagename-display optname-plot-height))
(width (get-option gnc:pagename-display optname-plot-width))
(sort-method (get-option gnc:pagename-display optname-sort-method))
(reverse-balance? (get-option "__report" "reverse-balance?"))
(work-done 0)
(work-to-do 0)
@ -351,7 +347,7 @@ developing over time"))
(map
(lambda (acc)
(let* ((comm (xaccAccountGetCommodity acc))
(split->elt (if reverse-balance?
(split->elt (if reverse-bal?
(lambda (s)
(gnc:make-gnc-monetary
comm (- (xaccSplitGetNoclosingBalance s))))
@ -712,12 +708,12 @@ developing over time"))
'menu-tip (get-menutip variant)
'options-generator (lambda ()
(options-generator (get-acct-types variant)
(get-reverse? variant)
(get-intervals? variant)))
'renderer (lambda (report-obj)
(category-barchart-renderer report-obj
(get-reportname variant)
(get-uuid variant)
(get-acct-types variant)
(get-intervals? variant)))))
(get-intervals? variant)
(get-reverse? variant)))))
variants)

View File

@ -196,7 +196,7 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
;; each column will be a vector
;; (vector heading - string
;; calculator-function - (calculator-function split) to obtain amount
;; reverse-column? - #t for sales, #f for purchases
;; reverse-column? - #f - already handled via myneg in fns above
;; subtotal? - #t - all columns need subtotals
;; start-dual-column? - unused in GST report
;; friendly-heading-fn - unused in GST report
@ -204,74 +204,61 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
;; Translators: "Gross Sales" refer to Net Sales + GST/VAT on Sales
(list (vector (_ "Gross Sales")
gross-sales
#t #t #f
(lambda (a) "")))
#f #t #f #f))
(if (opt-val gnc:pagename-display (N_ "Individual sales columns"))
(map (lambda (acc) (vector (xaccAccountGetName acc)
(account-adder-neg acc)
#t #t #f
(lambda (a) "")))
#f #t #f #f))
accounts-sales)
(list (vector (_ "Net Sales")
sales-without-tax
#t #t #f
(lambda (a) ""))))
#f #t #f #f)))
(if (opt-val gnc:pagename-display (N_ "Individual tax columns"))
(map (lambda (acc) (vector (xaccAccountGetName acc)
(account-adder-neg acc)
#t #t #f
(lambda (a) "")))
#f #t #f #f))
accounts-tax-collected)
(list (vector (_ "Tax on Sales")
tax-on-sales
#t #t #f
(lambda (a) ""))))
#f #t #f #f)))
;; Translators: "Gross Purchases" refer to Net Purchase + GST/VAT on Purchase
(list (vector (_ "Gross Purchases")
gross-purchases
#f #t #f
(lambda (a) "")))
#f #t #f #f))
(if (opt-val gnc:pagename-display (N_ "Individual purchases columns"))
(map (lambda (acc) (vector (xaccAccountGetName acc)
(account-adder acc)
#f #t #f
(lambda (a) "")))
#f #t #f #f))
accounts-purchases)
(list (vector (_ "Net Purchases")
purchases-without-tax
#f #t #f
(lambda (a) ""))))
#f #t #f #f)))
(if (opt-val gnc:pagename-display (N_ "Individual tax columns"))
(map (lambda (acc) (vector (xaccAccountGetName acc)
(account-adder acc)
#f #t #f
(lambda (a) "")))
#f #t #f #f))
accounts-tax-paid)
(list (vector (_ "Tax on Purchases")
tax-on-purchases
#f #t #f
(lambda (a) ""))))
#f #t #f #f)))
(if (opt-val gnc:pagename-display (N_ "Gross Balance"))
;; Translators: "Gross Balance" refer to "Gross Sales - Gross Purchases" in GST Report
(list (vector (_ "Gross Balance")
gross-balance
#f #t #f
(lambda (a) "")))
#f #t #f #f))
'())
;; Note: Net income = net balance - other costs
(if (opt-val gnc:pagename-display (N_ "Net Balance"))
;; Translators: "Net Balance" refer to Net Sales - Net Purchases in GST Report
(list (vector (_ "Net Balance")
net-balance
#f #t #f
(lambda (a) "")))
#f #t #f #f))
'())
(if (opt-val gnc:pagename-display (N_ "Tax payable"))
;; Translators: "Tax Payable" refer to the difference GST Sales - GST Purchases
(list (vector (_ "Tax payable")
tax-payable
#f #t #f
(lambda (a) "")))
#f #t #f #f))
'()))))
;; Define the report.

View File

@ -29,6 +29,7 @@
(use-modules (srfi srfi-1))
(use-modules (srfi srfi-11)) ;let-values
(use-modules (ice-9 match))
(use-modules (gnucash utilities))
(use-modules (gnucash engine))
(use-modules (gnucash core-utils))
@ -36,6 +37,7 @@
(use-modules (gnucash report))
(define optname-to-date (N_ "To"))
(define optname-sort-by (N_ "Sort By"))
(define optname-sort-order (N_ "Sort Order"))
(define optname-report-currency (N_ "Report's currency"))
(define optname-price-source (N_ "Price Source"))
@ -87,6 +89,20 @@ exist but have no suitable transactions."))
(gnc:lookup-option options gnc:pagename-general optname-to-date)
(cons 'relative 'today))
(add-option
(gnc:make-multichoice-option
gnc:pagename-general optname-sort-by "i" (N_ "Sort companies by.") 'name
(list
(vector 'name
(N_ "Name")
(N_ "Name of the company."))
(vector 'total
(N_ "Total Owed")
(N_ "Total amount owed to/from Company."))
(vector 'oldest-bracket
(N_ "Bracket Total Owed")
(N_ "Amount owed in oldest bracket - if same go to next oldest.")))))
(add-option
(gnc:make-multichoice-option
gnc:pagename-general optname-sort-order "ia" (N_ "Sort order.") 'increasing
@ -158,6 +174,9 @@ exist but have no suitable transactions."))
(define (gnc-owner-equal? a b)
(string=? (gncOwnerReturnGUID a) (gncOwnerReturnGUID b)))
(define (account<? a b)
(< (xaccAccountOrder a b) 0))
(define (split-has-owner? split owner)
(let* ((split-owner (split->owner split))
(retval (gnc-owner-equal? split-owner owner)))
@ -190,7 +209,7 @@ exist but have no suitable transactions."))
(define make-heading-list
(list (_ "Company")
(_ "Prepayments")
(_ "Pre-Payment")
(_ "Current")
(_ "0-30 days")
(_ "31-60 days")
@ -207,6 +226,7 @@ exist but have no suitable transactions."))
(gnc:date-option-absolute-time
(op-value gnc:pagename-general optname-to-date))))
(sort-order (op-value gnc:pagename-general optname-sort-order))
(sort-by (op-value gnc:pagename-general optname-sort-by))
(show-zeros (op-value gnc:pagename-general optname-show-zeros))
(date-type (op-value gnc:pagename-general optname-date-driver))
(query (qof-query-create-for-splits))
@ -217,10 +237,21 @@ exist but have no suitable transactions."))
(define (ownerGUID<? a b)
(string<? (gncOwnerGetGUID a) (gncOwnerGetGUID b)))
;; for presentation. compare names.
(define (owner<? a b)
((if (eq? sort-order 'increasing) string<? string>?)
(gncOwnerGetName a) (gncOwnerGetName b)))
(define (sort-aging<? a b)
(match-let* (((own1 aging1 aging-total1) a)
((own2 aging2 aging-total2) b)
(increasing? (eq? sort-order 'increasing))
(op-str (if increasing? string<? string>?))
(op-num (if increasing? < >)))
(case sort-by
((name) (op-str (gncOwnerGetName own1) (gncOwnerGetName own2)))
((total) (op-num aging-total1 aging-total2))
(else
(let lp ((aging1 aging1) (aging2 aging2))
(cond
((null? aging1) (op-str (gncOwnerGetName own1) (gncOwnerGetName own2)))
((= (car aging1) (car aging2)) (lp (cdr aging1) (cdr aging2)))
(else (op-num (car aging1) (car aging2)))))))))
;; set default title
(gnc:html-document-set-title! document report-title)
@ -234,7 +265,7 @@ exist but have no suitable transactions."))
(setup-query query accounts report-date)
(let* ((splits (xaccQueryGetSplitsUniqueTrans query))
(accounts (sort-and-delete-duplicates (map xaccSplitGetAccount splits)
gnc:account-path-less-p equal?)))
account<? equal?)))
(qof-query-destroy query)
;; loop into each APAR account
@ -307,7 +338,7 @@ exist but have no suitable transactions."))
(gnc:owner-report-text owner account)
(gnc:make-gnc-monetary comm aging-total)))))
(options->address options receivable owner)))))
(reverse owners-and-aging))
(sort owners-and-aging sort-aging<?))
(gnc:html-table-append-row!
table
@ -362,9 +393,8 @@ exist but have no suitable transactions."))
(gncOwnerFree owner)
b))))
'() acc-splits))
(acc-owners (sort (sort-and-delete-duplicates
split-owners ownerGUID<? gnc-owner-equal?)
owner<?)))
(acc-owners (sort-and-delete-duplicates
split-owners ownerGUID<? gnc-owner-equal?)))
;; loop into each APAR account split
(let lp ((acc-owners acc-owners)

View File

@ -30,6 +30,7 @@
(use-modules (srfi srfi-1))
(use-modules (srfi srfi-8))
(use-modules (srfi srfi-9))
(use-modules (srfi srfi-11)) ;for let-values
(use-modules (ice-9 match))
(use-modules (gnucash engine))
@ -83,6 +84,25 @@
(define (get-info key)
(assv-ref owner-string-alist key))
(define-record-type :link-data
(make-link-data date ref type desc amount)
link-data?
(date link-data-date)
(ref link-data-ref)
(type link-data-type)
(desc link-data-desc)
(amount link-data-amount))
(define-record-type :link-desc-amount
(make-link-desc-amount desc amount)
link-desc-amount?
(desc link-desc-amount-desc)
(amount link-desc-amount-amount))
(define-record-type :link-blank
(make-link-blank)
link-blank?)
;; Names in Option panel (Untranslated! Because it is used for option
;; naming and lookup only, and the display of the option name will be
;; translated somewhere else.)
@ -93,11 +113,11 @@
(vector-ref columns-used 0))
(define (date-due-col columns-used)
(vector-ref columns-used 1))
(define (num-col columns-used)
(define (ref-col columns-used)
(vector-ref columns-used 2))
(define (type-col columns-used)
(vector-ref columns-used 3))
(define (memo-col columns-used)
(define (desc-col columns-used)
(vector-ref columns-used 4))
(define (sale-col columns-used)
(vector-ref columns-used 5))
@ -107,9 +127,32 @@
(vector-ref columns-used 7))
(define (debit-col columns-used)
(vector-ref columns-used 8))
(define (value-col columns-used)
(define (bal-col columns-used)
(vector-ref columns-used 9))
(define (num-cols columns-used section)
(let* ((date? (date-col columns-used))
(due? (date-due-col columns-used))
(ref? (ref-col columns-used))
(type? (type-col columns-used))
(desc? (desc-col columns-used))
(sale? (sale-col columns-used))
(tax? (tax-col columns-used))
(credit? (credit-col columns-used))
(debit? (debit-col columns-used))
(bal? (bal-col columns-used))
(spacer? (or date? type? ref? desc? debit? credit?))
(amt? (or credit? debit?))
(cols-alist
(list
(list 'lhs-cols date? due? ref? type? desc? sale? tax? credit? debit? bal?)
(list 'ptt-span date? due? ref? type? desc?)
(list 'mid-spac spacer?)
(list 'rhs-cols date? ref? type? desc? amt?)
(list 'rhs-span date? ref? type? desc?)))
(cols-list (assq-ref cols-alist section)))
(count identity cols-list)))
(define columns-used-size 10)
(define (build-column-used options)
@ -145,11 +188,11 @@
(addto! heading-list (_ date-header)))
(if (date-due-col column-vector)
(addto! heading-list (_ due-date-header)))
(if (num-col column-vector)
(if (ref-col column-vector)
(addto! heading-list (_ reference-header)))
(if (type-col column-vector)
(addto! heading-list (_ type-header)))
(if (memo-col column-vector)
(if (desc-col column-vector)
(addto! heading-list (_ desc-header)))
(if (sale-col column-vector)
(addto! heading-list (_ sale-header)))
@ -159,25 +202,98 @@
(addto! heading-list (_ credit-header)))
(if (debit-col column-vector)
(addto! heading-list (_ debit-header)))
(if (value-col column-vector)
(if (bal-col column-vector)
(addto! heading-list (_ amount-header)))
(case link-option
((simple)
(addto! heading-list (_ linked-txns-header)))
((detailed)
(addto! heading-list (_ "Date"))
(addto! heading-list (_ "Details"))
(addto! heading-list (_ "Amount"))))
(if (< 0 (num-cols column-vector 'mid-spac)) (addto! heading-list #f))
(if (date-col column-vector) (addto! heading-list (_ "Date")))
(if (ref-col column-vector) (addto! heading-list (_ "Reference")))
(if (type-col column-vector) (addto! heading-list (_ "Type")))
(if (desc-col column-vector) (addto! heading-list (_ "Description")))
(if (or (debit-col column-vector) (credit-col column-vector))
(addto! heading-list (_ "Amount")))))
(reverse heading-list)))
(define num-buckets 6)
(define (new-bucket-vector)
(make-vector num-buckets 0))
(define (sign-equal? a b)
(or (= 0 a b) (< 0 (* a b))))
(define (lot-split->posting-split split)
(let* ((lot (xaccSplitGetLot split))
(invoice (gncInvoiceGetInvoiceFromLot lot))
(post-txn (gncInvoiceGetPostedTxn invoice)))
(and (not (null? lot))
(not (null? invoice))
(not (null? post-txn))
(find (lambda (split) (equal? (xaccSplitGetParent split) post-txn))
(gnc-lot-get-split-list lot)))))
(define (txn-is-invoice? txn)
(eqv? (xaccTransGetTxnType txn) TXN-TYPE-INVOICE))
(define (txn-is-payment? txn)
(eqv? (xaccTransGetTxnType txn) TXN-TYPE-PAYMENT))
(define (txn-is-link? txn)
(eqv? (xaccTransGetTxnType txn) TXN-TYPE-LINK))
(define (split<? a b)
(< (xaccSplitOrder a b) 0))
(define (split-is-payment? split)
(txn-is-payment? (xaccSplitGetParent split)))
(define (split->reference split)
(let* ((txn (xaccSplitGetParent split))
(type (xaccTransGetTxnType txn)))
(cond
((memv type (list TXN-TYPE-LINK TXN-TYPE-PAYMENT))
(let ((ref (gnc-get-num-action txn split)))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text split) ref))))
((eqv? type TXN-TYPE-INVOICE)
(let ((inv (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot split))))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:invoice-anchor-text inv)
(gncInvoiceGetID inv))))))))
(define (split->type-str split)
(let* ((txn (xaccSplitGetParent split))
(invoice (gncInvoiceGetInvoiceFromTxn txn)))
(cond
((txn-is-invoice? txn) (gncInvoiceGetTypeString invoice))
((txn-is-payment? txn) (_ "Payment"))
(else (_ "Unknown")))))
;; for splits, find the first peer that is not in an APAR
;; account. this is adequate to find the transfer split (ie
;; asset/liability/income/expense account split). lot-link txns are
;; not expected to have any non-APAR split therefore returns #f.
(define (txn->transfer-split txn)
(find
(compose (negate xaccAccountIsAPARType) xaccAccountGetType xaccSplitGetAccount)
(xaccTransGetSplitList txn)))
(define (txn->assetliab-splits txn)
(filter
(compose xaccAccountIsAssetLiabType xaccAccountGetType xaccSplitGetAccount)
(xaccTransGetSplitList txn)))
(define (splits->desc splits)
(let lp ((splits splits) (result '()))
(if (null? splits)
(apply gnc:make-html-text
(fold
(lambda (a b)
(cons* (gnc:html-string-sanitize a) (gnc:html-markup-br) b))
'() result))
(lp (cdr splits)
(let ((memo (xaccSplitGetMemo (car splits))))
(if (or (string-null? memo) (member memo result))
result
(cons memo result)))))))
(define (make-aging-table splits to-date payable? date-type currency)
(let ((table (gnc:make-html-table))
@ -185,7 +301,7 @@
splits num-buckets to-date date-type (not payable?))))
(gnc:html-table-set-col-headers!
table (list (_ "Prepayments")
table (list (_ "Pre-Payment")
(_ "Current")
(_ "0-30 days")
(_ "31-60 days")
@ -204,21 +320,65 @@
(define-syntax-rule (addif pred? elt)
(if pred? (list elt) '()))
(define (make-cell elt) (gnc:make-html-table-cell/markup "number-cell" elt))
(define (make-section-heading-list column-vector owner-desc)
(define (make-heading cols str)
(gnc:make-html-table-cell/size/markup 1 cols "th" str))
(let ((lhs (num-cols column-vector 'lhs-cols))
(mid (num-cols column-vector 'mid-spac))
(rhs (num-cols column-vector 'rhs-cols)))
(append
;; Translators: ~a History refers to main details table in owner
;; report. ~a will be replaced with Customer, Vendor or Employee.
(addif (< 0 lhs) (make-heading lhs (format #f (_ "~a History") owner-desc)) )
(addif (< 0 mid) (make-heading mid #f))
(addif (< 0 rhs) (make-heading rhs (_ "Linked Details"))))))
;;
;; Make a row list based on the visible columns
;;
(define (add-row table odd-row? column-vector date due-date num type-str
memo currency amt credit debit sale tax link-rows)
(define empty-cols
(count identity
(map (lambda (f) (f column-vector))
(list date-col date-due-col num-col type-col
memo-col sale-col tax-col credit-col
debit-col value-col))))
(define (add-row table odd-row? column-vector date due-date ref type-str
desc currency amt credit debit sale tax anchor-split
link-option link-rows)
(define nrows (if link-rows (length link-rows) 1))
(define (link-data->cols link-data)
(cond
((link-data? link-data)
(append
(addif (date-col column-vector) (link-data-date link-data))
(addif (ref-col column-vector) (link-data-ref link-data))
(addif (type-col column-vector) (link-data-type link-data))
(addif (desc-col column-vector) (link-data-desc link-data))
(addif (or (debit-col column-vector) (credit-col column-vector))
(gnc:make-html-table-cell/markup
"number-cell" (link-data-amount link-data)))))
((link-desc-amount? link-data)
(let ((cols (num-cols column-vector 'rhs-span)))
(append
(addif (< 0 cols) (gnc:make-html-table-cell/size
1 cols (link-desc-amount-desc link-data)))
(addif (or (debit-col column-vector) (credit-col column-vector))
(gnc:make-html-table-cell/markup
"number-cell" (link-desc-amount-amount link-data))))))
((link-blank? link-data)
(make-list (num-cols column-vector 'rhs-cols) #f))
(else link-data)))
(define (cell amt)
(and amt (make-cell (gnc:make-gnc-monetary currency amt))))
(and amt (gnc:make-gnc-monetary currency amt)))
(define (cell-anchor amt)
(and amt anchor-split
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text anchor-split)
(gnc:make-gnc-monetary currency amt)))))
(define cell-nohoriz
(let ((cell (gnc:make-html-table-cell/size nrows 1 #f)))
(gnc:html-table-cell-set-style!
cell "td" 'attribute '("style" "border-bottom: none; border-top: none;"))
cell))
(define mid-span
(if (eq? link-option 'detailed) (num-cols column-vector 'mid-spac) 0))
(let lp ((link-rows link-rows)
(first-row? #t))
(unless (null? link-rows)
@ -226,23 +386,30 @@
(gnc:html-table-append-row/markup!
table (if odd-row? "normal-row" "alternate-row")
(append
(addif (date-col column-vector) (qof-print-date date))
(addif (date-due-col column-vector)
(and due-date (qof-print-date due-date)))
(addif (num-col column-vector) (gnc:html-string-sanitize num))
(addif (type-col column-vector) type-str)
(addif (memo-col column-vector) (gnc:html-string-sanitize memo))
(addif (sale-col column-vector) (cell sale))
(addif (tax-col column-vector) (cell tax))
(addif (credit-col column-vector) (cell credit))
(addif (debit-col column-vector) (cell (and debit (- debit))))
(addif (value-col column-vector) (cell amt))
(car link-rows)))
(map
(lambda (cell)
(gnc:make-html-table-cell/size nrows 1 cell))
(append
(addif (date-col column-vector) (qof-print-date date))
(addif (date-due-col column-vector)
(and due-date (qof-print-date due-date)))
(addif (ref-col column-vector) ref)
(addif (type-col column-vector) type-str)
(addif (desc-col column-vector) desc)))
(map
(lambda (cell)
(gnc:make-html-table-cell/size/markup nrows 1 "number-cell" cell))
(append
(addif (sale-col column-vector) (cell sale))
(addif (tax-col column-vector) (cell tax))
(addif (credit-col column-vector) (cell-anchor credit))
(addif (debit-col column-vector) (cell-anchor (and debit (- debit))))
(addif (bal-col column-vector) (cell amt))))
(addif (< 0 mid-span) cell-nohoriz)
(link-data->cols (car link-rows))))
(gnc:html-table-append-row/markup!
table (if odd-row? "normal-row" "alternate-row")
(cons
(gnc:make-html-table-cell/size 1 empty-cols #f)
(car link-rows))))
(link-data->cols (car link-rows))))
(lp (cdr link-rows) #f))))
(define (add-owner-table table splits acc start-date end-date date-type
@ -250,99 +417,174 @@
(define (AP-negate num)
(if payable? (- num) num))
(define currency (xaccAccountGetCommodity acc))
(define link-cols (assq-ref '((none . 0) (simple . 1) (detailed . 3)) link-option))
(define rhs-cols (assq-ref `((none . 0)
(simple . 1)
(detailed . ,(num-cols used-columns 'rhs-cols)))
link-option))
(define mid-span
(if (eq? link-option 'detailed) (num-cols used-columns 'mid-spac) 0))
(define (print-totals total debit credit tax sale)
(define (total-cell cell)
(gnc:make-html-table-cell/markup "total-number-cell" cell))
(define (make-cell amt)
(total-cell (gnc:make-gnc-monetary currency amt)))
(define span
(count identity (map (lambda (f) (f used-columns))
(list memo-col type-col num-col date-due-col date-col))))
(define period-span (num-cols used-columns 'ptt-span))
(define grand-span (num-cols used-columns 'lhs-cols))
;; print period totals
(if (or (sale-col used-columns) (tax-col used-columns)
(credit-col used-columns) (debit-col used-columns))
(gnc:html-table-append-row/markup!
table "grand-total"
(append
(list (gnc:make-html-table-cell/markup
"total-label-cell" (_ "Period Totals")))
(addif (>= span 2) (gnc:make-html-table-cell/size 1 (1- span) ""))
(addif (< 0 period-span) (gnc:make-html-table-cell/markup
"total-label-cell" (_ "Period Totals")))
(addif (< 1 period-span) (gnc:make-html-table-cell/size
1 (1- period-span) #f))
(addif (sale-col used-columns) (make-cell sale))
(addif (tax-col used-columns) (make-cell tax))
(addif (credit-col used-columns) (make-cell credit))
(addif (debit-col used-columns) (make-cell (- debit)))
(addif (value-col used-columns) (make-cell (+ credit debit)))
(addif (> link-cols 0) (gnc:make-html-table-cell/size 1 link-cols #f)))))
(addif (bal-col used-columns) (make-cell (+ credit debit)))
(addif (< 0 rhs-cols) (gnc:make-html-table-cell/size
1 (+ mid-span rhs-cols) #f)))))
;; print grand total
(if (value-col used-columns)
(if (bal-col used-columns)
(gnc:html-table-append-row/markup!
table "grand-total"
(append
(list (gnc:make-html-table-cell/markup
"total-label-cell"
(if (negative? total)
(_ "Total Credit")
(_ "Total Due")))
(gnc:make-html-table-cell/size/markup
1 (value-col used-columns)
"total-number-cell"
(gnc:make-gnc-monetary currency total)))
(addif (> link-cols 0)
(gnc:make-html-table-cell/size 1 link-cols #f)))))
(addif (< 1 grand-span)
(gnc:make-html-table-cell/markup
"total-label-cell"
(if (negative? total)
(_ "Total Credit")
(_ "Total Due"))))
(addif (< 1 grand-span)
(gnc:make-html-table-cell/size/markup
1 (1- grand-span)
"total-number-cell"
(gnc:make-gnc-monetary currency total)))
(addif (< 0 rhs-cols)
(gnc:make-html-table-cell/size 1 (+ mid-span rhs-cols) #f)))))
;; print aging table
(gnc:html-table-append-row/markup!
table "grand-total"
(list (gnc:make-html-table-cell/size
1 (+ columns-used-size link-cols)
1 (+ grand-span mid-span rhs-cols)
(make-aging-table splits
end-date
payable? date-type currency)))))
(define (add-balance-row odd-row? total)
(add-row table odd-row? used-columns start-date #f "" (_ "Balance") ""
currency total #f #f #f #f (list (make-list link-cols #f))))
currency total #f #f #f #f (list (make-list rhs-cols #f))
link-option (case link-option
((none) '(()))
((simple) '((#f)))
((detailed) (list (make-link-blank))))))
(define (make-invoice->payments-table invoice)
(define lot (gncInvoiceGetPostedLot invoice))
(let lp ((invoice-splits (delete (gnc-lot-get-earliest-split lot)
(gnc-lot-get-split-list lot)))
(result '()))
(match invoice-splits
;; finished. test for underpayment and add outstanding balance
(() (reverse
(if (gncInvoiceIsPaid invoice)
result
(cons (list (gnc:make-html-table-cell/size 1 2 (_ "Outstanding"))
(make-cell
(gnc:make-gnc-monetary
currency (AP-negate (gnc-lot-get-balance lot)))))
result))))
(define (tfr-split->row tfr-split)
(let* ((pmt-txn (xaccSplitGetParent tfr-split))
(tfr-acct (xaccSplitGetAccount tfr-split))
(tfr-curr (xaccAccountGetCommodity tfr-acct))
(tfr-amt (AP-negate (xaccSplitGetAmount tfr-split))))
(make-link-data
(qof-print-date (xaccTransGetDate pmt-txn))
(split->reference tfr-split)
(split->type-str tfr-split)
(splits->desc (list tfr-split))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text (txn->transfer-split pmt-txn))
(gnc:make-gnc-monetary tfr-curr tfr-amt))))))
(define (posting-split->row posting-split)
(let* ((posting-txn (xaccSplitGetParent posting-split))
(inv (gncInvoiceGetInvoiceFromLot (xaccSplitGetLot posting-split))))
(make-link-data
(qof-print-date (xaccTransGetDate posting-txn))
(split->reference posting-split)
(split->type-str posting-split)
(splits->desc (list posting-split))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text (txn->transfer-split posting-txn))
(gnc:make-gnc-monetary
currency (AP-negate (xaccSplitGetAmount posting-split))))))))
(let ((lot (gncInvoiceGetPostedLot invoice)))
(let lp ((lot-splits (gnc-lot-get-split-list lot))
(transfer-splits-seen '())
(link-splits-seen '())
(result '()))
(cond
;; Finished result rows. Display them, and add Outstanding if
;; invoice still not completely paid.
((null? lot-splits)
(reverse
(if (gncInvoiceIsPaid invoice)
result
(cons (make-link-desc-amount
(_ "UNPAID")
(gnc:make-gnc-monetary
currency (AP-negate (gnc-lot-get-balance lot))))
result))))
;; invoice's lot's payment splits
((lot-split . rest-lot-splits)
(let* ((lot-txn (xaccSplitGetParent lot-split))
(tfr-splits (xaccTransGetPaymentAcctSplitList lot-txn)))
(let lp1 ((tfr-splits tfr-splits) (result result))
(match tfr-splits
(() (lp rest-lot-splits result))
((tfr-split . rest-tfr-splits)
(let* ((tfr-acct (xaccSplitGetAccount tfr-split))
(tfr-curr (xaccAccountGetCommodity tfr-acct))
(tfr-amt (AP-negate (xaccSplitGetAmount tfr-split))))
(lp1 rest-tfr-splits
(cons (list
(qof-print-date (xaccTransGetDate lot-txn))
(let ((num (gnc-get-num-action lot-txn lot-split)))
(if (string-null? num) (_ "Payment") num))
(make-cell
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text tfr-split)
(gnc:make-gnc-monetary tfr-curr tfr-amt)))))
result)))))))))))
;; This is the regular payment split. Find Transfer acct
;; splits, and if haven't encountered before, add to result rows.
((txn-is-payment? (xaccSplitGetParent (car lot-splits)))
(let lp1 ((pmt-splits (xaccTransGetPaymentAcctSplitList
(xaccSplitGetParent (car lot-splits))))
(transfer-splits-seen transfer-splits-seen)
(result result))
;; this is a secondary 'inner loop', looping
;; lot-split->tfr-account-splits.
(cond
;; finished tfr-splits. loop main lot-splits.
((null? pmt-splits)
(lp (cdr lot-splits) transfer-splits-seen link-splits-seen result))
;; we've encountered this tfr-split before. skip.
((member (car pmt-splits) transfer-splits-seen)
(lp1 (cdr pmt-splits) transfer-splits-seen result))
;; new tfr-split. render in original currency.
(else
(lp1 (cdr pmt-splits)
(cons (car pmt-splits) transfer-splits-seen)
(cons (tfr-split->row (car pmt-splits)) result))))))
;; This is a lot link split. Find corresponding documents,
;; and add to result rows.
((txn-is-link? (xaccSplitGetParent (car lot-splits)))
(let lp1 ((link-splits (xaccTransGetSplitList
(xaccSplitGetParent (car lot-splits))))
(link-splits-seen link-splits-seen)
(result result))
;; this is a secondary 'inner loop', looping
;; lot-split->peer-splits.
(cond
;; finished peer-splits. loop main lot-splits.
((null? link-splits)
(lp (cdr lot-splits) transfer-splits-seen link-splits-seen result))
;; peer split is of same sign as lot split. skip.
((sign-equal? (xaccSplitGetAmount (car lot-splits))
(xaccSplitGetAmount (car link-splits)))
(lp1 (cdr link-splits) link-splits-seen result))
;; we've encountered this peer-split before. skip.
((member (car link-splits) link-splits-seen)
(lp1 (cdr link-splits) link-splits-seen result))
;; new peer-split. render the posting split details.
((lot-split->posting-split (car link-splits))
=> (lambda (posting-split)
(lp1 (cdr link-splits)
(cons (car link-splits) link-splits-seen)
(cons (posting-split->row posting-split) result))))
;; can't find posting split. probably invalid txn. skip.
(else (lp1 (cdr link-splits) link-splits-seen result)))))
;; This is either the invoice posting transaction, or a
;; TXN-TYPE-NONE txn which shouldn't happen. Skip both.
(else
(lp (cdr lot-splits) transfer-splits-seen link-splits-seen result))))))
(define (payment-txn->overpayment-and-invoices txn)
(let lp ((splits (xaccTransGetAPARAcctSplitList txn #f))
@ -358,7 +600,9 @@
invoices)
(lp rest
overpayment
(cons invoice invoices))))))))
(if (member invoice invoices)
invoices
(cons invoice invoices)))))))))
(define (make-payment->invoices-list txn)
(list
@ -369,9 +613,7 @@
(lambda (inv)
(gnc:html-markup-anchor
(gnc:invoice-anchor-text inv)
(gnc-get-num-action
(gncInvoiceGetPostedTxn inv)
#f)))
(gncInvoiceGetID inv)))
(cdr (payment-txn->overpayment-and-invoices txn)))))))
(define (make-payment->invoices-table txn)
@ -384,37 +626,27 @@
(reverse
(if (zero? overpayment)
result
(cons (list (gnc:make-html-table-cell/size 1 2 (_ "Prepayments"))
(make-cell (gnc:make-gnc-monetary currency overpayment)))
(cons (make-link-desc-amount
(_ "Pre-Payment")
(gnc:make-gnc-monetary currency overpayment))
result)))))
((inv . rest)
(lp rest
(cons (list
(qof-print-date (gncInvoiceGetDatePosted inv))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:invoice-anchor-text inv)
(gnc-get-num-action (gncInvoiceGetPostedTxn inv) #f)))
(make-cell (gnc:make-gnc-monetary currency (invoice->total inv))))
result))))))
(define (split->type-str split)
(let* ((txn (xaccSplitGetParent split))
(invoice (gncInvoiceGetInvoiceFromTxn txn)))
(cond
((txn-is-invoice? txn)
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:invoice-anchor-text invoice)
(gncInvoiceGetTypeString invoice))))
((txn-is-payment? txn)
(apply gnc:make-html-text
(map (lambda (pmt-split)
(gnc:html-markup-anchor
(gnc:split-anchor-text pmt-split)
(_ "Payment")))
(xaccTransGetPaymentAcctSplitList txn))))
(else (_ "Unknown")))))
(let* ((tfr-txn (gncInvoiceGetPostedTxn inv))
(tfr-split (txn->transfer-split tfr-txn)))
(lp rest
(cons (make-link-data
(qof-print-date (gncInvoiceGetDatePosted inv))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:invoice-anchor-text inv)
(gncInvoiceGetID inv)))
(gncInvoiceGetTypeString inv)
(splits->desc (txn->assetliab-splits tfr-txn))
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text tfr-split)
(gnc:make-gnc-monetary currency (invoice->total inv)))))
result)))))))
(define (invoice->sale invoice)
(and (not (null? invoice))
@ -449,7 +681,7 @@
((null? splits)
;;Balance row may not have been added if all transactions were before
;;start-date (and no other rows would be added either) so add it now
(when (and (not printed?) (value-col used-columns) (not (zero? total)))
(when (and (not printed?) (bal-col used-columns) (not (zero? total)))
(add-balance-row odd-row? total))
(print-totals total debit credit tax sale)
(gnc:html-table-set-style!
@ -492,17 +724,24 @@
;; if balance row hasn't been rendered, consider
;; adding here. skip if value=0.
((not printed?)
(let ((print? (and (value-col used-columns) (not (zero? total)))))
(let ((print? (and (bal-col used-columns) (not (zero? total)))))
(if print? (add-balance-row odd-row? total))
(lp #t (not print?) splits total debit credit tax sale)))
(else
(add-row
table odd-row? used-columns date (invoice->due-date invoice)
(gnc-get-num-action txn split) (split->type-str split)
(xaccSplitGetMemo split) currency (+ total value)
(split->reference split)
(split->type-str split)
(splits->desc
(cond
((txn-is-invoice? txn) (list split))
((txn-is-payment? txn) (txn->assetliab-splits txn))))
currency (+ total value)
(and (>= value 0) value) (and (< value 0) value)
(invoice->sale invoice) (invoice->tax invoice)
(txn->transfer-split txn)
link-option
(cond
((and (txn-is-invoice? txn) (eq? link-option 'simple))
(if (gncInvoiceIsPaid invoice)
@ -713,6 +952,7 @@ invoices and amounts.")))))
(query (qof-query-create-for-splits))
(document (gnc:make-html-document))
(table (gnc:make-html-table))
(section-headings (make-section-heading-list used-columns owner-descr))
(headings (make-heading-list used-columns link-option))
(report-title (string-append (_ owner-descr) " " (_ "Report"))))
@ -821,7 +1061,11 @@ invoices and amounts.")))))
(make-break! document)
(gnc:html-table-set-col-headers! table headings)
(gnc:html-table-set-multirow-col-headers!
table
(if (eq? link-option 'detailed)
(list section-headings headings)
(list headings)))
(gnc:html-document-add-object! document table))))))

View File

@ -273,10 +273,10 @@
(set-option! balance-sheet-options "Display" "Parent account subtotals" 'f)
(let ((sxml (options->sxml balance-sheet-uuid balance-sheet-options "balsheet-recursive")))
(test-equal "recursive. root = $760+15000+104600"
(list "#200.00" "$340.00" "30 FUNDS" "$15,000.00" "$106,709.00" "$106,709.00")
'("#200.00" "$340.00" "$106,709.00" "$106,709.00" "30 FUNDS" "$15,000.00")
(sxml->table-row-col sxml 1 3 6))
(test-equal "recursive. assets = $760+15000+104600"
(list "#200.00" "$340.00" "30 FUNDS" "$15,000.00" "$106,709.00" "$106,709.00")
'("#200.00" "$340.00" "$106,709.00" "$106,709.00" "30 FUNDS" "$15,000.00")
(sxml->table-row-col sxml 1 4 5))
(test-equal "recursive. bank1 = $4,709.00"
(list "$4,709.00")
@ -294,7 +294,7 @@
(list "$100.00")
(sxml->table-row-col sxml 1 9 3))
(test-equal "recursive. broker = $15000+2000.00"
(list "30 FUNDS" "$15,000.00" "$2,000.00" "$2,000.00")
'("$2,000.00" "$2,000.00" "30 FUNDS" "$15,000.00")
(sxml->table-row-col sxml 1 10 4))
(test-equal "recursive. funds = $15,000.00"
(list "30 FUNDS" "$15,000.00" "$15,000.00")
@ -326,10 +326,10 @@
(set-option! balance-sheet-options "Commodities" "Show Exchange Rates" #t)
(let ((sxml (options->sxml balance-sheet-uuid balance-sheet-options "balsheet-enable show-fcur show-rates")))
(test-equal "show-fcur enabled"
(list "#200.00" "$340.00" "30 FUNDS" "$15,000.00" "$106,709.00" "$106,709.00")
'("#200.00" "$340.00" "$106,709.00" "$106,709.00" "30 FUNDS" "$15,000.00")
(sxml->table-row-col sxml 1 3 6))
(test-equal "show-rates enabled"
(list "1 FUNDS" "$500.00" "#1.00" "$1.70")
'("#1.00" "$1.70" "1 FUNDS" "$500.00")
(sxml->table-row-col sxml 2 #f #f)))
;;make-multilevel
@ -516,25 +516,25 @@
(let ((sxml (options->sxml multicol-balsheet-uuid multi-bs-options
"multicol-balsheet-halfyear")))
(test-equal "bal-1/1/70"
'("01/01/70" "$113,100.00" "$113,100.00" "$8,970.00" "$2,000.00" "$6,870.00"
"$0.00" "$100.00" "$4,000.00" "$2,000.00" "$2,000.00" "10 FUNDS " "$130.00"
"$130.00" "#100.00 " "$100,000.00" "$113,100.00" "$9,500.00" "$9,500.00"
"$500.00" "$9,000.00" "$9,500.00" "$103,600.00" "$0.00" "$0.00"
"$103,600.00" "1 FUNDS $200.00" "#1.00 $1.30")
'("01/01/70" "$113,100.00" "$113,100.00" "$8,970.00" "$2,000.00"
"$6,870.00" "$0.00" "$100.00" "$4,000.00" "$2,000.00" "$2,000.00"
"10 FUNDS " "$130.00" "$130.00" "#100.00 " "$100,000.00" "$113,100.00"
"$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" "$103,600.00"
"$0.00" "$0.00" "$103,600.00" "#1.00 $1.30" "1 FUNDS $200.00")
(sxml->table-row-col sxml 1 #f 2))
(test-equal "bal-1/1/71"
'("01/01/71" "$116,009.00" "$116,009.00" "$4,709.00" "$2,000.00" "$2,609.00"
"$0.00" "$100.00" "$11,000.00" "$2,000.00" "$9,000.00" "30 FUNDS " "$300.00"
"$300.00" "#200.00 " "$100,000.00" "$116,009.00" "$9,500.00" "$9,500.00"
"$500.00" "$9,000.00" "$9,500.00" "$103,600.00" "$2,909.00" "$0.00"
"$106,509.00" "1 FUNDS $300.00" "#1.00 $1.50")
'("01/01/71" "$116,009.00" "$116,009.00" "$4,709.00" "$2,000.00"
"$2,609.00" "$0.00" "$100.00" "$11,000.00" "$2,000.00" "$9,000.00"
"30 FUNDS " "$300.00" "$300.00" "#200.00 " "$100,000.00" "$116,009.00"
"$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" "$103,600.00"
"$2,909.00" "$0.00" "$106,509.00" "#1.00 $1.50" "1 FUNDS $300.00")
(sxml->table-row-col sxml 1 #f 3))
(test-equal "bal-1/1/72"
'("01/01/72" "$117,529.00" "$117,529.00" "$4,709.00" "$2,000.00" "$2,609.00"
"$0.00" "$100.00" "$12,500.00" "$2,000.00" "$10,500.00" "30 FUNDS " "$320.00"
"$320.00" "#200.00 " "$100,000.00" "$117,529.00" "$9,500.00" "$9,500.00"
"$500.00" "$9,000.00" "$9,500.00" "$103,600.00" "$4,429.00" "$0.00"
"$108,029.00" "1 FUNDS $350.00" "#1.00 $1.60")
'("01/01/72" "$117,529.00" "$117,529.00" "$4,709.00" "$2,000.00"
"$2,609.00" "$0.00" "$100.00" "$12,500.00" "$2,000.00" "$10,500.00"
"30 FUNDS " "$320.00" "$320.00" "#200.00 " "$100,000.00" "$117,529.00"
"$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00" "$103,600.00"
"$4,429.00" "$0.00" "$108,029.00" "#1.00 $1.60" "1 FUNDS $350.00")
(sxml->table-row-col sxml 1 #f 4)))
;; the following includes non-zero retained earnings of $1,270
@ -544,12 +544,11 @@
(let ((sxml (options->sxml multicol-balsheet-uuid multi-bs-options
"multicol-balsheet-retained")))
(test-equal "bal-1/3/80"
'("$123,319.00" "$123,319.00" "$5,129.00" "$2,000.00" "$3,029.00"
"$0.00" "$100.00" "$17,000.00" "$2,000.00" "$15,000.00" "30 FUNDS "
"$1,190.00" "$1,190.00" "#700.00 " "$100,000.00" "$123,319.00"
"$9,500.00" "$9,500.00" "$500.00" "$9,000.00" "$9,500.00"
"$103,600.00" "$8,949.00" "$1,270.00" "$113,819.00" "1 FUNDS $500.00"
"#1.00 $1.70")
'("$123,319.00" "$123,319.00" "$5,129.00" "$2,000.00" "$3,029.00" "$0.00"
"$100.00" "$17,000.00" "$2,000.00" "$15,000.00" "30 FUNDS " "$1,190.00"
"$1,190.00" "#700.00 " "$100,000.00" "$123,319.00" "$9,500.00" "$9,500.00"
"$500.00" "$9,000.00" "$9,500.00" "$103,600.00" "$8,949.00" "$1,270.00"
"$113,819.00" "#1.00 $1.70" "1 FUNDS $500.00")
(sxml->table-row-col sxml 1 #f 2)))))
(define (multicol-pnl-tests)

View File

@ -333,7 +333,7 @@
owner-1 (get-acct "AR-USD")))
(sxml (options->sxml 'customer-new options "new-customer-report basic")))
(test-equal "inv-descriptions"
'("inv >90 $11.50" "inv 60-90 $7.50" "inv 30-60 $8.50"
'("inv >90 $11.50" "$2.00" "inv 60-90 $7.50" "inv 30-60 $8.50"
"inv >90 payment" "inv >90 payment" "inv <30days $4.00"
"inv $200" "inv $200" "inv current $6.75" "inv $3 CN"
"$31.75" "$7.50")

View File

@ -1,5 +1,6 @@
set(stylesheets_SCHEME
css.scm
plain.scm
footer.scm
head-or-tail.scm

View File

@ -0,0 +1,212 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; stylesheet-css.scm : a customisable CSS gnucash stylesheet
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2 of
;; the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, contact:
;;
;; Free Software Foundation Voice: +1-617-542-5942
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash report stylesheets css))
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils))
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (srfi srfi-13))
(use-modules (gnucash html))
(define default-css "/* default style */
html, body {
height: 100vh;
margin: 0;
font-family: \"Noto Sans\", Sans-Serif;
font-size: 10pt;
}
body, p, table, tr, td, a, th {
vertical-align: top;
}
h3 {
font-size: 15pt;
font-weight: bold;
}
a {
font-style: italic;
}
/* table elements as follows */
td, th {
padding:4px;
}
tr.alternate-row {
background: #ffffff
}
tr {
page-break-inside: avoid !important;
}
td, th {
border-color: grey
}
td.total-number-cell, td.total-label-cell, td.centered-label-cell {
font-size: 12pt;
font-weight: bold;
}
th.column-heading-left {
text-align: left;
}
td.centered-label-cell, th.column-heading-center {
text-align: center;
}
td.number-header, th.column-heading-right, td.number-cell, td.total-number-cell {
text-align: right;
}
td.neg {
color: red;
}
td.number-cell, td.total-number-cell, td.anchor-cell, td.date-cell {
white-space: nowrap;
}
")
(define (css-options)
(let ((options (gnc:new-options)))
(gnc:register-option
options
(gnc:make-text-option
(N_ "General") (N_ "CSS") "a"
(N_ "CSS code. This field specifies the CSS code for styling reports.")
default-css))
options))
(define (css-renderer options doc)
(let* ((ssdoc (gnc:make-html-document))
(css (gnc:option-value (gnc:lookup-option options "General" "CSS")))
(report-css (or (gnc:html-document-style-text doc) ""))
(all-css (string-append css report-css))
(headline (or (gnc:html-document-headline doc)
(gnc:html-document-title doc))))
(gnc:html-document-set-style!
ssdoc "column-heading-left"
'tag "th"
'attribute (list "class" "column-heading-left"))
(gnc:html-document-set-style!
ssdoc "column-heading-center"
'tag "th"
'attribute (list "class" "column-heading-center"))
(gnc:html-document-set-style!
ssdoc "column-heading-right"
'tag "th"
'attribute (list "class" "column-heading-right"))
(gnc:html-document-set-style!
ssdoc "date-cell"
'tag "td"
'attribute (list "class" "date-cell"))
(gnc:html-document-set-style!
ssdoc "anchor-cell"
'tag "td"
'attribute (list "class" "anchor-cell"))
(gnc:html-document-set-style!
ssdoc "number-cell"
'tag "td"
'attribute (list "class" "number-cell"))
(gnc:html-document-set-style!
ssdoc "number-cell-neg"
'tag "td"
'attribute (list "class" "number-cell neg"))
(gnc:html-document-set-style!
ssdoc "number-header"
'tag "th"
'attribute (list "class" "number-header"))
(gnc:html-document-set-style!
ssdoc "text-cell"
'tag "td"
'attribute (list "class" "text-cell"))
(gnc:html-document-set-style!
ssdoc "total-number-cell"
'tag "td"
'attribute (list "class" "total-number-cell"))
(gnc:html-document-set-style!
ssdoc "total-number-cell-neg"
'tag "td"
'attribute (list "class" "total-number-cell neg"))
(gnc:html-document-set-style!
ssdoc "total-label-cell"
'tag "td"
'attribute (list "class" "total-label-cell"))
(gnc:html-document-set-style!
ssdoc "centered-label-cell"
'tag "td"
'attribute (list "class" "centered-label-cell"))
(gnc:html-document-set-style! ssdoc "normal-row" 'tag "tr")
(gnc:html-document-set-style! ssdoc "alternate-row" 'tag "tr")
(gnc:html-document-set-style! ssdoc "primary-subheading" 'tag "tr")
(gnc:html-document-set-style! ssdoc "secondary-subheading" 'tag "tr")
(gnc:html-document-set-style! ssdoc "grand-total" 'tag "tr")
(cond
((string-contains-ci all-css "</style")
(gnc:html-document-set-style-text! ssdoc default-css)
(gnc:html-document-add-object!
ssdoc (gnc:make-html-text
(_ "&lt;/style is disallowed in CSS. Using default CSS."))))
(else
(gnc:html-document-set-style-text! ssdoc all-css)))
(unless (equal? headline "")
(gnc:html-document-add-object!
ssdoc (gnc:make-html-text (gnc:html-markup-h3 headline))))
(gnc:html-document-append-objects! ssdoc (gnc:html-document-objects doc))
ssdoc))
(gnc:define-html-style-sheet
'version 1
'name (N_ "CSS")
'renderer css-renderer
'options-generator css-options)
(gnc:make-html-style-sheet "CSS" (N_ "CSS-based stylesheet (experimental)"))

View File

@ -42,6 +42,7 @@
(use-modules (gnucash core-utils))
(use-modules (srfi srfi-11))
(use-modules (srfi srfi-1))
(use-modules (ice-9 match))
;; Define the strings here to avoid typos and make changes easier.
@ -1033,7 +1034,8 @@ be excluded from periodic reporting.")
;; ;;;;;;;;;;;;;;;;;;;;
;; Here comes the big function that builds the whole table.
(define (make-split-table splits options custom-calculated-cells)
(define (make-split-table splits options custom-calculated-cells
begindate)
(define (opt-val section name)
(let ((option (gnc:lookup-option options section name)))
@ -1120,6 +1122,11 @@ be excluded from periodic reporting.")
'multi-line))
(export? (opt-val gnc:pagename-general optname-table-export)))
(define (acc-reverse? acc)
(if account-types-to-reverse
(memv (xaccAccountGetType acc) account-types-to-reverse)
(gnc-reverse-balance acc)))
(define (column-uses? param)
(cdr (assq param used-columns)))
@ -1315,6 +1322,7 @@ be excluded from periodic reporting.")
;; column must be the credit side
;; friendly-heading-fn (friendly-heading-fn account) to retrieve
;; friendly name for account debit/credit
;; or 'bal-bf for balance-brought-forward
(if (column-uses? 'amount-single)
(list (vector (header-commodity (_ "Amount"))
@ -1351,7 +1359,7 @@ be excluded from periodic reporting.")
(if (column-uses? 'running-balance)
(list (vector (_ "Running Balance")
running-balance #t #f #f
(lambda (a) "")))
'bal-bf))
'()))))
(define calculated-cells
@ -1406,29 +1414,35 @@ be excluded from periodic reporting.")
table subheading-style
(append
(gnc:html-make-empty-cells left-indent)
(if (and (opt-val pagename-sorting optname-show-informal-headers)
(column-uses? 'amount-double)
(memq sortkey SORTKEY-INFORMAL-HEADERS))
(append
(if export?
(cons
(gnc:make-html-table-cell data)
(gnc:html-make-empty-cells
(+ right-indent width-left-columns -1)))
(list
(gnc:make-html-table-cell/size
1 (+ right-indent width-left-columns) data)))
(map (lambda (cell)
(let ((friendly-fn (vector-ref cell 5)))
(and friendly-fn
(gnc:make-html-text
(gnc:html-markup-b
(friendly-fn (renderer-fn split)))))))
calculated-cells))
(if export?
(cons
(gnc:make-html-table-cell data)
(gnc:html-make-empty-cells
(+ right-indent width-left-columns -1)))
(list
(gnc:make-html-table-cell/size
1 (+ right-indent width-left-columns width-right-columns)
data))))))))
1 (+ right-indent width-left-columns) data)))
(map
(lambda (cell)
(match (vector-ref cell 5)
(#f #f)
('bal-bf
(let* ((acc (xaccSplitGetAccount split))
(bal (xaccAccountGetBalanceAsOfDate acc begindate)))
(and (memq sortkey ACCOUNT-SORTING-TYPES)
(gnc:make-html-table-cell/markup
"number-cell"
(gnc:make-gnc-monetary
(xaccAccountGetCommodity acc)
(if (acc-reverse? acc) (- bal) bal))))))
(fn
(and (opt-val pagename-sorting optname-show-informal-headers)
(column-uses? 'amount-double)
(memq sortkey SORTKEY-INFORMAL-HEADERS)
(gnc:make-html-text
(gnc:html-markup-b
(fn (xaccSplitGetAccount split))))))))
calculated-cells))))))
(define (add-subtotal-row subtotal-string subtotal-collectors
subtotal-style level row col)
@ -1605,10 +1619,7 @@ be excluded from periodic reporting.")
(define (add-split-row split cell-calculators row-style transaction-row?)
(let* ((account (xaccSplitGetAccount split))
(reversible-account? (if account-types-to-reverse
(memv (xaccAccountGetType account)
account-types-to-reverse)
(gnc-reverse-balance account)))
(reversible-account? (acc-reverse? account))
(cells (map (lambda (cell)
(let ((split->monetary (vector-ref cell 1)))
(vector (split->monetary split)
@ -2173,7 +2184,8 @@ be excluded from periodic reporting.")
(else
(let-values (((table grid csvlist)
(make-split-table splits options custom-calculated-cells)))
(make-split-table splits options custom-calculated-cells
begindate)))
(gnc:html-document-set-title! document report-title)

View File

@ -500,7 +500,7 @@ recurrenceListToString(const GList *r)
{
if (iter != r)
{
/* translators: " + " is an separator in a list of string-representations of recurrence frequencies */
/* Translators: " + " is an separator in a list of string-representations of recurrence frequencies */
g_string_append(str, _(" + "));
}
s = recurrenceToString((Recurrence *)iter->data);
@ -615,7 +615,7 @@ _weekly_list_to_compact_string(GList *rs, GString *buf)
g_string_printf(buf, "%s", _("Weekly"));
if (multiplier > 1)
{
/* translators: %u is the recurrence multiplier, i.e. this
/* Translators: %u is the recurrence multiplier, i.e. this
event should occur every %u'th week. */
g_string_append_printf(buf, _(" (x%u)"), multiplier);
}
@ -649,7 +649,7 @@ _monthly_append_when(Recurrence *r, GString *buf)
gnc_dow_abbrev(day_name_buf, abbrev_day_name_bufsize, g_date_get_weekday(&date) % 7);
/* translators: %s is an already-localized form of the day of the week. */
/* Translators: %s is an already-localized form of the day of the week. */
g_string_append_printf(buf, _("last %s"), day_name_buf);
}
else if (recurrenceGetPeriodType(r) == PERIOD_NTH_WEEKDAY)
@ -662,13 +662,13 @@ _monthly_append_when(Recurrence *r, GString *buf)
gnc_dow_abbrev(day_name_buf, abbrev_day_name_bufsize, g_date_get_weekday(&date) % 7);
day_of_month_index = g_date_get_day(&date) - 1;
week = day_of_month_index / 7 > 3 ? 3 : day_of_month_index / 7;
/* translators: %s is the string 1st, 2nd, 3rd and so on, and
/* Translators: %s is the string 1st, 2nd, 3rd and so on, and
* %s is an already-localized form of the day of the week. */
g_string_append_printf(buf, _("%s %s"), _(numerals[week]), day_name_buf);
}
else
{
/* translators: %u is the day of month */
/* Translators: %u is the day of month */
g_string_append_printf(buf, "%u", g_date_get_day(&date));
}
}
@ -705,7 +705,7 @@ recurrenceListToCompactString(GList *rs)
g_string_append_printf(buf, " ");
if (recurrenceGetMultiplier(first) > 1)
{
/* translators: %u is the recurrence multiplier number */
/* Translators: %u is the recurrence multiplier number */
g_string_append_printf(buf, _(" (x%u)"), recurrenceGetMultiplier(first));
}
g_string_append_printf(buf, ": ");
@ -715,7 +715,7 @@ recurrenceListToCompactString(GList *rs)
}
else
{
/* translators: %d is the number of Recurrences in the list. */
/* Translators: %d is the number of Recurrences in the list. */
g_string_printf(buf, _("Unknown, %d-size list."), g_list_length(rs));
}
}
@ -736,7 +736,7 @@ recurrenceListToCompactString(GList *rs)
g_string_printf(buf, "%s", _("Daily"));
if (multiplier > 1)
{
/* translators: %u is the recurrence multiplier. */
/* Translators: %u is the recurrence multiplier. */
g_string_append_printf(buf, _(" (x%u)"), multiplier);
}
}
@ -753,7 +753,7 @@ recurrenceListToCompactString(GList *rs)
g_string_printf(buf, "%s", _("Monthly"));
if (multiplier > 1)
{
/* translators: %u is the recurrence multiplier. */
/* Translators: %u is the recurrence multiplier. */
g_string_append_printf(buf, _(" (x%u)"), multiplier);
}
g_string_append_printf(buf, ": ");
@ -764,12 +764,10 @@ recurrenceListToCompactString(GList *rs)
{
//g_warning("nth weekday not handled");
//g_string_printf(buf, "@fixme: nth weekday not handled");
/* (keep the line break below to avoid a translator comment) */
g_string_printf(buf,
"%s", _("Monthly"));
g_string_printf(buf, "%s", _("Monthly"));
if (multiplier > 1)
{
/* translators: %u is the recurrence multiplier. */
/* Translators: %u is the recurrence multiplier. */
g_string_append_printf(buf, _(" (x%u)"), multiplier);
}
g_string_append_printf(buf, ": ");
@ -781,7 +779,7 @@ recurrenceListToCompactString(GList *rs)
g_string_printf(buf, "%s", _("Yearly"));
if (multiplier > 1)
{
/* translators: %u is the recurrence multiplier. */
/* Translators: %u is the recurrence multiplier. */
g_string_append_printf(buf, _(" (x%u)"), multiplier);
}
}

View File

@ -336,7 +336,7 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
amt_tot = split->amount;
amt_a = gnc_numeric_neg (baln);
amt_b = gnc_numeric_sub_fixed (amt_tot, amt_a);
g_assert (gnc_numeric_check(amt_b) == GNC_ERROR_OK);
g_return_val_if_fail(gnc_numeric_check(amt_b) == GNC_ERROR_OK, NULL);
PINFO ("++++++++++++++ splitting split=%p into amt = %s + %s",
split,
@ -366,7 +366,7 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
gnc_num_dbg_to_string(amt_tot));
}
if (gnc_numeric_zero_p(val_a) || gnc_numeric_zero_p(val_b))
if (gnc_numeric_zero_p(amt_a) || gnc_numeric_zero_p(amt_b))
{
PERR ("Failed to split into two!");
}
@ -376,8 +376,8 @@ xaccSplitAssignToLot (Split *split, GNCLot *lot)
gnc_num_dbg_to_string(val_a),
gnc_num_dbg_to_string(val_b) );
g_assert (!gnc_numeric_zero_p (amt_a));
g_assert (!gnc_numeric_zero_p (val_a));
g_return_val_if_fail (!gnc_numeric_zero_p (amt_a), NULL);
g_return_val_if_fail (!gnc_numeric_check (val_a), NULL);
xaccSplitSetAmount (split, amt_a);
xaccSplitSetValue (split, val_a);
@ -438,8 +438,8 @@ xaccSplitAssign (Split *split)
* have lots, we are done.
*/
if (split->lot) return FALSE;
g_assert (split->gains == GAINS_STATUS_UNKNOWN ||
(split->gains & GAINS_STATUS_GAINS) == FALSE);
g_return_val_if_fail (split->gains == GAINS_STATUS_UNKNOWN ||
(split->gains & GAINS_STATUS_GAINS) == FALSE, FALSE);
acc = split->acc;
if (!xaccAccountHasTrades (acc))
return FALSE;

View File

@ -147,9 +147,10 @@ void gnc_lot_get_balance_before (const GNCLot *, const Split *,
gboolean gnc_lot_is_closed (GNCLot *);
/** The gnc_lot_get_earliest_split() routine is a convenience routine
* that helps identify the date this lot was opened. It simply
* that helps identify the earliest date in the lot. It simply
* loops over all of the splits in the lot, and returns the split
* with the earliest split->transaction->date_posted.
* with the earliest split->transaction->date_posted. It may not
* necessarily identify the lot opening split.
*/
Split * gnc_lot_get_earliest_split (GNCLot *lot);

View File

@ -838,8 +838,6 @@ gncOwnerCreatePaymentLotSecs (const GncOwner *owner, Transaction **preset_txn,
xaccTransSetDescription (txn, name ? name : "");
/* set per book option */
xaccTransSetCurrency (txn, commodity);
xaccTransSetDateEnteredSecs (txn, gnc_time (NULL));
xaccTransSetDatePostedSecs (txn, date);
/* The split for the transfer account */
@ -892,6 +890,10 @@ gncOwnerCreatePaymentLotSecs (const GncOwner *owner, Transaction **preset_txn,
gnc_set_num_action (txn, NULL, num, _("Payment"));
xaccTransSetTxnType (txn, TXN_TYPE_PAYMENT);
/* Set date for transaction */
xaccTransSetDateEnteredSecs (txn, gnc_time (NULL));
xaccTransSetDatePostedSecs (txn, date);
/* Commit this new transaction */
xaccTransCommitEdit (txn);
if (preset_txn)

View File

@ -486,10 +486,10 @@ test_gnc_setlocale (int category, gchar *locale)
if (localeval != NULL)
return;
}
g_fprintf (stderr, "There are some differences between distros in the way they name"
"locales, and this can cause trouble with the locale-based"
"formatting. If you get the assert in this function, run locale -a"
"and make sure that en_US, en_GB, and fr_FR are installed and that"
g_fprintf (stderr, "There are some differences between distros in the way they name "
"locales, and this can cause trouble with the locale-based "
"formatting. If you get the assert in this function, run locale -a "
"and make sure that en_US, en_GB, and fr_FR are installed and that "
"if a suffix is needed it's in the suffixes array.");
g_assert_not_reached ();
}

View File

@ -76,6 +76,7 @@ function(make_gnucash_potfiles)
${CMAKE_SOURCE_DIR}/*.gschema.xml.in ${CMAKE_SOURCE_DIR}/*.appdata.xml.in.in
${CMAKE_SOURCE_DIR}/*.keys.in ${CMAKE_SOURCE_DIR}/*.scm
${CMAKE_SOURCE_DIR}/*/qofbookslots.h
${CMAKE_SOURCE_DIR}/*/gnc-commodity.h
)
# Only consider files in a selection of the source directories and

View File

@ -511,6 +511,7 @@ gnucash/report/reports/support/receipt.eguile.scm
gnucash/report/reports/support/taxinvoice.eguile.scm
gnucash/report/report.scm
gnucash/report/report-utilities.scm
gnucash/report/stylesheets/css.scm
gnucash/report/stylesheets/footer.scm
gnucash/report/stylesheets/head-or-tail.scm
gnucash/report/stylesheets/plain.scm
@ -629,6 +630,7 @@ libgnucash/engine/gncBillTerm.c
libgnucash/engine/gnc-budget.c
libgnucash/engine/gncBusiness.c
libgnucash/engine/gnc-commodity.c
libgnucash/engine/gnc-commodity.h
libgnucash/engine/gncCustomer.c
libgnucash/engine/gnc-date.cpp
libgnucash/engine/gnc-datetime.cpp

22085
po/ar.po

File diff suppressed because it is too large Load Diff

43608
po/as.po

File diff suppressed because it is too large Load Diff

36069
po/az.po

File diff suppressed because it is too large Load Diff

40883
po/bg.po

File diff suppressed because it is too large Load Diff

40136
po/brx.po

File diff suppressed because it is too large Load Diff

40611
po/ca.po

File diff suppressed because it is too large Load Diff

37859
po/cs.po

File diff suppressed because it is too large Load Diff

37741
po/da.po

File diff suppressed because it is too large Load Diff

6897
po/de.po

File diff suppressed because it is too large Load Diff

40896
po/doi.po

File diff suppressed because it is too large Load Diff

40136
po/el.po

File diff suppressed because it is too large Load Diff

38122
po/en_GB.po

File diff suppressed because it is too large Load Diff

17377
po/es.po

File diff suppressed because it is too large Load Diff

38059
po/es_NI.po

File diff suppressed because it is too large Load Diff

38127
po/eu.po

File diff suppressed because it is too large Load Diff

20470
po/fa.po

File diff suppressed because it is too large Load Diff

33280
po/fi.po

File diff suppressed because it is too large Load Diff

18711
po/fr.po

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More