[grisbi-cvs] grisbi/src gsb_file.c, 1.41, 1.42 gsb_file_load.c, 1.151, 1.152 gsb_file_save.c, 1.112, 1.113 import.c, 1.262, 1.263 structures.h, 1.224, 1.225 traitement_variables.c, 1.165, 1.166

Pierre Biava pbiava at users.sourceforge.net
Fri Feb 27 22:10:35 CET 2009


Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17661/src

Modified Files:
	gsb_file.c gsb_file_load.c gsb_file_save.c import.c 
	structures.h traitement_variables.c 
Log Message:
import.c : automatically retrieve the category of the payee if it exists

Index: structures.h
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/structures.h,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -d -r1.224 -r1.225
--- structures.h	31 Jan 2009 20:11:04 -0000	1.224
+++ structures.h	27 Feb 2009 21:10:33 -0000	1.225
@@ -99,6 +99,7 @@
     gint display_message_ofx_security;
 
     /* import rules */
+    gint get_categorie_for_payee;   /* TRUE to automatically retrieve the category of the payee if it exists */
     gint get_fyear_by_value_date;	/* TRUE to get the fyear by value date, FALSE by date */
 
     /* combofix configuration */

Index: gsb_file.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- gsb_file.c	17 Feb 2009 20:56:57 -0000	1.41
+++ gsb_file.c	27 Feb 2009 21:10:33 -0000	1.42
@@ -35,7 +35,6 @@
 #include "./utils.h"
 #include "./fenetre_principale.h"
 #include "./dialog.h"
-#include "./utils_files.h"
 #include "./utils_file_selection.h"
 #include "./gsb_assistant_account.h"
 #include "./gsb_assistant_file.h"
@@ -55,6 +54,7 @@
 #include "./parametres.h"
 #include "./affichage_liste.h"
 #include "./transaction_list.h"
+#include "./utils_files.h"
 #include "./fenetre_principale.h"
 #include "./include.h"
 #include "./erreur.h"

Index: traitement_variables.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/traitement_variables.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -d -r1.165 -r1.166
--- traitement_variables.c	12 Feb 2009 21:46:07 -0000	1.165
+++ traitement_variables.c	27 Feb 2009 21:10:33 -0000	1.166
@@ -161,6 +161,7 @@
 extern gint tab_affichage_ope[TRANSACTION_LIST_ROWS_NB][CUSTOM_MODEL_VISIBLE_COLUMNS];
 extern gint transaction_col_width[CUSTOM_MODEL_N_VISIBLES_COLUMN];
 extern gint valeur_echelle_recherche_date_import;
+extern GtkWidget *window;
 /*END_EXTERN*/
 
 

Index: gsb_file_save.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_save.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- gsb_file_save.c	18 Feb 2009 20:49:54 -0000	1.112
+++ gsb_file_save.c	27 Feb 2009 21:10:33 -0000	1.113
@@ -1,8 +1,8 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	      */
-/*			2003-2008 Benjamin Drieu (bdrieu at april.org)	      */
-/* 			http://www.grisbi.org				      */
+/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	          */
+/*			2003-2008 Benjamin Drieu (bdrieu at april.org)	                      */
+/* 			http://www.grisbi.org				                              */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
 /*  it under the terms of the GNU General Public License as published by      */
@@ -597,6 +597,7 @@
 					   "\t\tScheduler_custom_number=\"%d\"\n"
 					   "\t\tScheduler_custom_menu=\"%d\"\n"
 					   "\t\tImport_interval_search=\"%d\"\n"
+                       "\t\tImport_categorie_for_payee=\"%d\"\n"
 					   "\t\tImport_fyear_by_value_date=\"%d\"\n"
 					   "\t\tUse_logo=\"%d\"\n"
 					   "\t\tRemind_display_per_account=\"%d\"\n"
@@ -630,6 +631,7 @@
 	affichage_echeances_perso_nb_libre,
 	affichage_echeances_perso_j_m_a,
 	valeur_echelle_recherche_date_import,
+    etat.get_categorie_for_payee,
 	etat.get_fyear_by_value_date,
 	etat.utilise_logo,
 	etat.retient_affichage_par_compte,

Index: import.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/import.c,v
retrieving revision 1.262
retrieving revision 1.263
diff -u -d -r1.262 -r1.263
--- import.c	18 Feb 2009 20:50:00 -0000	1.262
+++ import.c	27 Feb 2009 21:10:33 -0000	1.263
@@ -1,8 +1,8 @@
 /* ************************************************************************** */
 /*                                                                            */
-/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	      */
-/*			2004-2008 Benjamin Drieu (bdrieu at april.org)	      */
-/* 			http://www.grisbi.org				      */
+/*     Copyright (C)	2000-2008 Cédric Auger (cedric at grisbi.org)	          */
+/*			2004-2008 Benjamin Drieu (bdrieu at april.org)	                      */
+/* 			http://www.grisbi.org				                              */
 /*                                                                            */
 /*  This program is free software; you can redistribute it and/or modify      */
 /*  it under the terms of the GNU General Public License as published by      */
@@ -49,6 +49,7 @@
 #include "./gsb_data_transaction.h"
 #include "./gsb_file.h"
 #include "./gsb_form_scheduler.h"
+#include "./gsb_form_transaction.h"
 #include "./utils_dates.h"
 #include "./fenetre_principale.h"
 #include "./navigation.h"
@@ -2176,7 +2177,10 @@
 {
     gchar **tab_str;
     gint transaction_number;
+    gint payee_number = 0;
     gint fyear = 0;
+    gint last_transaction_number;
+    gint category_number;
 
     /* we create the new transaction */
     transaction_number = gsb_data_transaction_new_transaction ( account_number );
@@ -2209,7 +2213,7 @@
     gsb_data_transaction_set_amount ( transaction_number,
 				      imported_transaction -> montant );
 
-    /* 	  récupération de la devise */
+    /* récupération de la devise */
     gsb_data_transaction_set_currency_number ( transaction_number,
 					       imported_transaction -> devise );
 
@@ -2217,9 +2221,11 @@
     if ( imported_transaction -> tiers
 	 &&
 	 strlen (imported_transaction -> tiers))
-	gsb_data_transaction_set_party_number ( transaction_number,
-						gsb_data_payee_get_number_by_name ( imported_transaction -> tiers,
-										    TRUE ));
+    {
+        payee_number = gsb_data_payee_get_number_by_name ( imported_transaction -> tiers,
+										    TRUE );
+        gsb_data_transaction_set_party_number ( transaction_number, payee_number );
+    }
 
     /* vérification si c'est ventilé, sinon récupération des catégories */
     if ( imported_transaction -> operation_ventilee )
@@ -2273,6 +2279,22 @@
 														   TRUE ));
 	    }
 	}
+    else if ( etat.get_categorie_for_payee )
+    {
+        /* pbiava the 02/26/2009 associate category to the tiers */
+        last_transaction_number = gsb_form_transactions_look_for_last_party ( 
+                                    payee_number, transaction_number, 
+                                    account_number );
+        category_number = gsb_data_transaction_get_category_number (
+                                    last_transaction_number );
+        devel_debug_int (category_number);
+        gsb_data_transaction_set_category_number ( transaction_number,
+                                category_number );
+        category_number = gsb_data_transaction_get_sub_category_number ( 
+                                last_transaction_number );
+        gsb_data_transaction_set_sub_category_number ( transaction_number,
+                                category_number );
+    }
 	else
 	{
 	    gsb_data_transaction_set_category_number ( transaction_number, 0 );
@@ -3109,6 +3131,19 @@
 			 12 );
     gtk_widget_show ( button );
 
+    /* automatically associate the category of the payee if it is possible */
+    button = gsb_automem_checkbutton_new ( 
+                        _("automatically associate the category of the payee if it is possible"),
+                        &etat.get_categorie_for_payee, 
+                        NULL, NULL );
+    
+    gtk_box_pack_start ( GTK_BOX ( vbox_pref ),
+			 button,
+			 FALSE,
+			 FALSE,
+			 0 );
+    gtk_widget_show ( button );
+
     /* propose to choose between getting the fyear by value date or by date */
     gsb_automem_radiobutton_new_with_title ( vbox_pref,
 					     _("Set the financial year"),

Index: gsb_file_load.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_file_load.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- gsb_file_load.c	18 Feb 2009 20:49:52 -0000	1.151
+++ gsb_file_load.c	27 Feb 2009 21:10:33 -0000	1.152
@@ -84,7 +84,6 @@
 static gboolean gsb_file_load_check_new_structure ( gchar *file_content );
 static void gsb_file_load_color_part ( const gchar **attribute_names,
 				const gchar **attribute_values );
-//~ static gboolean gsb_file_load_copy_old_file ( gchar *filename );
 static gboolean gsb_file_load_copy_old_file_and_glib ( gchar *filename, gchar *file_content);
 static void gsb_file_load_currency ( const gchar **attribute_names,
 			      const gchar **attribute_values );
@@ -741,6 +740,12 @@
 	}
 
 	else if ( !strcmp ( attribute_names[i],
+			    "Import_categorie_for_payee" ))
+	{
+	    etat.get_categorie_for_payee = utils_str_atoi ( attribute_values[i]);
+	}
+
+    else if ( !strcmp ( attribute_names[i],
 			    "Import_fyear_by_value_date" ))
 	{
 	    etat.get_fyear_by_value_date = utils_str_atoi ( attribute_values[i]);



More information about the cvs mailing list