mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug#431435: guard against dirtying the SX/book when setting to the same values the SX objects already contain.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15950 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
3d1174a884
commit
c818c83df7
@ -346,10 +346,13 @@ xaccSchedXactionGetLastOccurDate( SchedXaction *sx )
|
||||
}
|
||||
|
||||
void
|
||||
xaccSchedXactionSetLastOccurDate( SchedXaction *sx, GDate* newLastOccur )
|
||||
xaccSchedXactionSetLastOccurDate(SchedXaction *sx, GDate* new_last_occur)
|
||||
{
|
||||
if (g_date_valid(&sx->last_date)
|
||||
&& g_date_compare(&sx->last_date, new_last_occur) == 0)
|
||||
return;
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->last_date = *newLastOccur;
|
||||
sx->last_date = *new_last_occur;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
@ -367,10 +370,12 @@ xaccSchedXactionGetNumOccur( const SchedXaction *sx )
|
||||
}
|
||||
|
||||
void
|
||||
xaccSchedXactionSetNumOccur( SchedXaction *sx, gint newNum )
|
||||
xaccSchedXactionSetNumOccur(SchedXaction *sx, gint new_num)
|
||||
{
|
||||
if (sx->num_occurances_total == new_num)
|
||||
return;
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->num_occurances_remain = sx->num_occurances_total = newNum;
|
||||
sx->num_occurances_remain = sx->num_occurances_total = new_num;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
@ -382,18 +387,20 @@ xaccSchedXactionGetRemOccur( const SchedXaction *sx )
|
||||
}
|
||||
|
||||
void
|
||||
xaccSchedXactionSetRemOccur( SchedXaction *sx,
|
||||
gint numRemain )
|
||||
xaccSchedXactionSetRemOccur(SchedXaction *sx, gint num_remain)
|
||||
{
|
||||
/* FIXME This condition can be tightened up */
|
||||
if ( numRemain > sx->num_occurances_total )
|
||||
if (num_remain > sx->num_occurances_total)
|
||||
{
|
||||
g_warning("The number remaining is greater than the total occurrences");
|
||||
g_warning("number remaining [%d] > total occurrences [%d]",
|
||||
num_remain, sx->num_occurances_total);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_remain == sx->num_occurances_remain)
|
||||
return;
|
||||
gnc_sx_begin_edit(sx);
|
||||
sx->num_occurances_remain = numRemain;
|
||||
sx->num_occurances_remain = num_remain;
|
||||
qof_instance_set_dirty(&sx->inst);
|
||||
gnc_sx_commit_edit(sx);
|
||||
}
|
||||
@ -620,10 +627,12 @@ gnc_sx_get_instance_count( const SchedXaction *sx, void *stateData )
|
||||
}
|
||||
|
||||
void
|
||||
gnc_sx_set_instance_count( SchedXaction *sx, gint instanceNum )
|
||||
gnc_sx_set_instance_count(SchedXaction *sx, gint instance_num)
|
||||
{
|
||||
g_return_if_fail( sx );
|
||||
sx->instance_num = instanceNum;
|
||||
g_return_if_fail(sx);
|
||||
if (sx->instance_num == instance_num)
|
||||
return;
|
||||
sx->instance_num = instance_num;
|
||||
}
|
||||
|
||||
GList *
|
||||
|
Loading…
Reference in New Issue
Block a user