]> Dogcows Code - chaz/homebank/blobdiff - src/ui-assist-import.c
import homebank-5.1.7
[chaz/homebank] / src / ui-assist-import.c
index 8d8836d64aa6d85d79f2527f70b7db872379e162..9915c24aa3bcc0e81102b680a64fce206c5004f2 100644 (file)
@@ -1,5 +1,5 @@
 /*     HomeBank -- Free, easy, personal accounting for everyone.
 /*     HomeBank -- Free, easy, personal accounting for everyone.
- *     Copyright (C) 1995-2016 Maxime DOYEN
+ *     Copyright (C) 1995-2018 Maxime DOYEN
  *
  *     This file is part of HomeBank.
  *
  *
  *     This file is part of HomeBank.
  *
@@ -707,11 +707,14 @@ GList *lxxx, *list;
                        //only persist user selected to new account
                        if( item->imp_key == 0)
                        {
                        //only persist user selected to new account
                        if( item->imp_key == 0)
                        {
-                               //DB( g_print(" -> persist acc %x '%s'\n", item, item->name) );
+                               DB( g_print(" -> persist acc %x '%s' k=%d, ik=%d\n", item, item->name, item->key, item->imp_key) );
                                item->imported = FALSE;
                                g_free(item->imp_name);
                                item->imp_name = NULL;
                        }
                                item->imported = FALSE;
                                g_free(item->imp_name);
                                item->imp_name = NULL;
                        }
+                       //else
+                       //DB( g_print(" -> keep exist acc %x '%s' k=%d, ik=%d\n", item, item->name, item->key, item->imp_key) );
+                       
                }
                list = g_list_next(list);
        }
                }
                list = g_list_next(list);
        }
@@ -765,17 +768,25 @@ GList *lxxx, *list;
                Account *acc;
                        
                        //DB(g_print("import %d to acc: %d\n", data->total, item->account)      );
                Account *acc;
                        
                        //DB(g_print("import %d to acc: %d\n", data->total, item->account)      );
+
                        //todo: here also test imp_key on account and change the key into the transaction
                        acc = da_acc_get(item->kacc);
                        //todo: here also test imp_key on account and change the key into the transaction
                        acc = da_acc_get(item->kacc);
-                       if( acc != NULL)
+                       if( (acc != NULL) && (acc->imp_key > 0) )
                        {
                        {
-                               if( acc->imp_key > 0)
+                               item->kacc = acc->imp_key;
+                       }
+
+                       //#1653957 change also kxferacc
+                       if( item->paymode == PAYMODE_INTXFER )
+                       {
+                               acc = da_acc_get(item->kxferacc);
+                               if( (acc != NULL) && (acc->imp_key > 0) )
                                {
                                {
-                                       item->kacc = acc->imp_key;
+                                       item->kxferacc = acc->imp_key;
                                }
                        }
                                }
                        }
-
-                       transaction_add(item, NULL, 0);
+                       
+                       transaction_add(item);
                }
 
                /* Make iter point to the next row in the list store */
                }
 
                /* Make iter point to the next row in the list store */
This page took 0.019794 seconds and 4 git commands to generate.