- Payee *payitem;
- gchar *name = NULL;
-
- //#462919 name to payee or memo
- DB( g_print(" -> ofxname option: '%d'\n", PREFS->dtex_ofxname) );
- switch(PREFS->dtex_ofxname)
- {
- case 1: //to memo
- DB( g_print(" -> name to memo: '%s'\n", data.name) );
- newope->memo = g_strdup(data.name);
-
- //test
- //strip_extra_spaces(newope->wording);
-
- break;
- case 2: //to payee
- //manage memo append to payee as well
- if( (data.memo_valid==true) && (PREFS->dtex_ofxmemo == 3) )
- {
- name = g_strjoin(" ", data.name, data.memo, NULL);
- }
- else
- name = g_strdup(data.name);
-
- g_strstrip(name);
- //test
- //strip_extra_spaces(name);
-
- #ifndef G_OS_UNIX
- DB( g_print(" ensure UTF-8\n") );
-
- name = homebank_utf8_ensure(name);
- #endif
-
- DB( g_print(" -> name to payee: '%s'\n", name) );
-
- payitem = da_pay_get_by_name(name);
- if(payitem == NULL)
- {
- DB( g_print(" -> create new payee\n") );
-
- payitem = da_pay_malloc();
- payitem->name = name;
- payitem->imported = TRUE;
- da_pay_append(payitem);
-
- if( payitem->imported == TRUE )
- ctx->ictx->cnt_new_pay += 1;
- }
- else
- {
- g_free(name);
- }
-
- newope->kpay = payitem->key;
- break;
- }