Merge branch 'maint'

This commit is contained in:
John Ralls 2020-10-01 13:13:18 -07:00
commit 1d97f26344
20 changed files with 4944 additions and 4574 deletions

View File

@ -118,7 +118,6 @@ typedef struct _AccountWindow
GtkWidget * placeholder_button;
GtkWidget * hidden_button;
GtkWidget * auto_interest_button;
GtkWidget * auto_interest_button_label;
gint component_id;
} AccountWindow;
@ -1115,8 +1114,6 @@ set_auto_interest_box(AccountWindow *aw)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->auto_interest_button),
type_ok && pref_set);
gtk_widget_set_sensitive (GTK_WIDGET (aw->auto_interest_button), type_ok);
gtk_widget_set_sensitive (GTK_WIDGET (aw->auto_interest_button_label),
type_ok);
}
static void
@ -1392,7 +1389,7 @@ gnc_account_window_create(GtkWindow *parent, AccountWindow *aw)
&aw->commodity_mode);
// If the account has transactions, prevent changes by displaying a label and tooltip
if (xaccAccountCountSplits (aw_get_account (aw), FALSE) > 0)
if (xaccAccountGetSplitList (aw_get_account (aw)) != NULL)
{
const gchar *sec_name = gnc_commodity_get_printname (xaccAccountGetCommodity(aw_get_account (aw)));
GtkWidget *label = gtk_label_new (sec_name);
@ -1427,7 +1424,6 @@ gnc_account_window_create(GtkWindow *parent, AccountWindow *aw)
aw->placeholder_button = GTK_WIDGET(gtk_builder_get_object (builder, "placeholder_button"));
aw->hidden_button = GTK_WIDGET(gtk_builder_get_object (builder, "hidden_button"));
aw->auto_interest_button = GTK_WIDGET(gtk_builder_get_object (builder, "auto_interest_button"));
aw->auto_interest_button_label = GTK_WIDGET(gtk_builder_get_object (builder, "label405"));
set_auto_interest_box(aw);
@ -1477,7 +1473,7 @@ gnc_account_window_create(GtkWindow *parent, AccountWindow *aw)
// immutable if gnucash depends on details that would be lost/missing
// if changing from/to such a type. At the time of this writing the
// immutable types are AR, AP and trading types.
if (xaccAccountCountSplits (aw_get_account (aw), FALSE) > 0)
if (xaccAccountGetSplitList (aw_get_account (aw)) != NULL)
{
GNCAccountType atype = xaccAccountGetType (aw_get_account (aw));
compat_types = xaccAccountTypesCompatibleWith (atype);

View File

@ -2046,7 +2046,7 @@ gnc_plugin_page_account_tree_filter_accounts (Account *account,
if (!fd->show_unused)
{
if (xaccAccountCountSplits(account, TRUE) == 0)
if (gnc_account_and_descendants_empty(account))
{
LEAVE(" hide: unused");
return FALSE;

View File

@ -189,7 +189,7 @@ fill_model (GtkTreeModel *model, Account *account)
{
GtkTreeIter iter;
gchar *fullname = gnc_account_get_full_name (account);
gint splits = xaccAccountCountSplits (account, TRUE);
gboolean acc_empty = gnc_account_and_descendants_empty (account);
gnc_numeric total = xaccAccountGetBalanceInCurrency (account, NULL, TRUE);
PINFO("Add to Store: Account '%s'", fullname);
@ -200,7 +200,7 @@ fill_model (GtkTreeModel *model, Account *account)
ACC_FULL_NAME, fullname, ACCOUNT, account,
PLACE_HOLDER, (xaccAccountGetPlaceholder (account) == TRUE ? "emblem-default" : NULL),
HIDDEN, (xaccAccountGetHidden (account) == TRUE ? "emblem-default" : NULL),
NOT_USED, (splits == 0 ? "emblem-default" : NULL),
NOT_USED, (acc_empty ? "emblem-default" : NULL),
BAL_ZERO, (gnc_numeric_zero_p (total) == TRUE ? "emblem-default" : NULL),
TAX, (xaccAccountGetTaxRelated (account) == TRUE ? "emblem-default" : NULL), -1);
g_free (fullname);

File diff suppressed because it is too large Load Diff

View File

@ -42,12 +42,13 @@ typedef struct _GncSxSinceLastRunDialog GncSxSinceLastRunDialog;
* This encapsulates the "run when file opened" application logic. As such,
* it should probably move to a non-ui file.
**/
void gnc_sx_sxsincelast_book_opened(void);
void gnc_sx_sxsincelast_book_opened (void);
/**
* Create the since-last-run dialog.
**/
GncSxSinceLastRunDialog* gnc_ui_sx_since_last_run_dialog (GtkWindow *parent, GncSxInstanceModel *sx_instances,
GList *auto_created_txn_guids);
GncSxSinceLastRunDialog* gnc_ui_sx_since_last_run_dialog (GtkWindow *parent,
GncSxInstanceModel *sx_instances,
GList *auto_created_txn_guids);
#endif

View File

@ -1643,7 +1643,7 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
}
// If no transaction or children just delete it.
if (!(xaccAccountCountSplits (account, FALSE) ||
if (!(xaccAccountGetSplitList (account) != NULL ||
gnc_account_n_children (account)))
{
do_delete_account (account, NULL, NULL, NULL);

View File

@ -193,6 +193,8 @@ static void gnc_plugin_page_register_cmd_find_account (GtkAction* action,
GncPluginPageRegister* plugin_page);
static void gnc_plugin_page_register_cmd_find_transactions (GtkAction* action,
GncPluginPageRegister* plugin_page);
static void gnc_plugin_page_register_cmd_edit_tax_options (GtkAction* action,
GncPluginPageRegister* plugin_page);
static void gnc_plugin_page_register_cmd_cut_transaction (GtkAction* action,
GncPluginPageRegister* plugin_page);
static void gnc_plugin_page_register_cmd_copy_transaction (GtkAction* action,
@ -363,6 +365,18 @@ static GtkActionEntry gnc_plugin_page_register_actions [] =
N_ ("Find transactions with a search"),
G_CALLBACK (gnc_plugin_page_register_cmd_find_transactions)
},
{
"EditTaxOptionsAction", NULL,
/* Translators: remember to reuse this *
* translation in dialog-account.glade */
N_("Ta_x Report Options"), NULL,
/* Translators: currently implemented are *
* US: income tax and *
* DE: VAT *
* So adjust this string */
N_("Setup relevant accounts for tax reports, e.g. US income tax"),
G_CALLBACK (gnc_plugin_page_register_cmd_edit_tax_options)
},
/* Transaction menu */
@ -484,7 +498,7 @@ static GtkActionEntry gnc_plugin_page_register_actions [] =
},
{
"GotoDateAction", "x-office-calendar", N_ ("_Go to Date"), "<primary>G",
N_ ("Move to the the split at specified date"),
N_ ("Move to the split at specified date"),
G_CALLBACK (gnc_plugin_page_register_cmd_goto_date)
},
{
@ -3810,7 +3824,6 @@ gnc_plugin_page_register_cmd_find_account (GtkAction* action,
}
static void
gnc_plugin_page_register_cmd_find_transactions (GtkAction* action,
GncPluginPageRegister* page)
@ -3828,6 +3841,24 @@ gnc_plugin_page_register_cmd_find_transactions (GtkAction* action,
}
static void
gnc_plugin_page_register_cmd_edit_tax_options (GtkAction* action,
GncPluginPageRegister* page)
{
GncPluginPageRegisterPrivate* priv;
GtkWidget *window;
Account* account;
g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER (page));
ENTER ("(action %p, page %p)", action, page);
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE (page);
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
account = gnc_plugin_page_register_get_account (page);
gnc_tax_info_dialog (window, account);
LEAVE (" ");
}
static void
gnc_plugin_page_register_cmd_cut_transaction (GtkAction* action,
GncPluginPageRegister* plugin_page)

View File

@ -78,6 +78,7 @@
#include "gnc-icons.h"
#include "gnc-prefs.h"
#include "gnc-split-reg2.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "gnc-window.h"
#include "gnc-main-window.h"
@ -140,6 +141,7 @@ static void gnc_plugin_page_register2_cmd_paste (GtkAction *action, GncPluginPag
static void gnc_plugin_page_register2_cmd_edit_account (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_find_account (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_find_transactions (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_edit_tax_options (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_cut_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_copy_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_paste_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
@ -254,6 +256,18 @@ static GtkActionEntry gnc_plugin_page_register2_actions [] =
N_("Find transactions with a search"),
G_CALLBACK (gnc_plugin_page_register2_cmd_find_transactions)
},
{
"EditTaxOptionsAction", NULL,
/* Translators: remember to reuse this *
* translation in dialog-account.glade */
N_("Ta_x Report Options"), NULL,
/* Translators: currently implemented are *
* US: income tax and *
* DE: VAT *
* So adjust this string */
N_("Setup relevant accounts for tax reports, e.g. US income tax"),
G_CALLBACK (gnc_plugin_page_register2_cmd_edit_tax_options)
},
/* Transaction menu */
@ -2780,6 +2794,25 @@ gnc_plugin_page_register2_cmd_find_transactions (GtkAction *action,
LEAVE(" ");
}
static void
gnc_plugin_page_register2_cmd_edit_tax_options (GtkAction *action,
GncPluginPageRegister2 *page) // this works
{
GncPluginPageRegister2Private *priv;
GtkWidget *window;
Account* account;
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
ENTER("(action %p, page %p)", action, page);
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
account = gnc_plugin_page_register2_get_account (page);
gnc_tax_info_dialog (window, account);
LEAVE(" ");
}
static void
gnc_plugin_page_register2_cmd_cut_transaction (GtkAction *action,
GncPluginPageRegister2 *page) // this works

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<!-- Generated with glade 3.22.2 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkDialog" id="account_cascade_dialog">
@ -64,21 +64,9 @@
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Enable Cascading Account Color</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="enable_cascade_color">
<property name="label" translatable="yes">Enable Cascading Account Color</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -111,20 +99,9 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Enable Cascading Account Placeholder</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="enable_cascade_placeholder">
<property name="label" translatable="yes">Enable Cascading Account Placeholder</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -142,35 +119,14 @@
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Enable Cascading Account Hidden</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="enable_cascade_hidden">
<property name="label" translatable="yes">Enable Cascading Account Hidden</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@ -332,6 +288,16 @@
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hidden_box">
<property name="visible">True</property>
@ -1475,11 +1441,13 @@
</child>
<child>
<object class="GtkCheckButton" id="placeholder_button">
<property name="label" translatable="yes">Placeholde_r</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">This account is present solely as a placeholder in the hierarchy. Transactions may not be posted to this account, only to sub-accounts of this account.</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@ -1489,11 +1457,13 @@
</child>
<child>
<object class="GtkCheckButton" id="hidden_button">
<property name="label" translatable="yes">H_idden</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">This account (and any sub-accounts) will be hidden in the account tree and will not appear in the popup account list in the register. To reset this option, you will first need to open the "Filter By..." dialog for the account tree and check the "show hidden accounts" option. Doing so will allow you to select the account and reopen this dialog.</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@ -1503,11 +1473,13 @@
</child>
<child>
<object class="GtkCheckButton" id="auto_interest_button">
<property name="label" translatable="yes">Auto _interest transfer</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Prior to reconciling an account which charges or pays interest, prompt the user to enter a transaction for the interest charge or payment. Currently only enabled for Bank, Credit, Mutual, Asset, Receivable, Payable, and Liability accounts.</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@ -1517,12 +1489,14 @@
</child>
<child>
<object class="GtkCheckButton" id="tax_related_button">
<property name="label" translatable="yes">Ta_x related</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes" comments="Translators: use the same words here as in 'Ta_x Report Options'.">Use Edit-&gt;Tax Report Options to set the tax-related flag and assign a tax code to this account.</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@ -1531,61 +1505,16 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label401">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">H_idden</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">hidden_button</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
</packing>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label40">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Placeholde_r</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">placeholder_button</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">9</property>
</packing>
<placeholder/>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Ta_x related</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">tax_related_button</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
</packing>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="label405">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Auto _interest transfer</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">auto_interest_button</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">10</property>
</packing>
<placeholder/>
</child>
</object>
<packing>

View File

@ -769,9 +769,13 @@ for styling the invoice. Please see the exported report for the CSS class names.
(custom-title (opt-val gnc:pagename-general "Custom Title")))
(if (null? invoice)
(gnc:html-document-add-object! document
(gnc:make-html-text
(G_ "No valid invoice selected. Click on the Options button and select the invoice to use.")))
(gnc:html-document-add-object!
document
(gnc:html-make-generic-warning
(G_ "Invoice") (gnc:report-id report-obj) ""
(G_ "No valid invoice selected. Click on the Options button and select the invoice to use.")))
(let* ((book (gncInvoiceGetBook invoice))
(owner (gncInvoiceGetOwner invoice))
(type (gncInvoiceGetType invoice))

View File

@ -34,6 +34,7 @@ set(GUILE_DEPENDS
scm-core-utils
scm-test-report
scm-reports
scm-reports-standard-with-exposed-generator-links
scm-report-stylesheets
)

View File

@ -43,6 +43,9 @@
</menubar>
<popup name="MainPopup" action="FakeToplevel">
<placeholder name="PopupPlaceholder1">
<menuitem name="ViewFilterBy" action="ViewFilterByAction"/>
</placeholder>
<placeholder name="PopupPlaceholder2">
<menuitem name="AccountOpenAccount" action="FileOpenAccountAction"/>
<menuitem name="AccountOpenSubaccounts" action="FileOpenSubaccountsAction"/>

View File

@ -44,6 +44,9 @@
</menubar>
<popup name="MainPopup" action="FakeToplevel">
<placeholder name="PopupPlaceholder1">
<menuitem name="ViewFilterBy" action="ViewFilterByAction"/>
</placeholder>
<placeholder name="PopupPlaceholder2">
<menuitem name="AccountOpenAccount2" action="FileOpenAccount2Action"/>
<menuitem name="AccountOpenAccount" action="FileOpenAccountAction"/>

View File

@ -5,6 +5,7 @@
<menuitem name="EditEditAccount" action="EditEditAccountAction"/>
<menuitem name="EditFindAccount" action="EditFindAccountAction"/>
</placeholder>
<menuitem name="EditTaxOptions" action="EditTaxOptionsAction"/>
</menu>
<menu name="Transaction" action="TransactionAction">

View File

@ -5,6 +5,7 @@
<menuitem name="EditEditAccount" action="EditEditAccountAction"/>
<menuitem name="EditFindAccount" action="EditFindAccountAction"/>
</placeholder>
<menuitem name="EditTaxOptions" action="EditTaxOptionsAction"/>
</menu>
<menu name="Transaction" action="TransactionAction">

View File

@ -3887,6 +3887,20 @@ xaccAccountCountSplits (const Account *acc, gboolean include_children)
return nr;
}
gboolean gnc_account_and_descendants_empty (Account *acc)
{
g_return_val_if_fail (GNC_IS_ACCOUNT (acc), FALSE);
if (xaccAccountGetSplitList (acc)) return FALSE;
auto empty = TRUE;
auto *children = gnc_account_get_children (acc);
for (auto *n = children; n && empty; n = n->next)
{
empty = gnc_account_and_descendants_empty ((Account*)n->data);
}
g_list_free (children);
return empty;
}
LotList *
xaccAccountGetLotList (const Account *acc)
{
@ -3919,12 +3933,12 @@ xaccAccountFindOpenLots (const Account *acc,
continue;
/* Ok, this is a valid lot. Add it to our list of lots */
if (sort_func)
retval = g_list_insert_sorted (retval, lot, sort_func);
else
retval = g_list_prepend (retval, lot);
retval = g_list_prepend (retval, lot);
}
if (sort_func)
retval = g_list_sort (retval, sort_func);
return retval;
}

View File

@ -256,6 +256,12 @@ void gnc_book_set_root_account(QofBook *book, Account *root);
/** @} */
/* Tests account and descendants -- if all have no splits then return TRUE.
* Otherwise if any account or its descendants have split return FALSE.
*/
gboolean gnc_account_and_descendants_empty (Account *acc);
/** Composes a translatable error message showing which account
* names clash with the current account separator. Can be called
* after gnc_account_list_name_violations to have a consistent
@ -1020,7 +1026,9 @@ SplitList* xaccAccountGetSplitList (const Account *account);
/** The xaccAccountCountSplits() routine returns the number of all
* the splits in the account.
* the splits in the account. xaccAccountCountSplits is O(N). if
* testing for emptiness, use xaccAccountGetSplitList != NULL.
* @param acc the account for which to count the splits
*
* @param include_children also count splits in descendants (TRUE) or

View File

@ -1045,13 +1045,15 @@ gncOwnerSetLotLinkMemo (Transaction *ll_txn)
title = g_strdup_printf ("%s %s", gncInvoiceGetTypeString (invoice), gncInvoiceGetID (invoice));
titles = g_list_insert_sorted (titles, title, (GCompareFunc)g_strcmp0);
titles = g_list_prepend (titles, title);
splits = g_list_prepend (splits, split); // splits don't need to be sorted
}
if (!titles)
return; // We didn't find document lots
titles = g_list_sort (titles, (GCompareFunc)g_strcmp0);
// Create the memo as we'd want it to be
new_memo = g_strconcat (memo_prefix, titles->data, NULL);
for (titer = titles->next; titer; titer = titer->next)

View File

@ -175,6 +175,12 @@ test_invoice_post ( Fixture *fixture, gconstpointer pData )
g_assert(!gncInvoiceIsPosted(fixture->invoice));
}
static gboolean account_has_one_split (const Account *acc)
{
GList *splits = xaccAccountGetSplitList (acc);
return (splits && !(splits->next));
}
static void
test_invoice_posted_trans ( Fixture *fixture, gconstpointer pData )
{
@ -183,8 +189,8 @@ test_invoice_posted_trans ( Fixture *fixture, gconstpointer pData )
gnc_numeric total = gncInvoiceGetTotal(fixture->invoice);
gnc_numeric acct_balance, acct2_balance;
g_assert (1 == xaccAccountCountSplits (fixture->account, FALSE));
g_assert (1 == xaccAccountCountSplits (fixture->account2, FALSE));
g_assert (account_has_one_split (fixture->account));
g_assert (account_has_one_split (fixture->account2));
acct_balance = xaccAccountGetBalance(fixture->account);
acct2_balance = xaccAccountGetBalance(fixture->account2);

8439
po/hr.po

File diff suppressed because it is too large Load Diff