Merge branch 'maint'

This commit is contained in:
Christopher Lam 2022-09-09 21:23:40 +08:00
commit 161b07b241
89 changed files with 53461 additions and 53191 deletions

View File

@ -1818,7 +1818,7 @@ def gnc_numeric_from_decimal(decimal_value):
sign, digits, exponent = decimal_value.as_tuple()
# convert decimal digits to a fractional numerator
# equivlent to
# equivalent to
# numerator = int(''.join(digits))
# but without the wated conversion to string and back,
# this is probably the same algorithm int() uses

View File

@ -58,7 +58,7 @@ def gnc_numeric_from_decimal(decimal_value):
sign, digits, exponent = decimal_value.as_tuple()
# convert decimal digits to a fractional numerator
# equivlent to
# equivalent to
# numerator = int(''.join(digits))
# but without the wated conversion to string and back,
# this is probably the same algorithm int() uses

View File

@ -48,7 +48,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:commodity-scu>0</act:commodity-scu>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Actifs</act:name>
<act:name>Actif</act:name>
<act:id type="new">4f40ddce996f8f74b4e99f52e275ba14</act:id>
<act:type>ASSET</act:type>
<act:commodity>
@ -56,7 +56,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<cmdty:id>EUR</cmdty:id>
</act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:description>Actifs</act:description>
<act:description>Actif</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
</gnc:account>
<gnc:account version="2.0.0">
@ -1356,7 +1356,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:parent type="new">b615fad5f752ab26809e3f1c0e788dd1</act:parent>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Solde</act:name>
<act:name>Capitaux propres</act:name>
<act:id type="new">87e02e757b32b3059652cfe09fe9ae00</act:id>
<act:type>EQUITY</act:type>
<act:commodity>
@ -1364,7 +1364,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<cmdty:id>EUR</cmdty:id>
</act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:description>Solde</act:description>
<act:description>Capitaux propres</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
</gnc:account>
<gnc:account version="2.0.0">

View File

@ -48,7 +48,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:commodity-scu>0</act:commodity-scu>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Actifs</act:name>
<act:name>Actif</act:name>
<act:id type="new">4f40ddce996f8f74b4e99f52e275ba14</act:id>
<act:type>ASSET</act:type>
<act:commodity>
@ -56,7 +56,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<cmdty:id>USD</cmdty:id>
</act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:description>Actifs</act:description>
<act:description>Actif</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
</gnc:account>
<gnc:account version="2.0.0">
@ -1356,7 +1356,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:parent type="new">b615fad5f752ab26809e3f1c0e788dd1</act:parent>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Solde</act:name>
<act:name>Capitaux propres</act:name>
<act:id type="new">87e02e757b32b3059652cfe09fe9ae00</act:id>
<act:type>EQUITY</act:type>
<act:commodity>
@ -1364,7 +1364,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<cmdty:id>USD</cmdty:id>
</act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:description>Solde</act:description>
<act:description>Capitaux propres</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
</gnc:account>
<gnc:account version="2.0.0">

View File

@ -53,7 +53,7 @@
<act:commodity-scu>100</act:commodity-scu>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Actifs</act:name>
<act:name>Actif</act:name>
<act:id type="guid">e3f7b59890ec44688241f322db0a7392</act:id>
<act:type>ASSET</act:type>
<act:commodity>

View File

@ -48,7 +48,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:commodity-scu>0</act:commodity-scu>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Actifs</act:name>
<act:name>Actif</act:name>
<act:id type="new">4f40ddce996f8f74b4e99f52e275ba14</act:id>
<act:type>ASSET</act:type>
<act:commodity>
@ -56,7 +56,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<cmdty:id>EUR</cmdty:id>
</act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:description>Actifs</act:description>
<act:description>Actif</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
</gnc:account>
<gnc:account version="2.0.0">
@ -1356,7 +1356,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<act:parent type="new">b615fad5f752ab26809e3f1c0e788dd1</act:parent>
</gnc:account>
<gnc:account version="2.0.0">
<act:name>Solde</act:name>
<act:name>Capitaux propres</act:name>
<act:id type="new">87e02e757b32b3059652cfe09fe9ae00</act:id>
<act:type>EQUITY</act:type>
<act:commodity>
@ -1364,7 +1364,7 @@ Les utilisateurs gérant une entreprise sélectionneront ceci au lieu des autres
<cmdty:id>EUR</cmdty:id>
</act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:description>Solde</act:description>
<act:description>Capitaux propres</act:description>
<act:parent type="new">1972cce2e2364f95b2b0bc014502661d</act:parent>
</gnc:account>
<gnc:account version="2.0.0">

View File

@ -1921,7 +1921,7 @@
<cmdty:id>USD</cmdty:id>
</act:commodity>
<act:commodity-scu>100</act:commodity-scu>
<act:description>Fertalizer, roto-tiller</act:description>
<act:description>Fertilizer, roto-tiller</act:description>
<act:parent type="guid">ce8a0ff9cfc2c79c99e6c65d5e258a55</act:parent>
</gnc:account>
<gnc:account version="2.0.0">

View File

@ -296,7 +296,7 @@ gnc_date_edit_popup (GNCDateEdit *gde)
if (!date_was_valid)
{
/* No valid date. Hacky workaround: Instead of crashing we randomly choose today's date. */
gnc_tm_get_today_start(&mtm);
gnc_tm_get_today_neutral(&mtm);
}
mtm.tm_mon--;
@ -307,7 +307,7 @@ gnc_date_edit_popup (GNCDateEdit *gde)
if (mtm.tm_year >= 1900)
mtm.tm_year -= 1900;
gnc_tm_set_day_start(&mtm);
gnc_tm_set_day_neutral(&mtm);
/* Set the calendar. */
gtk_calendar_select_day (GTK_CALENDAR (gde->calendar), 1);
@ -1061,7 +1061,7 @@ gnc_date_edit_get_date_internal (GNCDateEdit *gde)
revert to today's date. Alternatively we can return some value that
signals that we don't get a valid date, but all callers of this
function will have to check this. Alas, I'm too lazy to do this here. */
gnc_tm_get_today_start(&tm);
gnc_tm_get_today_neutral(&tm);
}
tm.tm_mon--;
@ -1109,7 +1109,7 @@ gnc_date_edit_get_date_internal (GNCDateEdit *gde)
}
else
{
gnc_tm_set_day_start(&tm);
gnc_tm_set_day_neutral(&tm);
}
tm.tm_isdst = -1;

View File

@ -528,9 +528,10 @@ gnc_dense_cal_set_month(GncDenseCal *dcal, GDateMonth mon)
static void
_gnc_dense_cal_set_month(GncDenseCal *dcal, GDateMonth mon, gboolean redraw)
{
GTimer *t = g_timer_new();
GTimer *t;
if (dcal->month == mon)
return;
t = g_timer_new();
dcal->month = mon;
g_timer_start(t);
recompute_first_of_month_offset(dcal);

View File

@ -225,7 +225,7 @@ gnc_cbwe_require_list_item (GtkComboBox *cbwe)
/** Return whether the current gtk theme is a dark one. A theme is considered "dark" if
* it has a dark background color with a light foreground color (used for text and so on).
* We only test on the foregrond color assuming a sane theme chooses enough contrast between
* We only test on the foreground color assuming a sane theme chooses enough contrast between
* foreground and background colors.
*
* @param fg_color The foreground color to test.

View File

@ -3040,7 +3040,7 @@ gnc_main_window_new (void)
#endif
gnc_engine_add_commit_error_callback( gnc_main_window_engine_commit_error_callback, window );
// set up a callback for noteboook navigation
// set up a callback for notebook navigation
g_signal_connect (G_OBJECT(window), "key-press-event",
G_CALLBACK(gnc_main_window_key_press_event),
NULL);
@ -4939,7 +4939,7 @@ gnc_main_window_cmd_help_about (GtkAction *action, GncMainWindow *window)
g_signal_connect (dialog, "activate-link",
G_CALLBACK (url_signal_cb), nullptr);
// Add enviroment paths
// Add environment paths
add_about_paths (dialog);
/* Set dialog to resize. */

View File

@ -75,9 +75,10 @@ enum split_cols
{
SPLIT_COL_ACCOUNT = 0,
SPLIT_COL_MEMO,
SPLIT_COL_MEMO_ESCAPED,
SPLIT_COL_TOOLTIP,
SPLIT_COL_DEBIT,
SPLIT_COL_CREDIT,
SPLIT_COL_UNITS,
NUM_SPLIT_COLS
};
@ -501,6 +502,9 @@ stock_assistant_window_destroy_cb (GtkWidget *object, gpointer user_data)
{
auto info = static_cast<StockTransactionInfo*>(user_data);
gnc_unregister_gui_component_by_data (ASSISTANT_STOCK_TRANSACTION_CM_CLASS, info);
info->txn_types_date = std::nullopt;
info->txn_types = std::nullopt;
info->txn_type = std::nullopt;
g_free (info);
}
@ -630,26 +634,57 @@ add_error_str (StringVec& errors, const char* str)
errors.emplace_back (_(str));
}
struct SummaryLineInfo
{
bool debit_side;
bool value_is_zero;
std::string account;
std::string memo;
std::string value;
std::string units;
};
static void
check_page (GtkListStore *list, gnc_numeric& debit, gnc_numeric& credit,
add_to_summary_table (GtkListStore *list, SummaryLineInfo line)
{
GtkTreeIter iter;
auto tooltip = g_markup_escape_text (line.memo.c_str(), -1);
gtk_list_store_append (list, &iter);
gtk_list_store_set (list, &iter,
SPLIT_COL_ACCOUNT, line.account.c_str(),
SPLIT_COL_MEMO, line.memo.c_str(),
SPLIT_COL_TOOLTIP, tooltip,
SPLIT_COL_DEBIT, line.debit_side ? line.value.c_str() : "",
SPLIT_COL_CREDIT, !line.debit_side ? line.value.c_str() : "",
SPLIT_COL_UNITS, line.units.c_str(),
-1);
g_free (tooltip);
}
static void
check_page (SummaryLineInfo& line, gnc_numeric& debit, gnc_numeric& credit,
FieldMask splitfield, Account *acct, GtkWidget *memo, GtkWidget *gae,
gnc_commodity *comm, const char* page, StringVec& errors)
{
if (splitfield == FieldMask::DISABLED)
return;
// Translators: (missing) denotes that the amount or account is
// not provided, or incorrect, in the Stock Transaction Assistant.
const char* missing_str = N_("(missing)");
const gchar* amtstr;
gnc_numeric amount;
bool debit_side = (splitfield & FieldMask::ENABLED_DEBIT);
line.memo = gtk_entry_get_text (GTK_ENTRY (memo));
line.units = "";
line.debit_side = (splitfield & FieldMask::ENABLED_DEBIT);
if (gnc_amount_edit_expr_is_valid (GNC_AMOUNT_EDIT (gae), &amount, true, nullptr))
{
line.value_is_zero = false;
if (splitfield & FieldMask::ALLOW_ZERO)
amtstr = "";
line.value = "";
else
{
add_error (errors, N_("Amount for %s is missing."), page);
amtstr = _(missing_str);
line.value = _(missing_str);
}
}
else
@ -664,39 +699,25 @@ check_page (GtkListStore *list, gnc_numeric& debit, gnc_numeric& credit,
if (gnc_numeric_negative_p (amount))
{
amount = gnc_numeric_neg (amount);
debit_side = !debit_side;
line.debit_side = !line.debit_side;
}
if (debit_side)
if (line.debit_side)
debit = gnc_numeric_add_fixed (debit, amount);
else
credit = gnc_numeric_add_fixed (credit, amount);
amtstr = xaccPrintAmount (amount, gnc_commodity_print_info (comm, true));
line.value = xaccPrintAmount (amount, gnc_commodity_print_info (comm, true));
line.value_is_zero = gnc_numeric_zero_p (amount);
}
auto memostr = gtk_entry_get_text (GTK_ENTRY (memo));
auto memostr_escaped = g_markup_escape_text (memostr, -1);
const gchar *acctstr;
if (acct)
acctstr = xaccAccountGetName (acct);
line.account = xaccAccountGetName (acct);
else if ((splitfield & FieldMask::ALLOW_ZERO) && gnc_numeric_zero_p (amount))
acctstr = "";
line.account = "";
else
{
add_error (errors, N_("Account for %s is missing"), page);
acctstr = _(missing_str);
line.account = _(missing_str);
}
GtkTreeIter iter;
gtk_list_store_append (list, &iter);
gtk_list_store_set (list, &iter,
SPLIT_COL_ACCOUNT, acctstr,
SPLIT_COL_MEMO, memostr,
SPLIT_COL_MEMO_ESCAPED, memostr_escaped,
SPLIT_COL_DEBIT, debit_side ? amtstr : "",
SPLIT_COL_CREDIT, !debit_side ? amtstr : "",
-1);
g_free (memostr_escaped);
}
static inline Account*
@ -716,6 +737,7 @@ refresh_page_finish (StockTransactionInfo *info)
gnc_numeric debit = gnc_numeric_zero ();
gnc_numeric credit = gnc_numeric_zero ();
StringVec errors, warnings;
SummaryLineInfo line;
// check the stock transaction date. If there are existing stock
// transactions dated after the date specified, it is very likely
@ -746,14 +768,25 @@ to ensure proper recording."), new_date_str, last_split_date_str);
}
}
if (info->txn_type->stock_value == FieldMask::DISABLED)
line = { false, false, xaccAccountGetName (info->acct), "", "", "" };
else
check_page (line, debit, credit, info->txn_type->stock_value, info->acct,
info->stock_memo_edit, info->stock_value_edit, info->currency,
NC_ ("Stock Assistant: Page name", "stock value"), errors);
if (info->txn_type->stock_amount != FieldMask::DISABLED)
{
auto stock_amount = gnc_amount_edit_get_amount
(GNC_AMOUNT_EDIT(info->stock_amount_edit));
auto stock_pinfo = gnc_commodity_print_info
(xaccAccountGetCommodity (info->acct), true);
if (!gnc_numeric_positive_p (stock_amount))
add_error_str (errors, N_("Stock amount must be positive"));
if (info->txn_type->stock_amount & FieldMask::ENABLED_CREDIT)
stock_amount = gnc_numeric_neg (stock_amount);
line.units = xaccPrintAmount (stock_amount, stock_pinfo);
auto new_bal = gnc_numeric_add_fixed (info->balance_at_date, stock_amount);
if (gnc_numeric_positive_p (info->balance_at_date) &&
gnc_numeric_negative_p (new_bal))
@ -763,26 +796,37 @@ to ensure proper recording."), new_date_str, last_split_date_str);
add_error_str (errors, N_("Cannot cover buy more units than owed"));
}
check_page (list, debit, credit, info->txn_type->stock_value, info->acct,
info->stock_memo_edit, info->stock_value_edit, info->currency,
NC_ ("Stock Assistant: Page name", "stock value"), errors);
add_to_summary_table (list, line);
check_page (list, debit, credit, info->txn_type->cash_value,
gas_account (info->cash_account), info->cash_memo_edit,
info->cash_value, info->currency,
NC_ ("Stock Assistant: Page name", "cash"), errors);
if (info->txn_type->cash_value != FieldMask::DISABLED)
{
check_page (line, debit, credit, info->txn_type->cash_value,
gas_account (info->cash_account), info->cash_memo_edit,
info->cash_value, info->currency,
NC_ ("Stock Assistant: Page name", "cash"), errors);
add_to_summary_table (list, line);
}
auto capitalize_fees = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (info->capitalize_fees_checkbox));
check_page (list, debit, credit, info->txn_type->fees_value,
capitalize_fees ? info->acct : gas_account (info->fees_account),
info->fees_memo_edit, info->fees_value, info->currency,
NC_ ("Stock Assistant: Page name", "fees"), errors);
if (info->txn_type->fees_value != FieldMask::DISABLED)
{
auto capitalize_fees = gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON (info->capitalize_fees_checkbox));
check_page (line, debit, credit, info->txn_type->fees_value,
capitalize_fees ? info->acct : gas_account (info->fees_account),
info->fees_memo_edit, info->fees_value, info->currency,
NC_ ("Stock Assistant: Page name", "fees"), errors);
if (!line.value_is_zero)
add_to_summary_table (list, line);
}
check_page (list, debit, credit, info->txn_type->dividend_value,
gas_account (info->dividend_account),
info->dividend_memo_edit, info->dividend_value, info->currency,
NC_ ("Stock Assistant: Page name", "dividend"), errors);
if (info->txn_type->dividend_value != FieldMask::DISABLED)
{
check_page (line, debit, credit, info->txn_type->dividend_value,
gas_account (info->dividend_account),
info->dividend_memo_edit, info->dividend_value, info->currency,
NC_ ("Stock Assistant: Page name", "dividend"), errors);
add_to_summary_table (list, line);
}
// the next two checks will involve the two capgains splits:
// income side and stock side. The capgains_value ^
@ -790,16 +834,18 @@ to ensure proper recording."), new_date_str, last_split_date_str);
// flags.
if (info->txn_type->capgains_value != FieldMask::DISABLED)
{
check_page (list, debit, credit, info->txn_type->capgains_value,
check_page (line, debit, credit, info->txn_type->capgains_value,
gas_account (info->capgains_account),
info->capgains_memo_edit, info->capgains_value, info->currency,
NC_ ("Stock Assistant: Page name", "capital gains"), errors);
add_to_summary_table (list, line);
check_page (list, debit, credit,
check_page (line, debit, credit,
info->txn_type->capgains_value ^ (FieldMask::ENABLED_CREDIT | FieldMask::ENABLED_DEBIT),
info->acct, info->capgains_memo_edit, info->capgains_value,
info->currency,
NC_ ("Stock Assistant: Page name", "capital gains"), errors);
add_to_summary_table (list, line);
}
if (!gnc_numeric_equal (debit, credit))
@ -1143,7 +1189,8 @@ get_treeview (GtkBuilder *builder, const gchar *treeview_label)
gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), gnc_tree_view_get_grid_lines_pref ());
auto store = gtk_list_store_new (NUM_SPLIT_COLS, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING);
gtk_tree_view_set_model(view, GTK_TREE_MODEL(store));
g_object_unref(store);
@ -1173,6 +1220,13 @@ get_treeview (GtkBuilder *builder, const gchar *treeview_label)
(_("Credit"), renderer, "text", SPLIT_COL_CREDIT, nullptr);
gtk_tree_view_append_column(view, column);
renderer = gtk_cell_renderer_text_new();
gtk_cell_renderer_set_alignment (renderer, 1.0, 0.5);
gtk_cell_renderer_set_padding (renderer, 5, 0);
column = gtk_tree_view_column_new_with_attributes
(_("Units"), renderer, "text", SPLIT_COL_UNITS, nullptr);
gtk_tree_view_append_column(view, column);
return GTK_WIDGET (view);
}
@ -1250,7 +1304,7 @@ stock_assistant_create (StockTransactionInfo *info)
g_signal_connect (G_OBJECT(info->window), "destroy",
G_CALLBACK (stock_assistant_window_destroy_cb), info);
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (info->finish_split_view),
SPLIT_COL_MEMO_ESCAPED);
SPLIT_COL_TOOLTIP);
gtk_assistant_set_forward_page_func (GTK_ASSISTANT(info->window),
(GtkAssistantPageFunc)forward_page_func,

View File

@ -365,8 +365,6 @@ gnc_lot_viewer_fill (GNCLotViewer *lv)
char gain_buff[200];
GNCLot *lot = node->data;
Split *esplit = gnc_lot_get_earliest_split (lot);
Transaction *etrans = xaccSplitGetParent (esplit);
time64 open_date = xaccTransGetDate (etrans);
gnc_numeric amt_baln = gnc_lot_get_balance (lot);
gnc_commodity *currency = find_first_currency (lot);
gnc_numeric gains_baln = get_realized_gains (lot, currency);
@ -389,7 +387,14 @@ gnc_lot_viewer_fill (GNCLotViewer *lv)
gtk_list_store_set(store, &iter, LOT_COL_TYPE, type_buff, -1);
/* Opening date */
gtk_list_store_set(store, &iter, LOT_COL_OPEN, open_date, -1);
if (esplit)
{
Transaction *etrans = xaccSplitGetParent (esplit);
time64 open_date = xaccTransGetDate (etrans);
gtk_list_store_set(store, &iter, LOT_COL_OPEN, open_date, -1);
}
else
gtk_list_store_set(store, &iter, LOT_COL_OPEN, G_MININT64, -1);
/* Closing date */
if (gnc_lot_is_closed (lot))
@ -804,6 +809,49 @@ lv_response_cb (GtkDialog *dialog, gint response, gpointer data)
/* ======================================================================== */
static gchar* lot_get_open_date (GNCLot *lot)
{
g_return_val_if_fail (lot, NULL);
if (!gnc_lot_get_split_list (lot))
return g_strdup (_("Empty"));
else
return qof_print_date (xaccTransGetDate (xaccSplitGetParent (gnc_lot_get_earliest_split (lot))));
}
static gchar* lot_get_closing_date (GNCLot *lot)
{
g_return_val_if_fail (lot, NULL);
if (!gnc_lot_get_split_list (lot))
return NULL;
else if (!gnc_lot_is_closed (lot))
return g_strdup (_("Open"));
else
return qof_print_date (xaccTransGetDate (xaccSplitGetParent (gnc_lot_get_latest_split (lot))));
}
typedef gchar* (*LotToDateFunc) (GNCLot *lot);
static void lot_print_date (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
GtkTreeIter *iter,
LotToDateFunc lot_to_date)
{
GNCLot *lot;
gchar *str = NULL;
g_return_if_fail (cell && iter && tree_model);
gtk_tree_model_get (tree_model, iter, LOT_COL_PNTR, &lot, -1);
if (lot)
str = lot_to_date (lot);
g_object_set (G_OBJECT (cell), "text", str, NULL);
g_free (str);
}
static void print_date (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
@ -811,18 +859,14 @@ static void print_date (GtkTreeViewColumn *tree_column,
gpointer data)
{
time64 doc_date_time;
gchar *doc_date_str = g_strdup (_("Open"));
gchar *doc_date_str;
gint col = GPOINTER_TO_INT(data);
g_return_if_fail (cell && iter && tree_model);
gtk_tree_model_get (tree_model, iter, col, &doc_date_time, -1);
if (doc_date_time != G_MAXINT64) /* assumes INT64_MAX represents an invalid date/time */
{
g_free (doc_date_str);
doc_date_str = qof_print_date (doc_date_time);
}
doc_date_str = qof_print_date (doc_date_time);
g_object_set (G_OBJECT (cell), "text", doc_date_str, NULL);
g_free (doc_date_str);
}
@ -871,8 +915,8 @@ lv_init_lot_view (GNCLotViewer *lv)
gtk_tree_view_column_set_sort_column_id(column, LOT_COL_OPEN);
tree_view_column_set_default_width (view, column, "31-12-2013");
gtk_tree_view_column_set_cell_data_func (column, renderer,
(GtkTreeCellDataFunc) print_date,
GINT_TO_POINTER (LOT_COL_OPEN), NULL);
(GtkTreeCellDataFunc) lot_print_date,
lot_get_open_date, NULL);
gtk_tree_view_append_column(view, column);
renderer = gtk_cell_renderer_text_new();
@ -881,8 +925,8 @@ lv_init_lot_view (GNCLotViewer *lv)
gtk_tree_view_column_set_sort_column_id(column, LOT_COL_CLOSE);
tree_view_column_set_default_width (view, column, "31-12-2013");
gtk_tree_view_column_set_cell_data_func (column, renderer,
(GtkTreeCellDataFunc) print_date,
GINT_TO_POINTER (LOT_COL_CLOSE), NULL);
(GtkTreeCellDataFunc) lot_print_date,
lot_get_closing_date, NULL);
gtk_tree_view_append_column(view, column);
renderer = gtk_cell_renderer_text_new();

View File

@ -64,7 +64,7 @@
</row>
<row>
<col id="0" translatable="yes" comments="Label for locale settings of formats, …">Locale</col>
<col id="1" comments="Because it will be overwritten no translation is reqired">(dummy)</col>
<col id="1" comments="Because it will be overwritten no translation is required">(dummy)</col>
</row>
</data>
</object>

View File

@ -479,7 +479,7 @@ gnc_ab_get_purpose (const AB_TRANSACTION *ab_trans, gboolean is_ofx)
/* Ultimate Creditor and Ultimate Debtor are newish parameters added
* to SWIFT MT940 and CAMT.053 designating the originating
* payer or payee on the tranaction. It's unlikely, but still
* payer or payee on the transaction. It's unlikely, but still
* possible, that a bank would use both this markup and the Non-swift
* TransactionText or RemoteName tags.
*/
@ -510,50 +510,16 @@ ab_ultimate_creditor_debtor_to_gnc (const AB_TRANSACTION *ab_trans,
gchar *
gnc_ab_description_to_gnc (const AB_TRANSACTION *ab_trans, gboolean is_ofx)
{
/* Description */
gchar *description = gnc_ab_get_purpose (ab_trans, is_ofx);
gchar *other_name = gnc_ab_get_remote_name (ab_trans);
gchar *ultimate = ab_ultimate_creditor_debtor_to_gnc (ab_trans, is_ofx);
gchar *retval = NULL;
GList *acc = NULL;
gchar *retval;
if (ultimate)
retval = ultimate;
if (description)
{
if (retval)
{
char *tmp = g_strdup_printf ("%s; %s", retval, description);
g_free (retval);
g_free (description);
retval = tmp;
}
else
{
retval = description;
}
}
acc = g_list_prepend (acc, gnc_ab_get_remote_name (ab_trans));
acc = g_list_prepend (acc, gnc_ab_get_purpose (ab_trans, is_ofx));
acc = g_list_prepend (acc, ab_ultimate_creditor_debtor_to_gnc (ab_trans, is_ofx));
retval = gnc_g_list_stringjoin (acc, "; ");
if (other_name)
{
if (retval)
{
char *tmp = g_strdup_printf ("%s; %s", retval, other_name);
g_free (retval);
g_free (other_name);
retval = tmp;
}
else
{
retval = other_name;
}
}
if (!retval)
{
retval = g_strdup (_("Unspecified"));
}
return retval;
g_list_free_full (acc, g_free);
return retval ? retval : g_strdup (_("Unspecified"));
}
gchar *

View File

@ -49,7 +49,7 @@
* ']': increment month
*
* '{':
* '[': decrment month
* '[': decrement month
*
* 'M':
* 'm': beginning of month

View File

@ -471,7 +471,7 @@ not found.")))
(hash-map->list cons *gnc:_report-templates_*)))
;; This function should be called right before changing a custom-template's name
;; to test if the new name is unique among the existting custom reports.
;; to test if the new name is unique among the existing custom reports.
;; If not the calling function can prevent the name from being updated.
(define (gnc:report-template-has-unique-name? templ-guid new-name)
(or (not new-name)

View File

@ -981,7 +981,7 @@
splt-print-amnt))
) ;; end of let*
) ;; end of if
) ;; end of lamda
) ;; end of lambda
all-tran-splits) ;; end of map
;; if several splits are converted from several currencies, it is
;; possible that they won't add - this is a 'plug' amount to make

View File

@ -182,39 +182,41 @@ the split action field to detect capitalized fees on stock activity")
;; N000 should be (not x) however we can accept a zero-amount split too
(define (N000 x) (if (number? x) (= x 0) #t))
;; --stock-- cash cap exp divi capg
;; <-- bitfield masks to identify -> purchase?
;; <---- the transaction type -----> | sale?
;; --stock-- cash cap exp divi capg | | narrative
;; amt val fees fees
(define open-types
(list
(list N001 N001 N100 N011 N000 N000 N000 "Open Long")
(list N100 N100 N001 N011 N000 N000 N000 "Open Short")))
(list N001 N001 N100 N011 N000 N000 N000 #t #f "Open Long")
(list N100 N100 N001 N011 N000 N000 N000 #t #f "Open Short")))
(define long-types
(list
(list N001 N001 N100 N011 N000 N000 N000 "Buy")
(list N100 N100 N011 N000 N011 N000 N111 "Sell")
(list N000 N000 N001 N000 N011 N100 N000 "Dividend")
(list N001 N001 N001 N011 N000 N100 N000 "Dividend reinvestment (w/ remainder)")
(list N001 N001 N000 N011 N000 N100 N000 "Dividend reinvestment (w/o remainder)")
(list N000 N100 N001 N011 N000 N000 N000 "Return of Capital")
(list N000 N001 N000 N000 N011 N100 N000 "Notional distribution")
(list N001 N000 N000 N011 N000 N000 N000 "Stock split")
(list N100 N000 N000 N011 N000 N000 N000 "Reverse split")
(list N100 N100 N001 N000 N011 N000 N111 "Reverse split w/ cash in lieu for fractionals")))
(list N001 N001 N100 N011 N000 N000 N000 #t #f "Buy")
(list N100 N100 N011 N000 N011 N000 N111 #f #t "Sell")
(list N000 N000 N001 N000 N011 N100 N000 #f #f "Dividend")
(list N001 N001 N001 N011 N000 N100 N000 #t #f "Dividend reinvestment (w/ remainder)")
(list N001 N001 N000 N011 N000 N100 N000 #t #f "Dividend reinvestment (w/o remainder)")
(list N000 N100 N001 N011 N000 N000 N000 #t #f "Return of Capital")
(list N000 N001 N000 N000 N011 N100 N000 #t #f "Notional distribution")
(list N001 N000 N000 N011 N000 N000 N000 #f #f "Stock split")
(list N100 N000 N000 N011 N000 N000 N000 #f #f "Reverse split")
(list N100 N100 N001 N000 N011 N000 N111 #f #t "Reverse split w/ cash in lieu for fractionals")))
(define short-types
(list
(list N100 N100 N001 N011 N000 N000 N000 "Short Sell")
(list N001 N001 N110 N000 N011 N000 N111 "Cover Buy")
(list N000 N000 N100 N000 N011 N001 N000 "Compensatory dividend")
(list N000 N000 N000 N011 N000 N000 N000 "Dividend reinvestment (w remainder)")
(list N000 N000 N000 N011 N000 N000 N000 "Dividend reinvestment (w/o remainder)")
(list N000 N001 N100 N011 N000 N000 N000 "Compensatory return of capital")
(list N000 N100 N000 N000 N011 N001 N000 "Compensatory notional distribution")
(list N100 N000 N000 N011 N000 N000 N000 "Stock split")
(list N001 N000 N000 N011 N000 N000 N000 "Reverse split")
(list N001 N001 N100 N000 N011 N000 N111 "Reverse split w/ cash in lieu for fractionals")))
(list N100 N100 N001 N011 N000 N000 N000 #t #f "Short Sell")
(list N001 N001 N110 N000 N011 N000 N111 #f #t "Cover Buy")
(list N000 N000 N100 N000 N011 N001 N000 #f #f "Compensatory dividend")
(list N000 N000 N000 N011 N000 N000 N000 #t #f "Dividend reinvestment (w remainder)")
(list N000 N000 N000 N011 N000 N000 N000 #t #f "Dividend reinvestment (w/o remainder)")
(list N000 N001 N100 N011 N000 N000 N000 #t #f "Compensatory return of capital")
(list N000 N100 N000 N000 N011 N001 N000 #t #f "Compensatory notional distribution")
(list N100 N000 N000 N011 N000 N000 N000 #f #f "Stock split")
(list N001 N000 N000 N011 N000 N000 N000 #f #f "Reverse split")
(list N001 N001 N100 N000 N011 N000 N111 #f #t "Reverse split w/ cash in lieu for fractionals")))
(define (cmp amt neg zero pos)
(cond ((< amt 0) neg)
@ -227,8 +229,8 @@ the split action field to detect capitalized fees on stock activity")
(match types
(()
;; (gnc:pk (qof-print-date (xaccTransGetDate trans)) txn-info)
"Unknown")
(((amt-fn val-fn proc-fn fee-cap-fn fee-exp-fn div-fn capg-fn res) . tail)
(list #f #f "Unknown"))
(((amt-fn val-fn proc-fn fee-cap-fn fee-exp-fn div-fn capg-fn . res) . tail)
(if (and (amt-fn (get-stock-amt txn-info))
(val-fn (get-stock-val txn-info))
(proc-fn (get-proceeds-val txn-info))
@ -407,19 +409,17 @@ the split action field to detect capitalized fees on stock activity")
(trans-value (M+ (get-stock-val txn-info)
(get-fees-cap-val txn-info)))
(new-units (M+ cumul-units trans-units))
(identified
(cond
((< new-units 0 cumul-units) (list #f #f "ERROR: long→short"))
((< cumul-units 0 new-units) (list #f #f "ERROR: short→long"))
(else (txn-identify trans txn-info cumul-units))))
(sale?
(cond
((< trans-units 0) (<= 0 new-units))
((> trans-units 0) (<= new-units 0))
(else #f)))
(cadr identified))
(purchase?
(cond
((= trans-value 0) dividends-val) ;dividends
((= trans-units 0) cash-value) ;return of capital
((> trans-units 0) (< 0 new-units)) ;regular buy
((< trans-units 0) (< new-units 0)))) ;buy during short
(car identified))
(shorting? (or (< new-units 0)
(and (= new-units 0) (< 0 trans-units))))
@ -486,10 +486,7 @@ the split action field to detect capitalized fees on stock activity")
(gnc:html-string-sanitize (xaccTransGetDescription trans))
(to-cell (gnc:html-split-anchor split (to-commodity trans-units)))
(to-cell (to-commodity new-units))
(cond
((< new-units 0 cumul-units) "ERROR: long→short")
((< cumul-units 0 new-units) "ERROR: short→long")
(else (txn-identify trans txn-info cumul-units)))
(caddr identified)
(gnc-commodity-get-mnemonic currency)
(to-cell (gnc:default-price-renderer report-currency fx))
(to-cell (to-orig-currency purchase-val))
@ -522,6 +519,10 @@ the split action field to detect capitalized fees on stock activity")
;; (gnc:dump-all-transactions)
(gnc:html-document-add-object! document disclaimer)
(gnc:html-document-add-object!
document (gnc:html-render-options-changed (gnc:report-options report-obj)))
document)

View File

@ -323,7 +323,7 @@ deprecated_account_security_handler (xmlNodePtr node, gpointer act_pdata)
PWARN ("Account %s: Obsolete xml tag 'act:security' will not be preserved.",
xaccAccountGetName (pdata->account));
/* If the account has both a commodity and a security element, and
the commodity is a currecny, then the commodity is probably
the commodity is a currency, then the commodity is probably
wrong. In that case we want to replace it with the
security. jralls 2010-11-02 */
if (!orig || gnc_commodity_is_currency (orig))

View File

@ -1,5 +1,5 @@
/********************************************************************\
* gnc-filepath-utils.c -- file path resolutin utilitie *
* gnc-filepath-utils.c -- file path resolution utility *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *

View File

@ -335,18 +335,25 @@ gnc_g_list_stringjoin (GList *list_of_strings, const gchar *sep)
gint length = -seplen;
gchar *retval, *p;
if (!list_of_strings)
return NULL;
for (GList *n = list_of_strings; n; n = n->next)
length += strlen ((gchar*)n->data) + seplen;
{
gchar *str = n->data;
if (str && *str)
length += strlen (str) + seplen;
}
if (length <= 0)
return NULL;
p = retval = (gchar*) g_malloc0 (length * sizeof (gchar) + 1);
for (GList *n = list_of_strings; n; n = n->next)
{
p = g_stpcpy (p, (gchar*)n->data);
if (n->next && sep)
gchar *str = n->data;
if (!str || !str[0])
continue;
if (sep && (p != retval))
p = g_stpcpy (p, sep);
p = g_stpcpy (p, str);
}
return retval;

View File

@ -79,6 +79,11 @@ test_g_list_stringjoin (gconstpointer data)
g_assert_cmpstr (ret, ==, "one");
g_free (ret);
/* The following inserts a NULL between "two" and "one". As a
result, the stringjoin effectively skips a step, i.e. it does
not insert separator repeatedly between NULL strings */
test = g_list_prepend (test, NULL);
test = g_list_prepend (test, "two");
ret = gnc_g_list_stringjoin (test, NULL);

View File

@ -71,7 +71,7 @@ returned.
Simple/ad-hoc lazy evaluation works well when data dependencies are
simple, but it breaks down when there are too many/circular
relationships. It becomes all too easy to get trapped in inifite
relationships. It becomes all too easy to get trapped in inifinite
loops of corrections. The goal of moving to a formal constraint
system is to introduce specific, well-defined sync points where
constraint checking can be done, without incuring circular

View File

@ -25,7 +25,7 @@ If it seems to be an independent concept, it can still be placed
in the KVP tree of the book, which gives it a 'top-level' existence.
If the concept is used only infrequently, then it probably belongs
in a KVP tree. If the concept has performance-critical requriements,
in a KVP tree. If the concept has performance-critical requirements,
then it is better to implement it as a C struct, and similarly
design an appropriate SQL table around it, so that the database
can be queried efficiently and rapidly.

View File

@ -1334,6 +1334,12 @@ gnc_tm_get_today_start (struct tm *tm)
gnc_tm_get_day_start(tm, time(NULL));
}
void
gnc_tm_get_today_neutral (struct tm *tm)
{
gnc_tm_get_day_neutral(tm, time(NULL));
}
void
gnc_tm_get_today_end (struct tm *tm)
{

View File

@ -576,7 +576,7 @@ void gnc_tm_set_day_end (struct tm *tm)
time64 gnc_time64_get_day_start(time64 time_val);
/** The gnc_time64_get_day_neutral() routine will take the given time in
* seconds and adjust it to 10:59am of that day. */
* seconds and adjust it to 10:59:00Z of that day. */
time64 gnc_time64_get_day_neutral(time64 time_val);
/** The gnc_time64_get_day_end() routine will take the given time in
@ -596,6 +596,10 @@ int gnc_date_get_last_mday (int month, int year);
* tm and fills it in with the first second of the today. */
void gnc_tm_get_today_start(struct tm *tm);
/** The gnc_tm_get_today_start() routine takes a pointer to a struct
* tm and fills it in with the timezone neutral time (10:59:00Z). */
void gnc_tm_get_today_neutral(struct tm *tm);
/** The gnc_tm_get_today_end() routine takes a pointer to a struct
* tm and fills it in with the last second of the today. */
void gnc_tm_get_today_end(struct tm *tm);

View File

@ -90,7 +90,7 @@ struct _QofBook
/* Boolean indicates that the session is dirty -- that is, it has
* not yet been written out to disk after the last time the
* backend ran commit_edit(). This is distinct from the inherited
* QofInstance::dirty, which indicates that some persisitent
* QofInstance::dirty, which indicates that some persistent
* property of the book object itself has been edited and not
* committed. Some backends write data out as part of
* commit_edit() and so don't use this flag.

View File

@ -243,7 +243,7 @@ check_equality_operator (void)
check_unary_op (gnc_numeric_equal,
val, mval, mval, "expected %s = %s");
/* Certain modulo's should be very cleary un-equal; this
/* Certain modulo's should be very clearly un-equal; this
* helps stop funky modulo-64 aliasing in compares that
* might creep in. */
mval.denom >>= 1;

1721
po/ar.po

File diff suppressed because it is too large Load Diff

1721
po/as.po

File diff suppressed because it is too large Load Diff

1709
po/az.po

File diff suppressed because it is too large Load Diff

1721
po/bg.po

File diff suppressed because it is too large Load Diff

1721
po/brx.po

File diff suppressed because it is too large Load Diff

1710
po/ca.po

File diff suppressed because it is too large Load Diff

1721
po/cs.po

File diff suppressed because it is too large Load Diff

1722
po/da.po

File diff suppressed because it is too large Load Diff

1728
po/de.po

File diff suppressed because it is too large Load Diff

1721
po/doi.po

File diff suppressed because it is too large Load Diff

1721
po/el.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1710
po/es.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1718
po/et.po

File diff suppressed because it is too large Load Diff

1737
po/eu.po

File diff suppressed because it is too large Load Diff

1720
po/fa.po

File diff suppressed because it is too large Load Diff

1710
po/fi.po

File diff suppressed because it is too large Load Diff

1715
po/fr.po

File diff suppressed because it is too large Load Diff

1721
po/gu.po

File diff suppressed because it is too large Load Diff

1724
po/he.po

File diff suppressed because it is too large Load Diff

1721
po/hi.po

File diff suppressed because it is too large Load Diff

1714
po/hr.po

File diff suppressed because it is too large Load Diff

1733
po/hu.po

File diff suppressed because it is too large Load Diff

1710
po/id.po

File diff suppressed because it is too large Load Diff

1758
po/it.po

File diff suppressed because it is too large Load Diff

1710
po/ja.po

File diff suppressed because it is too large Load Diff

1721
po/kn.po

File diff suppressed because it is too large Load Diff

4713
po/ko.po

File diff suppressed because it is too large Load Diff

1721
po/kok.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1721
po/ks.po

File diff suppressed because it is too large Load Diff

1721
po/lt.po

File diff suppressed because it is too large Load Diff

1721
po/lv.po

File diff suppressed because it is too large Load Diff

1721
po/mai.po

File diff suppressed because it is too large Load Diff

1721
po/mni.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1721
po/mr.po

File diff suppressed because it is too large Load Diff

1721
po/nb.po

File diff suppressed because it is too large Load Diff

1721
po/ne.po

File diff suppressed because it is too large Load Diff

1718
po/nl.po

File diff suppressed because it is too large Load Diff

1709
po/pl.po

File diff suppressed because it is too large Load Diff

1718
po/pt.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1722
po/ro.po

File diff suppressed because it is too large Load Diff

1725
po/ru.po

File diff suppressed because it is too large Load Diff

1733
po/rw.po

File diff suppressed because it is too large Load Diff

1721
po/sk.po

File diff suppressed because it is too large Load Diff

1721
po/sr.po

File diff suppressed because it is too large Load Diff

1714
po/sv.po

File diff suppressed because it is too large Load Diff

1721
po/ta.po

File diff suppressed because it is too large Load Diff

1721
po/te.po

File diff suppressed because it is too large Load Diff

1721
po/tr.po

File diff suppressed because it is too large Load Diff

1714
po/uk.po

File diff suppressed because it is too large Load Diff

1721
po/ur.po

File diff suppressed because it is too large Load Diff

1721
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff