2003-01-25 Joshua Sled <jsled@asynchronous.org>

* src/gnome/dialog-scheduledxaction.c (gnc_sxed_update_cal): Fix
	the Recurrence-Frequency example-calendar date calculation to show
	upcoming instances correctly.

	* src/engine/SchedXaction.c (xaccSchedXactionGetNextInstance):
	Remove the validity check on the temporal-state-data's notion of
	the last-occurance date; as invalidity means something important,
	we must let it through; fixes Bug#103955.

	* src/backend/file/gnc-schedxaction-xml-v2.c
	(gnc_schedXaction_dom_tree_create): Make output of the
	deferred-instance last-date node optional on it's validity.

	* src/gnome/dialog-sxsincelast.c (cancel_check): Change assertion
	into conditional-activity, allowing rational use-case and fixing
	Bug #103182.

	* src/gnome/dialog-scheduledxaction.c (editor_ok_button_clicked):
	Correctly update available SX lists instead of the one we were
	spawned from, which may have disappeared in the mean time.  Fixes
	Bug#103629 [and allows the future fix of not needing to open the
	SX List Dialog when clicking "Advanced..." in the sx-from-transaction
	SX Editor-open vector].


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7885 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled 2003-01-26 02:53:58 +00:00
parent efcd9e71f1
commit f3c03a9dc8
6 changed files with 70 additions and 23 deletions

View File

@ -1,3 +1,29 @@
2003-01-25 Joshua Sled <jsled@asynchronous.org>
* src/gnome/dialog-scheduledxaction.c (gnc_sxed_update_cal): Fix
the Recurrence-Frequency example-calendar date calculation to show
upcoming instances correctly.
* src/engine/SchedXaction.c (xaccSchedXactionGetNextInstance):
Remove the validity check on the temporal-state-data's notion of
the last-occurance date; as invalidity means something important,
we must let it through; fixes Bug#103955.
* src/backend/file/gnc-schedxaction-xml-v2.c
(gnc_schedXaction_dom_tree_create): Make output of the
deferred-instance last-date node optional on it's validity.
* src/gnome/dialog-sxsincelast.c (cancel_check): Change assertion
into conditional-activity, allowing rational use-case and fixing
Bug #103182.
* src/gnome/dialog-scheduledxaction.c (editor_ok_button_clicked):
Correctly update available SX lists instead of the one we were
spawned from, which may have disappeared in the mean time. Fixes
Bug#103629 [and allows the future fix of not needing to open the
SX List Dialog when clicking "Advanced..." in the sx-from-transaction
SX Editor-open vector].
2003-01-26 Christian Stimming <stimming@tuhh.de>
* src/import-export/hbci/hbci.scm, gnc-hbci-utils.c: Add

View File

@ -221,8 +221,11 @@ gnc_schedXaction_dom_tree_create(SchedXaction *sx)
tsd = (temporalStateData*)l->data;
instNode = xmlNewNode( NULL, SX_DEFER_INSTANCE );
xmlAddChild( instNode, gdate_to_dom_tree( SX_LAST,
&tsd->last_date ) );
if ( g_date_valid( &tsd->last_date ) )
{
xmlAddChild( instNode, gdate_to_dom_tree( SX_LAST,
&tsd->last_date ) );
}
xmlAddChild( instNode, int_to_dom_tree( SX_REM_OCCUR,
tsd->num_occur_rem ) );
xmlAddChild( instNode, int_to_dom_tree( SX_INSTANCE_COUNT,

View File

@ -442,9 +442,7 @@ xaccSchedXactionGetNextInstance( SchedXaction *sx, void *stateData )
if ( stateData != NULL ) {
temporalStateData *tsd = (temporalStateData*)stateData;
if ( g_date_valid( &tsd->last_date ) ) {
last_occur = tsd->last_date;
}
last_occur = tsd->last_date;
}
if ( g_date_valid( &sx->start_date ) ) {
@ -460,7 +458,7 @@ xaccSchedXactionGetNextInstance( SchedXaction *sx, void *stateData )
* start date... one day should be good.
*
* This only holds for the first instance [read: if the
* last[-occur]_date is invalid. */
* last[-occur]_date is invalid] */
last_occur = sx->start_date;
g_date_subtract_days( &last_occur, 1 );
}
@ -693,10 +691,6 @@ gnc_sx_create_temporal_state( SchedXaction *sx )
temporalStateData *toRet =
g_new0( temporalStateData, 1 );
toRet->last_date = sx->last_date;
if ( !g_date_valid( &toRet->last_date ) ) {
toRet->last_date = sx->start_date;
g_date_subtract_days( &toRet->last_date, 1 );
}
toRet->num_occur_rem = sx->num_occurances_remain;
toRet->num_inst = sx->instance_num;
return (void*)toRet;

View File

@ -198,10 +198,6 @@ void xaccSchedXactionSetGUID( SchedXaction *sx, GUID g );
* store the initial state of SXes before modification ... if it later
* becomes necessary to revert an entire set of changes, we can 'revert' the
* SX without having to rollback all the individual state changes.
*
* NOTE that this is similar to the above SequenceState interface, and
* perhaps can be seen as entailing the above interface. In fact, the above
* interface is deprecated in favor of this one.
**/
void *gnc_sx_create_temporal_state( SchedXaction *sx );
void gnc_sx_incr_temporal_state( SchedXaction *sx, void *stateData );

View File

@ -218,6 +218,7 @@ void
sxd_close_handler ( gpointer user_data )
{
SchedXactionDialog *sxd = user_data;
gnc_sxl_record_size( sxd );
gnome_dialog_close( GNOME_DIALOG( sxd->dialog ) );
}
@ -336,7 +337,6 @@ editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
gnc_sxed_save_sx( sxed );
/* add to list */
putSchedXactionInDialog( sxed->sx, sxed->sxd );
if ( sxed->newsxP ) {
book = gnc_get_current_book ();
sxList = gnc_book_get_schedxactions( book );
@ -346,6 +346,28 @@ editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
sxed->newsxP = FALSE;
}
/* update lists */
/* We now do this by getting the list of SX Lists and updating them
[if they exist]. Otherwise, our pointer to our SXD might not be
valid; see Bug#103629. */
{
GList *listDialogs, *ldIter;
listDialogs =
gnc_find_gui_components( DIALOG_SCHEDXACTION_CM_CLASS,
NULL, NULL );
for ( ldIter = listDialogs;
ldIter != NULL;
ldIter = ldIter->next )
{
gnc_sxd_list_refresh( (SchedXactionDialog*)ldIter
->data );
}
if ( listDialogs != NULL )
{
g_list_free( listDialogs );
}
}
/* cleanup */
gnc_close_gui_component_by_data( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
sxed );
@ -1289,7 +1311,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
{ "rb_enddate", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(END_DATE_OPTION) },
{ "rb_num_occur", "toggled", endgroup_rb_toggled, GINT_TO_POINTER(NUM_OCCUR_OPTION) },
{ REMAIN_ENTRY , "changed", sxed_excal_update_adapt, NULL },
{ REMAIN_ENTRY , "changed", sxed_excal_update_adapt, NULL },
{ AUTOCREATE_OPT, "toggled", autocreate_toggled, NULL },
{ ADVANCE_OPT, "toggled", advance_toggle, (gpointer)ADVANCE_DAYS_SPIN },
@ -2234,10 +2256,10 @@ gnc_sxed_update_cal( SchedXactionEditorDialog *sxed )
lastInst = xaccSchedXactionGetLastOccurDate( sxed->sx );
if ( g_date_valid( lastInst )
&& g_date_valid( &d )
&& g_date_compare( lastInst, &d ) <= 0 ) {
&& g_date_compare( lastInst, &d ) != 0 ) {
d = *lastInst;
xaccFreqSpecGetNextInstance( fs, &d, &d );
}
xaccFreqSpecGetNextInstance( fs, &d, &d );
}
if ( !g_date_valid( &d ) ) {

View File

@ -1408,11 +1408,17 @@ cancel_check( GnomeDruidPage *druid_page,
for ( l = sxsld->createdTxnGUIDList; l; l = l->next ) {
t = xaccTransLookup( (GUID*)l->data,
gnc_get_current_book() );
g_assert( t );
xaccTransBeginEdit( t );
xaccTransDestroy( t );
xaccTransCommitEdit( t );
t = NULL;
/* we used to assert, but since we allow the user a
* register, they may have deleted 't' from their
* view. Thus, if we can't find it, don't die; fixes
* Bug#103182. */
if ( t != NULL )
{
xaccTransBeginEdit( t );
xaccTransDestroy( t );
xaccTransCommitEdit( t );
t = NULL;
}
}
}