mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 786708 - GnuCash won't load currency fractions larger than 1000000.
Also create larger fractions for the account dialog.
This commit is contained in:
parent
70bc472ffe
commit
80a4591736
@ -875,6 +875,15 @@
|
||||
<row>
|
||||
<col id="0" translatable="yes">1/1000000</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">1/10000000</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">1/100000000</col>
|
||||
</row>
|
||||
<row>
|
||||
<col id="0" translatable="yes">1/1000000000</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
<object class="GtkDialog" id="account_dialog">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkAdjustment" id="adjustment1">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">100000000</property>
|
||||
<property name="upper">1000000000</property>
|
||||
<property name="value">10000</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
|
@ -265,21 +265,21 @@ gnc_entry_ledger_config_cells (GncEntryLedger *ledger)
|
||||
((ComboCell *)
|
||||
gnc_table_layout_get_cell (ledger->table->layout, ENTRY_ACTN_CELL), FALSE);
|
||||
|
||||
/* Use 6 decimal places for all prices and quantities */
|
||||
/* Use GNC_COMMODITY_MAX_FRACTION for all prices and quantities */
|
||||
gnc_price_cell_set_fraction
|
||||
((PriceCell *)
|
||||
gnc_table_layout_get_cell (ledger->table->layout, ENTRY_PRIC_CELL),
|
||||
1000000);
|
||||
GNC_COMMODITY_MAX_FRACTION);
|
||||
|
||||
gnc_price_cell_set_fraction
|
||||
((PriceCell *)
|
||||
gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DISC_CELL),
|
||||
1000000);
|
||||
GNC_COMMODITY_MAX_FRACTION);
|
||||
|
||||
gnc_price_cell_set_fraction
|
||||
((PriceCell *) gnc_table_layout_get_cell (ledger->table->layout,
|
||||
ENTRY_QTY_CELL),
|
||||
1000000);
|
||||
GNC_COMMODITY_MAX_FRACTION);
|
||||
|
||||
/* add menu items for the action and payment cells */
|
||||
gnc_entry_ledger_config_action (ledger);
|
||||
|
@ -426,7 +426,7 @@ gnc_split_register_set_cell_fractions (SplitRegister *reg, Split *split)
|
||||
if (split_account)
|
||||
gnc_price_cell_set_fraction (cell, xaccAccountGetCommoditySCU (split_account));
|
||||
else
|
||||
gnc_price_cell_set_fraction (cell, 1000000);
|
||||
gnc_price_cell_set_fraction (cell, GNC_COMMODITY_MAX_FRACTION);
|
||||
}
|
||||
|
||||
CellBlock *
|
||||
|
@ -65,9 +65,6 @@ static QofLogModule log_module = GNC_MOD_LEDGER;
|
||||
static CursorClass copied_class = CURSOR_CLASS_NONE;
|
||||
static SCM copied_item = SCM_UNDEFINED;
|
||||
static GncGUID copied_leader_guid;
|
||||
/* A denominator representing number of digits to the right of the decimal point
|
||||
* displayed in a price cell. */
|
||||
static int PRICE_CELL_DENOM = 1000000;
|
||||
/** static prototypes *****************************************************/
|
||||
|
||||
static gboolean gnc_split_register_save_to_scm (SplitRegister *reg,
|
||||
@ -2609,11 +2606,11 @@ gnc_split_register_config_cells (SplitRegister *reg)
|
||||
((ComboCell *)
|
||||
gnc_table_layout_get_cell (reg->table->layout, ACTN_CELL), TRUE);
|
||||
|
||||
/* Use 6 decimal places for prices and "exchange rates" */
|
||||
/* Use GNC_COMMODITY_MAX_FRACTION for prices and "exchange rates" */
|
||||
gnc_price_cell_set_fraction
|
||||
((PriceCell *)
|
||||
gnc_table_layout_get_cell (reg->table->layout, PRIC_CELL),
|
||||
PRICE_CELL_DENOM);
|
||||
GNC_COMMODITY_MAX_FRACTION);
|
||||
|
||||
/* Initialize shares and share balance cells */
|
||||
gnc_price_cell_set_print_info
|
||||
|
@ -687,7 +687,7 @@ gnc_account_class_init (AccountClass *klass)
|
||||
"1 USD can be divided into 100 cents.",
|
||||
0,
|
||||
G_MAXINT32,
|
||||
1000000,
|
||||
GNC_COMMODITY_MAX_FRACTION,
|
||||
static_cast<GParamFlags>(G_PARAM_READWRITE)));
|
||||
|
||||
g_object_class_install_property
|
||||
|
@ -1111,7 +1111,7 @@ get_currency_denom(const Split * s)
|
||||
}
|
||||
else if (!s->parent || !s->parent->common_currency)
|
||||
{
|
||||
return 1000000; /* Max supported denom to avoid premature rounding. */
|
||||
return GNC_COMMODITY_MAX_FRACTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1128,7 +1128,7 @@ get_commodity_denom(const Split * s)
|
||||
}
|
||||
else if (!s->acc)
|
||||
{
|
||||
return 1000000; /* Max supported denom to avoid premature rounding. */
|
||||
return GNC_COMMODITY_MAX_FRACTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -842,7 +842,7 @@ gnc_commodity_class_init(struct _GncCommodityClass* klass)
|
||||
"The fraction is the number of sub-units that "
|
||||
"the basic commodity can be divided into.",
|
||||
1,
|
||||
1000000,
|
||||
GNC_COMMODITY_MAX_FRACTION,
|
||||
1,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property(gobject_class,
|
||||
|
@ -115,6 +115,11 @@ GType gnc_commodity_namespace_get_type(void);
|
||||
when presenting the currency related namespace to the user */
|
||||
#define GNC_COMMODITY_NS_ISO_GUI N_("Currencies")
|
||||
|
||||
/** Max fraction is 10^9 because 10^10 would require changing it to an
|
||||
* int64_t.
|
||||
*/
|
||||
#define GNC_COMMODITY_MAX_FRACTION 1000000000
|
||||
|
||||
typedef GList CommodityList;
|
||||
|
||||
/** @name Commodity Quote Source functions
|
||||
|
Loading…
Reference in New Issue
Block a user