- Transaction *newope = da_transaction_malloc();
-
- //DB( g_print(" ->%s\n", tmpstr ) );
-
- newope->date = hb_date_get_julian(str_array[0], ictx->datefmt);
- if( newope->date == 0 )
- {
- g_warning ("csv parse: line %d, parse date failed", count);
- ictx->cnt_err_date++;
- }
-
- newope->paymode = atoi(str_array[1]);
- newope->info = g_strdup(str_array[2]);
-
- /* payee */
- g_strstrip(str_array[3]);
- payitem = da_pay_get_by_name(str_array[3]);
- if(payitem == NULL)
- {
- payitem = da_pay_malloc();
- payitem->name = g_strdup(str_array[3]);
- payitem->imported = TRUE;
- da_pay_append(payitem);
-
- if( payitem->imported == TRUE )
- ictx->cnt_new_pay += 1;
- }
-
- newope->kpay = payitem->key;
- newope->wording = g_strdup(str_array[4]);
- newope->amount = hb_qif_parser_get_amount(str_array[5]);
-
- /* category */
- g_strstrip(str_array[6]);
- catitem = da_cat_append_ifnew_by_fullname(str_array[6], TRUE);
- if( catitem != NULL )
- {
- newope->kcat = catitem->key;
-
- if( catitem->imported == TRUE && catitem->key > 0 )
- ictx->cnt_new_cat += 1;
- }
-
- /* tags */
- transaction_tags_parse(newope, str_array[7]);
-
-
- newope->kacc = tmp_acc->key;
- //newope->kxferacc = accnum;
-
- newope->flags |= OF_ADDED;
-
- if( newope->amount > 0)
- newope->flags |= OF_INCOME;
+ GenTxn *newope = da_gen_txn_malloc();;
+
+ DB( g_print(" ->%s\n", tmpstr ) );
+
+ /* convert to generic transaction */
+ newope->date = g_strdup(str_array[0]);
+ newope->paymode = atoi(str_array[1]);
+ //added 5.1.8 forbid to import 5=internal xfer
+ if(newope->paymode == PAYMODE_INTXFER)
+ newope->paymode = PAYMODE_XFER;
+ newope->rawinfo = g_strdup(str_array[2]);
+ newope->rawpayee = g_strdup(g_strstrip(str_array[3]));
+ newope->rawmemo = g_strdup(str_array[4]);
+ newope->amount = hb_qif_parser_get_amount(str_array[5]);
+ newope->category = g_strdup(g_strstrip(str_array[6]));
+ newope->tags = g_strdup(str_array[7]);
+ newope->account = g_strdup(newacc->name);
+
+ /* todo: move this eval date valid */
+ //guint32 juliantmp = hb_date_get_julian(str_array[0], ictx->datefmt);
+ ///if( juliantmp == 0 )
+ // ictx->cnt_err_date++;