64
74
/* la lib ofx ne tient pas compte du 1er argument */
65
75
argv[1] = nom_fichier;
70
/* le dernier compte n'a pas �t� ajout� � la liste */
78
ofx_context = libofx_get_new_context();
79
ofx_set_status_cb ( ofx_context, ofx_proc_status_cb, NULL );
80
/* ofx_set_security_cb ( ofx_context, sofx_proc_security_cb, NULL ); */
81
ofx_set_account_cb ( ofx_context, ofx_proc_account_cb, NULL );
82
ofx_set_transaction_cb ( ofx_context, ofx_proc_transaction_cb, NULL );
83
ofx_set_statement_cb ( ofx_context, ofx_proc_statement_cb, NULL );
87
if ( libofx_proc_file ( ofx_context, nom_fichier, AUTODETECT ) < 0 )
89
if ( ofx_proc_file ( 2, argv ) < 0 )
92
// Case of Windows, libofx.dll is not present or Grisbi failed in dynamically loading ofx_proc_file
93
dialogue_error_hint(_("The OFX support can not be enabled!"),
94
g_strdup_printf (_("Cannot process OFX file '%s'"), nom_fichier));
98
/* le dernier compte n'a pas été ajouté à la liste */
72
100
liste_comptes_importes_ofx = g_slist_append ( liste_comptes_importes_ofx,
73
compte_ofx_importation_en_cours );
101
compte_ofx_importation_en_cours );
75
103
if ( !compte_ofx_importation_en_cours )
108
/* *******************************************************************************/
138
int ofx_proc_status_cb(struct OfxStatusData data, void * status_data)
109
140
int ofx_proc_status_cb(struct OfxStatusData data)
111
/* printf ( "ofx_proc_status_cb:\n" ); */
112
/* printf ( "ofx_element_name_valid %d\n", data . ofx_element_name_valid); */
113
/* printf ( "ofx_element_name %s\n", data . ofx_element_name ); */
114
/* printf ( "code_valid %d\n", data . code_valid ); */
115
/* printf ( "code %d\n", data . code); */
116
/* printf ( "name %s\n", data . name); */
117
/* printf ( "description %s\n", data . description); */
118
/* printf ( "severity_valid %d\n", data . severity_valid ); */
119
/* printf ( "severity %d\n", data . severity); */
120
/* printf ( "server_message_valid %d\n", data.server_message_valid ); */
121
/* printf ( "server_message %s\n\n", data . server_message ); */
143
/* printf ( "ofx_proc_status_cb:\n" ); */
144
/* printf ( "ofx_element_name_valid %d\n", data . ofx_element_name_valid); */
145
/* printf ( "ofx_element_name %s\n", data . ofx_element_name ); */
146
/* printf ( "code_valid %d\n", data . code_valid ); */
147
/* printf ( "code %d\n", data . code); */
148
/* printf ( "name %s\n", data . name); */
149
/* printf ( "description %s\n", data . description); */
150
/* printf ( "severity_valid %d\n", data . severity_valid ); */
151
/* printf ( "severity %d\n", data . severity); */
152
/* printf ( "server_message_valid %d\n", data.server_message_valid ); */
153
/* printf ( "server_message %s\n\n", data . server_message ); */
123
/* on v�rifie l'�tat, si c'est un warning, on l'affiche, si c'est une erreur, on vire */
155
/* on vérifie l'état, si c'est un warning, on l'affiche, si c'est une erreur, on vire */
125
157
if ( data.severity_valid )
127
159
switch ( data.severity )
130
162
/* pas de pb, on fait rien */
134
166
if ( data.code_valid )
135
167
dialogue_warning ( g_strconcat ( _("The file has returned the next message :\n"),
169
201
/* *******************************************************************************/
170
int ofx_proc_security_cb(struct OfxSecurityData data)
203
int ofx_proc_security_cb ( LibofxContextPtr ctx, LibofxProcSecurityCallback cb,
206
int ofx_proc_security_cb ( struct OfxSecurityData data )
172
printf ( "ofx_proc_security_cb :\n" );
173
printf ( "unique_id_valid %d\n", data.unique_id_valid );
174
printf ( "unique_id %s\n", data.unique_id );
175
printf ( "unique_id_type_valid %d\n", data.unique_id_type_valid );
176
printf ( "unique_id_type %s\n", data.unique_id_type );
177
printf ( "secname_valid %d\n", data.secname_valid );
178
printf ( "secname %s\n", data.secname );
179
printf ( "ticker_valid %d\n", data.ticker_valid );
180
printf ( "ticker %s\n", data.ticker );
181
printf ( "unitprice_valid %d\n", data.unitprice_valid );
182
printf ( "unitprice %f\n", data.unitprice );
183
printf ( "date_unitprice_valid %d\n", data.date_unitprice_valid );
184
printf ( "date_unitprice %s\n", ctime ( &data.date_unitprice ));
185
printf ( "currency_valid %d\n", data.currency_valid );
186
printf ( "currency %s\n", data.currency );
187
printf ( "memo_valid %d\n", data.memo_valid );
188
printf ( "memo %s\n", data.memo );
209
/* printf ( "ofx_proc_security_cb :\n" ); */
210
/* printf ( "unique_id_valid %d\n", data.unique_id_valid ); */
211
/* printf ( "unique_id %s\n", data.unique_id ); */
212
/* printf ( "unique_id_type_valid %d\n", data.unique_id_type_valid ); */
213
/* printf ( "unique_id_type %s\n", data.unique_id_type ); */
214
/* printf ( "secname_valid %d\n", data.secname_valid ); */
215
/* printf ( "secname %s\n", data.secname ); */
216
/* printf ( "ticker_valid %d\n", data.ticker_valid ); */
217
/* printf ( "ticker %s\n", data.ticker ); */
218
/* printf ( "unitprice_valid %d\n", data.unitprice_valid ); */
219
/* printf ( "unitprice %f\n", data.unitprice ); */
220
/* printf ( "date_unitprice_valid %d\n", data.date_unitprice_valid ); */
221
/* printf ( "date_unitprice %s\n", ctime ( &data.date_unitprice )); */
222
/* printf ( "currency_valid %d\n", data.currency_valid ); */
223
/* printf ( "currency %s\n", data.currency ); */
224
/* printf ( "memo_valid %d\n", data.memo_valid ); */
225
/* printf ( "memo %s\n", data.memo ); */
190
227
dialogue ( _("That file contains something on proc_security_cb.\nI didn't have any file to test that function.\nPlease contact the grisbi team to implement that function."));
195
230
/* *******************************************************************************/
200
235
/* *******************************************************************************/
238
int ofx_proc_account_cb(struct OfxAccountData data, void * account_data)
202
240
int ofx_proc_account_cb(struct OfxAccountData data)
204
/* printf ( "ofx_proc_account_cb\n" ); */
205
/* printf ( "account_id_valid %d\n", data.account_id_valid ); */
206
/* printf ( "account_id %s\n", data.account_id ); */
207
/* printf ( "account_name %s\n", data.account_name ); */
208
/* printf ( "account_type_valid %d\n", data.account_type_valid ); */
209
/* printf ( "account_type %d\n", data.account_type ); */
210
/* printf ( "currency_valid %d\n", data.currency_valid ); */
211
/* printf ( "currency %s\n", data. currency); */
243
/* printf ( "ofx_proc_account_cb\n" ); */
244
/* printf ( "account_id_valid %d\n", data.account_id_valid ); */
245
/* printf ( "account_id %s\n", data.account_id ); */
246
/* printf ( "account_name %s\n", data.account_name ); */
247
/* printf ( "account_type_valid %d\n", data.account_type_valid ); */
248
/* printf ( "account_type %d\n", data.account_type ); */
249
/* printf ( "currency_valid %d\n", data.currency_valid ); */
250
/* printf ( "currency %s\n", data. currency); */
213
/* si on revient ici et qu'un compte �tait en cours, c'est qu'il est fini et qu'on passe au compte */
252
/* si on revient ici et qu'un compte était en cours, c'est qu'il est fini et qu'on passe au compte */
216
255
if ( compte_ofx_importation_en_cours )
245
284
/* *******************************************************************************/
286
int ofx_proc_transaction_cb(struct OfxTransactionData data, void * security_data)
246
288
int ofx_proc_transaction_cb(struct OfxTransactionData data)
248
291
struct struct_ope_importation *ope_import;
252
/* printf ( "ofx_proc_transaction_cb\n" ); */
253
/* printf ( "account_id_valid : %d \n", data.account_id_valid ); */
254
/* printf ( "account_id : %s \n", data.account_id ); */
255
/* printf ( "transactiontype_valid : %d \n", data.transactiontype_valid ); */
256
/* printf ( "transactiontype : %d \n", data.transactiontype ); */
257
/* printf ( "invtransactiontype_valid : %d \n", data.invtransactiontype_valid ); */
258
/* printf ( "invtransactiontype : %d \n", data.invtransactiontype ); */
259
/* printf ( "units_valid : %d \n", data. units_valid); */
260
/* printf ( "units : %f \n", data.units ); */
261
/* printf ( "unitprice_valid : %d \n", data.unitprice_valid ); */
262
/* printf ( "unitprice : %f \n", data.unitprice ); */
263
/* printf ( "amount_valid : %d \n", data.amount_valid ); */
264
/* printf ( "amount : %f \n", data.amount ); */
265
/* printf ( "fi_id_valid : %d \n", data.fi_id_valid ); */
266
/* printf ( "fi_id : %s \n", data.fi_id ); */
267
/* printf ( "unique_id_valid : %d \n", data.unique_id_valid ); */
268
/* printf ( "unique_id : %s \n", data.unique_id ); */
269
/* printf ( "unique_id_type_valid : %d \n", data.unique_id_type_valid ); */
270
/* printf ( "unique_id_type : %s \n", data.unique_id_type ); */
271
/* printf ( "security_data_valid : %d \n", data.security_data_valid ); */
272
/* printf ( "security_data_ptr : %s \n", data.security_data_ptr ); */
273
/* printf ( "date_posted_valid : %d \n", data.date_posted_valid ); */
274
/* printf ( "date_posted : %s \n", ctime ( &data.date_posted )); */
275
/* printf ( "date_initiated_valid : %d \n", data.date_initiated_valid ); */
276
/* printf ( "date_initiated : %s \n", ctime ( &data.date_initiated )); */
277
/* printf ( "date_funds_available_valid : %d \n", data.date_funds_available_valid ); */
278
/* printf ( "date_funds_available : %s \n", ctime ( &data.date_funds_available )); */
279
/* printf ( "fi_id_corrected_valid : %d \n", data.fi_id_corrected_valid ); */
280
/* printf ( "fi_id_corrected : %s \n", data.fi_id_corrected ); */
281
/* printf ( "fi_id_correction_action_valid : %d \n", data.fi_id_correction_action_valid ); */
282
/* printf ( "fi_id_correction_action : %d \n", data.fi_id_correction_action ); */
283
/* printf ( "server_transaction_id_valid : %d \n", data.server_transaction_id_valid ); */
284
/* printf ( "server_transaction_id : %s \n", data.server_transaction_id ); */
285
/* printf ( "check_number_valid : %d \n", data.check_number_valid ); */
286
/* printf ( "check_number : %s \n", data.check_number ); */
287
/* printf ( "reference_number_valid : %d \n", data.reference_number_valid ); */
288
/* printf ( "reference_number : %s \n", data.reference_number ); */
289
/* printf ( "standard_industrial_code_valid : %d \n", data.standard_industrial_code_valid ); */
290
/* printf ( "standard_industrial_code : %s \n", data.standard_industrial_code ); */
291
/* printf ( "payee_id_valid : %d \n", data.payee_id_valid ); */
292
/* printf ( "payee_id : %s \n", data.payee_id ); */
293
/* printf ( "name_valid : %d \n", data.name_valid ); */
294
/* printf ( "name : %s \n", data.name ); */
295
/* printf ( "memo_valid : %d \n", data.memo_valid ); */
296
/* printf ( "memo : %s \n\n\n\n", data.memo ); */
298
/* si � ce niveau le comtpe n'est pas cr��, c'est qu'il y a un pb... */
294
/* printf ( "ofx_proc_transaction_cb\n" ); */
295
/* printf ( "account_id_valid : %d \n", data.account_id_valid ); */
296
/* printf ( "account_id : %s \n", data.account_id ); */
297
/* printf ( "transactiontype_valid : %d \n", data.transactiontype_valid ); */
298
/* printf ( "transactiontype : %d \n", data.transactiontype ); */
299
/* printf ( "invtransactiontype_valid : %d \n", data.invtransactiontype_valid ); */
300
/* printf ( "invtransactiontype : %d \n", data.invtransactiontype ); */
301
/* printf ( "units_valid : %d \n", data. units_valid); */
302
/* printf ( "units : %f \n", data.units ); */
303
/* printf ( "unitprice_valid : %d \n", data.unitprice_valid ); */
304
/* printf ( "unitprice : %f \n", data.unitprice ); */
305
/* printf ( "amount_valid : %d \n", data.amount_valid ); */
306
/* printf ( "amount : %f \n", data.amount ); */
307
/* printf ( "fi_id_valid : %d \n", data.fi_id_valid ); */
308
/* printf ( "fi_id : %s \n", data.fi_id ); */
309
/* printf ( "unique_id_valid : %d \n", data.unique_id_valid ); */
310
/* printf ( "unique_id : %s \n", data.unique_id ); */
311
/* printf ( "unique_id_type_valid : %d \n", data.unique_id_type_valid ); */
312
/* printf ( "unique_id_type : %s \n", data.unique_id_type ); */
313
/* printf ( "security_data_valid : %d \n", data.security_data_valid ); */
314
/* printf ( "security_data_ptr : %s \n", data.security_data_ptr ); */
315
/* printf ( "date_posted_valid : %d \n", data.date_posted_valid ); */
316
/* printf ( "date_posted : %s \n", ctime ( &data.date_posted )); */
317
/* printf ( "date_initiated_valid : %d \n", data.date_initiated_valid ); */
318
/* printf ( "date_initiated : %s \n", ctime ( &data.date_initiated )); */
319
/* printf ( "date_funds_available_valid : %d \n", data.date_funds_available_valid ); */
320
/* printf ( "date_funds_available : %s \n", ctime ( &data.date_funds_available )); */
321
/* printf ( "fi_id_corrected_valid : %d \n", data.fi_id_corrected_valid ); */
322
/* printf ( "fi_id_corrected : %s \n", data.fi_id_corrected ); */
323
/* printf ( "fi_id_correction_action_valid : %d \n", data.fi_id_correction_action_valid ); */
324
/* printf ( "fi_id_correction_action : %d \n", data.fi_id_correction_action ); */
325
/* printf ( "server_transaction_id_valid : %d \n", data.server_transaction_id_valid ); */
326
/* printf ( "server_transaction_id : %s \n", data.server_transaction_id ); */
327
/* printf ( "check_number_valid : %d \n", data.check_number_valid ); */
328
/* printf ( "check_number : %s \n", data.check_number ); */
329
/* printf ( "reference_number_valid : %d \n", data.reference_number_valid ); */
330
/* printf ( "reference_number : %s \n", data.reference_number ); */
331
/* printf ( "standard_industrial_code_valid : %d \n", data.standard_industrial_code_valid ); */
332
/* printf ( "standard_industrial_code : %s \n", data.standard_industrial_code ); */
333
/* printf ( "payee_id_valid : %d \n", data.payee_id_valid ); */
334
/* printf ( "payee_id : %s \n", data.payee_id ); */
335
/* printf ( "name_valid : %d \n", data.name_valid ); */
336
/* printf ( "name : %s \n", data.name ); */
337
/* printf ( "memo_valid : %d \n", data.memo_valid ); */
338
/* printf ( "memo : %s \n\n\n\n", data.memo ); */
340
/* si à ce niveau le comtpe n'est pas créé, c'est qu'il y a un pb... */
300
342
if ( !compte_ofx_importation_en_cours )
441
483
/* *******************************************************************************/
485
int ofx_proc_statement_cb(struct OfxStatementData data, void * statement_data)
442
487
int ofx_proc_statement_cb(struct OfxStatementData data)
446
/* printf ( "ofx_proc_statement_cb\n" ); */
447
/* printf ( "currency_valid : %d\n", data.currency_valid ); */
448
/* printf ( "currency : %s\n", data.currency ); */
449
/* printf ( "account_id_valid : %d\n", data.account_id_valid ); */
450
/* printf ( "account_id : %s\n", data.account_id ); */
451
/* printf ( "ledger_balance_valid : %d\n", data.ledger_balance_valid ); */
452
/* printf ( "ledger_balance : %f\n", data.ledger_balance ); */
453
/* printf ( "ledger_balance_date_valid : %d\n", data.ledger_balance_date_valid ); */
454
/* printf ( "ledger_balance_date : %s\n", ctime ( &data.ledger_balance_date)); */
455
/* printf ( "available_balance_valid : %d\n", data.available_balance_valid ); */
456
/* printf ( "available_balance : %f\n", data.available_balance ); */
457
/* printf ( "available_balance_date_valid : %d\n", data.available_balance_date_valid ); */
458
/* printf ( "available_balance_date : %s\n", ctime ( &data.available_balance_date )); */
459
/* printf ( "date_start_valid : %d\n", data.date_start_valid ); */
460
/* printf ( "date_start : %s\n", ctime ( &data.date_start )); */
461
/* printf ( "date_end_valid : %d\n", data.date_end_valid ); */
462
/* printf ( "date_end : %s\n", ctime ( &data.date_end )); */
463
/* printf ( "marketing_info_valid : %d\n", data.marketing_info_valid ); */
464
/* printf ( "marketing_info : %s\n", data.marketing_info ); */
492
/* printf ( "ofx_proc_statement_cb\n" ); */
493
/* printf ( "currency_valid : %d\n", data.currency_valid ); */
494
/* printf ( "currency : %s\n", data.currency ); */
495
/* printf ( "account_id_valid : %d\n", data.account_id_valid ); */
496
/* printf ( "account_id : %s\n", data.account_id ); */
497
/* printf ( "ledger_balance_valid : %d\n", data.ledger_balance_valid ); */
498
/* printf ( "ledger_balance : %f\n", data.ledger_balance ); */
499
/* printf ( "ledger_balance_date_valid : %d\n", data.ledger_balance_date_valid ); */
500
/* printf ( "ledger_balance_date : %s\n", ctime ( &data.ledger_balance_date)); */
501
/* printf ( "available_balance_valid : %d\n", data.available_balance_valid ); */
502
/* printf ( "available_balance : %f\n", data.available_balance ); */
503
/* printf ( "available_balance_date_valid : %d\n", data.available_balance_date_valid ); */
504
/* printf ( "available_balance_date : %s\n", ctime ( &data.available_balance_date )); */
505
/* printf ( "date_start_valid : %d\n", data.date_start_valid ); */
506
/* printf ( "date_start : %s\n", ctime ( &data.date_start )); */
507
/* printf ( "date_end_valid : %d\n", data.date_end_valid ); */
508
/* printf ( "date_end : %s\n", ctime ( &data.date_end )); */
509
/* printf ( "marketing_info_valid : %d\n", data.marketing_info_valid ); */
510
/* printf ( "marketing_info : %s\n", data.marketing_info ); */
466
512
if ( data.date_start_valid )