mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-12 17:32:00 -05:00
2001-07-30 Joshua Sled <jsled@asynchronous.org>
* src/gnome/glade/sched-xact.glade: Added seperate reminders dialog from since-last-run dialog. Removed reminders frame/section from since-last-run dialog. Added alternative SX Editor UI [not presently used]. * src/gnome/dialog-sxsincelast.c: Changes for reminders-as-seperate-dialog; selected reminders then update since-last-run dialog [whether it's open or not]; the dialogs [mostly] deal with their closing conditions correctly. Support for ad-hoc variables in template-transaction-split formulas. * src/engine/gnc-schedxaction-xml-v2.c (gnc_schedXaction_end_handler): Added support for restoring in-development pre-template-account-stored-in-SX change. (tt_act_handler): Added support for restoring in-devel pre-CIT .gml2/XMLv2 files. * src/gnc-exp-parser.c (gnc_exp_parser_parse_seperate_vars): Added for Scheduled-Transaction-related since-last-run/split-formula parsing. * src/gnome/dialog-sxsincelast.c: Added support for variable entry before creation/formulas in template transactions. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5058 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
1 parent
a1e4ca2cfe
commit
4017f68403
15 files changed
+2160
-478
No files matched your search
@@ -1,3 +1,29 @@
|
||||
2001-07-30 Joshua Sled <jsled@asynchronous.org>
|
||||
|
||||
* src/gnome/glade/sched-xact.glade: Added seperate reminders
|
||||
dialog from since-last-run dialog. Removed reminders
|
||||
frame/section from since-last-run dialog. Added alternative SX
|
||||
Editor UI [not presently used].
|
||||
|
||||
* src/gnome/dialog-sxsincelast.c: Changes for
|
||||
reminders-as-seperate-dialog; selected reminders then update
|
||||
since-last-run dialog [whether it's open or not]; the dialogs
|
||||
[mostly] deal with their closing conditions correctly. Support
|
||||
for ad-hoc variables in template-transaction-split formulas.
|
||||
|
||||
* src/engine/gnc-schedxaction-xml-v2.c
|
||||
(gnc_schedXaction_end_handler): Added support for restoring
|
||||
in-development pre-template-account-stored-in-SX change.
|
||||
(tt_act_handler): Added support for restoring in-devel pre-CIT
|
||||
.gml2/XMLv2 files.
|
||||
|
||||
* src/gnc-exp-parser.c (gnc_exp_parser_parse_seperate_vars): Added
|
||||
for Scheduled-Transaction-related since-last-run/split-formula
|
||||
parsing.
|
||||
|
||||
* src/gnome/dialog-sxsincelast.c: Added support for variable entry
|
||||
before creation/formulas in template transactions.
|
||||
|
||||
2001-07-28 Robert Graham Merkel <rgmerk@mira.net>
|
||||
|
||||
* src/engine/SchedXaction.{ch}: Store template account in the
|
||||
|
||||
@@ -3399,12 +3399,6 @@ xaccSRSaveChangedTemplateCells( SplitRegister *reg,
|
||||
gnc_numeric credit;
|
||||
gnc_numeric debit;
|
||||
|
||||
/* credit = xaccGetPriceCellValue(reg->creditCell); */
|
||||
/* debit = xaccGetPriceCellValue(reg->debitCell); */
|
||||
/* new_amount = gnc_numeric_sub_fixed (debit, credit); */
|
||||
|
||||
/* FIXME: the credit/debit cells are limited to
|
||||
numeric values by definition [and code]. Blegh. */
|
||||
DEBUG( "kvp_frame before: %s\n", kvp_frame_to_string( kvpf ) );
|
||||
|
||||
/* amountStr = gnc_numeric_to_string( new_amount ); */
|
||||
|
||||
+28
-13
@@ -13,9 +13,12 @@ X XMLv2 I/O
|
||||
X need policy for start-dates in GNCFrequency
|
||||
X fix GetNextInstance and GetInstanceAfter, mostly for composite FreqSpecs
|
||||
X also needs to deal with >28-mday values WRT last-occur date + multipliers
|
||||
X would like "don't even tell me you instantiated it, just fscking do
|
||||
it!" option for non-manual-conf SXes
|
||||
|
||||
##################################################
|
||||
### To-Do
|
||||
### '.' = to-do, 'X' = done
|
||||
##################################################
|
||||
|
||||
. Engine ...Init() functions should be private.
|
||||
@@ -41,18 +44,29 @@ X create a template register
|
||||
. need "since-last-run" UI for instanatiation.
|
||||
X/O create transactions
|
||||
X numeric
|
||||
. formula
|
||||
. need variable fill-in UI...
|
||||
. re-use gnome-sheet code for a variable-binding table?
|
||||
X formula
|
||||
X need variable fill-in UI...
|
||||
X re-use gnome-sheet code for a variable-binding table? -- ended up
|
||||
using GtkTable [for now?]
|
||||
. need way to expire/purge scheduled transactions which have no chance of
|
||||
being created [outside their end date; once-scheduled and past].
|
||||
. need 'reminders' of upcoming scheduled transactions during since-last-run
|
||||
. Is it sufficient to look at the next instance of ea. transaction only?
|
||||
. infrequent enough that a dialog should suffice.
|
||||
X need 'reminders' of upcoming scheduled transactions during since-last-run
|
||||
X Is it sufficient to look at the next instance of ea. transaction only?
|
||||
I think not... we probably want to look out until the transaction is
|
||||
outside the reminder range.
|
||||
. need some configuration for constantly-running GnuCash users of when to
|
||||
pop up the 'new scheduled transactions' dialog [option, time-of-day]
|
||||
. Should deal with "nothing-to-do" better [not even show up].
|
||||
. Should deal with "nothing-to-do" better [not even show up in the worst
|
||||
[read: no auto-notify/to-create/reminders] case].
|
||||
. Double-clicking on auto-create list should jump to transaction
|
||||
. register of first split?
|
||||
. double-clicking a reminder should [probably] move it up to the to-create
|
||||
list.
|
||||
X Easy UI way of moving through the SXes which need variable bindings.
|
||||
[This presently is: click "Ok" and the next clist row which needs
|
||||
bindings is selected.]
|
||||
. Need some way to defer to-create SXes.
|
||||
|
||||
. register mods
|
||||
. to see upcoming xactions, modifying future balance
|
||||
@@ -64,13 +78,10 @@ X create a template register
|
||||
not-yet-created transactions.
|
||||
. The ability to turn a non-recurring transaction into a recurring one...
|
||||
|
||||
X would like "don't even tell me you instantiated it, just fscking do
|
||||
it!" option for non-manual-conf SXes
|
||||
|
||||
|
||||
. deal better with formulas in template transactions [real FormulaCell]
|
||||
. recognize purely numeric template transactions and balance at
|
||||
template-creation time.
|
||||
. balance transaction via symbolic math?
|
||||
|
||||
. GNCFrequency
|
||||
. initial-settings synchronization [start date, optionmenus]
|
||||
@@ -82,7 +93,7 @@ X would like "don't even tell me you instantiated it, just fscking do
|
||||
|
||||
. SX Creation...
|
||||
. Creation occurs due to a variety of circumstances:
|
||||
. GnuCash starts and hasn't been run in some length of time; the
|
||||
X GnuCash starts and hasn't been run in some length of time; the
|
||||
transactions which have "come due" since the last run are available for
|
||||
creation.
|
||||
. A user opens a register with future transactions in it; they manually
|
||||
@@ -111,7 +122,9 @@ X would like "don't even tell me you instantiated it, just fscking do
|
||||
. reminder
|
||||
. lead-time
|
||||
|
||||
. Changes
|
||||
|
||||
|
||||
. [NOTES] Dealing with SX state-changes
|
||||
. Create-into-future vs. create-normal
|
||||
. into-future -> normal : no change; the last_occur date will be
|
||||
appropriate, and will catch up eventually [unless the have-been-created
|
||||
@@ -145,11 +158,13 @@ X would like "don't even tell me you instantiated it, just fscking do
|
||||
much whitespace on the two top panels]
|
||||
. Size/space issues.
|
||||
. Un-selecting "End Date" leaves calendar widget sensitive
|
||||
. 'ESC' while editing template register causes window to go away [badly].
|
||||
|
||||
. Scheduled Transaction List
|
||||
|
||||
. Since-last-run
|
||||
. always goes one date past the instantiation date.
|
||||
. tab-order on variable-entry window isn't always correct.
|
||||
X credit and debit seem reversed at instantiation time...
|
||||
. this is fixed, but is the fix correct?
|
||||
|
||||
@@ -166,7 +181,7 @@ X would like "don't even tell me you instantiated it, just fscking do
|
||||
staying around].
|
||||
. There probably wants to be a multi-month "example" View which the
|
||||
GNCFrequency can work with.
|
||||
. jalapeno[ben] has some thoughts on this...
|
||||
. jalapeno/ben has some thoughts on this...
|
||||
. Evolution calendar integ.
|
||||
. Evolution To-Do list integ. [SX reminders]
|
||||
|
||||
|
||||
+13
-15
@@ -69,13 +69,14 @@ xaccSchedXactionInit( SchedXaction *sx, GNCBook *book )
|
||||
sx->advanceCreateDays = 0;
|
||||
sx->advanceRemindDays = 0;
|
||||
|
||||
// sx->templateSplits = NULL;
|
||||
/* sx->templateSplits = NULL; */
|
||||
/* create a new template account for our splits */
|
||||
sx->template_acct = xaccMallocAccount();
|
||||
name = guid_to_string( &sx->guid );
|
||||
xaccAccountSetName( sx->template_acct, name );
|
||||
xaccAccountSetCommodity( sx->template_acct,
|
||||
gnc_commodity_new( "template", "template", "template", "template", 1 ) );
|
||||
gnc_commodity_new( "template", "template",
|
||||
"template", "template", 1 ) );
|
||||
g_free( name );
|
||||
xaccAccountSetType( sx->template_acct, BANK );
|
||||
ag = gnc_book_get_template_group( book );
|
||||
@@ -92,7 +93,6 @@ xaccSchedXactionMalloc( GNCBook *book )
|
||||
return sx;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sxprivtransactionListMapDelete( gpointer data, gpointer user_data )
|
||||
{
|
||||
@@ -196,14 +196,12 @@ xaccSchedXactionGetName( SchedXaction *sx )
|
||||
void
|
||||
xaccSchedXactionSetName( SchedXaction *sx, const gchar *newName )
|
||||
{
|
||||
GString *gstr;
|
||||
g_return_if_fail( newName != NULL );
|
||||
if ( sx->name != NULL ) {
|
||||
g_free( sx->name );
|
||||
sx->name = NULL;
|
||||
}
|
||||
gstr = g_string_new( newName );
|
||||
sx->name = gstr->str;
|
||||
g_string_free( gstr, FALSE );
|
||||
sx->name = g_strdup( newName );
|
||||
}
|
||||
|
||||
GDate*
|
||||
@@ -391,17 +389,17 @@ xaccSchedXactionGetNextInstance( SchedXaction *sx )
|
||||
} else {
|
||||
g_date_set_time( &last_occur, time(NULL) );
|
||||
}
|
||||
#endif // 0
|
||||
#endif /* 0 */
|
||||
|
||||
if ( g_date_valid( &sx->start_date )
|
||||
&& ! g_date_valid( &sx->last_date ) ) {
|
||||
// Think about this for a second, and you realize
|
||||
// that if the start date is _today_, we need a
|
||||
// last-occur date such that the 'next instance' is
|
||||
// after that date... one day should be good.
|
||||
//
|
||||
// This only holds for the first instance [read: if the
|
||||
// last[-occur]_date is invalid.
|
||||
/* Think about this for a second, and you realize
|
||||
* that if the start date is _today_, we need a
|
||||
* last-occur date such that the 'next instance' is
|
||||
* after that date... one day should be good.
|
||||
*
|
||||
* This only holds for the first instance [read: if the
|
||||
* last[-occur]_date is invalid. */
|
||||
g_date_subtract_days( &last_occur, 1 );
|
||||
}
|
||||
|
||||
|
||||
@@ -74,10 +74,10 @@ typedef struct gncp_SchedXaction {
|
||||
gboolean autoCreateOption;
|
||||
gboolean autoCreateNotify;
|
||||
gint advanceCreateDays;
|
||||
gint advanceRemindDays;
|
||||
gint advanceRemindDays;
|
||||
|
||||
Account *template_acct;
|
||||
GUID guid;
|
||||
GUID guid;
|
||||
kvp_frame *kvp_data;
|
||||
|
||||
|
||||
|
||||
@@ -1052,9 +1052,6 @@ gnc_numeric_to_string(gnc_numeric n) {
|
||||
|
||||
const gchar *
|
||||
string_to_gnc_numeric(const gchar* str, gnc_numeric *n) {
|
||||
/* Read a gnc_numeric from str, skipping any leading whitespace, and
|
||||
returning a pointer to just past the last byte read. Return NULL
|
||||
on error. */
|
||||
int num_read;
|
||||
long long int tmpnum;
|
||||
long long int tmpdenom;
|
||||
|
||||
@@ -158,6 +158,10 @@ gnc_numeric double_to_gnc_numeric(double in, gint64 denom,
|
||||
double gnc_numeric_to_double(gnc_numeric in);
|
||||
|
||||
gchar *gnc_numeric_to_string(gnc_numeric n);
|
||||
|
||||
/* Read a gnc_numeric from str, skipping any leading whitespace, and
|
||||
returning a pointer to just past the last byte read. Return NULL
|
||||
on error. */
|
||||
const gchar *string_to_gnc_numeric(const gchar* str, gnc_numeric *n);
|
||||
|
||||
#endif
|
||||
@@ -44,6 +44,8 @@
|
||||
#include "sixtp-dom-parsers.h"
|
||||
#include "SchedXaction.h"
|
||||
|
||||
static short module = MOD_SX;
|
||||
|
||||
/**
|
||||
* The XML output should look something like:
|
||||
* <gnc:count-data cd:type="schedXaction">XXX</gnc:count-data>
|
||||
@@ -143,9 +145,6 @@ gnc_schedXaction_dom_tree_create(SchedXaction *sx)
|
||||
|
||||
xmlNewTextChild( ret, NULL, SX_NAME, xaccSchedXactionGetName(sx) );
|
||||
|
||||
//xmlNewTextChild( ret, NULL, "sx:manual-conf",
|
||||
//(xaccSchedXactionGetManual(sx) == 1 ? "t" : "f") );
|
||||
|
||||
xmlNewTextChild( ret, NULL, SX_AUTOCREATE,
|
||||
( sx->autoCreateOption ? "y" : "n" ) );
|
||||
xmlNewTextChild( ret, NULL, SX_AUTOCREATE_NOTIFY,
|
||||
@@ -323,24 +322,6 @@ sx_freqspec_handler( xmlNodePtr node, gpointer sx )
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static
|
||||
gboolean
|
||||
sx_manualConf_handler( xmlNodePtr node, gpointer sx )
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
tmp = dom_tree_to_text( node );
|
||||
g_return_val_if_fail( tmp, FALSE );
|
||||
|
||||
xaccSchedXactionSetManual( (SchedXaction*)sx,
|
||||
safe_strcmp(tmp, "t") == 0 );
|
||||
|
||||
g_free(tmp);
|
||||
return TRUE;
|
||||
}
|
||||
#endif //0
|
||||
|
||||
static
|
||||
gboolean
|
||||
sx_numOccur_handler( xmlNodePtr node, gpointer sx )
|
||||
@@ -408,7 +389,7 @@ struct dom_tree_handler sx_dom_handlers[] = {
|
||||
{ SX_NUM_OCCUR, sx_numOccur_handler, 0, 0 },
|
||||
{ SX_REM_OCCUR, sx_remOccur_handler, 0, 0 },
|
||||
{ SX_END, sx_end_handler, 0, 0 },
|
||||
{ SX_TEMPL_ACCT, sx_templ_acct_handler, 1, 0 },
|
||||
{ SX_TEMPL_ACCT, sx_templ_acct_handler, 0, 0 },
|
||||
{ SX_FREQSPEC, sx_freqspec_handler, 1, 0 },
|
||||
{ SX_SLOTS, sx_slots_handler, 0, 0 },
|
||||
};
|
||||
@@ -437,6 +418,15 @@ gnc_schedXaction_end_handler(gpointer data_for_children,
|
||||
|
||||
sx = xaccSchedXactionMalloc( NULL );
|
||||
|
||||
/* FIXME: this should be removed somewhere near 1.8 release time. */
|
||||
{
|
||||
/* This is the just-created template acct. It can safely be
|
||||
removed, as we either will find or don't have a relevent
|
||||
template_acct. */
|
||||
xaccAccountDestroy( sx->template_acct );
|
||||
sx->template_acct = NULL;
|
||||
}
|
||||
|
||||
successful = dom_tree_generic_parse( tree, sx_dom_handlers, sx );
|
||||
|
||||
if ( successful ) {
|
||||
@@ -446,6 +436,40 @@ gnc_schedXaction_end_handler(gpointer data_for_children,
|
||||
xaccSchedXactionFree( sx );
|
||||
}
|
||||
|
||||
/* FIXME: this should be removed somewhere near 1.8 release time. */
|
||||
if ( sx->template_acct == NULL )
|
||||
{
|
||||
AccountGroup *ag;
|
||||
char *id;
|
||||
Account *acct;
|
||||
|
||||
ag = acct = id = NULL;
|
||||
|
||||
/* We're dealing with a pre-200107<near-end-of-month> rgmerk
|
||||
change re: storing template accounts. */
|
||||
/* Fix: get account with name of our GUID from the template
|
||||
accounts group. Make that our template_acct pointer. */
|
||||
id = guid_to_string( xaccSchedXactionGetGUID( sx ) );
|
||||
ag = gnc_book_get_template_group( ((sixtp_gdv2*)gdata->data)->book );
|
||||
if ( ag == NULL )
|
||||
{
|
||||
PERR( "Error getting template account group from being-parsed Book." );
|
||||
xmlFreeNode( tree );
|
||||
return FALSE;
|
||||
}
|
||||
acct = xaccGetAccountFromName( ag, id );
|
||||
if ( acct == NULL )
|
||||
{
|
||||
PERR( "Error getting template account with name \"%s\"", id );
|
||||
xmlFreeNode( tree );
|
||||
return FALSE;
|
||||
}
|
||||
DEBUG( "Got template account with name \"%s\" for SX with GUID \"%s\"",
|
||||
xaccAccountGetName( acct ), id );
|
||||
/* FIXME: free existing template account. */
|
||||
sx->template_acct = acct;
|
||||
}
|
||||
|
||||
xmlFreeNode( tree );
|
||||
|
||||
return successful;
|
||||
@@ -459,14 +483,33 @@ gnc_schedXaction_sixtp_parser_create(void)
|
||||
|
||||
static
|
||||
gboolean
|
||||
tt_act_handler( xmlNodePtr node, gpointer data)
|
||||
tt_act_handler( xmlNodePtr node, gpointer data )
|
||||
{
|
||||
gnc_template_xaction_data *txd = data;
|
||||
Account *acc;
|
||||
gnc_commodity *com;
|
||||
|
||||
acc = dom_tree_to_account( node );
|
||||
|
||||
if ( acc == NULL ) {
|
||||
return FALSE;
|
||||
} else {
|
||||
/* Check for the lack of a commodity [signifying that the
|
||||
pre-7/11/2001-CIT-change SX template Account was parsed [but
|
||||
incorrectly]. */
|
||||
if ( xaccAccountGetCommodity( acc ) == NULL ) {
|
||||
/* FIXME: This should first look in the table of the
|
||||
book, maybe? The right thing happens [WRT file
|
||||
load/save] if we just _new all the time, but it
|
||||
doesn't seem right. This whole block should go
|
||||
away at some point, but the same concern still
|
||||
applies for
|
||||
SchedXaction.c:xaccSchedXactionInit... */
|
||||
com = gnc_commodity_new( "template", "template",
|
||||
"template", "template", 1 );
|
||||
xaccAccountSetCommodity( acc, com );
|
||||
}
|
||||
|
||||
txd->accts = g_list_append( txd->accts, acc );
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -153,19 +153,24 @@ Use: Storage for the various fields of a scheduled transaction's
|
||||
|
||||
Name: sched-xaction/xfrm
|
||||
Type: GUID
|
||||
Entities: Split
|
||||
Entities: Split associated with a SchedXaction
|
||||
Use: The GUID of this Split's xfrm account.
|
||||
|
||||
Name: sched-xaction/amnt
|
||||
Type: string
|
||||
Entities: Split in a SchedXaction
|
||||
Entities: Split associated with a SchedXaction
|
||||
Use: The amount field of a SchedXaction might be a formula, which we
|
||||
store here.
|
||||
|
||||
Name: from-sched-xaction
|
||||
Type: GUID
|
||||
Entities: Transaction
|
||||
Use: Identifies that the Transaction was created from a ScheduledTransaction,
|
||||
and stores the GUID of that SX.
|
||||
|
||||
Name: user-keys
|
||||
Type: frame
|
||||
Entities: All
|
||||
Use: This frame is used to store keys which are editable directly by
|
||||
the user. The program should not attach any semantics to keys
|
||||
under this frame.
|
||||
|
||||
+54
-7
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#include <glib.h>
|
||||
#include <guile/gh.h>
|
||||
|
||||
#include "finproto.h"
|
||||
@@ -253,7 +254,7 @@ gnc_exp_parser_set_value (const char * variable_name, gnc_numeric value)
|
||||
|
||||
key = g_strdup (variable_name);
|
||||
|
||||
pnum = g_new(ParserNum, 1);
|
||||
pnum = g_new0(ParserNum, 1);
|
||||
pnum->value = value;
|
||||
|
||||
g_hash_table_insert (variable_bindings, key, pnum);
|
||||
@@ -269,7 +270,7 @@ make_predefined_vars_helper (gpointer key, gpointer value, gpointer data)
|
||||
|
||||
var = g_new0 (var_store, 1);
|
||||
|
||||
pnum = g_new (ParserNum, 1);
|
||||
pnum = g_new0 (ParserNum, 1);
|
||||
*pnum = *pnum_old;
|
||||
|
||||
var->variable_name = g_strdup(key);
|
||||
@@ -279,6 +280,16 @@ make_predefined_vars_helper (gpointer key, gpointer value, gpointer data)
|
||||
*vars_p = var;
|
||||
}
|
||||
|
||||
static void
|
||||
make_predefined_vars_from_external_helper( gpointer key, gpointer value, gpointer data )
|
||||
{
|
||||
ParserNum *pnum = g_new0( ParserNum, 1 );
|
||||
if ( value != NULL )
|
||||
pnum->value = *(gnc_numeric*)value;
|
||||
|
||||
make_predefined_vars_helper( key, pnum, data );
|
||||
}
|
||||
|
||||
static var_store_ptr
|
||||
make_predefined_variables (void)
|
||||
{
|
||||
@@ -354,7 +365,7 @@ numeric_ops(char op_sym,
|
||||
if ((left == NULL) || (right == NULL))
|
||||
return NULL;
|
||||
|
||||
result = (op_sym == ASN_OP) ? left : g_new(ParserNum, 1);
|
||||
result = (op_sym == ASN_OP) ? left : g_new0(ParserNum, 1);
|
||||
|
||||
switch (op_sym)
|
||||
{
|
||||
@@ -396,8 +407,16 @@ negate_numeric(void *value)
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_exp_parser_parse (const char * expression, gnc_numeric *value_p,
|
||||
char **error_loc_p)
|
||||
gnc_exp_parser_parse( const char * expression, gnc_numeric *value_p,
|
||||
char **error_loc_p )
|
||||
{
|
||||
return gnc_exp_parser_parse_seperate_vars( expression, value_p,
|
||||
error_loc_p, NULL );
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_exp_parser_parse_seperate_vars (const char * expression, gnc_numeric *value_p,
|
||||
char **error_loc_p, GHashTable *varHash )
|
||||
{
|
||||
parser_env_ptr pe;
|
||||
var_store_ptr vars;
|
||||
@@ -417,6 +436,11 @@ gnc_exp_parser_parse (const char * expression, gnc_numeric *value_p,
|
||||
result.next_var = NULL;
|
||||
|
||||
vars = make_predefined_variables ();
|
||||
|
||||
if ( varHash != NULL ) {
|
||||
g_hash_table_foreach( varHash, make_predefined_vars_from_external_helper, &vars);
|
||||
}
|
||||
|
||||
lc = gnc_localeconv ();
|
||||
|
||||
pe = init_parser (vars, *lc->mon_decimal_point, *lc->mon_thousands_sep,
|
||||
@@ -460,8 +484,31 @@ gnc_exp_parser_parse (const char * expression, gnc_numeric *value_p,
|
||||
last_error = get_parse_error (pe);
|
||||
}
|
||||
|
||||
update_variables (vars);
|
||||
update_variables (parser_get_vars (pe));
|
||||
if ( varHash != NULL ) {
|
||||
var_store_ptr newVars;
|
||||
gpointer maybeKey, maybeValue;
|
||||
gnc_numeric *numericValue;
|
||||
|
||||
newVars = parser_get_vars( pe );
|
||||
for ( ; newVars ; newVars = newVars->next_var ) {
|
||||
pnum = newVars->value;
|
||||
if ( g_hash_table_lookup_extended( varHash, newVars->variable_name,
|
||||
&maybeKey, &maybeValue ) ) {
|
||||
g_hash_table_remove( varHash, maybeKey );
|
||||
g_free( maybeKey );
|
||||
g_free( maybeValue );
|
||||
}
|
||||
numericValue = g_new0( gnc_numeric, 1 );
|
||||
*numericValue = ((ParserNum*)newVars->value)->value;
|
||||
numericValue = NULL;
|
||||
g_hash_table_insert( varHash,
|
||||
g_strdup(newVars->variable_name),
|
||||
numericValue );
|
||||
}
|
||||
} else {
|
||||
update_variables (vars);
|
||||
update_variables (parser_get_vars (pe));
|
||||
}
|
||||
|
||||
free_predefined_variables (vars);
|
||||
|
||||
|
||||
+17
-6
@@ -26,13 +26,13 @@
|
||||
|
||||
#include "gnc-numeric.h"
|
||||
|
||||
|
||||
/* Initialize the expression parser. If this function is not
|
||||
* called before one of the other parsing routines (other than
|
||||
* gnc_exp_parser_shutdown), it will be called if needed. */
|
||||
* gnc_exp_parser_shutdown), it will be called if needed.
|
||||
*/
|
||||
void gnc_exp_parser_init (void);
|
||||
|
||||
/* Shutdown the expression parser and free any associated memory. */
|
||||
/* Shutdown the expression parser and free any associated memory in the ParserState. */
|
||||
void gnc_exp_parser_shutdown (void);
|
||||
|
||||
/* Return a list of variable names which are currently defined
|
||||
@@ -54,7 +54,8 @@ gboolean gnc_exp_parser_get_value (const char * variable_name,
|
||||
|
||||
/* Set the value of the variable to the given value. If the variable is
|
||||
* not already defined, it will be after the call. */
|
||||
void gnc_exp_parser_set_value (const char * variable_name, gnc_numeric value);
|
||||
void gnc_exp_parser_set_value (const char * variable_name,
|
||||
gnc_numeric value);
|
||||
|
||||
/* Parse the given expression using the current variable definitions.
|
||||
* If the parse was successful, return TRUE and, if value_p is
|
||||
@@ -63,8 +64,18 @@ void gnc_exp_parser_set_value (const char * variable_name, gnc_numeric value);
|
||||
* returned and error_loc_p is non-NULL, *error_loc_p is set to the
|
||||
* character in expression where parsing aborted. If TRUE is returned
|
||||
* and error_loc_p is non-NULL, *error_loc_p is set to NULL. */
|
||||
gboolean gnc_exp_parser_parse (const char * expression, gnc_numeric *value_p,
|
||||
char **error_loc_p);
|
||||
gboolean gnc_exp_parser_parse (const char * expression,
|
||||
gnc_numeric *value_p,
|
||||
char **error_loc_p );
|
||||
|
||||
/* Parses as per gnc_exp_parser_parse, but with an optional last argument
|
||||
* dealing with a non-shared variable list and state, local to the expression
|
||||
* being parsed. This is a hashTable of variable names mapping to
|
||||
* gnc_numeric pointers. */
|
||||
gboolean gnc_exp_parser_parse_seperate_vars (const char * expression,
|
||||
gnc_numeric *value_p,
|
||||
char **error_loc_p,
|
||||
GHashTable *varHash );
|
||||
|
||||
/* If the last parse returned FALSE, return an error string describing
|
||||
* the problem. Otherwise, return NULL. */
|
||||
|
||||
@@ -351,8 +351,6 @@ scheduledxaction_editor_dialog_destroy(GtkObject *object, gpointer data)
|
||||
gtk_widget_destroy( sxed->dialog );
|
||||
sxed->sx = NULL;
|
||||
|
||||
/* xaccAccountDestroy( sxed->tmpAcct ); */
|
||||
|
||||
g_free(sxed);
|
||||
}
|
||||
|
||||
@@ -485,7 +483,7 @@ gnc_ui_scheduled_xaction_editor_dialog_create( SchedXactionDialog *sxd,
|
||||
} widgets[] = {
|
||||
{ "ok_button", "clicked", editor_ok_button_clicked, NULL },
|
||||
{ "cancel_button", "clicked", editor_close_button_clicked, NULL },
|
||||
{ "help_button", "clicked", editor_help_button_clicked, NULL},
|
||||
{ "help_button", "clicked", editor_help_button_clicked, NULL},
|
||||
|
||||
{ "rb_enddate", "toggled", endgroup_rb_toggled, (gpointer)END_OPTION },
|
||||
{ "rb_num_occur", "toggled", endgroup_rb_toggled, (gpointer)NUM_OCCUR_OPTION },
|
||||
|
||||
+1011
-311
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -360,7 +360,35 @@ gchar *s = N_("Date");
|
||||
gchar *s = N_("To-create...");
|
||||
gchar *s = N_("Name");
|
||||
gchar *s = N_("Date");
|
||||
gchar *s = N_("Ready?");
|
||||
gchar *s = N_("Variables");
|
||||
gchar *s = N_("Value");
|
||||
gchar *s = N_("Variable");
|
||||
gchar *s = N_("Edit Scheduled Transaction");
|
||||
gchar *s = N_("Name:");
|
||||
gchar *s = N_("Conditional on splits not having variables");
|
||||
gchar *s = N_("Create Automatically");
|
||||
gchar *s = N_("Notify me when created");
|
||||
gchar *s = N_("Create ");
|
||||
gchar *s = N_(" days in advance");
|
||||
gchar *s = N_("Remind me ");
|
||||
gchar *s = N_(" days in advance");
|
||||
gchar *s = N_("Creation Options");
|
||||
gchar *s = N_("No End");
|
||||
gchar *s = N_("End Date: ");
|
||||
gchar *s = N_("Number of Occurances:");
|
||||
gchar *s = N_("End");
|
||||
gchar *s = N_("Recurrence Frequency");
|
||||
gchar *s = N_("Recurrance Frequency");
|
||||
gchar *s = N_("Record");
|
||||
gchar *s = N_("REPLACEME with the Register control box");
|
||||
gchar *s = N_("Template Transactions");
|
||||
gchar *s = N_("Reminders");
|
||||
gchar *s = N_("The listed Scheduled Transactions are to-be created soon. \n"
|
||||
"Select any which you would\n"
|
||||
"like to create now, and click\n"
|
||||
"\"OK\" to create them.");
|
||||
gchar *s = N_("Reminders...");
|
||||
gchar *s = N_("Name");
|
||||
gchar *s = N_("Next Date");
|
||||
gchar *s = N_("Days");
|
||||
Reference in new issue
Block a user