Fix bad writing of invalid FreqSpec, then disable writing FreqSpecs altogether. :p

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16233 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Joshua Sled 2007-06-30 13:36:02 +00:00
parent 5c2e45dfef
commit 6ee471aee8
3 changed files with 38 additions and 25 deletions

View File

@ -174,29 +174,37 @@ gnc_freqSpec_dom_tree_create( FreqSpec *fs )
case INVALID: {
xmlSub = xmlNewNode( NULL, BAD_CAST "fs:none" );
xmlAddChild( ret, xmlSub );
} break;
case ONCE: {
xmlSub = xmlNewNode( NULL, BAD_CAST "fs:once" );
xmlAddChild( xmlSub,
gdate_to_dom_tree( "fs:date",
&fs->s.once.date ) );
if (!g_date_valid(&fs->s.once.date))
{
xmlSub = xmlNewNode(NULL, BAD_CAST "fs:none");
}
else
{
xmlSub = xmlNewNode( NULL, BAD_CAST "fs:once" );
xmlAddChild( xmlSub,
gdate_to_dom_tree( "fs:date",
&fs->s.once.date ) );
}
xmlAddChild( ret, xmlSub );
} break;
case DAILY: {
xmlSub = xmlNewNode( NULL, BAD_CAST "fs:daily" );
xmlAddChild( xmlSub,
guint_to_dom_tree(
"fs:interval",
fs->s.daily.interval_days )
);
xmlAddChild( xmlSub,
guint_to_dom_tree(
"fs:offset",
fs->s.daily.offset_from_epoch )
);
xmlAddChild( ret, xmlSub );
xmlSub = xmlNewNode( NULL, BAD_CAST "fs:daily" );
xmlAddChild( xmlSub,
guint_to_dom_tree(
"fs:interval",
fs->s.daily.interval_days )
);
xmlAddChild( xmlSub,
guint_to_dom_tree(
"fs:offset",
fs->s.daily.offset_from_epoch )
);
xmlAddChild( ret, xmlSub );
} break;
case WEEKLY: {

View File

@ -155,14 +155,14 @@ gnc_schedXaction_dom_tree_create(SchedXaction *sx)
GDate *date;
gint instCount;
const GUID *templ_acc_guid;
gboolean allow_incompat = TRUE;
gboolean allow_2_2_incompat = TRUE;
templ_acc_guid = xaccAccountGetGUID(sx->template_acct);
/* FIXME: this should be the same as the def in io-gncxml-v2.c */
ret = xmlNewNode( NULL, BAD_CAST GNC_SCHEDXACTION_TAG );
if (allow_incompat)
if (allow_2_2_incompat)
xmlSetProp(ret, BAD_CAST "version", BAD_CAST schedxaction_version2_string);
else
xmlSetProp(ret, BAD_CAST "version", BAD_CAST schedxaction_version_string);
@ -173,7 +173,7 @@ gnc_schedXaction_dom_tree_create(SchedXaction *sx)
xmlNewTextChild( ret, NULL, BAD_CAST SX_NAME, BAD_CAST xaccSchedXactionGetName(sx) );
if (allow_incompat)
if (allow_2_2_incompat)
{
xmlNewTextChild( ret, NULL, BAD_CAST SX_ENABLED,
BAD_CAST ( sx->enabled ? "y" : "n" ) );
@ -219,14 +219,17 @@ gnc_schedXaction_dom_tree_create(SchedXaction *sx)
guid_to_dom_tree(SX_TEMPL_ACCT,
templ_acc_guid));
/* output freq spec */
fsNode = xmlNewNode(NULL, BAD_CAST SX_FREQSPEC);
xmlAddChild( fsNode,
gnc_freqSpec_dom_tree_create(
if (!allow_2_2_incompat)
{
/* output freq spec */
fsNode = xmlNewNode(NULL, BAD_CAST SX_FREQSPEC);
xmlAddChild( fsNode,
gnc_freqSpec_dom_tree_create(
xaccSchedXactionGetFreqSpec(sx)) );
xmlAddChild( ret, fsNode );
xmlAddChild( ret, fsNode );
}
if (allow_incompat)
if (allow_2_2_incompat)
{
xmlNodePtr schedule_node = xmlNewNode(NULL, "sx:schedule");
GList *schedule = gnc_sx_get_schedule(sx);

View File

@ -220,6 +220,8 @@ TODO
- [ ] remove FreqSpec code
- [x] don't write FreqSpecs out.
- [ ] SX code
- [ ] engine