Globally replace the words "exchange_code" with cusip in the

source. No user visible changes.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13213 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2006-02-11 20:00:52 +00:00
parent 1f61299d0d
commit cdc686ecb5
17 changed files with 109 additions and 95 deletions

View File

@ -1,3 +1,19 @@
2006-02-11 David Hampton <hampton@employees.org>
* src/backend/file/test/test-xml-commodity.c:
* src/backend/file/gnc-commodity-xml-v2.c:
* src/backend/postgres/table.m4:
* src/import-export/ofx/gnc-ofx-import.c:
* src/import-export/import-commodity-matcher.[ch]:
* src/gnome-utils/gnc-tree-view-commodity.c:
* src/gnome-utils/gnc-tree-model-commodity.[ch]:
* src/gnome-utils/dialog-commodity.[ch]:
* src/engine/gw-engine-spec.scm:
* src/engine/test-core/test-engine-stuff.c:
* src/engine/test/test-commodities.c:
* src/engine/gnc-commodity.[ch]: Globally replace the words
"exchange_code" with cusip in the source. No user visible changes.
2006-02-11 Christian Stimming <stimming@tuhh.de>
* po/Makevars: Add --keyword=Q_ to xgettext arguments so that

View File

@ -81,12 +81,12 @@ gnc_commodity_dom_tree_create(const gnc_commodity *com)
gnc_commodity_get_fullname(com)));
}
if(gnc_commodity_get_exchange_code(com) &&
strlen(gnc_commodity_get_exchange_code(com)) > 0)
if(gnc_commodity_get_cusip(com) &&
strlen(gnc_commodity_get_cusip(com)) > 0)
{
xmlAddChild(ret, text_to_dom_tree(
cmdty_xcode,
gnc_commodity_get_exchange_code(com)));
gnc_commodity_get_cusip(com)));
}
xmlAddChild(ret, int_to_dom_tree(cmdty_fraction,
@ -117,7 +117,7 @@ struct com_char_handler com_handlers[] = {
{ cmdty_namespace, gnc_commodity_set_namespace },
{ cmdty_id, gnc_commodity_set_mnemonic },
{ cmdty_name, gnc_commodity_set_fullname },
{ cmdty_xcode, gnc_commodity_set_exchange_code },
{ cmdty_xcode, gnc_commodity_set_cusip },
{ cmdty_quote_tz, gnc_commodity_set_quote_tz },
{ 0, 0 }
};

View File

@ -76,7 +76,7 @@ node_and_commodity_equal(xmlNodePtr node, const gnc_commodity *com)
else if(safe_strcmp((char*)mark->name, "cmdty:xcode") == 0)
{
if(!equals_node_val_vs_string(
mark, gnc_commodity_get_exchange_code(com)))
mark, gnc_commodity_get_cusip(com)))
{
return "exchange codes differ";
}

View File

@ -62,7 +62,7 @@ define(`modity', `gncCommodity, Commodity, gnc_commodity, c,
namespace, , char *, gnc_commodity_get_namespace(ptr),
fullname, , char *, gnc_commodity_get_fullname(ptr),
mnemonic, , char *, gnc_commodity_get_mnemonic(ptr),
code, , char *, gnc_commodity_get_exchange_code(ptr),
code, , char *, gnc_commodity_get_cusip(ptr),
fraction, , int32, gnc_commodity_get_fraction(ptr),
commodity, KEY, char *, gnc_commodity_get_unique_name(ptr),
')

View File

@ -55,7 +55,7 @@ struct gnc_commodity_s
char * fullname;
char * mnemonic;
char * printname;
char * exchange_code; /* CUSIP or other identifying code */
char * cusip; /* CUSIP or other identifying code */
int fraction;
char * unique_name;
gint16 mark; /* user-defined mark, handy for traversals */
@ -502,8 +502,7 @@ reset_unique_name(gnc_commodity *com)
gnc_commodity *
gnc_commodity_new(QofBook *book, const char * fullname,
const char * namespace, const char * mnemonic,
const char * exchange_code,
int fraction)
const char * cusip, int fraction)
{
gnc_commodity * retval = g_new0(gnc_commodity, 1);
gnc_commodity_table *table;
@ -520,7 +519,7 @@ gnc_commodity_new(QofBook *book, const char * fullname,
retval->fullname = CACHE_INSERT(fullname);
retval->mnemonic = CACHE_INSERT(mnemonic);
retval->exchange_code = CACHE_INSERT(exchange_code);
retval->cusip = CACHE_INSERT(cusip);
retval->fraction = fraction;
retval->mark = 0;
retval->quote_flag = 0;
@ -548,7 +547,7 @@ gnc_commodity_destroy(gnc_commodity * cm)
/* Set at creation */
CACHE_REMOVE (cm->fullname);
CACHE_REMOVE (cm->exchange_code);
CACHE_REMOVE (cm->cusip);
CACHE_REMOVE (cm->mnemonic);
CACHE_REMOVE (cm->quote_tz);
cm->namespace = NULL;
@ -575,7 +574,7 @@ gnc_commodity_copy(gnc_commodity * dest, gnc_commodity *src)
gnc_commodity_set_fullname (dest, src->fullname);
dest->namespace = src->namespace;
gnc_commodity_set_fraction (dest, src->fraction);
gnc_commodity_set_exchange_code (dest, src->exchange_code);
gnc_commodity_set_cusip (dest, src->cusip);
gnc_commodity_set_quote_flag (dest, src->quote_flag);
gnc_commodity_set_quote_source (dest, gnc_commodity_get_quote_source (src));
gnc_commodity_set_quote_tz (dest, src->quote_tz);
@ -588,7 +587,7 @@ gnc_commodity_clone(gnc_commodity *src)
dest->fullname = CACHE_INSERT(src->fullname);
dest->mnemonic = CACHE_INSERT(src->mnemonic);
dest->exchange_code = CACHE_INSERT(src->exchange_code);
dest->cusip = CACHE_INSERT(src->cusip);
dest->quote_tz = CACHE_INSERT(src->quote_tz);
dest->namespace = src->namespace;
@ -671,14 +670,14 @@ gnc_commodity_get_unique_name(const gnc_commodity * cm)
/********************************************************************
* gnc_commodity_get_exchange_code
* gnc_commodity_get_cusip
********************************************************************/
const char *
gnc_commodity_get_exchange_code(const gnc_commodity * cm)
gnc_commodity_get_cusip(const gnc_commodity * cm)
{
if(!cm) return NULL;
return cm->exchange_code;
return cm->cusip;
}
/********************************************************************
@ -807,18 +806,18 @@ gnc_commodity_set_fullname(gnc_commodity * cm, const char * fullname)
}
/********************************************************************
* gnc_commodity_set_exchange_code
* gnc_commodity_set_cusip
********************************************************************/
void
gnc_commodity_set_exchange_code(gnc_commodity * cm,
const char * exchange_code)
gnc_commodity_set_cusip(gnc_commodity * cm,
const char * cusip)
{
if(!cm) return;
if(cm->exchange_code == exchange_code) return;
if(cm->cusip == cusip) return;
CACHE_REMOVE (cm->exchange_code);
cm->exchange_code = CACHE_INSERT (exchange_code);
CACHE_REMOVE (cm->cusip);
cm->cusip = CACHE_INSERT (cusip);
mark_commodity_dirty(cm);
}
@ -943,10 +942,9 @@ gnc_commodity_equal(const gnc_commodity * a, const gnc_commodity * b)
return FALSE;
}
if (safe_strcmp(a->exchange_code, b->exchange_code) != 0)
if (safe_strcmp(a->cusip, b->cusip) != 0)
{
DEBUG ("exchange codes differ: %s vs %s",
a->exchange_code, b->exchange_code);
DEBUG ("cusips differ: %s vs %s", a->cusip, b->cusip);
return FALSE;
}

View File

@ -248,9 +248,9 @@ const char *gnc_quote_source_get_old_internal_name (gnc_quote_source *source);
* match the stock ticker symbol used by the exchange where you want
* to get automatic stock quote updates. E.G. ACME, ACME.US, etc.
*
* @param exchange_code A string containing the CUSIP code or similar
* @param cusip A string containing the CUSIP code or similar
* UNIQUE code for this commodity. The stock ticker is NOT
* appropriate.
* appropriate as that goes in the mnemonic field.
*
* @param fraction The smallest division of this commodity
* allowed. I.E. If this is 1, then the commodity must be traded in
@ -263,7 +263,7 @@ gnc_commodity * gnc_commodity_new(QofBook *book,
const char * fullname,
const char * namespace,
const char * mnemonic,
const char * exchange_code,
const char * cusip,
int fraction);
/** Destroy a commodity. Release all memory attached to this data structure.
@ -356,7 +356,7 @@ const char * gnc_commodity_get_printname(const gnc_commodity * cm);
* string is owned by the engine and should not be freed by the
* caller.
*/
const char * gnc_commodity_get_exchange_code(const gnc_commodity * cm);
const char * gnc_commodity_get_cusip(const gnc_commodity * cm);
/** Retrieve the 'unique' name for the specified commodity. This will
* be a pointer to a null terminated string of the form "AMEX::ACME",
@ -480,11 +480,11 @@ void gnc_commodity_set_fullname(gnc_commodity * cm, const char * fullname);
*
* @param cm A pointer to a commodity data structure.
*
* @param exchange_code A pointer to the full name for this commodity. This
* string belongs to the caller and will be duplicated by the engine.
* @param cusip A pointer to the cusip or other exchange specific
* data for this commodity. This string belongs to the caller and
* will be duplicated by the engine.
*/
void gnc_commodity_set_exchange_code(gnc_commodity * cm,
const char * exchange_code);
void gnc_commodity_set_cusip(gnc_commodity * cm, const char * cusip);
/** Set the fraction for the specified commodity. This should be
* an integer value specifying the number of fractional units that

View File

@ -2065,9 +2065,9 @@ of having a parent transaction with which one is working...")
ws
'gnc:commodity-get-exchange-code
'(<gw:mchars> callee-owned const)
"gnc_commodity_get_exchange_code"
"gnc_commodity_get_cusip"
'((<gnc:commodity*> comm))
"Get the exchange code (ISO numeric code)")
"Get the cusip (exchange specific data, not the stock ticker)")
(gw:wrap-function
ws

View File

@ -587,7 +587,7 @@ make_random_changes_to_commodity (gnc_commodity *com)
g_free (str);
str = get_random_string ();
gnc_commodity_set_exchange_code (com, str);
gnc_commodity_set_cusip (com, str);
g_free (str);
gnc_commodity_set_fraction (com, get_random_int_in_range (1, 100000));

View File

@ -51,7 +51,7 @@ test_commodity(void)
char *fullname;
const char *namespace;
char *mnemonic;
char *exchange_code;
char *cusip;
int fraction;
gnc_commodity *com2;
QofBook *book;
@ -60,11 +60,11 @@ test_commodity(void)
fullname = get_random_string();
namespace = get_random_commodity_namespace();
mnemonic = get_random_string();
exchange_code = get_random_string();
cusip = get_random_string();
fraction = get_random_int_in_range(0, 10000);
com = gnc_commodity_new(book, fullname, namespace, mnemonic,
exchange_code, fraction);
cusip, fraction);
do_test(
com != NULL, "commodity with data new and destroy");
@ -82,8 +82,8 @@ test_commodity(void)
"mnemonic equal test");
do_test(
safe_strcmp(exchange_code, gnc_commodity_get_exchange_code(com)) == 0,
"exchange code equal test");
safe_strcmp(cusip, gnc_commodity_get_cusip(com)) == 0,
"cusip equal test");
do_test(
gnc_commodity_get_fraction(com) == fraction,
@ -107,11 +107,11 @@ test_commodity(void)
safe_strcmp(mnemonic, gnc_commodity_get_mnemonic(com)) == 0,
"reset mnemonic equal test");
exchange_code = get_random_string();
gnc_commodity_set_exchange_code(com, exchange_code);
cusip = get_random_string();
gnc_commodity_set_cusip(com, cusip);
do_test(
safe_strcmp(exchange_code, gnc_commodity_get_exchange_code(com)) == 0,
"reset exchange code equal test");
safe_strcmp(cusip, gnc_commodity_get_cusip(com)) == 0,
"reset cusip equal test");
fraction = get_random_int_in_range(0, 10000);
gnc_commodity_set_fraction(com, fraction);
@ -120,7 +120,7 @@ test_commodity(void)
"reset fraction code equal test");
com2 = gnc_commodity_new(book, fullname, namespace, mnemonic,
exchange_code, fraction);
cusip, fraction);
do_test(
gnc_commodity_equiv(com, com2), "commodity equiv");

View File

@ -59,7 +59,7 @@ struct select_commodity_window {
gnc_commodity * selection;
const char * default_exchange_code;
const char * default_cusip;
const char * default_fullname;
const char * default_mnemonic;
int default_fraction;
@ -134,7 +134,7 @@ gnc_ui_select_commodity_modal_full(gnc_commodity * orig_sel,
GtkWidget * parent,
dialog_commodity_mode mode,
const char * user_message,
const char * code,
const char * cusip,
const char * fullname,
const char * mnemonic)
{
@ -146,7 +146,7 @@ gnc_ui_select_commodity_modal_full(gnc_commodity * orig_sel,
gint value;
win = gnc_ui_select_commodity_create(orig_sel, mode);
win->default_exchange_code=code;
win->default_cusip=cusip;
win->default_fullname=fullname;
win->default_mnemonic=mnemonic;
@ -155,7 +155,7 @@ gnc_ui_select_commodity_modal_full(gnc_commodity * orig_sel,
if (user_message != NULL)
initial = user_message;
else if ((code != NULL) || (fullname != NULL) || (mnemonic != NULL))
else if ((cusip != NULL) || (fullname != NULL) || (mnemonic != NULL))
initial = _("\nPlease select a commodity to match:");
else
initial = "";
@ -165,8 +165,8 @@ gnc_ui_select_commodity_modal_full(gnc_commodity * orig_sel,
initial,
fullname ? _("\nCommodity: ") : "",
fullname ? fullname : "",
code ? _("\nExchange code (CUSIP or similar): ") : "",
code ? code : "",
cusip ? _("\nExchange code (CUSIP or similar): ") : "",
cusip ? cusip : "",
mnemonic ? _("\nMnemonic(Ticker symbol or similar): ") : "",
mnemonic ? mnemonic : "");
gtk_label_set_text ((GtkLabel *)(win->select_user_prompt),
@ -303,7 +303,7 @@ gnc_ui_select_commodity_new_cb(GtkButton * button,
const gnc_commodity * new_commodity =
gnc_ui_new_commodity_modal_full(namespace,
w->dialog,
w->default_exchange_code,
w->default_cusip,
w->default_fullname,
w->default_mnemonic,
w->default_fraction);
@ -486,7 +486,7 @@ gnc_ui_select_commodity_response_cb (GtkDialog * dialog, gint response, gpointer
commodity = gnc_ui_new_commodity_modal_full (namespace,
w->dialog,
w->default_exchange_code,
w->default_cusip,
w->default_fullname,
w->default_mnemonic,
w->default_fraction);
@ -975,7 +975,7 @@ static gnc_commodity *
gnc_ui_common_commodity_modal(gnc_commodity *commodity,
GtkWidget * parent,
const char * namespace,
const char * code,
const char * cusip,
const char * fullname,
const char * mnemonic,
int fraction)
@ -992,7 +992,7 @@ gnc_ui_common_commodity_modal(gnc_commodity *commodity,
namespace = gnc_commodity_get_namespace (commodity);
fullname = gnc_commodity_get_fullname (commodity);
mnemonic = gnc_commodity_get_mnemonic (commodity);
code = gnc_commodity_get_exchange_code (commodity);
cusip = gnc_commodity_get_cusip (commodity);
fraction = gnc_commodity_get_fraction (commodity);
} else {
/* Not allowed to create new currencies */
@ -1002,7 +1002,7 @@ gnc_ui_common_commodity_modal(gnc_commodity *commodity,
}
win = gnc_ui_new_commodity_dialog(namespace, parent, fullname,
mnemonic, code, fraction);
mnemonic, cusip, fraction);
/* Update stock quote info based on existing commodity */
gnc_ui_commodity_update_quote_info(win, commodity);
@ -1047,7 +1047,7 @@ gnc_ui_common_commodity_modal(gnc_commodity *commodity,
gnc_commodity *
gnc_ui_new_commodity_modal_full(const char * namespace,
GtkWidget * parent,
const char * exchange_code,
const char * cusip,
const char * fullname,
const char * mnemonic,
int fraction)
@ -1056,7 +1056,7 @@ gnc_ui_new_commodity_modal_full(const char * namespace,
ENTER(" ");
result = gnc_ui_common_commodity_modal(NULL, parent, namespace, fullname,
mnemonic, exchange_code, 10000);
mnemonic, cusip, 10000);
LEAVE(" ");
return result;
}
@ -1160,7 +1160,7 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
gnc_commodity_set_fullname (c, fullname);
gnc_commodity_set_mnemonic (c, mnemonic);
gnc_commodity_set_namespace (c, namespace);
gnc_commodity_set_exchange_code (c, code);
gnc_commodity_set_cusip (c, code);
gnc_commodity_set_fraction (c, fraction);
}

View File

@ -81,9 +81,10 @@ void gnc_ui_commodity_set_help_callback (gnc_commodity_help_callback cb);
* the dialog box as an instruction to the user. If NULL, a generic
* instruction will be used.
*
* @param exchange_code If present, a note will be added to the user
* @param cusip If present, a note will be added to the user
* instruction providing this exchange specific code, and this will
* be the default exchange code for any newly created commodities.
* be the default exchange specific data for any newly created
* commodities.
*
* @param fullname If present, a note will be added to the user
* instruction providing this commodity's full name, and this will be
@ -104,7 +105,7 @@ gnc_ui_select_commodity_modal_full(gnc_commodity * orig_sel,
GtkWidget * parent,
dialog_commodity_mode mode,
const char * user_message,
const char * exchange_code,
const char * cusip,
const char * fullname,
const char * mnemonic);
@ -149,8 +150,8 @@ gnc_ui_select_commodity_modal(gnc_commodity * orig_sel,
* the dialog box as an instruction to the user. If NULL, a generic
* instruction will be used.
*
* @param exchange_code If present, this will be the default exchange
* code for the new commodity.
* @param cusip If present, this will be the default exchange
* specific data for the new commodity.
*
* @param fullname If present, this will be the default fullname for
* the new commodity.
@ -166,7 +167,7 @@ gnc_ui_select_commodity_modal(gnc_commodity * orig_sel,
gnc_commodity *
gnc_ui_new_commodity_modal_full(const char * namespace,
GtkWidget * parent,
const char * exchange_code,
const char * cusip,
const char * fullname,
const char * mnemonic,
int fraction);

View File

@ -389,7 +389,7 @@ gnc_tree_model_commodity_get_column_type (GtkTreeModel *tree_model,
case GNC_TREE_MODEL_COMMODITY_COL_NAMESPACE:
case GNC_TREE_MODEL_COMMODITY_COL_FULLNAME:
case GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME:
case GNC_TREE_MODEL_COMMODITY_COL_EXCHANGE_CODE:
case GNC_TREE_MODEL_COMMODITY_COL_CUSIP:
case GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME:
case GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE:
case GNC_TREE_MODEL_COMMODITY_COL_QUOTE_TZ:
@ -580,10 +580,10 @@ gnc_tree_model_commodity_get_value (GtkTreeModel *tree_model,
g_value_set_string (value, gnc_commodity_get_printname (commodity));
break;
case GNC_TREE_MODEL_COMMODITY_COL_EXCHANGE_CODE:
case GNC_TREE_MODEL_COMMODITY_COL_CUSIP:
g_value_init (value, G_TYPE_STRING);
g_value_set_string (value, gnc_commodity_get_exchange_code (commodity));
g_value_set_string (value, gnc_commodity_get_cusip (commodity));
break;
case GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME:
g_value_init (value, G_TYPE_STRING);

View File

@ -60,7 +60,7 @@ typedef enum {
GNC_TREE_MODEL_COMMODITY_COL_FULLNAME,
GNC_TREE_MODEL_COMMODITY_COL_PRINTNAME,
GNC_TREE_MODEL_COMMODITY_COL_UNIQUE_NAME,
GNC_TREE_MODEL_COMMODITY_COL_EXCHANGE_CODE,
GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
GNC_TREE_MODEL_COMMODITY_COL_FRACTION,
GNC_TREE_MODEL_COMMODITY_COL_QUOTE_FLAG,
GNC_TREE_MODEL_COMMODITY_COL_QUOTE_SOURCE,

View File

@ -229,8 +229,8 @@ default_sort (gnc_commodity *comm_a, gnc_commodity *comm_b)
SAFE_STRCMP (gnc_commodity_get_fullname (comm_a),
gnc_commodity_get_fullname (comm_b));
SAFE_STRCMP (gnc_commodity_get_exchange_code (comm_a),
gnc_commodity_get_exchange_code (comm_b));
SAFE_STRCMP (gnc_commodity_get_cusip (comm_a),
gnc_commodity_get_cusip (comm_b));
fraction_a = gnc_commodity_get_fraction (comm_a);
fraction_b = gnc_commodity_get_fraction (comm_b);
@ -340,8 +340,8 @@ sort_by_cusip_code (GtkTreeModel *f_model,
if (!get_commodities (f_model, f_iter_a, f_iter_b, &comm_a, &comm_b))
return sort_namespace (f_model, f_iter_a, f_iter_b);
SAFE_STRCMP (gnc_commodity_get_exchange_code (comm_a),
gnc_commodity_get_exchange_code (comm_b));
SAFE_STRCMP (gnc_commodity_get_cusip (comm_a),
gnc_commodity_get_cusip (comm_b));
return default_sort(comm_a, comm_b);
}
@ -504,7 +504,7 @@ gnc_tree_view_commodity_new (QofBook *book,
sort_by_unique_name);
gnc_tree_view_add_text_column (view, _("CUSIP code"), "cusip_code", NULL,
"QWERTYUIOP",
GNC_TREE_MODEL_COMMODITY_COL_EXCHANGE_CODE,
GNC_TREE_MODEL_COMMODITY_COL_CUSIP,
GNC_TREE_MODEL_COMMODITY_COL_VISIBILITY,
sort_by_cusip_code);
gnc_tree_view_add_numeric_column (view, _("Fraction"), "fraction", "10000",

View File

@ -53,7 +53,7 @@ static QofLogModule log_module = GNC_MOD_IMPORT;
gnc_commodity * gnc_import_select_commodity(char * exchange_code,
gnc_commodity * gnc_import_select_commodity(char * cusip,
char auto_create,
char * default_fullname,
char * default_mnemonic)
@ -67,7 +67,7 @@ gnc_commodity * gnc_import_select_commodity(char * exchange_code,
DEBUG("Default fullname received: %s", default_fullname);
DEBUG("Default mnemonic received: %s", default_mnemonic);
DEBUG("Looking for commodity with exchange_code: %s", exchange_code);
DEBUG("Looking for commodity with exchange_code: %s", cusip);
namespace_list = gnc_commodity_table_get_namespaces(commodity_table);
@ -88,9 +88,9 @@ gnc_commodity * gnc_import_select_commodity(char * exchange_code,
tmp_commodity=commodity_list->data;
DEBUG("Looking at commodity %s",gnc_commodity_get_fullname(tmp_commodity));
if(gnc_commodity_get_exchange_code(tmp_commodity)!=NULL &&
exchange_code != NULL &&
strncmp(gnc_commodity_get_exchange_code(tmp_commodity),exchange_code,strlen(exchange_code))==0)
if(gnc_commodity_get_cusip(tmp_commodity)!=NULL &&
cusip != NULL &&
strncmp(gnc_commodity_get_cusip(tmp_commodity),cusip,strlen(cusip))==0)
{
retval = tmp_commodity;
DEBUG("Commodity %s%s",gnc_commodity_get_fullname(retval)," matches.");
@ -118,18 +118,17 @@ gnc_commodity * gnc_import_select_commodity(char * exchange_code,
NULL,
DIAG_COMM_ALL,
message,
exchange_code,
cusip,
default_fullname,
default_mnemonic);
}
if (retval != NULL&&
gnc_commodity_get_exchange_code(tmp_commodity)!=NULL &&
exchange_code != NULL &&
(strncmp(gnc_commodity_get_exchange_code(retval),exchange_code,strlen(exchange_code))!=0))
gnc_commodity_get_cusip(tmp_commodity)!=NULL &&
cusip != NULL &&
(strncmp(gnc_commodity_get_cusip(retval),cusip,strlen(cusip))!=0))
{
gnc_commodity_set_exchange_code(retval,
exchange_code);
gnc_commodity_set_cusip(retval, cusip);
}
return retval;
};

View File

@ -29,18 +29,18 @@
/**
Must be called with a string containing a unique identifier for the
commodity. If an commodity with a matching exchange_code is
commodity. If an commodity with a matching cusip is
found, the function immediately returns with a pointer to that
commodity. Otherwise, the user may be prompted to select a GnuCash
account or create a new one (in both cases, the exchange_code is written
written to the commodity's exchange_code field, overwriting anything that
account or create a new one (in both cases, the cusip is
written to the commodity's cusip field, overwriting anything that
was there before.
@param exchange_code The string containing the code for which you
@param cusip The string containing the code for which you
want a matching commodity. A CUISP code or similar UNIQUE code.
The stock ticker is NOT appropriate, unless you have no other option.
@param auto_create If 0, if the exchange_code value in unknown,
@param auto_create If 0, if the cusip value in unknown,
the function returns NULL, otherwise, the user will be asked to
create a new account.
@ -58,7 +58,7 @@
account was found or created.
*/
gnc_commodity * gnc_import_select_commodity(char * exchange_code,
gnc_commodity * gnc_import_select_commodity(char * cusip,
char auto_create,
char * default_fullname,
char * default_mnemonic);

View File

@ -76,13 +76,13 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data);
int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data)
{
char * tmp_exchange_code=NULL;
char * tmp_cusip=NULL;
char * tmp_default_fullname=NULL;
char * tmp_default_mnemonic=NULL;
if(data.unique_id_valid==true)
{
tmp_exchange_code=(char *)data.unique_id;
tmp_cusip=(char *)data.unique_id;
}
if(data.secname_valid==true)
{
@ -93,7 +93,7 @@ int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user
tmp_default_mnemonic=(char *)data.ticker;
}
gnc_import_select_commodity(tmp_exchange_code,
gnc_import_select_commodity(tmp_cusip,
true,
tmp_default_fullname,
tmp_default_mnemonic);