mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 796812 - gnc_date_cell_get_date and gnc_date_cell_get_date_gdate have different date validation behaviour - part 1
Add gboolean parameter to gnc_date_cell_get_date to enable warning for the date out of range dialogue and update every occurrence accordingly.
This commit is contained in:
parent
dd49756f4e
commit
aabae1caf9
@ -1012,7 +1012,7 @@ static void gnc_entry_ledger_save_cells (gpointer save_data,
|
||||
|
||||
cell = gnc_table_layout_get_cell (ledger->table->layout, ENTRY_DATE_CELL);
|
||||
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &cell_time);
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &cell_time, TRUE);
|
||||
|
||||
/* commit any pending changes */
|
||||
gnc_date_cell_commit ((DateCell *) cell);
|
||||
|
@ -1258,7 +1258,7 @@ gnc_split_register_xfer_dialog(SplitRegister *reg, Transaction *txn,
|
||||
if (cell)
|
||||
{
|
||||
time64 time;
|
||||
gnc_date_cell_get_date((DateCell*) cell, &time);
|
||||
gnc_date_cell_get_date((DateCell*) cell, &time, TRUE);
|
||||
gnc_xfer_dialog_set_date(xfer, time);
|
||||
}
|
||||
else
|
||||
|
@ -67,7 +67,7 @@ gnc_split_register_save_date_cell (BasicCell * cell,
|
||||
|
||||
DEBUG ("DATE: %s", value ? value : "(null)");
|
||||
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &cell_time);
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &cell_time, TRUE);
|
||||
|
||||
/* commit any pending changes */
|
||||
gnc_date_cell_commit ((DateCell *) cell);
|
||||
@ -103,7 +103,7 @@ gnc_split_register_save_due_date_cell (BasicCell * cell,
|
||||
/* commit any pending changes */
|
||||
gnc_date_cell_commit ((DateCell *) cell);
|
||||
DEBUG ("DATE: %s", value ? value : "(null)");
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &time);
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &time, TRUE);
|
||||
xaccTransSetDateDue (sd->trans, time);
|
||||
}
|
||||
|
||||
|
@ -1385,7 +1385,7 @@ gnc_split_register_save_to_scm (SplitRegister *reg,
|
||||
BasicCell *cell;
|
||||
time64 time;
|
||||
cell = gnc_table_layout_get_cell (reg->table->layout, DATE_CELL);
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &time);
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &time, TRUE);
|
||||
xaccTransSetDatePostedSecsNormalized(trans, time);
|
||||
}
|
||||
|
||||
@ -2085,7 +2085,7 @@ record_price (SplitRegister *reg, Account *account, gnc_numeric value,
|
||||
*/
|
||||
if (gnc_split_reg_has_rate_cell (reg->type))
|
||||
return;
|
||||
gnc_date_cell_get_date ((DateCell*)cell, &time);
|
||||
gnc_date_cell_get_date ((DateCell*)cell, &time, TRUE);
|
||||
price = gnc_pricedb_lookup_day_t64 (pricedb, comm, curr, time);
|
||||
if (gnc_commodity_equiv (comm, gnc_price_get_currency (price)))
|
||||
swap = TRUE;
|
||||
|
@ -123,8 +123,9 @@ void gnc_date_cell_commit (DateCell *cell);
|
||||
/** Set a time64 to the value in the DateCell.
|
||||
* @param cell The DateCell
|
||||
* @param time A time64* to which the function will write the time.
|
||||
* @param warn Whether to warn of parse errors or silently change to a valid one.
|
||||
*/
|
||||
void gnc_date_cell_get_date (DateCell *cell, time64 *time);
|
||||
void gnc_date_cell_get_date (DateCell *cell, time64 *time, gboolean warn);
|
||||
|
||||
/** Set a GDate to the value in the DateCell.
|
||||
* @param cell The DateCell
|
||||
|
@ -710,7 +710,7 @@ gnc_date_cell_leave (BasicCell *bcell)
|
||||
box->calendar_popped = FALSE;
|
||||
|
||||
/* Refresh the date to expand any shortcuts. */
|
||||
gnc_date_cell_get_date ((DateCell *)bcell, &time);
|
||||
gnc_date_cell_get_date ((DateCell *)bcell, &time, TRUE);
|
||||
gnc_date_cell_set_value_secs ((DateCell *)bcell, time);
|
||||
}
|
||||
|
||||
@ -731,13 +731,13 @@ gnc_date_cell_get_date_gdate (DateCell *cell, GDate *date)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_date_cell_get_date (DateCell *cell, time64 *time)
|
||||
gnc_date_cell_get_date (DateCell *cell, time64 *time, gboolean warn)
|
||||
{
|
||||
PopBox *box = cell->cell.gui_private;
|
||||
if (!cell || !time)
|
||||
return;
|
||||
|
||||
gnc_parse_date (&(box->date), cell->cell.value, TRUE);
|
||||
gnc_parse_date (&(box->date), cell->cell.value, warn);
|
||||
*time = gnc_mktime (&box->date);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user