]>
Dogcows Code - chaz/homebank/blob - src/hb-import.c
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2016 Maxime DOYEN
4 * This file is part of HomeBank.
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "hb-import.h"
24 /****************************************************************************/
26 /****************************************************************************/
35 /* our global datas */
36 extern struct HomeBank
*GLOBALS
;
37 extern struct Preferences
*PREFS
;
43 Account
*import_create_account(gchar
*name
, gchar
*number
)
45 Account
*accitem
, *existitem
;
47 //first check we do not have already this imported account
48 existitem
= da_acc_get_by_imp_name(name
);
52 DB( g_print(" ** create acc: '%s' '%s'\n", name
, number
) );
54 accitem
= da_acc_malloc();
55 accitem
->key
= da_acc_get_max_key() + 1;
56 accitem
->pos
= da_acc_length() + 1;
58 // existing named account ?
59 existitem
= da_acc_get_by_name(name
);
61 accitem
->imp_key
= existitem
->key
;
63 if(!existitem
&& *name
!= 0)
64 accitem
->name
= g_strdup(name
);
66 accitem
->name
= g_strdup_printf(_("(account %d)"), accitem
->key
);
68 accitem
->imp_name
= g_strdup(name
);
71 accitem
->number
= g_strdup(number
);
74 accitem
->kcur
= GLOBALS
->kcur
;
76 accitem
->imported
= TRUE
;
77 da_acc_insert(accitem
);
This page took 0.042528 seconds and 4 git commands to generate.