[grisbi-cvs] [SCM] grisbi branch, grisbi-0.8.x, updated. upstream_version_0_8_4-1-g4beb192
Pierre Biava
nobody at users.sourceforge.net
Thu Mar 17 22:46:31 CET 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".
The branch, grisbi-0.8.x has been updated
via 4beb1924d110f522b03fc5bc160fc1f9fa61064d (commit)
from 2f67d1e6ab16634a6426e8431b0cac45137afa42 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4beb1924d110f522b03fc5bc160fc1f9fa61064d
Author: pbiava <pierre.biava at nerim.net>
Date: Wed Mar 16 23:27:01 2011 +0100
fixes bug 1313 : Grisbi crashes when Importing a QIF file with a list of categories
-----------------------------------------------------------------------
Changes:
diff --git a/src/qif.c b/src/qif.c
index 464a014..a9aa8ab 100644
--- a/src/qif.c
+++ b/src/qif.c
@@ -52,6 +52,7 @@ static gchar **gsb_qif_get_date_content ( gchar *date_string );
static gint gsb_qif_get_date_order ( GSList *transactions_list );
static gchar *gsb_qif_get_account_name ( FILE *qif_file, const gchar *coding_system );
static gint gsb_qif_get_account_type ( gchar *header );
+static gint gsb_qif_recupere_categories ( FILE *qif_file, const gchar *coding_system );
static gint gsb_qif_recupere_operations_from_account ( FILE *qif_file,
const gchar *coding_system,
struct struct_compte_importation *imported_account );
@@ -163,6 +164,24 @@ gboolean recuperation_donnees_qif ( GtkWidget *assistant, struct imported_file *
&&
tmp_str
&&
+ g_ascii_strncasecmp ( tmp_str, "!Type:Cat", 9 ) == 0 )
+ {
+
+ do
+ {
+ returned_value = gsb_qif_recupere_categories ( qif_file,
+ imported -> coding_system );
+
+ if ( returned_value == 0 )
+ tmp_str = last_header;
+ }
+ /* continue untill the end of the file or a change of account */
+ while ( returned_value != EOF && returned_value != 0 );
+ }
+ else if ( returned_value != EOF
+ &&
+ tmp_str
+ &&
g_ascii_strncasecmp ( tmp_str, "!Type", 5 ) == 0 )
{
gint account_type;
@@ -1248,6 +1267,96 @@ gint gsb_qif_recupere_operations_from_account ( FILE *qif_file,
}
+/**
+ *
+ *
+ *
+ *
+ * */
+gint gsb_qif_recupere_categories ( FILE *qif_file, const gchar *coding_system )
+{
+ gchar *string;
+ gint returned_value;
+
+ do
+ {
+ returned_value = get_utf8_line_from_file ( qif_file, &string, coding_system );
+
+ /* a category never begin with ^ and ! */
+ if ( strlen ( string )
+ &&
+ returned_value != EOF
+ &&
+ string[0] != '^'
+ &&
+ string[0] != '!' )
+ {
+ gint category_number;
+ gint type_category = 1;
+ gchar **tab_str = NULL;
+
+ tab_str = g_strsplit ( string + 1, ":", 2 );
+ g_free ( string );
+
+ do
+ {
+ returned_value = get_utf8_line_from_file ( qif_file,
+ &string, coding_system );
+ if ( strlen ( string )
+ &&
+ returned_value != EOF
+ &&
+ string[0] != '^'
+ &&
+ string[0] != '!' )
+ {
+ if ( strcmp ( string, "I" ) == 0 )
+ type_category = 0;
+ g_free ( string );
+ }
+ }
+ while ( string[0] != '^' && returned_value != EOF && string[0] != '!' );
+
+ /* get the category and create it if doesn't exist */
+ if (tab_str[0])
+ {
+ tab_str[0] = g_strstrip ( tab_str[0] );
+ category_number = gsb_data_category_get_number_by_name ( tab_str[0],
+ TRUE,
+ type_category );
+
+ if (tab_str[1])
+ {
+ tab_str[1] = g_strstrip ( tab_str[1] );
+
+ gsb_data_category_get_sub_category_number_by_name (
+ category_number,
+ tab_str[1],
+ TRUE );
+ }
+ }
+
+ g_strfreev(tab_str);
+ }
+ }
+ while ( string[0] != '^' && returned_value != EOF && string[0] != '!' );
+
+ if ( string[0] == '!' )
+ {
+ if ( last_header && strlen ( last_header ) )
+ g_free ( last_header );
+ last_header = g_strdup ( string );
+ }
+
+ if ( returned_value != EOF && string[0] != '!' )
+ return 1;
+ else if ( returned_value == EOF )
+ return EOF;
+ else
+ return 0;
+}
+
+
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
hooks/post-receive
--
grisbi
More information about the cvs
mailing list