mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'maint'
This commit is contained in:
commit
6bba55128f
@ -29,9 +29,9 @@
|
||||
|
||||
struct TTInfo_s
|
||||
{
|
||||
/* FIXME add notes field */
|
||||
char *description; /* owned by us */
|
||||
char *num; /* owned by us */
|
||||
char *notes;
|
||||
gnc_commodity *common_currency; /* not freed */
|
||||
|
||||
GList *splits; /* list of template splits, owned by us */
|
||||
@ -65,6 +65,7 @@ void gnc_ttinfo_free(TTInfo *info)
|
||||
|
||||
g_free(info->description);
|
||||
g_free(info->num);
|
||||
g_free (info->notes);
|
||||
g_list_foreach(info->splits,
|
||||
delete_splitinfo,
|
||||
NULL);
|
||||
@ -125,6 +126,28 @@ gnc_ttinfo_get_num(TTInfo *tti)
|
||||
return tti->num;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ttinfo_set_notes (TTInfo *tti, const char *notes)
|
||||
{
|
||||
g_return_if_fail (tti);
|
||||
|
||||
if (tti->notes)
|
||||
{
|
||||
g_free (tti->notes);
|
||||
}
|
||||
|
||||
tti->notes = g_strdup (notes);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const char*
|
||||
gnc_ttinfo_get_notes (TTInfo *tti)
|
||||
{
|
||||
g_return_val_if_fail (tti, NULL);
|
||||
|
||||
return tti->notes;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_ttinfo_set_currency(TTInfo *tti, gnc_commodity *common_currency)
|
||||
|
@ -41,7 +41,7 @@ void gnc_ttinfo_free(TTInfo *info);
|
||||
/* these two deep-copy their arguments */
|
||||
void gnc_ttinfo_set_description(TTInfo *tti, const char *description);
|
||||
void gnc_ttinfo_set_num(TTInfo *tti, const char *num);
|
||||
|
||||
void gnc_ttinfo_set_notes (TTInfo *tti, const char *notes);
|
||||
|
||||
/* this one points to a persistent pointer so ownership isn't relevant */
|
||||
void gnc_ttinfo_set_currency(TTInfo *tti, gnc_commodity *common_currency);
|
||||
@ -52,6 +52,7 @@ void gnc_ttinfo_set_template_splits(TTInfo *tti, GList *splits);
|
||||
|
||||
const char * gnc_ttinfo_get_description(TTInfo *tti);
|
||||
const char * gnc_ttinfo_get_num(TTInfo *tti);
|
||||
const char *gnc_ttinfo_get_notes (TTInfo *tti);
|
||||
gnc_commodity * gnc_ttinfo_get_currency(TTInfo *tti);
|
||||
GList * gnc_ttinfo_get_template_splits(TTInfo *tti);
|
||||
|
||||
|
@ -1018,6 +1018,7 @@ xaccSchedXactionSetTemplateTrans(SchedXaction *sx, GList *t_t_list,
|
||||
* xaccTransSetNum with these arguments */
|
||||
gnc_set_num_action(new_trans, NULL,
|
||||
gnc_ttinfo_get_num(tti), NULL);
|
||||
xaccTransSetNotes (new_trans, gnc_ttinfo_get_notes (tti));
|
||||
xaccTransSetCurrency( new_trans,
|
||||
gnc_ttinfo_get_currency(tti) );
|
||||
|
||||
|
@ -1128,7 +1128,7 @@ get_currency_denom(const Split * s)
|
||||
}
|
||||
else if (!s->parent || !s->parent->common_currency)
|
||||
{
|
||||
return 100000;
|
||||
return 1000000; /* Max supported denom to avoid premature rounding. */
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1145,7 +1145,7 @@ get_commodity_denom(const Split * s)
|
||||
}
|
||||
else if (!s->acc)
|
||||
{
|
||||
return 100000;
|
||||
return 1000000; /* Max supported denom to avoid premature rounding. */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1460,7 +1460,11 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
||||
|
||||
/* If this is a bill, and the entry came from an invoice originally, copy the price */
|
||||
if (gncEntryGetBillable (entry))
|
||||
gncEntrySetInvPrice (entry, gncEntryGetBillPrice (entry));
|
||||
{
|
||||
/* We need to set the net price since it may be another tax rate for invoices than bills */
|
||||
gncEntrySetInvPrice (entry, gncEntryGetPrice (entry, FALSE, TRUE));
|
||||
gncEntrySetInvTaxIncluded (entry, FALSE);
|
||||
}
|
||||
}
|
||||
gncEntryCommitEdit (entry);
|
||||
|
||||
|
@ -761,10 +761,10 @@ test_get_currency_denom (Fixture *fixture, gconstpointer pData)
|
||||
const gint denom = gnc_commodity_get_fraction (fixture->curr);
|
||||
g_assert_cmpint (fixture->func->get_currency_denom (NULL), ==, 0);
|
||||
fixture->split->parent = NULL;
|
||||
g_assert_cmpint (fixture->func->get_currency_denom (fixture->split), ==, 100000);
|
||||
g_assert_cmpint (fixture->func->get_currency_denom (fixture->split), ==, 1000000);
|
||||
fixture->split->parent = txn;
|
||||
txn->common_currency = NULL;
|
||||
g_assert_cmpint (fixture->func->get_currency_denom (fixture->split), ==, 100000);
|
||||
g_assert_cmpint (fixture->func->get_currency_denom (fixture->split), ==, 1000000);
|
||||
txn->common_currency = fixture->curr;
|
||||
g_assert_cmpint (fixture->func->get_currency_denom (fixture->split), ==, denom);
|
||||
}
|
||||
@ -779,7 +779,7 @@ test_get_commodity_denom (Fixture *fixture, gconstpointer pData)
|
||||
const gint denom = gnc_commodity_get_fraction (fixture->comm);
|
||||
g_assert_cmpint (fixture->func->get_commodity_denom (NULL), ==, 0);
|
||||
fixture->split->acc = NULL;
|
||||
g_assert_cmpint (fixture->func->get_commodity_denom (fixture->split), ==, 100000);
|
||||
g_assert_cmpint (fixture->func->get_commodity_denom (fixture->split), ==, 1000000);
|
||||
fixture->split->acc = acc;
|
||||
g_assert_cmpint (fixture->func->get_commodity_denom (fixture->split), ==, denom);
|
||||
}
|
||||
|
@ -1373,7 +1373,7 @@ gnc_account_window_create(AccountWindow *aw)
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL(label), amount);
|
||||
|
||||
box = GTK_WIDGET(gtk_builder_get_object (builder, "opening_balance_date_box"));
|
||||
date_edit = gnc_date_edit_new (gnc_time (NULL), 1, 1);
|
||||
date_edit = gnc_date_edit_new (gnc_time (NULL), 0, 0);
|
||||
aw->opening_balance_date_edit = date_edit;
|
||||
gtk_box_pack_start(GTK_BOX(box), date_edit, TRUE, TRUE, 0);
|
||||
gtk_widget_show (date_edit);
|
||||
|
@ -221,6 +221,7 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti)
|
||||
|
||||
gnc_ttinfo_set_description(tti, xaccTransGetDescription(tr));
|
||||
gnc_ttinfo_set_num(tti, gnc_get_num_action(tr, NULL));
|
||||
gnc_ttinfo_set_notes (tti, xaccTransGetNotes (tr));
|
||||
gnc_ttinfo_set_currency(tti, xaccTransGetCurrency(tr));
|
||||
|
||||
for (splits = xaccTransGetSplitList(tr); splits; splits = splits->next)
|
||||
|
@ -1833,6 +1833,7 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
|
||||
char *account_name;
|
||||
ComboCell *cell = (ComboCell *) bcell;
|
||||
Account *account;
|
||||
static gboolean creating_account = FALSE;
|
||||
|
||||
if (!name || (strlen(name) == 0))
|
||||
return NULL;
|
||||
@ -1842,15 +1843,16 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
|
||||
if (!account)
|
||||
account = gnc_account_lookup_by_code(gnc_get_current_root_account(), name);
|
||||
|
||||
if (!account)
|
||||
if (!account && !creating_account)
|
||||
{
|
||||
/* Ask if they want to create a new one. */
|
||||
if (!gnc_verify_dialog (gnc_split_register_get_parent (reg),
|
||||
TRUE, missing, name))
|
||||
return NULL;
|
||||
|
||||
creating_account = TRUE;
|
||||
/* User said yes, they want to create a new account. */
|
||||
account = gnc_ui_new_accounts_from_name_window (name);
|
||||
creating_account = FALSE;
|
||||
if (!account)
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user