[assistant-stock-transaction] better punctuation for error messages.

This commit is contained in:
Christopher Lam 2022-09-24 00:19:12 +08:00
parent 1cac132214
commit ae993503ee

View File

@ -696,7 +696,7 @@ check_page (SummaryLineInfo& line, gnc_numeric& debit, gnc_numeric& credit,
line.account = ""; line.account = "";
else else
{ {
add_error (errors, N_("Account for %s is missing"), page); add_error (errors, N_("Account for %s is missing."), page);
line.account = _(missing_str); line.account = _(missing_str);
} }
} }
@ -775,11 +775,11 @@ to ensure proper recording."), new_date_str, last_split_date_str);
line.units = xaccPrintAmount (stock_amount, stock_pinfo); line.units = xaccPrintAmount (stock_amount, stock_pinfo);
line.units_in_red = negative_in_red && gnc_numeric_negative_p (stock_amount); line.units_in_red = negative_in_red && gnc_numeric_negative_p (stock_amount);
if (gnc_numeric_check (ratio) || !gnc_numeric_positive_p (ratio)) if (gnc_numeric_check (ratio) || !gnc_numeric_positive_p (ratio))
add_error_str (errors, N_("Invalid stock new balance")); add_error_str (errors, N_("Invalid stock new balance."));
else if (gnc_numeric_negative_p (delta) && !credit_side) else if (gnc_numeric_negative_p (delta) && !credit_side)
add_error_str (errors, N_("New balance must be higher than old balance")); add_error_str (errors, N_("New balance must be higher than old balance."));
else if (gnc_numeric_positive_p (delta) && credit_side) else if (gnc_numeric_positive_p (delta) && credit_side)
add_error_str (errors, N_("New balance must be lower than old balance")); add_error_str (errors, N_("New balance must be lower than old balance."));
} }
else else
{ {
@ -788,7 +788,7 @@ to ensure proper recording."), new_date_str, last_split_date_str);
auto stock_pinfo = gnc_commodity_print_info auto stock_pinfo = gnc_commodity_print_info
(xaccAccountGetCommodity (info->acct), true); (xaccAccountGetCommodity (info->acct), true);
if (!gnc_numeric_positive_p (stock_amount)) if (!gnc_numeric_positive_p (stock_amount))
add_error_str (errors, N_("Stock amount must be positive")); add_error_str (errors, N_("Stock amount must be positive."));
if (info->txn_type->stock_amount & FieldMask::ENABLED_CREDIT) if (info->txn_type->stock_amount & FieldMask::ENABLED_CREDIT)
stock_amount = gnc_numeric_neg (stock_amount); stock_amount = gnc_numeric_neg (stock_amount);
line.units = xaccPrintAmount (stock_amount, stock_pinfo); line.units = xaccPrintAmount (stock_amount, stock_pinfo);
@ -796,10 +796,10 @@ to ensure proper recording."), new_date_str, last_split_date_str);
auto new_bal = gnc_numeric_add_fixed (info->balance_at_date, stock_amount); auto new_bal = gnc_numeric_add_fixed (info->balance_at_date, stock_amount);
if (gnc_numeric_positive_p (info->balance_at_date) && if (gnc_numeric_positive_p (info->balance_at_date) &&
gnc_numeric_negative_p (new_bal)) gnc_numeric_negative_p (new_bal))
add_error_str (errors, N_("Cannot sell more units than owned")); add_error_str (errors, N_("Cannot sell more units than owned."));
else if (gnc_numeric_negative_p (info->balance_at_date) && else if (gnc_numeric_negative_p (info->balance_at_date) &&
gnc_numeric_positive_p (new_bal)) gnc_numeric_positive_p (new_bal))
add_error_str (errors, N_("Cannot cover buy more units than owed")); add_error_str (errors, N_("Cannot cover buy more units than owed."));
} }
add_to_summary_table (list, line); add_to_summary_table (list, line);